decko 0.9.3 → 0.11.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 (98) hide show
  1. checksums.yaml +4 -4
  2. data/lib/decko.rb +0 -15
  3. data/lib/decko/application.rb +1 -6
  4. data/lib/decko/commands/application.rb +2 -2
  5. data/lib/decko/commands/cucumber_command.rb +4 -7
  6. data/lib/decko/commands/rspec_command.rb +4 -6
  7. data/lib/decko/commands/rspec_command/parser.rb +48 -36
  8. data/lib/decko/config/environments/cypress.rb +0 -2
  9. data/lib/decko/config/environments/development.rb +9 -20
  10. data/lib/decko/config/environments/production.rb +3 -0
  11. data/lib/decko/config/environments/test.rb +1 -8
  12. data/lib/decko/engine.rb +0 -1
  13. data/lib/decko/generators/{decko → deck}/USAGE +0 -0
  14. data/lib/decko/generators/deck/deck_generator.rb +132 -0
  15. data/lib/decko/generators/deck/deck_generator/deck_helper.rb +110 -0
  16. data/lib/decko/generators/deck/deck_generator/interactive.rb +120 -0
  17. data/lib/decko/generators/deck/deck_generator/rails_overrides.rb +54 -0
  18. data/lib/decko/generators/deck/templates/Gemfile.erb +56 -0
  19. data/lib/decko/generators/{decko/templates/Rakefile → deck/templates/Rakefile.erb} +0 -0
  20. data/lib/decko/generators/{decko/templates/bin/spring → deck/templates/bin/spring.erb} +3 -1
  21. data/lib/decko/generators/{decko/templates/config.ru → deck/templates/config.ru.erb} +0 -0
  22. data/lib/decko/generators/{decko/templates/config/application.rb → deck/templates/config/application.rb.erb} +38 -17
  23. data/lib/decko/generators/{decko/templates/config/boot.rb → deck/templates/config/boot.rb.erb} +1 -5
  24. data/lib/decko/generators/deck/templates/config/cucumber.yml +1 -0
  25. data/lib/decko/generators/{decko → deck}/templates/config/databases/frontbase.yml +0 -0
  26. data/lib/decko/generators/{decko → deck}/templates/config/databases/ibm_db.yml +0 -0
  27. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbc.yml +0 -0
  28. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcmysql.yml +0 -0
  29. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcpostgresql.yml +0 -0
  30. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcsqlite3.yml +0 -0
  31. data/lib/decko/generators/{decko → deck}/templates/config/databases/mysql.yml +0 -0
  32. data/lib/decko/generators/{decko → deck}/templates/config/databases/oracle.yml +0 -0
  33. data/lib/decko/generators/{decko → deck}/templates/config/databases/postgresql.yml +0 -0
  34. data/lib/decko/generators/{decko → deck}/templates/config/databases/sqlite3.yml +0 -0
  35. data/lib/decko/generators/{decko → deck}/templates/config/deck.yml +0 -0
  36. data/lib/decko/generators/{decko/templates/config/environment.rb → deck/templates/config/environment.rb.erb} +2 -2
  37. data/lib/decko/generators/{decko/templates/config/initializers/cypress_on_rails.rb → deck/templates/config/initializers/cypress.rb} +2 -0
  38. data/lib/decko/generators/{decko → deck}/templates/config/puma.rb +5 -5
  39. data/lib/decko/generators/{decko/templates/config/routes.erb → deck/templates/config/routes.rb.erb} +1 -1
  40. data/lib/decko/generators/{decko → deck}/templates/gitignore +0 -0
  41. data/lib/decko/generators/deck/templates/pryrc +6 -0
  42. data/lib/decko/generators/{decko → deck}/templates/public/files/htaccess +0 -0
  43. data/lib/decko/generators/{decko → deck}/templates/public/robots.txt +2 -1
  44. data/lib/decko/generators/deck/templates/rspec.erb +6 -0
  45. data/lib/decko/generators/{decko → deck}/templates/script/decko +2 -1
  46. data/lib/decko/generators/deck/templates/script/decko_cucumber +8 -0
  47. data/lib/decko/generators/deck/templates/script/decko_rspec +8 -0
  48. data/lib/decko/generators/{decko/templates/bin → deck/templates/script}/delayed_job +1 -1
  49. data/lib/decko/generators/deck/templates/simplecov.rb.erb +34 -0
  50. data/lib/decko/generators/{decko/templates/spec/javascripts/support/deck_jasmine.yml → deck/templates/spec/javascripts/support/deck_jasmine.yml.erb} +1 -1
  51. data/lib/decko/generators/{decko/templates/spec/javascripts/support/decko_jasmine.yml → deck/templates/spec/javascripts/support/decko_jasmine.yml.erb} +3 -3
  52. data/lib/decko/generators/{decko → deck}/templates/spec/spec_helper.rb +0 -0
  53. data/lib/decko/mods_spec_helper.rb +5 -4
  54. data/lib/decko/response.rb +7 -2
  55. data/lib/decko/tasks/decko.rake +1 -30
  56. data/lib/decko/tasks/decko/docs.rake +26 -0
  57. data/lib/decko/tasks/decko/tmpsets.rake +25 -0
  58. metadata +65 -80
  59. data/GPL +0 -331
  60. data/LICENSE +0 -16
  61. data/README.rdoc +0 -151
  62. data/app/assets/images/body-bg.bmp +0 -0
  63. data/app/assets/images/body-bg.png +0 -0
  64. data/app/assets/images/external_link.png +0 -0
  65. data/app/assets/images/smoothness/animated-overlay.gif +0 -0
  66. data/app/assets/images/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  67. data/app/assets/images/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
  68. data/app/assets/images/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  69. data/app/assets/images/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
  70. data/app/assets/images/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
  71. data/app/assets/images/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  72. data/app/assets/images/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  73. data/app/assets/images/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  74. data/app/assets/images/smoothness/ui-icons_222222_256x240.png +0 -0
  75. data/app/assets/images/smoothness/ui-icons_2e83ff_256x240.png +0 -0
  76. data/app/assets/images/smoothness/ui-icons_454545_256x240.png +0 -0
  77. data/app/assets/images/smoothness/ui-icons_888888_256x240.png +0 -0
  78. data/app/assets/images/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
  79. data/lib/decko/generators/decko/decko_generator.rb +0 -263
  80. data/lib/decko/generators/decko/decko_generator/interactive.rb +0 -114
  81. data/lib/decko/generators/decko/templates/Gemfile +0 -126
  82. data/lib/decko/generators/decko/templates/config/cucumber.yml +0 -1
  83. data/lib/decko/generators/decko/templates/config/initializers/cypress_dev.rb +0 -10
  84. data/lib/decko/generators/decko/templates/rspec +0 -5
  85. data/lib/decko/generators/decko/templates/simplecov +0 -5
  86. data/rails/application-routes.rb +0 -3
  87. data/rails/assets/external_link.png +0 -0
  88. data/rails/assets/jasmine/404.html +0 -27
  89. data/rails/assets/jasmine/500.html +0 -28
  90. data/rails/assets/jasmine/card_form.html +0 -13
  91. data/rails/assets/jquery.min.map +0 -1
  92. data/rails/controllers/application_controller.rb +0 -2
  93. data/rails/controllers/card_controller.rb +0 -152
  94. data/rails/engine-routes.rb +0 -53
  95. data/script/autospec +0 -4
  96. data/script/decko +0 -6
  97. data/script/rails +0 -6
  98. data/script/test_filter +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05a8d491e994dc90730abbcfb162bedc6b1e30950b00e3ee62cc01bcd9421fdf
4
- data.tar.gz: ee98d6512689e0ba436229d838cd71d856e34ac90b363143b03c1fc6c509685a
3
+ metadata.gz: 7224a35bbfe70eb0161da009005fed740cc35ee689af6adfa980b3ed0f2170df
4
+ data.tar.gz: 289ac9de6b45e6eda87c7e4348eafc92d08c8fb7d8b83702f15c1c3ad4b74f51
5
5
  SHA512:
6
- metadata.gz: ad07bc82020a54fa5bdfccc8c93c2a7e362623a29807cfb1bed460c76345a50f4daaa252ffc872b8e2e71eccd24db8800828b2de6d56683cce39343e1bab9e02
7
- data.tar.gz: d939edebebf8095b86281abea809abee816501fbac3773acd2f5a0907ed7db3559b517c83f778cb2a21703b11ca353cd8115f52f048f3f14de1d51f4a32305a8
6
+ metadata.gz: cc0b3db286b9c49e7011d6be0a5392203393eb95621ee3b19abdc06bec656be1820fb7f845e2e2fddb3d03fae7c21710dcd9f7a38a9dcbb2b3190adb10a72644
7
+ data.tar.gz: f2bfe942fed37c30724f92f7bd7048af9445de4dcb8a41b66491c52016b0192974e24b674010022f51b341fdbd847479e595ac774b4685de7138403d97865329
@@ -22,20 +22,5 @@ module Decko
22
22
  def gem_root
23
23
  DECKO_GEM_ROOT
24
24
  end
25
-
26
- def card_gem_root
27
- @card_gem_root ||= locate_gem "card"
28
- end
29
-
30
- private
31
-
32
- def locate_gem name
33
- spec = Bundler.load.specs.find { |s| s.name == name }
34
- unless spec
35
- raise GemNotFound, "Could not find gem '#{name}' in the current bundle."
36
- end
37
- return File.expand_path("../../../", __FILE__) if spec.name == "bundler"
38
- spec.full_gem_path
39
- end
40
25
  end
41
26
  end
@@ -3,12 +3,7 @@
3
3
  require "decko/engine"
4
4
  require_relative "config/initializers/sedate_parser"
5
5
 
6
- if defined?(Bundler)
7
- # If you precompile assets before deploying to production, use this line
8
- Bundler.require *Rails.groups(assets: %w[development test cypress])
9
- # If you want your assets lazily compiled in production, use this line
10
- # Bundler.require(:default, :assets, Rails.env)
11
- end
6
+ Bundler.require :default, *Rails.groups
12
7
 
13
8
  module Decko
14
9
  class Application < Rails::Application
@@ -1,5 +1,5 @@
1
1
  require "rails/generators"
2
- require File.expand_path("../../generators/decko/decko_generator", __FILE__)
2
+ require File.expand_path("../../generators/deck/deck_generator", __FILE__)
3
3
 
4
4
  if ARGV.first != "new"
5
5
  ARGV[0] = "--help"
@@ -7,4 +7,4 @@ else
7
7
  ARGV.shift
8
8
  end
9
9
 
10
- DeckoGenerator.start
10
+ Decko::Generators::Deck::DeckGenerator.start
@@ -13,17 +13,14 @@ module Decko
13
13
 
14
14
  def command
15
15
  @cmd ||=
16
- "#{env_args} #{@opts[:executer] || "bundle exec"} cucumber #{require_args} #{feature_args}"
16
+ "#{env_args} #{@opts[:executer] || 'bundle exec'} " \
17
+ "cucumber #{require_args} #{feature_args}"
17
18
  end
18
19
 
19
20
  private
20
21
 
21
22
  def env_args
22
- env_args = @opts[:env].join " "
23
- # turn coverage off if not all cukes run
24
- env_args << " COVERAGE=false" if @cucumber_args.present?
25
- env_args << " RAILS_GROUPS=test,debug"
26
- env_args
23
+ @opts[:env].join " "
27
24
  end
28
25
 
29
26
  def feature_args
@@ -40,7 +37,7 @@ module Decko
40
37
  end
41
38
 
42
39
  def feature_paths
43
- Card::Mod.dirs.map do |p|
40
+ Cardio::Mod.dirs.map do |p|
44
41
  Dir.glob "#{p}/features"
45
42
  end.flatten
46
43
  end
@@ -14,8 +14,7 @@ module Decko
14
14
 
15
15
  def command
16
16
  "#{env_args} #{@opts[:executer]} #{@opts[:rescue]}" \
17
- "rspec #{@rspec_args.shelljoin} #{@opts[:files]} "\
18
- "--exclude-pattern \"./card/vendor/**/*\""
17
+ "rspec #{@rspec_args.shelljoin} #{@opts[:files]}"
19
18
  end
20
19
 
21
20
  private
@@ -26,10 +25,9 @@ module Decko
26
25
 
27
26
  def coverage
28
27
  # no coverage if rspec was started with file argument
29
- if (@opts[:files] || @rspec_args.present?) && !@opts[:simplecov]
30
- @opts[:simplecov] = "COVERAGE=false"
31
- end
32
- @opts[:simplecov]
28
+ return unless @opts[:files] || @rspec_args.present?
29
+
30
+ "COVERAGE=false"
33
31
  end
34
32
  end
35
33
  end
@@ -5,21 +5,22 @@ module Decko
5
5
  module Commands
6
6
  class RspecCommand
7
7
  class Parser < OptionParser
8
- def initialize opts
9
- super() do |parser|
10
- parser.banner = "Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]\n\n" \
11
- "RSPEC ARGS"
12
- parser.separator <<-EOT
8
+ RSPEC_PATH_MESSAGE = <<-EOT
13
9
 
14
10
  DECKO ARGS
15
11
 
16
- You don't have to give a full path for FILENAME, the basename is enough
17
- If FILENAME does not include '_spec' rspec searches for the
18
- corresponding spec file.
19
- The line number always referes to example in the (corresponding) spec
20
- file.
12
+ You don't have to give a full path for FILENAME; the basename is enough.
13
+ If FILENAME does not include '_spec', then rspec searches for the
14
+ corresponding spec file.
15
+ The line number always refers to the example in the spec file.
16
+
17
+ EOT
21
18
 
22
- EOT
19
+ def initialize opts
20
+ super() do |parser|
21
+ parser.banner = "Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]\n\n" \
22
+ "RSPEC ARGS"
23
+ parser.separator RSPEC_PATH_MESSAGE
23
24
 
24
25
  parser.on("-d", "--spec FILENAME(:LINE)",
25
26
  "Run spec for a Decko deck file") do |file|
@@ -31,42 +32,53 @@ module Decko
31
32
  end
32
33
  parser.on("-m", "--mod MODNAME",
33
34
  "Run all specs for a mod or matching a mod") do |file|
34
- opts[:files] =
35
- if File.exist?("mod/#{file}")
36
- "#{Cardio.gem_root}/mod/#{file}"
37
- elsif File.exist?("#{Cardio.gem_root}/mod/#{file}")
38
- "#{Cardio.gem_root}/mod/#{file}"
39
- elsif (files = find_spec_file(file, "mod")) && files.present?
40
- files
41
- else
42
- find_spec_file(file, "#{Cardio.gem_root}/mod")
43
- end
35
+ opts[:files] = find_mod_file(file, Cardio.gem_root)
44
36
  end
45
37
  parser.on("-s", "--[no-]simplecov", "Run with simplecov") do |s|
46
- opts[:simplecov] = s ? "" : "COVERAGE=false"
38
+ opts[:simplecov] = s ? "TMPSETS=true" : ""
47
39
  end
48
40
  parser.on("--rescue", "Run with pry-rescue") do
49
- if opts[:executer] == "spring"
50
- puts "Disabled pry-rescue. Not compatible with spring."
51
- else
52
- opts[:rescue] = "rescue "
53
- end
41
+ process_rescue_opts opts
54
42
  end
55
43
  parser.on("--[no-]spring", "Run with spring") do |spring|
56
- if spring
57
- opts[:executer] = "spring"
58
- if opts[:rescue]
59
- opts[:rescue] = ""
60
- puts "Disabled pry-rescue. Not compatible with spring."
61
- end
62
- else
63
- opts[:executer] = "bundle exec"
64
- end
44
+ process_spring_opts spring, opts
65
45
  end
66
46
  parser.separator "\n"
67
47
  end
68
48
  end
69
49
 
50
+ private
51
+
52
+ def process_rescue_opts opts
53
+ if opts[:executer] == "spring"
54
+ puts "Disabled pry-rescue. Not compatible with spring."
55
+ else
56
+ opts[:rescue] = "rescue "
57
+ end
58
+ end
59
+
60
+ def process_spring_opts spring, opts
61
+ if spring
62
+ opts[:executer] = "spring"
63
+ if opts[:rescue]
64
+ opts[:rescue] = ""
65
+ puts "Disabled pry-rescue. Not compatible with spring."
66
+ end
67
+ else
68
+ opts[:executer] = "bundle exec"
69
+ end
70
+ end
71
+
72
+ def find_mod_file filename, base_dir
73
+ if File.exist?("mod/#{filename}") || File.exist?("#{base_dir}/mod/#{filename}")
74
+ "#{base_dir}/mod/#{filename}"
75
+ elsif (files = find_spec_file(filename, "mod"))&.present?
76
+ files
77
+ else
78
+ find_spec_file(file, "#{base_dir}/mod")
79
+ end
80
+ end
81
+
70
82
  def find_spec_file filename, base_dir
71
83
  file, line = filename.split(":")
72
84
  if file.include?("_spec.rb") && File.exist?(file)
@@ -88,8 +88,6 @@ Decko.application.class.configure do
88
88
 
89
89
  config.action_mailer.perform_deliveries = false
90
90
 
91
- # config.active_job.queue_adapter = :delayed_job
92
-
93
91
  # Use Pry instead of IRB
94
92
  silence_warnings do
95
93
  require "pry"
@@ -1,11 +1,9 @@
1
-
1
+ # -*- encoding : utf-8 -*-
2
2
 
3
3
  Decko::Engine.configure do
4
4
  config.cache_classes = false
5
5
  end
6
6
 
7
- # -*- encoding : utf-8 -*-
8
-
9
7
  Decko.application.class.configure do
10
8
  # Settings specified here will take precedence over those in config/application.rb
11
9
 
@@ -22,16 +20,6 @@ Decko.application.class.configure do
22
20
  config.cache_classes = false
23
21
  config.reload_classes_only_on_change = true
24
22
 
25
- config.reload_sets = true
26
-
27
- # if defined?(RailsDevTweaks)
28
- # config.dev_tweaks.autoload_rules do
29
- # skip "/files"
30
- # skip "/favicon.ico"
31
- # skip /view\=status/
32
- # end
33
- # end
34
-
35
23
  # Log error messages when you accidentally call methods on nil.
36
24
  config.whiny_nils = true
37
25
 
@@ -57,9 +45,9 @@ Decko.application.class.configure do
57
45
 
58
46
  # config.performance_logger = {
59
47
  # methods: [:event, :search, :fetch, :view], # choose methods to log
60
- # min_time: 100, # show only method calls that are slower than 100ms
61
- # max_depth: 3, # show nested method calls only up to depth 3
62
- # details: true # show method arguments and sql
48
+ # min_time: 100, # show only method calls that are slower than 100ms
49
+ # max_depth: 3, # show nested method calls only up to depth 3
50
+ # details: true # show method arguments and sql
63
51
  # log_level: :info
64
52
  # }
65
53
 
@@ -72,11 +60,13 @@ Decko.application.class.configure do
72
60
  # # Expands the lines which load the assets
73
61
  # config.assets.debug = false
74
62
  #
75
- # # This needs to be on for tinymce to work, because several important files (themes, etc) are only served statically
63
+ # # This needs to be on for tinymce to work, because several important files
64
+ # (themes, etc) are only served statically
76
65
  # config.serve_static_files = ENV['STATIC_ASSETS'] || true
77
66
  #
78
67
  # # Setting a bogus directory so rails won't find public/assets in dev mode.
79
- # # Normally you could skip that by not serving static assets, but that breaks tinymce (see above)
68
+ # # Normally you could skip that by not serving static assets, but that breaks
69
+ # tinymce (see above)
80
70
  # config.assets.prefix = "dynamic-assets"
81
71
 
82
72
  # Log the query plan for queries taking more than this (works
@@ -92,14 +82,13 @@ Decko.application.class.configure do
92
82
 
93
83
  config.action_mailer.perform_deliveries = false
94
84
 
95
- # config.active_job.queue_adapter = :delayed_job
96
-
97
85
  # Use Pry instead of IRB
98
86
  silence_warnings do
99
87
  require "pry"
100
88
  config.console = Pry
101
89
  rescue LoadError
102
90
  end
91
+
103
92
  #config.session_store :cookie_store
104
93
  end
105
94
 
@@ -64,4 +64,7 @@ Decko.application.class.configure do
64
64
 
65
65
  # Send deprecation notices to registered listeners
66
66
  config.active_support.deprecation = :notify
67
+
68
+ # cache the list of set module objects on card objects
69
+ config.cache_set_module_list = true
67
70
  end
@@ -10,7 +10,7 @@ Decko.application.class.configure do
10
10
  # test suite. You never need to work with it otherwise. Remember that
11
11
  # your test database is "scratch space" for the test suite and is wiped
12
12
  # and recreated between test runs. Don't rely on the data there!
13
- config.cache_classes = true
13
+ config.cache_classes = false
14
14
 
15
15
  config.assets.enabled = true if Object.const_defined?(:JasmineRails)
16
16
 
@@ -58,13 +58,6 @@ Decko.application.class.configure do
58
58
 
59
59
  config.raise_all_rendering_errors = true
60
60
 
61
- config.active_job.queue_adapter = :delayed_job
62
- # Note: With delay_jobs set to false integrate_with_delay events don't run
63
- # in a separate process and hence can behave differently from a real
64
- # environment. To test integrate_with_delay events properly set delay_jobs to
65
- # true in your test
66
- Delayed::Worker.delay_jobs = false
67
-
68
61
  config.rescue_all_in_controller = false
69
62
  # Use Pry instead of IRB
70
63
  silence_warnings do
@@ -4,7 +4,6 @@ require "cardio"
4
4
 
5
5
  # TODO: Move these to modules that use them
6
6
  require "htmlentities"
7
- require "recaptcha"
8
7
  require "coderay"
9
8
  require "haml"
10
9
  require "kaminari"
@@ -0,0 +1,132 @@
1
+ require "rails/generators/app_base"
2
+
3
+ module Decko
4
+ module Generators
5
+ module Deck
6
+ # Create new Decks (Decko Applications)
7
+ class DeckGenerator < Rails::Generators::AppBase
8
+ require "decko/generators/deck/deck_generator/rails_overrides"
9
+ require "decko/generators/deck/deck_generator/deck_helper"
10
+
11
+ include RailsOverrides
12
+ include DeckHelper
13
+
14
+ source_root File.expand_path("../templates", __FILE__)
15
+
16
+ # All but the first aliases should be considered deprecated
17
+ class_option "monkey",
18
+ type: :boolean, aliases: %w[-M --mod-dev],
19
+ default: false, group: :runtime,
20
+ desc: "Prepare deck for monkey (mod developer)"
21
+
22
+ class_option "platypus",
23
+ type: :boolean, aliases: %w[-P --core-dev -c],
24
+ default: false, group: :runtime,
25
+ desc: "Prepare deck for platypus (core development)"
26
+
27
+ class_option "repo-path",
28
+ type: :string, aliases: %w[-R -g --gem-path],
29
+ default: "", group: :runtime,
30
+ desc: "Path to local decko repository " \
31
+ "(Default, use env DECKO_REPO_PATH)"
32
+
33
+ class_option :database,
34
+ type: :string, aliases: %w[-D -d], default: "mysql",
35
+ desc: "Preconfigure for selected database " \
36
+ "(options: #{DATABASES.join('/')})"
37
+
38
+ class_option "interactive",
39
+ type: :boolean, aliases: %w[-I -i], default: false, group: :runtime,
40
+ desc: "Prompt with dynamic installation options"
41
+
42
+ public_task :set_default_accessors!
43
+ public_task :create_root
44
+
45
+ def self.banner
46
+ "decko new #{arguments.map(&:usage).join(' ')} [options]"
47
+ end
48
+
49
+ # Generator works its way through each public method below
50
+
51
+ def core_files
52
+ erb_template "config.ru"
53
+ erb_template "Gemfile"
54
+ erb_template "Rakefile"
55
+ end
56
+
57
+ def empty_dirs
58
+ %w[mod log files tmp].each { |dirname| empty_directory_with_keep_file dirname }
59
+ end
60
+
61
+ def dotfiles
62
+ copy_file "pryrc", ".pryrc"
63
+ copy_file "gitignore", ".gitignore"
64
+ template "rspec.erb", ".rspec"
65
+ template "simplecov.rb.erb", ".simplecov"
66
+ end
67
+
68
+ def config
69
+ inside "config" do
70
+ erb_template "application.rb"
71
+ erb_template "routes.rb"
72
+ erb_template "environment.rb"
73
+ erb_template "boot.rb"
74
+ template "databases/#{options[:database]}.yml", "database.yml"
75
+ template "cucumber.yml"
76
+ template "initializers/cypress.rb" if platypus?
77
+ template "puma.rb"
78
+ end
79
+ end
80
+
81
+ def public
82
+ inside "public" do
83
+ template "robots.txt"
84
+ inside("files") { template "htaccess", ".htaccess" }
85
+ end
86
+ end
87
+
88
+ def spring
89
+ inside("bin") { erb_template "spring" }
90
+ end
91
+
92
+ def script
93
+ directory("script") { |content| "#{shebang}\n" + content }
94
+ chmod "script", 0o755 & ~File.umask, verbose: false
95
+ end
96
+
97
+ def spec
98
+ inside "spec" do
99
+ if platypus?
100
+ jasmine_yml :decko
101
+ else
102
+ jasmine_yml :deck
103
+ template "spec_helper.rb"
104
+ end
105
+ end
106
+ end
107
+
108
+ public_task :run_bundle
109
+
110
+ def seed_data
111
+ if options["interactive"]
112
+ Interactive.new(destination_root, (monkey? || platypus?)).run
113
+ else
114
+ puts "Now:
115
+ 1. Run `cd #{File.basename(destination_root)}` to enter your new deck directory
116
+ 2. Run `decko seed` to seed your database (see config/database.yml).
117
+ 3. Run `decko server` to start your server"
118
+ end
119
+ end
120
+
121
+ protected
122
+
123
+ def database_gemfile_entry
124
+ return [] if options[:skip_active_record]
125
+ gem_name, gem_version = gem_for_database
126
+ msg = "Use #{options[:database]} as the database for Active Record"
127
+ GemfileEntry.version gem_name, gem_version, msg
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end