Commit 28ec0895b9d45c980e3a3be8ffcfd1589f291c94

Authored by Cyril Mougel
1 parent 3bfad3d8
Exists in master and in 1 other branch production

be compatible to rails 3.2 series

Gemfile
1 1 source 'http://rubygems.org'
2 2  
3   -gem 'rails', '3.0.10'
  3 +RAILS_VERSION = '~> 3.2.0'
  4 +gem 'activesupport',RAILS_VERSION, :require => 'active_support'
  5 +gem 'actionpack', RAILS_VERSION, :require => 'action_pack'
  6 +gem 'actionmailer', RAILS_VERSION, :require => 'action_mailer'
  7 +gem 'railties', RAILS_VERSION, :require => 'rails'
  8 +
4 9 gem 'nokogiri'
5 10 gem 'mongoid', '~> 2.2.2'
6 11  
... ... @@ -35,7 +40,7 @@ group :development, :test do
35 40 gem 'webmock', :require => false
36 41 unless ENV['TRAVIS']
37 42 gem 'ruby-debug', :platform => :mri_18
38   - gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug'
  43 + # gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug'
39 44 end
40 45 # gem 'rpm_contrib', :git => "git://github.com/bensymonds/rpm_contrib.git", :branch => "mongo-1.4.0_update"
41 46 end
... ...
Gemfile.lock
... ... @@ -2,50 +2,50 @@ GEM
2 2 remote: http://rubygems.org/
3 3 specs:
4 4 SystemTimer (1.2.3)
5   - abstract (1.0.0)
6   - actionmailer (3.0.10)
7   - actionpack (= 3.0.10)
8   - mail (~> 2.2.19)
  5 + actionmailer (3.2.3)
  6 + actionpack (= 3.2.3)
  7 + mail (~> 2.4.4)
9 8 actionmailer_inline_css (1.3.1)
10 9 actionmailer (>= 3.0.0)
11 10 nokogiri (>= 1.4.4)
12 11 premailer (>= 1.7.1)
13   - actionpack (3.0.10)
14   - activemodel (= 3.0.10)
15   - activesupport (= 3.0.10)
16   - builder (~> 2.1.2)
17   - erubis (~> 2.6.6)
18   - i18n (~> 0.5.0)
19   - rack (~> 1.2.1)
20   - rack-mount (~> 0.6.14)
21   - rack-test (~> 0.5.7)
22   - tzinfo (~> 0.3.23)
23   - activemodel (3.0.10)
24   - activesupport (= 3.0.10)
25   - builder (~> 2.1.2)
26   - i18n (~> 0.5.0)
27   - activerecord (3.0.10)
28   - activemodel (= 3.0.10)
29   - activesupport (= 3.0.10)
30   - arel (~> 2.0.10)
31   - tzinfo (~> 0.3.23)
32   - activeresource (3.0.10)
33   - activemodel (= 3.0.10)
34   - activesupport (= 3.0.10)
35   - activesupport (3.0.10)
36   - addressable (2.2.6)
37   - archive-tar-minitar (0.5.2)
38   - arel (2.0.10)
  12 + actionpack (3.2.3)
  13 + activemodel (= 3.2.3)
  14 + activesupport (= 3.2.3)
  15 + builder (~> 3.0.0)
  16 + erubis (~> 2.7.0)
  17 + journey (~> 1.0.1)
  18 + rack (~> 1.4.0)
  19 + rack-cache (~> 1.2)
  20 + rack-test (~> 0.6.1)
  21 + sprockets (~> 2.1.2)
  22 + activemodel (3.2.3)
  23 + activesupport (= 3.2.3)
  24 + builder (~> 3.0.0)
  25 + activerecord (3.2.3)
  26 + activemodel (= 3.2.3)
  27 + activesupport (= 3.2.3)
  28 + arel (~> 3.0.2)
  29 + tzinfo (~> 0.3.29)
  30 + activeresource (3.2.3)
  31 + activemodel (= 3.2.3)
  32 + activesupport (= 3.2.3)
  33 + activesupport (3.2.3)
  34 + i18n (~> 0.6)
  35 + multi_json (~> 1.0)
  36 + addressable (2.2.8)
  37 + arel (3.0.2)
39 38 bcrypt-ruby (3.0.1)
40 39 bson (1.3.1)
41 40 bson_ext (1.3.1)
42   - builder (2.1.2)
43   - columnize (0.3.4)
  41 + builder (3.0.0)
  42 + columnize (0.3.6)
44 43 crack (0.3.1)
45   - css_parser (1.2.5)
  44 + css_parser (1.2.6)
46 45 addressable
  46 + rdoc
47 47 database_cleaner (0.6.7)
48   - devise (1.4.7)
  48 + devise (1.4.9)
49 49 bcrypt-ruby (~> 3.0)
50 50 orm_adapter (~> 0.0.3)
51 51 warden (~> 1.0.3)
... ... @@ -53,48 +53,49 @@ GEM
53 53 email_spec (1.2.1)
54 54 mail (~> 2.2)
55 55 rspec (~> 2.0)
56   - erubis (2.6.6)
57   - abstract (>= 1.0.0)
58   - fabrication (1.2.0)
59   - faraday (0.7.4)
60   - addressable (~> 2.2.6)
61   - multipart-post (~> 1.1.0)
62   - rack (>= 1.1.0, < 2)
  56 + erubis (2.7.0)
  57 + fabrication (1.4.0)
  58 + faraday (0.7.6)
  59 + addressable (~> 2.2)
  60 + multipart-post (~> 1.1)
  61 + rack (~> 1.1)
63 62 faraday_middleware (0.7.0)
64 63 faraday (~> 0.7.3)
65   - haml (3.1.3)
  64 + haml (3.1.5)
66 65 happymapper (0.4.0)
67 66 libxml-ruby (~> 2.0)
68 67 has_scope (0.5.1)
69 68 hashie (1.0.0)
  69 + hike (1.2.1)
70 70 hoptoad_notifier (2.4.11)
71 71 activesupport
72 72 builder
73   - htmlentities (4.3.0)
74   - i18n (0.5.0)
75   - inherited_resources (1.3.0)
  73 + htmlentities (4.3.1)
  74 + i18n (0.6.0)
  75 + inherited_resources (1.3.1)
76 76 has_scope (~> 0.5.0)
77   - responders (~> 0.6.0)
78   - kaminari (0.12.4)
79   - rails (>= 3.0.0)
80   - kgio (2.6.0)
81   - libxml-ruby (2.2.2)
  77 + responders (~> 0.6)
  78 + journey (1.0.3)
  79 + json (1.7.1)
  80 + kaminari (0.13.0)
  81 + actionpack (>= 3.0.0)
  82 + activesupport (>= 3.0.0)
  83 + railties (>= 3.0.0)
  84 + kgio (2.7.4)
  85 + libxml-ruby (2.3.2)
82 86 lighthouse-api (2.0)
83 87 activeresource (>= 3.0.0)
84 88 activesupport (>= 3.0.0)
85 89 linecache (0.46)
86 90 rbx-require-relative (> 0.0.4)
87   - linecache19 (0.5.12)
88   - ruby_core_source (>= 0.1.4)
89   - mail (2.2.19)
90   - activesupport (>= 2.3.6)
  91 + mail (2.4.4)
91 92 i18n (>= 0.4.0)
92 93 mime-types (~> 1.16)
93 94 treetop (~> 1.4.8)
94   - mime-types (1.16)
  95 + mime-types (1.18)
95 96 mongo (1.3.1)
96 97 bson (>= 1.3.1)
97   - mongoid (2.2.4)
  98 + mongoid (2.2.5)
98 99 activemodel (~> 3.0)
99 100 mongo (~> 1.3)
100 101 tzinfo (~> 0.3.22)
... ... @@ -104,18 +105,18 @@ GEM
104 105 rails (>= 3.0.0)
105 106 railties (>= 3.0.0)
106 107 multi_json (1.0.4)
107   - multipart-post (1.1.4)
108   - nokogiri (1.5.0)
  108 + multipart-post (1.1.5)
  109 + nokogiri (1.5.2)
109 110 octokit (0.6.4)
110 111 addressable (~> 2.2.6)
111 112 faraday (~> 0.7.3)
112 113 faraday_middleware (~> 0.7.0.rc1)
113 114 hashie (~> 1.0.0)
114 115 multi_json (~> 1.0.2)
115   - orm_adapter (0.0.5)
  116 + orm_adapter (0.0.7)
116 117 oruen_redmine_client (0.0.1)
117 118 activeresource (>= 2.3.0)
118   - pivotal-tracker (0.4.1)
  119 + pivotal-tracker (0.5.4)
119 120 builder
120 121 builder
121 122 happymapper (>= 0.3.2)
... ... @@ -124,86 +125,82 @@ GEM
124 125 nokogiri (~> 1.4)
125 126 rest-client (~> 1.6.0)
126 127 rest-client (~> 1.6.0)
127   - polyglot (0.3.2)
  128 + polyglot (0.3.3)
128 129 premailer (1.7.3)
129 130 css_parser (>= 1.1.9)
130 131 htmlentities (>= 4.0.0)
131   - rack (1.2.4)
132   - rack-mount (0.6.14)
133   - rack (>= 1.0.0)
  132 + rack (1.4.1)
  133 + rack-cache (1.2)
  134 + rack (>= 0.4)
  135 + rack-ssl (1.3.2)
  136 + rack
134 137 rack-ssl-enforcer (0.2.4)
135   - rack-test (0.5.7)
  138 + rack-test (0.6.1)
136 139 rack (>= 1.0)
137   - rails (3.0.10)
138   - actionmailer (= 3.0.10)
139   - actionpack (= 3.0.10)
140   - activerecord (= 3.0.10)
141   - activeresource (= 3.0.10)
142   - activesupport (= 3.0.10)
  140 + rails (3.2.3)
  141 + actionmailer (= 3.2.3)
  142 + actionpack (= 3.2.3)
  143 + activerecord (= 3.2.3)
  144 + activeresource (= 3.2.3)
  145 + activesupport (= 3.2.3)
143 146 bundler (~> 1.0)
144   - railties (= 3.0.10)
145   - railties (3.0.10)
146   - actionpack (= 3.0.10)
147   - activesupport (= 3.0.10)
  147 + railties (= 3.2.3)
  148 + railties (3.2.3)
  149 + actionpack (= 3.2.3)
  150 + activesupport (= 3.2.3)
  151 + rack-ssl (~> 1.3.2)
148 152 rake (>= 0.8.7)
149 153 rdoc (~> 3.4)
150   - thor (~> 0.14.4)
  154 + thor (~> 0.14.6)
151 155 raindrops (0.8.0)
152   - rake (0.9.2)
153   - rbx-require-relative (0.0.5)
154   - rdoc (3.9.4)
155   - responders (0.6.4)
  156 + rake (0.9.2.2)
  157 + rbx-require-relative (0.0.9)
  158 + rdoc (3.12)
  159 + json (~> 1.4)
  160 + responders (0.9.1)
  161 + railties (~> 3.1)
156 162 rest-client (1.6.7)
157 163 mime-types (>= 1.16)
158 164 ri_cal (0.8.8)
159   - rspec (2.6.0)
160   - rspec-core (~> 2.6.0)
161   - rspec-expectations (~> 2.6.0)
162   - rspec-mocks (~> 2.6.0)
163   - rspec-core (2.6.4)
164   - rspec-expectations (2.6.0)
165   - diff-lcs (~> 1.1.2)
166   - rspec-mocks (2.6.0)
167   - rspec-rails (2.6.1)
168   - actionpack (~> 3.0)
169   - activesupport (~> 3.0)
170   - railties (~> 3.0)
171   - rspec (~> 2.6.0)
  165 + rspec (2.10.0)
  166 + rspec-core (~> 2.10.0)
  167 + rspec-expectations (~> 2.10.0)
  168 + rspec-mocks (~> 2.10.0)
  169 + rspec-core (2.10.0)
  170 + rspec-expectations (2.10.0)
  171 + diff-lcs (~> 1.1.3)
  172 + rspec-mocks (2.10.1)
  173 + rspec-rails (2.10.1)
  174 + actionpack (>= 3.0)
  175 + activesupport (>= 3.0)
  176 + railties (>= 3.0)
  177 + rspec (~> 2.10.0)
172 178 ruby-debug (0.10.4)
173 179 columnize (>= 0.1)
174 180 ruby-debug-base (~> 0.10.4.0)
175 181 ruby-debug-base (0.10.4)
176 182 linecache (>= 0.3)
177   - ruby-debug-base19 (0.11.25)
178   - columnize (>= 0.3.1)
179   - linecache19 (>= 0.5.11)
180   - ruby_core_source (>= 0.1.4)
181   - ruby-debug19 (0.11.6)
182   - columnize (>= 0.3.1)
183   - linecache19 (>= 0.5.11)
184   - ruby-debug-base19 (>= 0.11.19)
185   - ruby-fogbugz (0.0.4)
  183 + ruby-fogbugz (0.1.1)
186 184 crack
187   - typhoeus
188   - ruby_core_source (0.1.5)
189   - archive-tar-minitar (>= 0.5.2)
  185 + sprockets (2.1.3)
  186 + hike (~> 1.2)
  187 + rack (~> 1.0)
  188 + tilt (~> 1.1, != 1.3.0)
190 189 thor (0.14.6)
  190 + tilt (1.3.3)
191 191 treetop (1.4.10)
192 192 polyglot
193 193 polyglot (>= 0.3.1)
194   - typhoeus (0.2.4)
195   - mime-types
196   - mime-types
197   - tzinfo (0.3.30)
198   - unicorn (4.1.1)
199   - kgio (~> 2.4)
  194 + tzinfo (0.3.33)
  195 + unicorn (4.3.1)
  196 + kgio (~> 2.6)
200 197 rack
201   - raindrops (~> 0.6)
  198 + raindrops (~> 0.7)
202 199 useragent (0.3.2)
203   - warden (1.0.5)
  200 + warden (1.0.6)
204 201 rack (>= 1.0)
205   - webmock (1.7.6)
206   - addressable (~> 2.2, > 2.2.5)
  202 + webmock (1.8.6)
  203 + addressable (>= 2.2.7)
207 204 crack (>= 0.1.7)
208 205  
209 206 PLATFORMS
... ... @@ -211,7 +208,10 @@ PLATFORMS
211 208  
212 209 DEPENDENCIES
213 210 SystemTimer
  211 + actionmailer (~> 3.2.0)
214 212 actionmailer_inline_css (~> 1.3.0)
  213 + actionpack (~> 3.2.0)
  214 + activesupport (~> 3.2.0)
215 215 bson (= 1.3.1)
216 216 bson_ext (= 1.3.1)
217 217 database_cleaner (~> 0.6.0)
... ... @@ -232,12 +232,11 @@ DEPENDENCIES
232 232 oruen_redmine_client
233 233 pivotal-tracker
234 234 rack-ssl-enforcer
235   - rails (= 3.0.10)
  235 + railties (~> 3.2.0)
236 236 ri_cal
237 237 rspec (~> 2.6)
238 238 rspec-rails (~> 2.6)
239 239 ruby-debug
240   - ruby-debug19
241 240 ruby-fogbugz
242 241 unicorn
243 242 useragent (~> 0.3.1)
... ...
app/models/app.rb
... ... @@ -14,12 +14,13 @@ class App
14 14 # Some legacy apps may have string as key instead of BSON::ObjectID
15 15 identity :type => String
16 16  
17   - # There seems to be a Mongoid bug making it impossible to use String identity with references_many feature:
18   - # https://github.com/mongoid/mongoid/issues/703
19   - # Using 32 character string as a workaround.
20   - before_create do |r|
21   - r.id = ActiveSupport::SecureRandom.hex
22   - end
  17 + # Bug fix
  18 + # # There seems to be a Mongoid bug making it impossible to use String identity with references_many feature:
  19 + # # https://github.com/mongoid/mongoid/issues/703
  20 + # # Using 32 character string as a workaround.
  21 + # before_create do |r|
  22 + # r.id = ActiveSupport::SecureRandom.hex
  23 + # end
23 24  
24 25 embeds_many :watchers
25 26 embeds_many :deploys
... ... @@ -154,7 +155,7 @@ class App
154 155 end
155 156  
156 157 def generate_api_key
157   - self.api_key ||= ActiveSupport::SecureRandom.hex
  158 + self.api_key ||= SecureRandom.hex
158 159 end
159 160  
160 161 def check_issue_tracker
... ...
app/models/issue_trackers/lighthouse_tracker.rb
... ... @@ -23,7 +23,7 @@ class IssueTrackers::LighthouseTracker &lt; IssueTracker
23 23 Lighthouse.token = api_token
24 24 # updating lighthouse account
25 25 Lighthouse::Ticket.site
26   -
  26 + Lighthouse::Ticket.format = :xml
27 27 ticket = Lighthouse::Ticket.new(:project_id => project_id)
28 28 ticket.title = issue_title problem
29 29  
... ...
app/models/issue_trackers/redmine_tracker.rb
... ... @@ -31,6 +31,7 @@ class IssueTrackers::RedmineTracker &lt; IssueTracker
31 31 RedmineClient::Base.configure do
32 32 self.token = token
33 33 self.site = acc
  34 + self.format = :xml
34 35 end
35 36 issue = RedmineClient::Issue.new(:project_id => project_id)
36 37 issue.subject = issue_title problem
... ...
lib/issue_tracker_apis/mingle.rb
1 1 module Mingle
2 2 class Card < ActiveResource::Base
3 3 # site template ~> "https://username:password@mingle.example.com/api/v1/projects/:project_id/"
  4 + self.format = :xml
4 5 end
5 6 def self.set_site(site)
6 7 # ActiveResource seems to clone and freeze the @site variable
... ...
spec/fabricators/app_fabricator.rb
... ... @@ -22,6 +22,6 @@ Fabricator(:deploy) do
22 22 username 'clyde.frog'
23 23 repository 'git@github.com/errbit/errbit.git'
24 24 environment 'production'
25   - revision { ActiveSupport::SecureRandom.hex(10) }
  25 + revision { SecureRandom.hex(10) }
26 26 end
27 27  
... ...
spec/fabricators/err_fabricator.rb
... ... @@ -19,7 +19,7 @@ def random_backtrace
19 19 backtrace = []
20 20 99.times {|t| backtrace << {
21 21 'number' => rand(999),
22   - 'file' => "/path/to/file/#{ActiveSupport::SecureRandom.hex(4)}.rb",
  22 + 'file' => "/path/to/file/#{SecureRandom.hex(4)}.rb",
23 23 'method' => ActiveSupport.methods.shuffle.first
24 24 }}
25 25 backtrace
... ...
spec/views/errs/show.html.haml_spec.rb
... ... @@ -17,7 +17,7 @@ describe &quot;errs/show.html.haml&quot; do
17 17  
18 18 it "should confirm the 'resolve' link by default" do
19 19 render
20   - action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  20 + action_bar = String.new(view.view_flow.get(:action_bar))
21 21 resolve_link = action_bar.match(/(<a href.*?(class="resolve").*?>)/)[0]
22 22 resolve_link.should =~ /data-confirm="Seriously\?"/
23 23 end
... ... @@ -25,7 +25,7 @@ describe &quot;errs/show.html.haml&quot; do
25 25 it "should confirm the 'resolve' link if configuration is unset" do
26 26 Errbit::Config.stub(:confirm_resolve_err).and_return(nil)
27 27 render
28   - action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  28 + action_bar = String.new(view.view_flow.get(:action_bar))
29 29 resolve_link = action_bar.match(/(<a href.*?(class="resolve").*?>)/)[0]
30 30 resolve_link.should =~ /data-confirm="Seriously\?"/
31 31 end
... ... @@ -33,7 +33,7 @@ describe &quot;errs/show.html.haml&quot; do
33 33 it "should not confirm the 'resolve' link if configured not to" do
34 34 Errbit::Config.stub(:confirm_resolve_err).and_return(false)
35 35 render
36   - action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  36 + action_bar = String.new(view.view_flow.get(:action_bar))
37 37 resolve_link = action_bar.match(/(<a href.*?(class="resolve").*?>)/)[0]
38 38 resolve_link.should_not =~ /data-confirm=/
39 39 end
... ... @@ -42,7 +42,7 @@ describe &quot;errs/show.html.haml&quot; do
42 42 url = 'http://localhost:3000/errs'
43 43 controller.request.env['HTTP_REFERER'] = url
44 44 render
45   - action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  45 + action_bar = String.new(view.view_flow.get(:action_bar))
46 46 action_bar.should =~ /<span><a href=\"#{url}\" class=\"up\">up<\/a><\/span>/
47 47 end
48 48  
... ... @@ -52,7 +52,7 @@ describe &quot;errs/show.html.haml&quot; do
52 52 assign :problem, problem
53 53 assign :app, problem.app
54 54 render
55   - action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  55 + action_bar = String.new(view.view_flow.get(:action_bar))
56 56 action_bar.should =~ /<span><a href=\"#{app_errs_path(problem.app)}\" class=\"up\">up<\/a><\/span>/
57 57 end
58 58  
... ... @@ -68,7 +68,7 @@ describe &quot;errs/show.html.haml&quot; do
68 68 assign :problem, problem
69 69 assign :app, problem.app
70 70 render
71   - comments_section = String.new(view.instance_variable_get(:@_content_for)[:comments])
  71 + comments_section = String.new(view.view_flow.get(:comments))
72 72 comments_section.should =~ /Test comment/
73 73 comments_section.should =~ /Add a comment/
74 74 end
... ... @@ -84,7 +84,7 @@ describe &quot;errs/show.html.haml&quot; do
84 84 problem = Fabricate(:problem)
85 85 with_issue_tracker(problem)
86 86 render
87   - view.instance_variable_get(:@_content_for)[:comments].should be_blank
  87 + view.view_flow.get(:comments).should be_blank
88 88 end
89 89  
90 90 it 'should display existing comments' do
... ... @@ -92,7 +92,7 @@ describe &quot;errs/show.html.haml&quot; do
92 92 problem.reload
93 93 with_issue_tracker(problem)
94 94 render
95   - comments_section = String.new(view.instance_variable_get(:@_content_for)[:comments])
  95 + comments_section = String.new(view.view_flow.get(:comments))
96 96 comments_section.should =~ /Test comment/
97 97 comments_section.should_not =~ /Add a comment/
98 98 end
... ...