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 | 11 | gem 'ruby-feedparser', '~> 0.7' |
12 | 12 | gem 'daemons', '~> 1.1.5' |
13 | 13 | #gem 'thin', '~> 1.3.1' |
14 | -#gem 'nokogiri', '~> 1.6.0' | |
14 | +gem 'nokogiri', '~> 1.6.0' | |
15 | 15 | gem 'unicorn', '~> 4.8' |
16 | -gem 'nokogiri', '~> 1.5.5' | |
16 | +#gem 'nokogiri', '~> 1.5.5' | |
17 | 17 | gem 'rake', :require => false |
18 | 18 | gem 'rest-client', '~> 1.6.7' |
19 | 19 | gem 'exception_notification', '~> 4.0.1' | ... | ... |
Gemfile.lock
... | ... | @@ -8,6 +8,7 @@ GIT |
8 | 8 | |
9 | 9 | GEM |
10 | 10 | remote: https://rubygems.org/ |
11 | + remote: https://rubygems.org/ | |
11 | 12 | specs: |
12 | 13 | RedCloth (4.2.9) |
13 | 14 | actionmailer (3.2.22) |
... | ... | @@ -39,7 +40,11 @@ GEM |
39 | 40 | multi_json (~> 1.0) |
40 | 41 | acts-as-taggable-on (3.4.4) |
41 | 42 | activerecord (>= 3.2, < 5) |
43 | + addressable (2.3.8) | |
42 | 44 | api-pagination (4.1.1) |
45 | + api_smith (1.3.0) | |
46 | + hashie (>= 1.0, < 3.0) | |
47 | + httparty | |
43 | 48 | arel (3.0.3) |
44 | 49 | axiom-types (0.1.1) |
45 | 50 | descendants_tracker (~> 0.0.4) |
... | ... | @@ -57,6 +62,8 @@ GEM |
57 | 62 | chronic (0.10.2) |
58 | 63 | coercible (1.0.0) |
59 | 64 | descendants_tracker (~> 0.0.1) |
65 | + css_parser (1.3.7) | |
66 | + addressable | |
60 | 67 | cucumber (1.0.6) |
61 | 68 | builder (>= 2.1.2) |
62 | 69 | diff-lcs (>= 1.1.2) |
... | ... | @@ -82,6 +89,10 @@ GEM |
82 | 89 | actionmailer (>= 3.0.4) |
83 | 90 | activesupport (>= 3.0.4) |
84 | 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 | 96 | fast_gettext (0.6.12) |
86 | 97 | ffi (1.9.10) |
87 | 98 | gettext (2.2.1) |
... | ... | @@ -89,7 +100,7 @@ GEM |
89 | 100 | gherkin (2.4.21) |
90 | 101 | json (>= 1.4.6) |
91 | 102 | git-version-bump (0.15.1) |
92 | - grape (0.12.0) | |
103 | + grape (0.13.0) | |
93 | 104 | activesupport |
94 | 105 | builder |
95 | 106 | hashie (>= 2.1.0) |
... | ... | @@ -99,21 +110,25 @@ GEM |
99 | 110 | rack-accept |
100 | 111 | rack-mount |
101 | 112 | virtus (>= 1.0.0) |
102 | - grape-entity (0.4.7) | |
113 | + grape-entity (0.4.8) | |
103 | 114 | activesupport |
104 | 115 | multi_json (>= 1.3.2) |
105 | 116 | grape-swagger (0.10.2) |
106 | 117 | grape (>= 0.8.0) |
107 | 118 | grape-entity |
108 | - hashie (3.4.2) | |
119 | + hashie (2.1.2) | |
109 | 120 | hike (1.2.3) |
121 | + httparty (0.12.0) | |
122 | + json (~> 1.8) | |
123 | + multi_xml (>= 0.5.2) | |
110 | 124 | i18n (0.7.0) |
111 | 125 | ice_nine (0.11.1) |
112 | 126 | journey (1.0.4) |
113 | 127 | json (1.8.3) |
114 | 128 | kgio (2.10.0) |
115 | - kramdown (1.8.0) | |
129 | + kramdown (1.9.0) | |
116 | 130 | libv8 (3.16.14.11) |
131 | + link_header (0.0.8) | |
117 | 132 | liquid (3.0.6) |
118 | 133 | locale (2.0.9) |
119 | 134 | magic (0.2.9) |
... | ... | @@ -123,18 +138,25 @@ GEM |
123 | 138 | treetop (~> 1.4.8) |
124 | 139 | metaclass (0.0.4) |
125 | 140 | mime-types (1.25.1) |
141 | + mini_portile (0.6.2) | |
126 | 142 | minitest (3.2.0) |
127 | 143 | mocha (1.1.0) |
128 | 144 | metaclass (~> 0.0.1) |
129 | 145 | multi_json (1.11.2) |
130 | 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 | 154 | pg (0.13.2) |
133 | 155 | polyglot (0.3.5) |
134 | 156 | rack (1.4.7) |
135 | 157 | rack-accept (0.4.5) |
136 | 158 | rack (>= 0.4) |
137 | - rack-cache (1.2) | |
159 | + rack-cache (1.5.0) | |
138 | 160 | rack (>= 0.4) |
139 | 161 | rack-contrib (1.4.0) |
140 | 162 | git-version-bump (~> 0.15) |
... | ... | @@ -165,12 +187,24 @@ GEM |
165 | 187 | thor (>= 0.14.6, < 2.0) |
166 | 188 | raindrops (0.15.0) |
167 | 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 | 196 | rdoc (3.12.2) |
169 | 197 | json (~> 1.4) |
170 | 198 | ref (2.0.0) |
171 | 199 | rest-client (1.6.9) |
172 | 200 | mime-types (~> 1.16) |
173 | 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 | 208 | rspec (2.14.1) |
175 | 209 | rspec-core (~> 2.14.0) |
176 | 210 | rspec-expectations (~> 2.14.0) |
... | ... | @@ -190,7 +224,7 @@ GEM |
190 | 224 | ruby-feedparser (0.9.3) |
191 | 225 | magic |
192 | 226 | rubyzip (1.1.7) |
193 | - sass (3.4.18) | |
227 | + sass (3.4.19) | |
194 | 228 | sass-rails (3.2.6) |
195 | 229 | railties (~> 3.2.0) |
196 | 230 | sass (>= 3.1.10) |
... | ... | @@ -218,7 +252,7 @@ GEM |
218 | 252 | treetop (1.4.15) |
219 | 253 | polyglot |
220 | 254 | polyglot (>= 0.3.1) |
221 | - tzinfo (0.3.44) | |
255 | + tzinfo (0.3.45) | |
222 | 256 | uglifier (2.7.2) |
223 | 257 | execjs (>= 0.3.0) |
224 | 258 | json (>= 1.8.0) |
... | ... | @@ -265,15 +299,20 @@ DEPENDENCIES |
265 | 299 | locale (~> 2.0.5) |
266 | 300 | minitest (~> 3.2.0) |
267 | 301 | mocha (~> 1.1.0) |
268 | - nokogiri (~> 1.5.5) | |
302 | + nokogiri (~> 1.6.0) | |
303 | + oai (= 0.3.1) | |
269 | 304 | pg (~> 0.13.2) |
270 | 305 | rack-contrib |
271 | 306 | rack-cors |
272 | 307 | rails (~> 3.2.22) |
273 | 308 | rails_autolink (~> 1.1.5) |
274 | 309 | rake |
310 | + rdf | |
311 | + rdf-virtuoso | |
275 | 312 | rest-client (~> 1.6.7) |
276 | 313 | rmagick (~> 2.13.1) |
314 | + roadie (= 3.0.5) | |
315 | + roadie-rails | |
277 | 316 | rspec (~> 2.14.0) |
278 | 317 | rspec-rails (~> 2.14.1) |
279 | 318 | ruby-feedparser (~> 0.7) | ... | ... |
plugins/gamification
plugins/juventude
plugins/virtuoso/Gemfile
... | ... | @@ -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 | 26 | assert_equal user, current_user |
27 | 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 | 30 | user = create_user('someuser') |
31 | 31 | user.generate_private_token! |
32 | 32 | user.private_token_generated_at = DateTime.now.prev_year |
33 | 33 | user.save |
34 | 34 | self.params = {:private_token => user.private_token} |
35 | - assert_nil current_user | |
35 | + assert_equal user, current_user | |
36 | 36 | end |
37 | 37 | |
38 | 38 | should 'get the person of current user' do | ... | ... |
test/unit/block_test.rb
... | ... | @@ -364,22 +364,22 @@ class BlockTest < ActiveSupport::TestCase |
364 | 364 | |
365 | 365 | should 'return the icon block path' do |
366 | 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 | 368 | end |
369 | 369 | |
370 | 370 | should 'return the icon block path for blocks inside modules' do |
371 | 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 | 373 | end |
374 | 374 | |
375 | 375 | should 'return the default icon for blocks without icon' do |
376 | 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 | 378 | end |
379 | 379 | |
380 | 380 | should 'return the default preview path for blocks without preview images' do |
381 | 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 | 383 | end |
384 | 384 | |
385 | 385 | should 'get limit as a number when limit is string' do | ... | ... |