Commit 3e83c756bdc0cffa0b209162805d6f971762882f
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'staging' of gitlab.com:participa/noosfero into staging
Showing
8 changed files
with
131 additions
and
21 deletions
Show diff stats
Gemfile
@@ -11,9 +11,9 @@ gem 'will_paginate', '~> 3.0.3' | @@ -11,9 +11,9 @@ gem 'will_paginate', '~> 3.0.3' | ||
11 | gem 'ruby-feedparser', '~> 0.7' | 11 | gem 'ruby-feedparser', '~> 0.7' |
12 | gem 'daemons', '~> 1.1.5' | 12 | gem 'daemons', '~> 1.1.5' |
13 | #gem 'thin', '~> 1.3.1' | 13 | #gem 'thin', '~> 1.3.1' |
14 | -#gem 'nokogiri', '~> 1.6.0' | 14 | +gem 'nokogiri', '~> 1.6.0' |
15 | gem 'unicorn', '~> 4.8' | 15 | gem 'unicorn', '~> 4.8' |
16 | -gem 'nokogiri', '~> 1.5.5' | 16 | +#gem 'nokogiri', '~> 1.5.5' |
17 | gem 'rake', :require => false | 17 | gem 'rake', :require => false |
18 | gem 'rest-client', '~> 1.6.7' | 18 | gem 'rest-client', '~> 1.6.7' |
19 | gem 'exception_notification', '~> 4.0.1' | 19 | gem 'exception_notification', '~> 4.0.1' |
Gemfile.lock
@@ -8,6 +8,7 @@ GIT | @@ -8,6 +8,7 @@ GIT | ||
8 | 8 | ||
9 | GEM | 9 | GEM |
10 | remote: https://rubygems.org/ | 10 | remote: https://rubygems.org/ |
11 | + remote: https://rubygems.org/ | ||
11 | specs: | 12 | specs: |
12 | RedCloth (4.2.9) | 13 | RedCloth (4.2.9) |
13 | actionmailer (3.2.22) | 14 | actionmailer (3.2.22) |
@@ -39,7 +40,11 @@ GEM | @@ -39,7 +40,11 @@ GEM | ||
39 | multi_json (~> 1.0) | 40 | multi_json (~> 1.0) |
40 | acts-as-taggable-on (3.4.4) | 41 | acts-as-taggable-on (3.4.4) |
41 | activerecord (>= 3.2, < 5) | 42 | activerecord (>= 3.2, < 5) |
43 | + addressable (2.3.8) | ||
42 | api-pagination (4.1.1) | 44 | api-pagination (4.1.1) |
45 | + api_smith (1.3.0) | ||
46 | + hashie (>= 1.0, < 3.0) | ||
47 | + httparty | ||
43 | arel (3.0.3) | 48 | arel (3.0.3) |
44 | axiom-types (0.1.1) | 49 | axiom-types (0.1.1) |
45 | descendants_tracker (~> 0.0.4) | 50 | descendants_tracker (~> 0.0.4) |
@@ -57,6 +62,8 @@ GEM | @@ -57,6 +62,8 @@ GEM | ||
57 | chronic (0.10.2) | 62 | chronic (0.10.2) |
58 | coercible (1.0.0) | 63 | coercible (1.0.0) |
59 | descendants_tracker (~> 0.0.1) | 64 | descendants_tracker (~> 0.0.1) |
65 | + css_parser (1.3.7) | ||
66 | + addressable | ||
60 | cucumber (1.0.6) | 67 | cucumber (1.0.6) |
61 | builder (>= 2.1.2) | 68 | builder (>= 2.1.2) |
62 | diff-lcs (>= 1.1.2) | 69 | diff-lcs (>= 1.1.2) |
@@ -82,6 +89,10 @@ GEM | @@ -82,6 +89,10 @@ GEM | ||
82 | actionmailer (>= 3.0.4) | 89 | actionmailer (>= 3.0.4) |
83 | activesupport (>= 3.0.4) | 90 | activesupport (>= 3.0.4) |
84 | execjs (2.6.0) | 91 | execjs (2.6.0) |
92 | + faraday (0.9.2) | ||
93 | + multipart-post (>= 1.2, < 3) | ||
94 | + faraday_middleware (0.10.0) | ||
95 | + faraday (>= 0.7.4, < 0.10) | ||
85 | fast_gettext (0.6.12) | 96 | fast_gettext (0.6.12) |
86 | ffi (1.9.10) | 97 | ffi (1.9.10) |
87 | gettext (2.2.1) | 98 | gettext (2.2.1) |
@@ -89,7 +100,7 @@ GEM | @@ -89,7 +100,7 @@ GEM | ||
89 | gherkin (2.4.21) | 100 | gherkin (2.4.21) |
90 | json (>= 1.4.6) | 101 | json (>= 1.4.6) |
91 | git-version-bump (0.15.1) | 102 | git-version-bump (0.15.1) |
92 | - grape (0.12.0) | 103 | + grape (0.13.0) |
93 | activesupport | 104 | activesupport |
94 | builder | 105 | builder |
95 | hashie (>= 2.1.0) | 106 | hashie (>= 2.1.0) |
@@ -99,21 +110,25 @@ GEM | @@ -99,21 +110,25 @@ GEM | ||
99 | rack-accept | 110 | rack-accept |
100 | rack-mount | 111 | rack-mount |
101 | virtus (>= 1.0.0) | 112 | virtus (>= 1.0.0) |
102 | - grape-entity (0.4.7) | 113 | + grape-entity (0.4.8) |
103 | activesupport | 114 | activesupport |
104 | multi_json (>= 1.3.2) | 115 | multi_json (>= 1.3.2) |
105 | grape-swagger (0.10.2) | 116 | grape-swagger (0.10.2) |
106 | grape (>= 0.8.0) | 117 | grape (>= 0.8.0) |
107 | grape-entity | 118 | grape-entity |
108 | - hashie (3.4.2) | 119 | + hashie (2.1.2) |
109 | hike (1.2.3) | 120 | hike (1.2.3) |
121 | + httparty (0.12.0) | ||
122 | + json (~> 1.8) | ||
123 | + multi_xml (>= 0.5.2) | ||
110 | i18n (0.7.0) | 124 | i18n (0.7.0) |
111 | ice_nine (0.11.1) | 125 | ice_nine (0.11.1) |
112 | journey (1.0.4) | 126 | journey (1.0.4) |
113 | json (1.8.3) | 127 | json (1.8.3) |
114 | kgio (2.10.0) | 128 | kgio (2.10.0) |
115 | - kramdown (1.8.0) | 129 | + kramdown (1.9.0) |
116 | libv8 (3.16.14.11) | 130 | libv8 (3.16.14.11) |
131 | + link_header (0.0.8) | ||
117 | liquid (3.0.6) | 132 | liquid (3.0.6) |
118 | locale (2.0.9) | 133 | locale (2.0.9) |
119 | magic (0.2.9) | 134 | magic (0.2.9) |
@@ -123,18 +138,25 @@ GEM | @@ -123,18 +138,25 @@ GEM | ||
123 | treetop (~> 1.4.8) | 138 | treetop (~> 1.4.8) |
124 | metaclass (0.0.4) | 139 | metaclass (0.0.4) |
125 | mime-types (1.25.1) | 140 | mime-types (1.25.1) |
141 | + mini_portile (0.6.2) | ||
126 | minitest (3.2.0) | 142 | minitest (3.2.0) |
127 | mocha (1.1.0) | 143 | mocha (1.1.0) |
128 | metaclass (~> 0.0.1) | 144 | metaclass (~> 0.0.1) |
129 | multi_json (1.11.2) | 145 | multi_json (1.11.2) |
130 | multi_xml (0.5.5) | 146 | multi_xml (0.5.5) |
131 | - nokogiri (1.5.11) | 147 | + multipart-post (2.0.0) |
148 | + nokogiri (1.6.6.2) | ||
149 | + mini_portile (~> 0.6.0) | ||
150 | + oai (0.3.1) | ||
151 | + builder (>= 2.0.0) | ||
152 | + faraday | ||
153 | + faraday_middleware | ||
132 | pg (0.13.2) | 154 | pg (0.13.2) |
133 | polyglot (0.3.5) | 155 | polyglot (0.3.5) |
134 | rack (1.4.7) | 156 | rack (1.4.7) |
135 | rack-accept (0.4.5) | 157 | rack-accept (0.4.5) |
136 | rack (>= 0.4) | 158 | rack (>= 0.4) |
137 | - rack-cache (1.2) | 159 | + rack-cache (1.5.0) |
138 | rack (>= 0.4) | 160 | rack (>= 0.4) |
139 | rack-contrib (1.4.0) | 161 | rack-contrib (1.4.0) |
140 | git-version-bump (~> 0.15) | 162 | git-version-bump (~> 0.15) |
@@ -165,12 +187,24 @@ GEM | @@ -165,12 +187,24 @@ GEM | ||
165 | thor (>= 0.14.6, < 2.0) | 187 | thor (>= 0.14.6, < 2.0) |
166 | raindrops (0.15.0) | 188 | raindrops (0.15.0) |
167 | rake (10.4.2) | 189 | rake (10.4.2) |
190 | + rdf (1.1.17.1) | ||
191 | + link_header (~> 0.0, >= 0.0.8) | ||
192 | + rdf-virtuoso (0.1.6) | ||
193 | + api_smith (~> 1.3.0) | ||
194 | + httparty (~> 0.12.0) | ||
195 | + rdf (~> 1.1.0) | ||
168 | rdoc (3.12.2) | 196 | rdoc (3.12.2) |
169 | json (~> 1.4) | 197 | json (~> 1.4) |
170 | ref (2.0.0) | 198 | ref (2.0.0) |
171 | rest-client (1.6.9) | 199 | rest-client (1.6.9) |
172 | mime-types (~> 1.16) | 200 | mime-types (~> 1.16) |
173 | rmagick (2.13.4) | 201 | rmagick (2.13.4) |
202 | + roadie (3.0.5) | ||
203 | + css_parser (~> 1.3.4) | ||
204 | + nokogiri (~> 1.6.0) | ||
205 | + roadie-rails (1.0.6) | ||
206 | + railties (>= 3.0, < 4.3) | ||
207 | + roadie (~> 3.0) | ||
174 | rspec (2.14.1) | 208 | rspec (2.14.1) |
175 | rspec-core (~> 2.14.0) | 209 | rspec-core (~> 2.14.0) |
176 | rspec-expectations (~> 2.14.0) | 210 | rspec-expectations (~> 2.14.0) |
@@ -190,7 +224,7 @@ GEM | @@ -190,7 +224,7 @@ GEM | ||
190 | ruby-feedparser (0.9.3) | 224 | ruby-feedparser (0.9.3) |
191 | magic | 225 | magic |
192 | rubyzip (1.1.7) | 226 | rubyzip (1.1.7) |
193 | - sass (3.4.18) | 227 | + sass (3.4.19) |
194 | sass-rails (3.2.6) | 228 | sass-rails (3.2.6) |
195 | railties (~> 3.2.0) | 229 | railties (~> 3.2.0) |
196 | sass (>= 3.1.10) | 230 | sass (>= 3.1.10) |
@@ -218,7 +252,7 @@ GEM | @@ -218,7 +252,7 @@ GEM | ||
218 | treetop (1.4.15) | 252 | treetop (1.4.15) |
219 | polyglot | 253 | polyglot |
220 | polyglot (>= 0.3.1) | 254 | polyglot (>= 0.3.1) |
221 | - tzinfo (0.3.44) | 255 | + tzinfo (0.3.45) |
222 | uglifier (2.7.2) | 256 | uglifier (2.7.2) |
223 | execjs (>= 0.3.0) | 257 | execjs (>= 0.3.0) |
224 | json (>= 1.8.0) | 258 | json (>= 1.8.0) |
@@ -265,15 +299,20 @@ DEPENDENCIES | @@ -265,15 +299,20 @@ DEPENDENCIES | ||
265 | locale (~> 2.0.5) | 299 | locale (~> 2.0.5) |
266 | minitest (~> 3.2.0) | 300 | minitest (~> 3.2.0) |
267 | mocha (~> 1.1.0) | 301 | mocha (~> 1.1.0) |
268 | - nokogiri (~> 1.5.5) | 302 | + nokogiri (~> 1.6.0) |
303 | + oai (= 0.3.1) | ||
269 | pg (~> 0.13.2) | 304 | pg (~> 0.13.2) |
270 | rack-contrib | 305 | rack-contrib |
271 | rack-cors | 306 | rack-cors |
272 | rails (~> 3.2.22) | 307 | rails (~> 3.2.22) |
273 | rails_autolink (~> 1.1.5) | 308 | rails_autolink (~> 1.1.5) |
274 | rake | 309 | rake |
310 | + rdf | ||
311 | + rdf-virtuoso | ||
275 | rest-client (~> 1.6.7) | 312 | rest-client (~> 1.6.7) |
276 | rmagick (~> 2.13.1) | 313 | rmagick (~> 2.13.1) |
314 | + roadie (= 3.0.5) | ||
315 | + roadie-rails | ||
277 | rspec (~> 2.14.0) | 316 | rspec (~> 2.14.0) |
278 | rspec-rails (~> 2.14.1) | 317 | rspec-rails (~> 2.14.1) |
279 | ruby-feedparser (~> 0.7) | 318 | ruby-feedparser (~> 0.7) |
plugins/gamification
plugins/juventude
plugins/virtuoso/Gemfile
1 | source 'https://rubygems.org' | 1 | source 'https://rubygems.org' |
2 | gem 'rdf' | 2 | gem 'rdf' |
3 | gem 'rdf-virtuoso' | 3 | gem 'rdf-virtuoso' |
4 | -gem 'oai' | 4 | +gem 'oai', '0.3.1' |
5 | gem 'liquid', '~> 3.0.3' | 5 | gem 'liquid', '~> 3.0.3' |
6 | -gem 'roadie' | 6 | +gem 'roadie', '3.0.5' |
7 | gem 'roadie-rails' | 7 | gem 'roadie-rails' |
8 | +#gem 'nokogiri', '1.6.6.2' |
@@ -0,0 +1,70 @@ | @@ -0,0 +1,70 @@ | ||
1 | +#!/usr/bin/env ruby | ||
2 | +require File.dirname(__FILE__) + '/../config/environment' | ||
3 | + | ||
4 | +#http://ruby.bastardsbook.com/chapters/html-parsing/ | ||
5 | + | ||
6 | +puts "Runing script" | ||
7 | + | ||
8 | +article = Article.find(410) | ||
9 | +new_article = TinyMceArticle.new | ||
10 | + | ||
11 | +doc = Nokogiri::HTML(article.body) | ||
12 | +html_body = '' | ||
13 | +doc.css("p").map do |element| | ||
14 | + html_body += '<p>' + element.text + '</p>' | ||
15 | +end | ||
16 | + | ||
17 | +comments = article.comments.reorder(:group_id) | ||
18 | +comment_association = {} | ||
19 | + | ||
20 | +puts 'antes' | ||
21 | +comments.map do |c| | ||
22 | + comment_association[c.id] = c.group_id | ||
23 | + puts c.group_id.inspect | ||
24 | +end | ||
25 | + | ||
26 | +puts "Set comment group to nil" | ||
27 | +article.comments.map do |comment| | ||
28 | + comment.group_id = nil | ||
29 | + comment.save | ||
30 | +end | ||
31 | + | ||
32 | +puts "Change article body" | ||
33 | +article.body = html_body | ||
34 | +article.save | ||
35 | +puts article.body | ||
36 | +article.comment_paragraph_plugin_activate = !article.comment_paragraph_plugin_activate | ||
37 | +article.save! | ||
38 | +puts article.body | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | +puts 'depois' | ||
43 | +comments.map do |c| | ||
44 | + puts c.group_id.inspect | ||
45 | +end | ||
46 | +puts 'Migrating comments' | ||
47 | + | ||
48 | +doc = Nokogiri::HTML(article.body) | ||
49 | +group = 0 | ||
50 | +doc.css("[data-macro-paragraph_uuid]").map do |paragraph| | ||
51 | + uid = paragraph.attributes['data-macro-paragraph_uuid'].value | ||
52 | + puts "Paragraph: #{uid}" | ||
53 | + puts "Cheking paragraph group #{group} in comment #{comments[0].inspect}" | ||
54 | + comment = comments.shift if !comments.empty? && comments[0].group_id.to_s == group.to_s | ||
55 | + group += 1 | ||
56 | + next if comment.nil? | ||
57 | + puts "Change coment #{comment.id} to paragraph_uuid #{uid}" | ||
58 | + comment.paragraph_uuid = uid | ||
59 | + comment.save | ||
60 | + comment = nil | ||
61 | +end | ||
62 | + | ||
63 | +#<Comment id: 4, title: "", body: "teste 1", source_id: 410, author_id: 54, name: nil, email: nil, created_at: "2015-09-29 18:54:32", reply_of_id: nil, ip_address: "127.0.0.1", spam: nil, source_type: "Article", user_agent: "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (K...", referrer: "http://localhost:3000/adminuser/coment-group-plugin...", settings: {:comment_paragraph_selected_area=>nil, :comment_paragraph_selected_content=>nil}, paragraph_id: nil, paragraph_uuid: nil, group_id: 0> | ||
64 | + | ||
65 | +#<Comment id: 2, title: "", body: "teste", source_id: 409, author_id: 54, name: nil, email: nil, created_at: "2015-09-29 18:54:11", reply_of_id: nil, ip_address: "127.0.0.1", spam: nil, source_type: "Article", user_agent: "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (K...", referrer: "http://localhost:3000/adminuser/comentario-por-para...", settings: {:comment_paragraph_selected_area=>nil, :comment_paragraph_selected_content=>nil}, paragraph_id: nil, paragraph_uuid: "9445dee8-0a65-4d5b-a654-5dd0e68b1db3", group_id: nil> | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | +puts new_article.body | ||
70 | +# |
test/unit/api/helpers_test.rb
@@ -26,13 +26,13 @@ class APIHelpersTest < ActiveSupport::TestCase | @@ -26,13 +26,13 @@ class APIHelpersTest < ActiveSupport::TestCase | ||
26 | assert_equal user, current_user | 26 | assert_equal user, current_user |
27 | end | 27 | end |
28 | 28 | ||
29 | - should 'not get the current user with expired token' do | 29 | + should 'get the current user even with expired token' do |
30 | user = create_user('someuser') | 30 | user = create_user('someuser') |
31 | user.generate_private_token! | 31 | user.generate_private_token! |
32 | user.private_token_generated_at = DateTime.now.prev_year | 32 | user.private_token_generated_at = DateTime.now.prev_year |
33 | user.save | 33 | user.save |
34 | self.params = {:private_token => user.private_token} | 34 | self.params = {:private_token => user.private_token} |
35 | - assert_nil current_user | 35 | + assert_equal user, current_user |
36 | end | 36 | end |
37 | 37 | ||
38 | should 'get the person of current user' do | 38 | should 'get the person of current user' do |
test/unit/block_test.rb
@@ -364,22 +364,22 @@ class BlockTest < ActiveSupport::TestCase | @@ -364,22 +364,22 @@ class BlockTest < ActiveSupport::TestCase | ||
364 | 364 | ||
365 | should 'return the icon block path' do | 365 | should 'return the icon block path' do |
366 | class NewBlock < Block; end | 366 | class NewBlock < Block; end |
367 | - assert_equal 'blocks/new_block/icon.png', NewBlock.icon_path | 367 | + assert_equal 'images/blocks/new_block/icon.png', NewBlock.icon_path |
368 | end | 368 | end |
369 | 369 | ||
370 | should 'return the icon block path for blocks inside modules' do | 370 | should 'return the icon block path for blocks inside modules' do |
371 | module SomeModule class NewBlock < Block; end; end | 371 | module SomeModule class NewBlock < Block; end; end |
372 | - assert_equal 'blocks/new_block/icon.png', SomeModule::NewBlock.icon_path | 372 | + assert_equal 'images/blocks/new_block/icon.png', SomeModule::NewBlock.icon_path |
373 | end | 373 | end |
374 | 374 | ||
375 | should 'return the default icon for blocks without icon' do | 375 | should 'return the default icon for blocks without icon' do |
376 | class NewBlock < Block; end | 376 | class NewBlock < Block; end |
377 | - assert_equal 'icon_block.png', NewBlock.default_icon_path | 377 | + assert_equal '/images/icon_block.png', NewBlock.default_icon_path |
378 | end | 378 | end |
379 | 379 | ||
380 | should 'return the default preview path for blocks without preview images' do | 380 | should 'return the default preview path for blocks without preview images' do |
381 | class NewBlock < Block; end | 381 | class NewBlock < Block; end |
382 | - assert_equal 'block_preview.png', NewBlock.default_preview_path | 382 | + assert_equal '/images/block_preview.png', NewBlock.default_preview_path |
383 | end | 383 | end |
384 | 384 | ||
385 | should 'get limit as a number when limit is string' do | 385 | should 'get limit as a number when limit is string' do |