wagn 1.18.6 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +2 -2
  3. data/bin/wagn +3 -3
  4. data/features/notifications.feature +1 -0
  5. data/features/rules.feature +2 -0
  6. data/features/step_definitions/email_steps.rb +10 -2
  7. data/features/step_definitions/history_steps.rb +1 -1
  8. data/features/step_definitions/wagn_steps.rb +72 -48
  9. data/features/step_definitions/web_steps.rb +12 -12
  10. data/features/step_definitions/window_steps.rb +3 -3
  11. data/features/structure.feature +1 -0
  12. data/features/support/delayed_job.rb +18 -0
  13. data/features/support/env.rb +43 -24
  14. data/features/support/paths.rb +4 -4
  15. data/features/support/scopes.rb +6 -6
  16. data/features/support/wagn_env.rb +2 -2
  17. data/features/table_of_contents.feature +1 -0
  18. data/features/update_includers.feature +2 -4
  19. data/lib/decko/engine.rb +29 -28
  20. data/lib/wagn.rb +1 -1
  21. data/lib/wagn/all.rb +1 -1
  22. data/lib/wagn/application.rb +9 -9
  23. data/lib/wagn/cli.rb +5 -5
  24. data/lib/wagn/commands.rb +48 -48
  25. data/lib/wagn/commands/application.rb +4 -4
  26. data/lib/wagn/config/environments/cucumber.rb +2 -0
  27. data/lib/wagn/config/environments/development.rb +2 -2
  28. data/lib/wagn/config/environments/production.rb +2 -2
  29. data/lib/wagn/config/environments/test.rb +12 -3
  30. data/lib/wagn/config/initializers/secret_token.rb +2 -2
  31. data/lib/wagn/generators/wagn/templates/Gemfile +38 -51
  32. data/lib/wagn/generators/wagn/templates/bin/spring +6 -6
  33. data/lib/wagn/generators/wagn/templates/config/application.rb +12 -1
  34. data/lib/wagn/generators/wagn/templates/spec/javascripts/support/deck_jasmine.yml +2 -2
  35. data/lib/wagn/generators/wagn/templates/spec/javascripts/support/wagn_jasmine.yml +15 -10
  36. data/lib/wagn/generators/wagn/templates/spec/spec_helper.rb +1 -1
  37. data/lib/wagn/generators/wagn/wagn_generator.rb +87 -87
  38. data/lib/wagn/generators/wagn/wagn_generator/interactive.rb +28 -28
  39. data/lib/wagn/mods_spec_helper.rb +9 -9
  40. data/lib/wagn/parser.rb +27 -27
  41. data/lib/wagn/response.rb +106 -0
  42. data/lib/wagn/script_wagn_loader.rb +4 -4
  43. data/lib/wagn/simplecov_helper.rb +19 -19
  44. data/lib/wagn/tasks/cucumber.rake +19 -19
  45. data/lib/wagn/tasks/db.rake +8 -8
  46. data/lib/wagn/tasks/test.rake +25 -25
  47. data/lib/wagn/tasks/wagn.rake +107 -110
  48. data/rails/application-routes.rb +2 -2
  49. data/rails/controllers/card_controller.rb +37 -196
  50. data/rails/engine-routes.rb +29 -29
  51. data/script/autospec +3 -3
  52. data/script/rails +3 -3
  53. data/script/test_filter +2 -2
  54. data/script/wagn +3 -3
  55. data/spec/controllers/card_controller_spec.rb +194 -170
  56. data/spec/controllers/location_spec.rb +10 -10
  57. data/spec/javascripts/support/jasmine.yml.erb +4 -4
  58. data/spec/javascripts/support/jasmine_config.rb +4 -4
  59. data/spec/javascripts/support/jasmine_runner.rb +5 -5
  60. data/test/performance/card_create_test.rb +5 -5
  61. data/test/performance/fetch_test.rb +3 -3
  62. data/test/performance/homepage_test.rb +3 -3
  63. data/test/performance/render_test.rb +3 -3
  64. data/test/test_helper.rb +14 -14
  65. data/wagn.gemspec +16 -16
  66. metadata +7 -5
@@ -1,8 +1,8 @@
1
- require 'rails/generators'
2
- require File.expand_path('../../generators/wagn/wagn_generator', __FILE__)
1
+ require "rails/generators"
2
+ require File.expand_path("../../generators/wagn/wagn_generator", __FILE__)
3
3
 
4
- if ARGV.first != 'new'
5
- ARGV[0] = '--help'
4
+ if ARGV.first != "new"
5
+ ARGV[0] = "--help"
6
6
  else
7
7
  ARGV.shift
8
8
  end
@@ -28,4 +28,6 @@ Wagn.application.class.configure do
28
28
  # The :test delivery method accumulates sent emails in the
29
29
  # ActionMailer::Base.deliveries array.
30
30
  config.action_mailer.delivery_method = :test
31
+
32
+ config.use_transactional_fixtures = false
31
33
  end
@@ -19,7 +19,7 @@ Wagn.application.class.configure do
19
19
 
20
20
  if defined?(RailsDevTweaks)
21
21
  config.dev_tweaks.autoload_rules do
22
- skip '/files'
22
+ skip "/files"
23
23
  skip /view\=status/
24
24
  end
25
25
  end
@@ -82,7 +82,7 @@ Wagn.application.class.configure do
82
82
  # Use Pry instead of IRB
83
83
  silence_warnings do
84
84
  begin
85
- require 'pry'
85
+ require "pry"
86
86
  IRB = Pry
87
87
  rescue LoadError
88
88
  end
@@ -46,7 +46,7 @@ Wagn.application.class.configure do
46
46
  # config.action_controller.asset_host = "http://assets.example.com"
47
47
 
48
48
  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- config.assets.precompile += %w( application-all.css application-print.css barebones.css html5shiv-printshiv.js )
49
+ config.assets.precompile += %w(application-all.css application-print.css barebones.css html5shiv-printshiv.js)
50
50
 
51
51
  # Disable delivery errors, bad email addresses will be ignored
52
52
  # config.action_mailer.raise_delivery_errors = false
@@ -61,5 +61,5 @@ Wagn.application.class.configure do
61
61
  # Send deprecation notices to registered listeners
62
62
  config.active_support.deprecation = :notify
63
63
 
64
- ENV['RAILS_ASSET_ID'] = ''
64
+ ENV["RAILS_ASSET_ID"] = ""
65
65
  end
@@ -14,7 +14,7 @@ Wagn.application.class.configure do
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance
16
16
  config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
17
+ config.static_cache_control = "public, max-age=3600"
18
18
 
19
19
  # Log error messages when you accidentally call methods on nil
20
20
  config.whiny_nils = true
@@ -34,7 +34,7 @@ Wagn.application.class.configure do
34
34
  # ActionMailer::Base.deliveries array.
35
35
  config.action_mailer.delivery_method = :test
36
36
  config.action_mailer.perform_deliveries = true
37
- config.action_mailer.default charset: 'utf-8'
37
+ config.action_mailer.default charset: "utf-8"
38
38
 
39
39
  # config.action_mailer.delivery_method = :smtp
40
40
  # config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
@@ -51,10 +51,19 @@ Wagn.application.class.configure do
51
51
  # Print deprecation notices to the stderr
52
52
  config.active_support.deprecation = :stderr
53
53
 
54
+ config.active_job.queue_adapter = :delayed_job
55
+ # Note: With delay_jobs set to false integrate_with_delay events don't run
56
+ # in a separate process and hence can behave differently from a real
57
+ # environment. To test integrate_with_delay events properly set delay_jobs to
58
+ # true in your test
59
+ Delayed::Worker.delay_jobs = false
60
+
61
+ config.active_record.raise_in_transactional_callbacks = true
62
+
54
63
  # Use Pry instead of IRB
55
64
  silence_warnings do
56
65
  begin
57
- require 'pry'
66
+ require "pry"
58
67
  IRB = Pry
59
68
  rescue LoadError
60
69
  end
@@ -6,5 +6,5 @@
6
6
  # Make sure the secret is at least 30 characters and all random,
7
7
  # no regular words or you'll be exposed to dictionary attacks.
8
8
 
9
- Wagn.config.secret_token = '65632e048d6c80d1e63c911e1a40a51072413543f3182e0261b52e3812b2c9f0ee81828fa5688a34c13a78e438a4b56f497135dc079a4e4460733d555968a2f8'
10
- Wagn.config.secret_key_base = '65632e048d6c80d1e63c911e1a40a51072413543f3182e0261b52e3812b2c9f0ee81828fa5688a34c13a78e438a4b56f497135dc079a4e4460733d555968a2f8'
9
+ Wagn.config.secret_token = "65632e048d6c80d1e63c911e1a40a51072413543f3182e0261b52e3812b2c9f0ee81828fa5688a34c13a78e438a4b56f497135dc079a4e4460733d555968a2f8"
10
+ Wagn.config.secret_key_base = "65632e048d6c80d1e63c911e1a40a51072413543f3182e0261b52e3812b2c9f0ee81828fa5688a34c13a78e438a4b56f497135dc079a4e4460733d555968a2f8"
@@ -7,25 +7,39 @@ gem 'card', :path=>"<%= @gemfile_gem_path %>/card", :require => false
7
7
  gem 'wagn'
8
8
  <% end %>
9
9
 
10
- gem '<%= database_gemfile_entry.name %>'<%= %(, '#{database_gemfile_entry.version}') if database_gemfile_entry.version -%>
10
+ gem '<%= database_gemfile_entry.name %>'<%= %(, '#{database_gemfile_entry.version}') if database_gemfile_entry.version %>
11
11
 
12
12
  # Use Unicorn or Thin as server
13
13
  # gem 'unicorn'
14
14
  # gem 'thin'
15
15
 
16
- <% if options['mod-dev'] -%>
16
+ # Use Delayed::Job for the Active Job queue to run tasks like
17
+ # sending in notifications in a background process.
18
+ # To activate it you have to set config.active_job.queue_adapter to :delayed_job
19
+ # in your config file and start the background process with
20
+ # RAILS_ENV=production script/delayed_job start
21
+ gem 'delayed_job_active_record', '~> 4.1'
22
+ gem 'daemons'
23
+
24
+
25
+ <% if options['mod-dev'] || options['core-dev'] -%>
17
26
  group :test do
18
- gem 'rspec-rails', '~> 3.1.0' # behavior-driven-development suite
27
+ gem 'rspec', '~> 3.4'
28
+ gem 'rspec-rails' # behavior-driven-development suite
19
29
  gem 'spork', '>=0.9'
20
- # gem 'simplecov' # code coverage analysis tool
21
30
  end
22
31
 
23
32
  group :test, :development do
24
33
  gem 'rails-dev-tweaks'
25
34
  gem 'jasmine'
26
- gem 'jasmine-rails' #, :git=>"https://github.com/chuenlok/jasmine-rails.git"
35
+ gem 'jasmine-rails'
27
36
  gem 'jasmine-jquery-rails'
28
37
  gem 'sprockets' # just so above works
38
+ gem 'phantomjs', '1.9.7.1' #locked because 1.9.8.0 is breaking
39
+ gem 'test_after_commit'
40
+ gem 'colorize'
41
+ gem 'delayed_job_active_record', '~> 4.1'
42
+
29
43
  <%- if spring_install? %>
30
44
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
31
45
  gem 'listen', '3.0.6'
@@ -33,17 +47,18 @@ group :test, :development do
33
47
  gem 'spring-commands-rspec'
34
48
  gem 'spring-commands-cucumber'
35
49
  <% end -%>
36
- # gem 'pry-rails'
37
- # gem 'pry-rescue'
38
- # gem 'pry-stack_explorer'
50
+ end
51
+
52
+ group :debug do
53
+ gem 'pry-rails'
54
+ gem 'pry-rescue'
55
+ gem 'pry-stack_explorer'
39
56
  if RUBY_VERSION =~ /^2/
40
- gem 'byebug'
41
- # gem 'pry-byebug'
57
+ gem 'pry-byebug'
42
58
  else
43
59
  gem 'debugger'
44
60
  end
45
61
  end
46
-
47
62
  <% end -%>
48
63
 
49
64
  <% if options['core-dev'] -%>
@@ -55,17 +70,9 @@ group :assets do
55
70
  gem 'tinymce-rails', '~> 3.4' # wysiwyg editor
56
71
  end
57
72
 
58
- group :development do
59
- gem 'rails-dev-tweaks'
60
- gem 'sprockets' # just so above works
61
- end
62
-
63
73
  group :test do
64
- gem 'rspec', '~> 3.4'
65
- gem 'rspec-rails' # behavior-driven-development suite
66
74
  gem 'rspec-html-matchers'
67
- gem 'spork', '>=0.9'
68
- gem 'rr'#, '=1.0.0'
75
+ gem 'rr' #, '=1.0.0'
69
76
  gem 'simplecov', '~> 0.7.1', :require => false #test coverage
70
77
  gem 'codeclimate-test-reporter', require: nil
71
78
  # gem 'guard-rspec', '~> 4.2' # trigger test runs based on file edits,
@@ -77,50 +84,31 @@ group :test do
77
84
  end
78
85
 
79
86
  # CUKES see features dir
80
- gem 'cucumber-rails', '~> 1.3', :require=>false # feature-driven-development suite
81
- gem 'capybara', '~> 2.4.4'
82
- gem 'selenium-webdriver', '~> 2.47.1'
83
- # gem 'capybara-webkit'
87
+ gem 'cucumber-rails', '~> 1.4', :require=>false # feature-driven-development suite
88
+ gem 'capybara', '~> 2.7'
89
+ gem 'selenium-webdriver', '~> 2.53'
90
+ # gem 'capybara-webkit'
84
91
  gem 'launchy' # lets cucumber launch browser windows
85
92
 
86
93
  gem 'timecop', '=0.3.5' # not clear on use/need. referred to in shared_data.rb
87
94
  # NOTE: had weird errors with timecop 0.4.4. would like to update when possible
88
95
 
89
-
90
96
  gem 'email_spec' #
91
- gem 'database_cleaner', '~> 1.4' # used by cucumber for db transactions
97
+ gem 'database_cleaner', '~> 1.5 ' # used by cucumber for db transactions
92
98
 
93
99
  gem 'turn', :require => false # Pretty printed test output. (version constraint is to avoid minitest requirement)
94
100
  gem 'minitest'
101
+
102
+ if RUBY_VERSION =~ /^(1|2\.0)/
103
+ puts "Warning: Can't install i18-tasks without Ruby 2.1+: will not be able to test if I18n keys are missing"
104
+ else
105
+ gem 'i18n-tasks', '~> 0.9.5' # See if I18n keys are missing or unused
106
+ end
95
107
  end
96
108
 
97
109
  gem 'ruby-prof', :group=>:profile # profiling
98
110
 
99
- group :development, :test do
100
- <%- if spring_install? %>
101
- gem 'listen', '3.0.6'
102
- # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
103
- gem 'listen', '3.0.6'
104
- gem 'spring'
105
- gem 'spring-commands-rspec'
106
- gem 'spring-commands-cucumber'
107
- gem 'spring-watcher-listen'
108
- <% end -%>
109
- gem 'pry-rails'
110
- gem 'pry-rescue'
111
- # gem 'pry-stack_explorer'
112
- gem 'jasmine'
113
- gem 'jasmine-rails' #, :git=>"https://github.com/chuenlok/jasmine-rails.git"
114
- gem 'jasmine-jquery-rails'
115
- gem 'phantomjs', '1.9.7.1' #locked because 1.9.8.0 is breaking
116
- end
117
-
118
111
  group :debug do
119
- if RUBY_VERSION =~ /^2/
120
- gem 'pry-byebug'
121
- else
122
- gem 'debugger'
123
- end
124
112
  gem 'better_errors', :git=>"https://github.com/xithan/better_errors.git"
125
113
  gem 'binding_of_caller'
126
114
  end
@@ -129,4 +117,3 @@ end
129
117
  Dir.glob( 'mod/**{,/*/**}/Gemfile' ).each do |gemfile|
130
118
  instance_eval File.read(gemfile)
131
119
  end
132
-
@@ -4,15 +4,15 @@
4
4
  # It gets overwritten when you run the `spring binstub` command
5
5
 
6
6
  unless defined?(Spring)
7
- require 'rubygems'
8
- require 'bundler'
7
+ require "rubygems"
8
+ require "bundler"
9
9
 
10
10
  if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
- ENV['GEM_PATH'] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
- ENV['GEM_HOME'] = ''
11
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
+ ENV["GEM_HOME"] = ""
13
13
  Gem.paths = ENV
14
14
 
15
- gem 'spring', match[1]
16
- require 'spring/binstub'
15
+ gem "spring", match[1]
16
+ require "spring/binstub"
17
17
  end
18
18
  end
@@ -9,7 +9,6 @@ module <%= app_const_base %>
9
9
  # Wagn inherits Rails configuration options. See http://guides.rubyonrails.org/configuring.html
10
10
 
11
11
  # Email configuration
12
-
13
12
  config.action_mailer.perform_deliveries = false
14
13
  # config.action_mailer.delivery_method = ...
15
14
  # config.action_mailer.smtp_settings = ...
@@ -19,6 +18,18 @@ module <%= app_const_base %>
19
18
  # config.action_mailer.delivery_method = :smtp
20
19
  # config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
21
20
 
21
+
22
+ # Delayed jobs
23
+ # Moves time-consuming minor tasks that are part of a card update
24
+ # (like sending notifications to followers) to a background process.
25
+ # To activate it add the gems 'delayed_job_active_record' and 'daemons'
26
+ # to the Gemfile, uncomment the two lines below and run
27
+ # 'RAILS_ENV=production script/delayed_job start' to start the background process.
28
+ # See https://github.com/collectiveidea/delayed_job#running-jobs for more information
29
+ #
30
+ # config.active_job.queue_adapter = :delayed_job
31
+ # Delayed::Worker.delay_jobs = true
32
+
22
33
  # The below keys are fine for testing but should not be used in production sites.
23
34
 
24
35
  # config.read_only = true
@@ -24,11 +24,11 @@ src_files:
24
24
 
25
25
  # list of file expressions to include as css files
26
26
  # relative path from css_dir
27
- css_files:
27
+ css_files:
28
28
  # - "**/*.{css,scss}"
29
29
  # THIS IS IMPORTANT!!
30
30
  include_dir: "mod"
31
- #- <%= Cardio.gem_root+"/mod/03_machines/lib/javascript" %>
31
+ #- <%= Cardio.gem_root+"/mod/machines/lib/javascript" %>
32
32
  # path to parent directory of spec_files
33
33
  # relative path from Rails.root
34
34
  #
@@ -2,7 +2,7 @@
2
2
  # relative path from Rails.root
3
3
  # defaults to app/assets/javascripts
4
4
  # useless for wagn file structure
5
- src_dir: <%= @cardio_gem_root %>/mod/03_machines/lib/javascript
5
+ src_dir: <%= @cardio_gem_root %>/mod/machines/lib/javascript
6
6
  #"app/assets/javascripts"
7
7
 
8
8
  # path to additional directory of source file that are not part of assets pipeline and need to be included
@@ -15,7 +15,7 @@ src_dir: <%= @cardio_gem_root %>/mod/03_machines/lib/javascript
15
15
  # relative path from Rails.root
16
16
  # defaults to app/assets/stylesheets
17
17
  # useless for wagn file structure
18
- css_dir: <%= @cardio_gem_root %>/mod/03_machines/lib/stylesheets
18
+ css_dir: <%= @cardio_gem_root %>/mod/machines/lib/stylesheets
19
19
 
20
20
  # list of file expressions to include as source files
21
21
  # relative path from src_dir
@@ -23,25 +23,30 @@ src_files:
23
23
  - script_jquery.js
24
24
  - script_tinymce.js
25
25
  - wagn_mod.js.coffee
26
+ - wagn_editor.js.coffee
27
+ - wagn_upload.js.coffee
28
+ - wagn_layout.js.coffee
29
+ - wagn_navbox.js.coffee
26
30
  - wagn.js.coffee
27
31
  - script_card_menu.js
28
- # - jquerymobile.js
29
- - jquery-ui.js
30
- - jquery.ui.autocomplete.html.js
31
- - jquery.autosize.js
32
- - jquery.fileupload.js
33
- - jquery.iframe-transport.js
32
+ # - jquerymobile.js
33
+ - jquery-ui.js
34
+ - jquery.ui.autocomplete.html.js
35
+ - jquery.autosize.js
36
+ - jquery.fileupload.js
37
+ - jquery.iframe-transport.js
34
38
  - jquery_ujs.js
35
39
  - script_ace.js
40
+ - script_prosemirror.js
36
41
  #- "**/*.{js.coffee,js,coffee}"
37
42
 
38
43
  # list of file expressions to include as css files
39
44
  # relative path from css_dir
40
- css_files:
45
+ css_files:
41
46
  # - "**/*.{css,scss}"
42
47
  # THIS IS IMPORTANT!!!
43
48
  include_dir:
44
- - <%= @cardio_gem_root %>/mod/03_machines/lib/javascript
49
+ - <%= @cardio_gem_root %>/mod/machines/lib/javascript
45
50
  # path to parent directory of spec_files
46
51
  # relative path from Rails.root
47
52
  #
@@ -1 +1 @@
1
- require 'wagn/mods_spec_helper'
1
+ require "wagn/mods_spec_helper"
@@ -1,33 +1,33 @@
1
- require 'rails/generators/app_base'
1
+ require "rails/generators/app_base"
2
2
 
3
3
  class WagnGenerator < Rails::Generators::AppBase
4
4
  # class WagnGenerator < Rails::Generators::AppGenerator
5
5
 
6
- source_root File.expand_path('../templates', __FILE__)
6
+ source_root File.expand_path("../templates", __FILE__)
7
7
 
8
8
  argument :deck_path, required: false
9
9
 
10
10
  class_option :database,
11
- type: :string, aliases: '-d', default: 'mysql',
12
- desc: 'Preconfigure for selected database ' \
11
+ type: :string, aliases: "-d", default: "mysql",
12
+ desc: "Preconfigure for selected database " \
13
13
  "(options: #{DATABASES.join('/')})"
14
14
 
15
- class_option 'core-dev',
16
- type: :boolean, aliases: '-c', default: false, group: :runtime,
17
- desc: 'Prepare deck for wagn core testing'
15
+ class_option "core-dev",
16
+ type: :boolean, aliases: "-c", default: false, group: :runtime,
17
+ desc: "Prepare deck for wagn core testing"
18
18
 
19
- class_option 'gem-path',
20
- type: :string, aliases: '-g', default: false, group: :runtime,
21
- desc: 'Path to local gem installation ' \
22
- '(Default, use env WAGN_GEM_PATH)'
19
+ class_option "gem-path",
20
+ type: :string, aliases: "-g", default: false, group: :runtime,
21
+ desc: "Path to local gem installation " \
22
+ "(Default, use env WAGN_GEM_PATH)"
23
23
 
24
- class_option 'mod-dev',
25
- type: :boolean, aliases: '-m', default: false, group: :runtime,
26
- desc: 'Prepare deck for mod testing'
24
+ class_option "mod-dev",
25
+ type: :boolean, aliases: "-m", default: false, group: :runtime,
26
+ desc: "Prepare deck for mod testing"
27
27
 
28
- class_option 'interactive',
29
- type: :boolean, aliases: '-i', default: false, group: :runtime,
30
- desc: 'Prompt with dynamic installation options'
28
+ class_option "interactive",
29
+ type: :boolean, aliases: "-i", default: false, group: :runtime,
30
+ desc: "Prompt with dynamic installation options"
31
31
 
32
32
  public_task :set_default_accessors!
33
33
  public_task :create_root
@@ -37,25 +37,25 @@ class WagnGenerator < Rails::Generators::AppBase
37
37
  def dev_setup
38
38
  # TODO: rename or split, gem_path points to the source repo,
39
39
  # card and wagn gems are subdirs
40
- @gemfile_gem_path = @gem_path = options['gem-path']
41
- env_gem_path = ENV['WAGN_GEM_PATH']
40
+ @gemfile_gem_path = @gem_path = options["gem-path"]
41
+ env_gem_path = ENV["WAGN_GEM_PATH"]
42
42
  if env_gem_path.present?
43
43
  @gemfile_gem_path = %q(#{ENV['WAGN_GEM_PATH']})
44
44
  @gem_path = env_gem_path
45
45
  end
46
46
 
47
47
  @include_jasmine_engine = false
48
- if options['core-dev']
48
+ if options["core-dev"]
49
49
  core_dev_setup
50
50
  shared_dev_setup
51
- elsif options['mod-dev']
51
+ elsif options["mod-dev"]
52
52
  mod_dev_setup
53
53
  shared_dev_setup
54
54
  end
55
55
  end
56
56
 
57
57
  def rakefile
58
- template 'Rakefile'
58
+ template "Rakefile"
59
59
  end
60
60
 
61
61
  # def readme
@@ -63,70 +63,70 @@ class WagnGenerator < Rails::Generators::AppBase
63
63
  # end
64
64
 
65
65
  def mod
66
- empty_directory_with_keep_file 'mod'
66
+ empty_directory_with_keep_file "mod"
67
67
  end
68
68
 
69
69
  def log
70
- empty_directory_with_keep_file 'log'
70
+ empty_directory_with_keep_file "log"
71
71
  end
72
72
 
73
73
  def files
74
- empty_directory_with_keep_file 'files'
74
+ empty_directory_with_keep_file "files"
75
75
  end
76
76
 
77
77
  def tmp
78
- empty_directory 'tmp'
78
+ empty_directory "tmp"
79
79
  end
80
80
 
81
81
  def gemfile
82
- template 'Gemfile'
82
+ template "Gemfile"
83
83
  end
84
84
 
85
85
  def configru
86
- template 'config.ru'
86
+ template "config.ru"
87
87
  end
88
88
 
89
89
  def gitignore
90
- copy_file 'gitignore', '.gitignore'
90
+ copy_file "gitignore", ".gitignore"
91
91
  end
92
92
 
93
93
  def config
94
- empty_directory 'config'
95
-
96
- inside 'config' do
97
- template 'application.rb'
98
- template 'routes.erb', 'routes.rb'
99
- template 'environment.rb'
100
- template 'boot.rb'
101
- template "databases/#{options[:database]}.yml", 'database.yml'
102
- template 'cucumber.yml' if options['core-dev']
94
+ empty_directory "config"
95
+
96
+ inside "config" do
97
+ template "application.rb"
98
+ template "routes.erb", "routes.rb"
99
+ template "environment.rb"
100
+ template "boot.rb"
101
+ template "databases/#{options[:database]}.yml", "database.yml"
102
+ template "cucumber.yml" if options["core-dev"]
103
103
  end
104
104
  end
105
105
 
106
106
  def public
107
- empty_directory 'public'
107
+ empty_directory "public"
108
108
 
109
- inside 'public' do
110
- template 'robots.txt'
111
- empty_directory 'files'
109
+ inside "public" do
110
+ template "robots.txt"
111
+ empty_directory "files"
112
112
 
113
- inside 'files' do
114
- template 'htaccess', '.htaccess'
113
+ inside "files" do
114
+ template "htaccess", ".htaccess"
115
115
  end
116
116
  end
117
117
  end
118
118
 
119
119
  def script
120
- directory 'script' do |content|
120
+ directory "script" do |content|
121
121
  "#{shebang}\n" + content
122
122
  end
123
- chmod 'script', 0755 & ~File.umask, verbose: false
123
+ chmod "script", 0755 & ~File.umask, verbose: false
124
124
  end
125
125
 
126
126
  public_task :run_bundle
127
127
 
128
128
  def seed_data
129
- if options['interactive']
129
+ if options["interactive"]
130
130
  Interactive.new(options, destination_root).run
131
131
  else
132
132
  puts "Now:
@@ -138,13 +138,13 @@ class WagnGenerator < Rails::Generators::AppBase
138
138
  def database_gemfile_entry
139
139
  return [] if options[:skip_active_record]
140
140
  gem_name, gem_version = gem_for_database
141
- if gem_name == 'mysql2'
141
+ if gem_name == "mysql2"
142
142
  # && Gem.loaded_specs['rails'].version < Gem::Version.new('4.2.5')
143
143
  # Rails update from 4.2.4 to 4.2.5 didn't help.
144
144
  # Current mysql2 gem (0.4.1) is still causing trouble.
145
145
  # Maybe with the next Rails release?
146
146
  # Could also be that ruby 1.9.3 is the problem.
147
- gem_version = '0.3.20'
147
+ gem_version = "0.3.20"
148
148
  end
149
149
  msg = "Use #{options[:database]} as the database for Active Record"
150
150
  GemfileEntry.version gem_name, gem_version, msg
@@ -159,60 +159,60 @@ class WagnGenerator < Rails::Generators::AppBase
159
159
  def core_dev_setup
160
160
  unless @gem_path
161
161
  @gemfile_gem_path =
162
- @gem_path = ask('Enter the path to your local wagn gem installation: ')
162
+ @gem_path = ask("Enter the path to your local wagn gem installation: ")
163
163
  end
164
164
 
165
165
  @include_jasmine_engine = true
166
166
  @spec_path = @gem_path
167
- @spec_helper_path = File.join @spec_path, 'card', 'spec', 'spec_helper'
168
- empty_directory 'spec'
169
-
170
- @cardio_gem_root = File.join @gem_path, 'card'
171
- @wagn_gem_root = File.join @gem_path, 'wagn'
172
- inside 'spec' do
173
- template File.join('javascripts', 'support', 'wagn_jasmine.yml'),
174
- File.join('javascripts', 'support', 'jasmine.yml')
167
+ @spec_helper_path = File.join @spec_path, "card", "spec", "spec_helper"
168
+ empty_directory "spec"
169
+
170
+ @cardio_gem_root = File.join @gem_path, "card"
171
+ @wagn_gem_root = File.join @gem_path, "wagn"
172
+ inside "spec" do
173
+ template File.join("javascripts", "support", "wagn_jasmine.yml"),
174
+ File.join("javascripts", "support", "jasmine.yml")
175
175
  end
176
176
 
177
177
  # ending slash is important in order to load support and step folders
178
- @features_path = File.join @gem_path, 'wagn/features/'
178
+ @features_path = File.join @gem_path, "wagn/features/"
179
179
 
180
- @simplecov_config = 'card_core_dev_simplecov_filters'
180
+ @simplecov_config = "card_core_dev_simplecov_filters"
181
181
  end
182
182
 
183
183
  def mod_dev_setup
184
- @spec_path = 'mod/'
185
- @spec_helper_path = './spec/spec_helper'
186
- @simplecov_config = 'card_simplecov_filters'
187
- empty_directory 'spec'
188
- inside 'spec' do
189
- template 'spec_helper.rb'
190
- template File.join('javascripts', 'support', 'deck_jasmine.yml'),
191
- File.join('javascripts', 'support', 'jasmine.yml')
184
+ @spec_path = "mod/"
185
+ @spec_helper_path = "./spec/spec_helper"
186
+ @simplecov_config = "card_simplecov_filters"
187
+ empty_directory "spec"
188
+ inside "spec" do
189
+ template "spec_helper.rb"
190
+ template File.join("javascripts", "support", "deck_jasmine.yml"),
191
+ File.join("javascripts", "support", "jasmine.yml")
192
192
  end
193
193
  end
194
194
 
195
195
  def shared_dev_setup
196
- template 'rspec', '.rspec'
197
- template 'simplecov', '.simplecov'
198
- empty_directory 'bin'
199
- inside 'bin' do
200
- template 'spring'
196
+ template "rspec", ".rspec"
197
+ template "simplecov", ".simplecov"
198
+ empty_directory "bin"
199
+ inside "bin" do
200
+ template "spring"
201
201
  end
202
202
  end
203
203
 
204
204
  def mysql_socket
205
205
  @mysql_socket ||= [
206
- '/tmp/mysql.sock', # default
207
- '/var/run/mysqld/mysqld.sock', # debian/gentoo
208
- '/var/tmp/mysql.sock', # freebsd
209
- '/var/lib/mysql/mysql.sock', # fedora
210
- '/opt/local/lib/mysql/mysql.sock', # fedora
211
- '/opt/local/var/run/mysqld/mysqld.sock', # mac + darwinports + mysql
212
- '/opt/local/var/run/mysql4/mysqld.sock', # mac + darwinports + mysql4
213
- '/opt/local/var/run/mysql5/mysqld.sock', # mac + darwinports + mysql5
214
- '/opt/lampp/var/mysql/mysql.sock' # xampp for linux
215
- ].find { |f| File.exist?(f) } unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
206
+ "/tmp/mysql.sock", # default
207
+ "/var/run/mysqld/mysqld.sock", # debian/gentoo
208
+ "/var/tmp/mysql.sock", # freebsd
209
+ "/var/lib/mysql/mysql.sock", # fedora
210
+ "/opt/local/lib/mysql/mysql.sock", # fedora
211
+ "/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
212
+ "/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
213
+ "/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
214
+ "/opt/lampp/var/mysql/mysql.sock" # xampp for linux
215
+ ].find { |f| File.exist?(f) } unless RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
216
216
  end
217
217
 
218
218
  ### the following is straight from rails and is focused on checking
@@ -233,14 +233,14 @@ class WagnGenerator < Rails::Generators::AppBase
233
233
  def defined_app_const_base
234
234
  Rails.respond_to?(:application) && defined?(Rails::Application) &&
235
235
  Wagn.application.is_a?(Rails::Application) &&
236
- Wagn.application.class.name.sub(/::Application$/, '')
236
+ Wagn.application.class.name.sub(/::Application$/, "")
237
237
  end
238
238
 
239
239
  alias defined_app_const_base? defined_app_const_base
240
240
 
241
241
  def app_const_base
242
242
  @app_const_base ||= defined_app_const_base ||
243
- app_name.gsub(/\W/, '_').squeeze('_').camelize
243
+ app_name.gsub(/\W/, "_").squeeze("_").camelize
244
244
  end
245
245
  alias camelized app_const_base
246
246
 
@@ -251,14 +251,14 @@ class WagnGenerator < Rails::Generators::AppBase
251
251
  def valid_const?
252
252
  if app_const =~ /^\d/
253
253
  raise Error, "Invalid application name #{app_name}. " \
254
- 'Please give a name which does not start with numbers.'
254
+ "Please give a name which does not start with numbers."
255
255
  # elsif RESERVED_NAMES.include?(app_name)
256
256
  # raise Error, "Invalid application name #{app_name}." \
257
257
  # "Please give a name which does not match one of the reserved rails words."
258
258
  elsif Object.const_defined?(app_const_base)
259
259
  raise Error, "Invalid application name #{app_name}, " \
260
260
  "constant #{app_const_base} is already in use. " \
261
- 'Please choose another application name.'
261
+ "Please choose another application name."
262
262
  end
263
263
  end
264
264
  end