wagn 1.17.4 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +14 -17
  3. data/bin/wagn +2 -2
  4. data/features/step_definitions/email_steps.rb +14 -17
  5. data/features/step_definitions/history_steps.rb +1 -1
  6. data/features/step_definitions/wagn_steps.rb +5 -11
  7. data/features/step_definitions/web_steps.rb +10 -15
  8. data/features/step_definitions/window_steps.rb +7 -7
  9. data/features/support/env.rb +3 -3
  10. data/features/support/paths.rb +13 -13
  11. data/features/support/scopes.rb +2 -2
  12. data/lib/decko/engine.rb +9 -12
  13. data/lib/wagn/cli.rb +4 -4
  14. data/lib/wagn/commands.rb +20 -24
  15. data/lib/wagn/commands/application.rb +4 -4
  16. data/lib/wagn/config/environments/cucumber.rb +0 -1
  17. data/lib/wagn/config/environments/development.rb +17 -20
  18. data/lib/wagn/config/environments/production.rb +3 -5
  19. data/lib/wagn/config/environments/profile.rb +2 -3
  20. data/lib/wagn/config/environments/test.rb +8 -9
  21. data/lib/wagn/generators/wagn/templates/bin/spring +7 -7
  22. data/lib/wagn/generators/wagn/templates/spec/spec_helper.rb +1 -1
  23. data/lib/wagn/generators/wagn/wagn_generator.rb +126 -160
  24. data/lib/wagn/generators/wagn/wagn_generator/interactive.rb +0 -0
  25. data/lib/wagn/mods_spec_helper.rb +10 -19
  26. data/lib/wagn/parser.rb +3 -3
  27. data/lib/wagn/script_wagn_loader.rb +6 -6
  28. data/lib/wagn/simplecov_helper.rb +16 -17
  29. data/lib/wagn/tasks/cucumber.rake +12 -15
  30. data/lib/wagn/tasks/db.rake +7 -12
  31. data/lib/wagn/tasks/test.rake +24 -28
  32. data/lib/wagn/tasks/wagn.rake +54 -57
  33. data/rails/application-routes.rb +2 -2
  34. data/rails/controllers/card_controller.rb +4 -6
  35. data/rails/engine-routes.rb +9 -13
  36. data/script/autospec +1 -1
  37. data/script/rails +1 -1
  38. data/script/test_filter +8 -8
  39. data/spec/controllers/card_controller_spec.rb +138 -155
  40. data/spec/controllers/location_spec.rb +8 -13
  41. data/spec/javascripts/support/jasmine_config.rb +6 -9
  42. data/spec/javascripts/support/jasmine_runner.rb +3 -3
  43. data/test/performance/card_create_test.rb +2 -3
  44. data/test/performance/fetch_test.rb +2 -2
  45. data/test/performance/homepage_test.rb +1 -1
  46. data/test/performance/render_test.rb +1 -1
  47. data/test/test_helper.rb +26 -30
  48. data/wagn.gemspec +10 -11
  49. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cb318e1936d35df9506dbaad6d532c3aa04bb00
4
- data.tar.gz: e00a5f64958deaed66d86f60faac607f9fee02d6
3
+ metadata.gz: db58a4a4675681de858310ae6ae98a97e3627a22
4
+ data.tar.gz: 7cd9465e0d9b19a9c7813f588431c6ab7c740b44
5
5
  SHA512:
6
- metadata.gz: f3b2af23091d31d7bae896654f8707775f0785b3521dcaeb23d781cb4beb41df4664fffdf23f973c5ee2342eb6a249135983d05922819df1249fd702df42d049
7
- data.tar.gz: 673bc99e55659ac4a1800a8afb627c739f7b12c80d59b20941fe96a42f2f9fb44146de34e2fc09248aed9a383f1227e24cd0fa37b860c503efdf3054c8a2ccec
6
+ metadata.gz: 35c942ff3d452913629f879640ad445ed1db871877e02a2cb04410c956d4584b1e4d3223be89eea6c928d8fb9dacbd5c6cefb685eacc8cb210ebfa1a0e85aa21
7
+ data.tar.gz: d713f160f746785569b5a1b03f2947df48f88916ff7759301b007f175c9ad25267b9b8a9fce6822b2366c9e4047db9d92a31980c37ec6cff4c5a6e7fa8a534a8
data/Guardfile CHANGED
@@ -1,35 +1,32 @@
1
1
  # A sample Guardfile
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
- #guard :rspec, cmd: 'bundle exec env COVERAGE=false rspec' do
4
+ # guard :rspec, cmd: 'bundle exec env COVERAGE=false rspec' do
5
5
  guard :rspec, cmd: 'bundle exec wagn rspec' do
6
-
7
6
  watch(%r{^spec/.+_spec\.rb$})
8
7
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
- watch('spec/spec_helper.rb') { "spec" }
8
+ watch('spec/spec_helper.rb') { 'spec' }
10
9
 
11
10
  # Rails example
12
11
  watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
13
- # watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
14
- # watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
15
-
16
- # watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
17
- # watch('config/routes.rb') { "spec/routing" }
18
- # watch('app/controllers/application_controller.rb') { "spec/controllers" }
12
+ # watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
13
+ # watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
14
+
15
+ # watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
16
+ # watch('config/routes.rb') { "spec/routing" }
17
+ # watch('app/controllers/application_controller.rb') { "spec/controllers" }
19
18
 
20
19
  # Capybara features specs
21
- # watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
20
+ # watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
22
21
 
23
22
  # Wagn mods
24
23
  watch(%r{^mod/(.+)\.rb}) { |m| "mod/spec/#{m[1]}_spec.rb" }
25
24
  watch(%r{^tmp/mod/(.+)\.rb}) { |m| "mod/spec/#{m[1]}_spec.rb" }
26
25
 
27
-
28
26
  # Turnip features and steps
29
- # watch(%r{^spec/acceptance/(.+)\.feature$})
30
- # watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
31
-
32
- #callback(:start_begin) { puts "guard-rspec is watching ..." }
33
- #callback(:run_on_modifications_begin) { puts "<script>document.body.innerHTML = '';</script>" } # use js to clear textmate's html view
34
- end
27
+ # watch(%r{^spec/acceptance/(.+)\.feature$})
28
+ # watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
35
29
 
30
+ # callback(:start_begin) { puts "guard-rspec is watching ..." }
31
+ # callback(:run_on_modifications_begin) { puts "<script>document.body.innerHTML = '';</script>" } # use js to clear textmate's html view
32
+ end
data/bin/wagn CHANGED
@@ -4,6 +4,6 @@ git_path = File.expand_path('../../../.git', __FILE__)
4
4
 
5
5
  if File.exist?(git_path)
6
6
  railties_path = File.expand_path('../../lib', __FILE__)
7
- $:.unshift(railties_path)
7
+ $LOAD_PATH.unshift(railties_path)
8
8
  end
9
- require "wagn/cli"
9
+ require 'wagn/cli'
@@ -58,8 +58,8 @@ Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amou
58
58
  end
59
59
 
60
60
  Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject|
61
- # address = address_for_user address
62
- expect(unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size).to eq(parse_email_count(amount))
61
+ # address = address_for_user address
62
+ expect(unread_emails_for(address).count { |m| m.subject =~ Regexp.new(subject) }).to eq(parse_email_count(amount))
63
63
  end
64
64
 
65
65
  Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
@@ -96,11 +96,11 @@ Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text|
96
96
  end
97
97
 
98
98
  Then /^(?:I|they) should see \|(.*)\| in the email body$/ do |text|
99
- expect(current_email.text_part.body.raw_source).to include("#{text}")
99
+ expect(current_email.text_part.body.raw_source).to include(text.to_s)
100
100
  end
101
101
 
102
102
  Then /^(?:I|they) should see "(.*)" in the email body$/ do |text|
103
- expect(current_email.text_part.body.raw_source).to include("#{text}")
103
+ expect(current_email.text_part.body.raw_source).to include(text.to_s)
104
104
  end
105
105
 
106
106
  Then /^(?:I|they) should see \/([^\/]*?)\/ in the email body$/ do |text|
@@ -128,7 +128,7 @@ Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amoun
128
128
  end
129
129
 
130
130
  Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
131
- expect(current_email_attachments.select { |a| a.original_filename == filename }.size).to eq(parse_email_count(amount))
131
+ expect(current_email_attachments.count { |a| a.original_filename == filename }).to eq(parse_email_count(amount))
132
132
  end
133
133
 
134
134
  Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
@@ -136,7 +136,7 @@ Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
136
136
  end
137
137
 
138
138
  Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
139
- expect(current_email_attachments.select { |a| a.content_type == content_type }.size).to eq(parse_email_count(amount))
139
+ expect(current_email_attachments.count { |a| a.content_type == content_type }).to eq(parse_email_count(amount))
140
140
  end
141
141
 
142
142
  Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
@@ -150,7 +150,7 @@ Then /^all attachments should not be blank$/ do
150
150
  end
151
151
 
152
152
  Then /^show me a list of email attachments$/ do
153
- EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email)
153
+ EmailSpec::EmailViewer.save_and_open_email_attachments_list(current_email)
154
154
  end
155
155
 
156
156
  #
@@ -172,29 +172,27 @@ end
172
172
  #
173
173
 
174
174
  Then /^save and open current email$/ do
175
- EmailSpec::EmailViewer::save_and_open_email(current_email)
175
+ EmailSpec::EmailViewer.save_and_open_email(current_email)
176
176
  end
177
177
 
178
178
  Then /^save and open all text emails$/ do
179
- EmailSpec::EmailViewer::save_and_open_all_text_emails
179
+ EmailSpec::EmailViewer.save_and_open_all_text_emails
180
180
  end
181
181
 
182
182
  Then /^save and open all html emails$/ do
183
- EmailSpec::EmailViewer::save_and_open_all_html_emails
183
+ EmailSpec::EmailViewer.save_and_open_all_html_emails
184
184
  end
185
185
 
186
186
  Then /^save and open all raw emails$/ do
187
- EmailSpec::EmailViewer::save_and_open_all_raw_emails
187
+ EmailSpec::EmailViewer.save_and_open_all_raw_emails
188
188
  end
189
189
 
190
-
191
-
192
190
  Then /^(.*) should be notified that "(.*)"$/ do |username, subject|
193
191
  email = address_for_user username
194
192
  begin
195
- step %{"#{email}" should receive 1 email}
193
+ step %("#{email}" should receive 1 email)
196
194
  rescue RSpec::Expectations::ExpectationNotMetError => e
197
- raise RSpec::Expectations::ExpectationNotMetError, %(#{e.message}\n Found the following emails:\n\n #{all_emails*"\n\n~~~~~~~~\n\n"})
195
+ raise RSpec::Expectations::ExpectationNotMetError, %(#{e.message}\n Found the following emails:\n\n #{all_emails * "\n\n~~~~~~~~\n\n"})
198
196
  end
199
197
  open_email(email, with_subject: /#{subject}/)
200
198
  end
@@ -203,8 +201,7 @@ Then /^No notification should be sent$/ do
203
201
  expect(all_emails).to be_empty
204
202
  end
205
203
 
206
-
207
204
  def address_for_user username
208
- card_with_acct = username=='I' ? Auth.current : Card[username]
205
+ card_with_acct = username == 'I' ? Auth.current : Card[username]
209
206
  card_with_acct ? card_with_acct.account.email : username
210
207
  end
@@ -1,3 +1,3 @@
1
1
  When /^I expand act (\d+)$/ do |index|
2
- all("a.arrow-right")[-index.to_i].click
2
+ all('a.arrow-right')[-index.to_i].click
3
3
  end
@@ -28,9 +28,7 @@ end
28
28
 
29
29
  Given /^I am signed out$/ do
30
30
  visit '/'
31
- if page.has_content? 'Sign out'
32
- step 'I follow "Sign out"'
33
- end
31
+ step 'I follow "Sign out"' if page.has_content? 'Sign out'
34
32
  end
35
33
 
36
34
  # Given /^I sign in as (.+)$/ do |account_name|
@@ -164,9 +162,7 @@ end
164
162
 
165
163
  When /^I wait until ajax response done$/ do
166
164
  Timeout.timeout(Capybara.default_wait_time) do
167
- while page.evaluate_script('jQuery.active') != 0
168
- sleep(0.5)
169
- end
165
+ sleep(0.5) while page.evaluate_script('jQuery.active') != 0
170
166
  end
171
167
  end
172
168
 
@@ -200,9 +196,7 @@ def signed_in_as username
200
196
  sameuser = (username == 'I')
201
197
  sameuser ||= (Card::Auth.current.key == username.to_name.key)
202
198
  was_signed_in = Card::Auth.current_id if Card::Auth.signed_in?
203
- unless sameuser
204
- step "I am signed in as #{username}"
205
- end
199
+ step "I am signed in as #{username}" unless sameuser
206
200
  yield
207
201
  return if sameuser
208
202
  msg = if was_signed_in
@@ -317,7 +311,7 @@ Then class_re do |selection, neg, element, selector|
317
311
  element = 'a' if element == 'link'
318
312
  within scope_of(selection) do
319
313
  verb = neg ? :should_not : :should
320
- page.send(verb, have_css([element, selector] * '.'))
314
+ page.send(verb, have_css([element, selector].join('.')))
321
315
  end
322
316
  end
323
317
 
@@ -372,7 +366,7 @@ end
372
366
  img_should = /^I should see a non-mod image of size "(.+)" and type "(.+)"$/
373
367
  Then img_should do |size, type|
374
368
  element = find("img[src*='#{size}.#{type}']")
375
- expect(element[:src]).to match(%r(/~\d+/))
369
+ expect(element[:src]).to match(%r{/~\d+/})
376
370
  end
377
371
 
378
372
  Then /^I should see "([^\"]*)" in color (.*)$/ do |text, css_class|
@@ -5,10 +5,9 @@
5
5
  # instead of editing this one. Cucumber will automatically load all features/**/*.rb
6
6
  # files.
7
7
 
8
-
9
8
  require 'uri'
10
9
  require 'cgi'
11
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
10
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'support', 'paths'))
12
11
 
13
12
  # Commonly used webrat steps
14
13
  # http://github.com/brynary/webrat
@@ -41,12 +40,10 @@ When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
41
40
  fill_in(field, with: value)
42
41
  end
43
42
 
44
-
45
43
  When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
46
44
  select(value, from: field)
47
45
  end
48
46
 
49
-
50
47
  # Use this step in conjunction with Rail's datetime_select helper. For example:
51
48
  # When I select "December 25, 2008 10:00" as the date and time
52
49
  When /^(?:|I )select "([^"]*)" as the date and time$/ do |time|
@@ -110,17 +107,17 @@ end
110
107
  # passed to attach_file() you will get a "Photo file is not one of the allowed file types."
111
108
  # error message
112
109
  When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
113
- type = path.split(".")[1]
110
+ type = path.split('.')[1]
114
111
 
115
112
  case type
116
- when "jpg"
117
- type = "image/jpg"
118
- when "jpeg"
119
- type = "image/jpeg"
120
- when "png"
121
- type = "image/png"
122
- when "gif"
123
- type = "image/gif"
113
+ when 'jpg'
114
+ type = 'image/jpg'
115
+ when 'jpeg'
116
+ type = 'image/jpeg'
117
+ when 'png'
118
+ type = 'image/png'
119
+ when 'gif'
120
+ type = 'image/gif'
124
121
  end
125
122
 
126
123
  attach_file(field, path, type)
@@ -134,7 +131,5 @@ Then /^(?:|I )should not see "([^"]*)"$/ do |text|
134
131
  expect(page).to_not have_content(text)
135
132
  end
136
133
 
137
-
138
134
  Then /^show me the page$/ do
139
- save_and_open_page
140
135
  end
@@ -1,23 +1,23 @@
1
1
  When /^I open a new window for (.*)$/ do |account_name|
2
- str =
3
- <<END_TAG
2
+ str =
3
+ <<END_TAG
4
4
  window.open("", "#{account_name}", "height=600,width=800");
5
5
  END_TAG
6
6
  page.execute_script(str)
7
- page.driver.browser.switch_to.window( page.driver.browser.window_handles.last )
7
+ page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
8
8
  accounted = Card[account_name]
9
9
  visit "/update/:signin?card[subcards][%2B*email][content]=#{accounted.account.email}&card[subcards][%2B*password][content]=joe_pass"
10
10
  end
11
11
 
12
12
  When /I switch to (.+) window$/ do |window|
13
13
  if window == 'first'
14
- page.driver.browser.switch_to.window( page.driver.browser.window_handles.first )
14
+ page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)
15
15
  elsif window == 'last'
16
- page.driver.browser.switch_to.window( page.driver.browser.window_handles.last )
16
+ page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
17
17
  end
18
18
  end
19
19
 
20
20
  When /^I close window$/ do
21
- page.execute_script("window.close();")
22
- page.driver.browser.switch_to.window( page.driver.browser.window_handles.last )
21
+ page.execute_script('window.close();')
22
+ page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
23
23
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
- ENV['RAILS_ENV'] = "cucumber"
2
+ ENV['RAILS_ENV'] = 'cucumber'
3
3
 
4
- require File.expand_path( '../../../lib/wagn/simplecov_helper.rb', __FILE__ )
4
+ require File.expand_path('../../../lib/wagn/simplecov_helper.rb', __FILE__)
5
5
  require 'simplecov'
6
6
  require 'minitest/autorun'
7
7
 
@@ -43,7 +43,7 @@ ActionController::Base.allow_rescue = false
43
43
  begin
44
44
  DatabaseCleaner.strategy = :transaction
45
45
  rescue NameError
46
- raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
46
+ raise 'You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.'
47
47
  end
48
48
 
49
49
  # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
@@ -6,7 +6,7 @@ module NavigationHelpers
6
6
  #
7
7
  # step definition in web_steps.rb
8
8
  #
9
- def path_to(page_name)
9
+ def path_to page_name
10
10
  case page_name
11
11
 
12
12
  when /the home\s?page/
@@ -19,37 +19,37 @@ module NavigationHelpers
19
19
  # user_profile_path(Auth[ $1 ])
20
20
 
21
21
  when /card (.*) with (.*) layout$/
22
- "/#{$1.to_name.url_key}?layout=$2"
22
+ "/#{Regexp.last_match(1).to_name.url_key}?layout=$2"
23
23
 
24
24
  when /card (.*)$/
25
- "/#{$1.to_name.url_key}"
25
+ "/#{Regexp.last_match(1).to_name.url_key}"
26
26
 
27
27
  when /new (.*) presetting name to "(.*)" and author to "(.*)"/
28
- url = "/new/#{$1}?card[name]=#{$2.to_name.url_key}&_author=#{CGI.escape($3)}"
28
+ url = "/new/#{Regexp.last_match(1)}?card[name]=#{Regexp.last_match(2).to_name.url_key}&_author=#{CGI.escape(Regexp.last_match(3))}"
29
29
 
30
30
  when /new card named (.*)$/
31
- "/card/new?card[name]=#{CGI.escape($1)}"
31
+ "/card/new?card[name]=#{CGI.escape(Regexp.last_match(1))}"
32
32
 
33
33
  when /edit (.*)$/
34
- "/#{$1.to_name.url_key}?view=edit"
34
+ "/#{Regexp.last_match(1).to_name.url_key}?view=edit"
35
35
 
36
36
  when /new (.*)$/
37
- "/new/#{$1.to_name.url_key}"
37
+ "/new/#{Regexp.last_match(1).to_name.url_key}"
38
38
 
39
39
  when /kml source/
40
- "/House+*type+by_name.kml"
40
+ '/House+*type+by_name.kml'
41
41
 
42
42
  when /url "(.*)"/
43
- "#{$1}"
43
+ Regexp.last_match(1).to_s
44
44
 
45
45
  else
46
46
  begin
47
47
  page_name =~ /the (.*) page/
48
- path_components = $1.split(/\s+/)
49
- self.send(path_components.push('path').join('_').to_sym)
48
+ path_components = Regexp.last_match(1).split(/\s+/)
49
+ send(path_components.push('path').join('_').to_sym)
50
50
  rescue Object => e
51
- raise "#{e.message} Can't find mapping from \"#{page_name}\" to a path.\n" +
52
- "Now, go and add a mapping in #{__FILE__}"
51
+ raise "#{e.message} Can't find mapping from \"#{page_name}\" to a path.\n" \
52
+ "Now, go and add a mapping in #{__FILE__}"
53
53
  end
54
54
  end
55
55
  end
@@ -22,8 +22,8 @@ module ScopeHelpers
22
22
  '#main > .card-slot > .card-frame'
23
23
 
24
24
  else
25
- raise "Can't find mapping from \"#{section}\" to a scope.\n" +
26
- "Now, go and add a mapping in #{__FILE__}"
25
+ raise "Can't find mapping from \"#{section}\" to a scope.\n" \
26
+ "Now, go and add a mapping in #{__FILE__}"
27
27
  end
28
28
  end
29
29
  end
@@ -16,15 +16,13 @@ require 'builder'
16
16
  require 'wagn'
17
17
 
18
18
  module Decko
19
-
20
19
  class Engine < ::Rails::Engine
21
-
22
- paths.add "app/controllers", with: 'rails/controllers', eager_load: true
20
+ paths.add 'app/controllers', with: 'rails/controllers', eager_load: true
23
21
  paths.add 'gem-assets', with: 'rails/assets'
24
22
  paths.add 'config/routes.rb', with: 'rails/engine-routes.rb'
25
23
  paths.add 'lib/tasks', with: "#{::Wagn.gem_root}/lib/wagn/tasks", glob: '**/*.rake'
26
24
  paths.add 'lib/wagn/config/initializers',
27
- with: File.join( Wagn.gem_root, 'lib/wagn/config/initializers' ), glob: "**/*.rb"
25
+ with: File.join(Wagn.gem_root, 'lib/wagn/config/initializers'), glob: '**/*.rb'
28
26
 
29
27
  initializer 'decko.engine.load_config_initializers', after: :load_config_initializers do
30
28
  paths['lib/wagn/config/initializers'].existent.sort.each do |initializer|
@@ -33,8 +31,8 @@ module Decko
33
31
  end
34
32
 
35
33
  initializer 'engine.copy_configs', before: 'decko.engine.load_config_initializers' do
36
- #this code should all be in Wagn somewhere, and it is now, gem-wize
37
- #Ideally railties would do this for us, and this is needed for both use cases
34
+ # this code should all be in Wagn somewhere, and it is now, gem-wize
35
+ # Ideally railties would do this for us, and this is needed for both use cases
38
36
  Engine.paths['request_log'] = Wagn.paths['request_log']
39
37
  Engine.paths['log'] = Wagn.paths['log']
40
38
  Engine.paths['lib/tasks'] = Wagn.paths['lib/tasks']
@@ -46,13 +44,12 @@ module Decko
46
44
  ActiveRecord::Base.establish_connection(::Rails.env.to_sym)
47
45
  end
48
46
  ActiveSupport.on_load(:after_initialize) do
49
- begin
50
- require_dependency 'card' unless defined?(Card)
51
- rescue ActiveRecord::StatementInvalid => e
52
- ::Rails.logger.warn "database not available[#{::Rails.env}] #{e}"
53
- end
47
+ begin
48
+ require_dependency 'card' unless defined?(Card)
49
+ rescue ActiveRecord::StatementInvalid => e
50
+ ::Rails.logger.warn "database not available[#{::Rails.env}] #{e}"
51
+ end
54
52
  end
55
53
  end
56
54
  end
57
55
  end
58
-