decko 0.9.5 → 0.11.2
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.
- checksums.yaml +4 -4
- data/lib/decko.rb +0 -15
- data/lib/decko/application.rb +1 -6
- data/lib/decko/commands/application.rb +2 -2
- data/lib/decko/commands/cucumber_command.rb +4 -7
- data/lib/decko/commands/rspec_command.rb +4 -6
- data/lib/decko/commands/rspec_command/parser.rb +48 -36
- data/lib/decko/config/environments/cypress.rb +0 -2
- data/lib/decko/config/environments/development.rb +9 -18
- data/lib/decko/config/environments/production.rb +6 -0
- data/lib/decko/config/environments/test.rb +0 -7
- data/lib/decko/engine.rb +0 -1
- data/lib/decko/generators/{decko → deck}/USAGE +0 -0
- data/lib/decko/generators/deck/deck_generator.rb +133 -0
- data/lib/decko/generators/deck/deck_generator/deck_helper.rb +110 -0
- data/lib/decko/generators/deck/deck_generator/interactive.rb +120 -0
- data/lib/decko/generators/deck/deck_generator/rails_overrides.rb +54 -0
- data/lib/decko/generators/deck/templates/Gemfile.erb +56 -0
- data/lib/decko/generators/{decko/templates/Rakefile → deck/templates/Rakefile.erb} +0 -0
- data/lib/decko/generators/{decko/templates/bin/spring → deck/templates/bin/spring.erb} +3 -1
- data/lib/decko/generators/{decko/templates/config.ru → deck/templates/config.ru.erb} +0 -0
- data/lib/decko/generators/{decko/templates/config/application.rb → deck/templates/config/application.rb.erb} +38 -17
- data/lib/decko/generators/{decko/templates/config/boot.rb → deck/templates/config/boot.rb.erb} +1 -5
- data/lib/decko/generators/deck/templates/config/cucumber.yml +1 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/frontbase.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/ibm_db.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbc.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcmysql.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcpostgresql.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcsqlite3.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/mysql.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/oracle.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/postgresql.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/databases/sqlite3.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/config/deck.yml +0 -0
- data/lib/decko/generators/{decko/templates/config/environment.rb → deck/templates/config/environment.rb.erb} +2 -2
- data/lib/decko/generators/{decko/templates/config/initializers/cypress_on_rails.rb → deck/templates/config/initializers/cypress.rb} +2 -0
- data/lib/decko/generators/{decko → deck}/templates/config/puma.rb +5 -5
- data/lib/decko/generators/{decko/templates/config/routes.erb → deck/templates/config/routes.rb.erb} +1 -1
- data/lib/decko/generators/deck/templates/config/storage.yml +0 -0
- data/lib/decko/generators/{decko → deck}/templates/gitignore +0 -0
- data/lib/decko/generators/deck/templates/pryrc +6 -0
- data/lib/decko/generators/{decko → deck}/templates/public/files/htaccess +0 -0
- data/lib/decko/generators/{decko → deck}/templates/public/robots.txt +2 -1
- data/lib/decko/generators/deck/templates/rspec.erb +6 -0
- data/lib/decko/generators/{decko → deck}/templates/script/decko +2 -1
- data/lib/decko/generators/deck/templates/script/decko_cucumber +8 -0
- data/lib/decko/generators/deck/templates/script/decko_rspec +8 -0
- data/lib/decko/generators/{decko/templates/bin → deck/templates/script}/delayed_job +1 -1
- data/lib/decko/generators/deck/templates/simplecov.rb.erb +34 -0
- data/lib/decko/generators/{decko/templates/spec/javascripts/support/deck_jasmine.yml → deck/templates/spec/javascripts/support/deck_jasmine.yml.erb} +1 -1
- data/lib/decko/generators/{decko/templates/spec/javascripts/support/decko_jasmine.yml → deck/templates/spec/javascripts/support/decko_jasmine.yml.erb} +3 -3
- data/lib/decko/generators/{decko → deck}/templates/spec/spec_helper.rb +0 -0
- data/lib/decko/mods_spec_helper.rb +5 -4
- data/lib/decko/response.rb +8 -3
- data/lib/decko/tasks/decko.rake +1 -30
- data/lib/decko/tasks/decko/docs.rake +26 -0
- data/lib/decko/tasks/decko/tmpsets.rake +25 -0
- data/rails/assets/jasmine/500.html +1 -1
- data/rails/controllers/card_controller.rb +5 -35
- data/rails/controllers/card_controller/errors.rb +35 -0
- data/rails/engine-routes.rb +1 -1
- metadata +74 -52
- data/GPL +0 -331
- data/LICENSE +0 -16
- data/README.rdoc +0 -151
- data/lib/decko/generators/decko/decko_generator.rb +0 -263
- data/lib/decko/generators/decko/decko_generator/interactive.rb +0 -114
- data/lib/decko/generators/decko/templates/Gemfile +0 -126
- data/lib/decko/generators/decko/templates/config/cucumber.yml +0 -1
- data/lib/decko/generators/decko/templates/config/initializers/cypress_dev.rb +0 -10
- data/lib/decko/generators/decko/templates/rspec +0 -5
- data/lib/decko/generators/decko/templates/simplecov +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6bb1203eba43f58959d97efbfb758f1381d7db1ac7816d73cb5dfa033dc6643b
|
|
4
|
+
data.tar.gz: 496f2f2b1d9552f716379e9d25e6ebf24085993e4030ff656d717e7f9cd68b14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ced715eed9b7f6c0956598955021106a396a1beb82cac21762ddcf9f69aefc6f94121945e20e6d1a434237cf3dddee35f75b474510e11bf6ebfa63ee51570a2
|
|
7
|
+
data.tar.gz: bf9643036097f1475b8aab433419b20f27a46a85d4dd1fb4397ffd207a4fee607265cb32d8839cd2473e74db97ec63ecb263acd15c0746679a3f584fd5482a99
|
data/lib/decko.rb
CHANGED
|
@@ -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
|
data/lib/decko/application.rb
CHANGED
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
require "decko/engine"
|
|
4
4
|
require_relative "config/initializers/sedate_parser"
|
|
5
5
|
|
|
6
|
-
|
|
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/
|
|
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
|
-
|
|
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] ||
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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 ? "" : "
|
|
38
|
+
opts[:simplecov] = s ? "TMPSETS=true" : ""
|
|
47
39
|
end
|
|
48
40
|
parser.on("--rescue", "Run with pry-rescue") do
|
|
49
|
-
|
|
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
|
-
|
|
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)
|
|
@@ -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,14 +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
|
-
# if defined?(RailsDevTweaks)
|
|
26
|
-
# config.dev_tweaks.autoload_rules do
|
|
27
|
-
# skip "/files"
|
|
28
|
-
# skip "/favicon.ico"
|
|
29
|
-
# skip /view\=status/
|
|
30
|
-
# end
|
|
31
|
-
# end
|
|
32
|
-
|
|
33
23
|
# Log error messages when you accidentally call methods on nil.
|
|
34
24
|
config.whiny_nils = true
|
|
35
25
|
|
|
@@ -55,9 +45,9 @@ Decko.application.class.configure do
|
|
|
55
45
|
|
|
56
46
|
# config.performance_logger = {
|
|
57
47
|
# methods: [:event, :search, :fetch, :view], # choose methods to log
|
|
58
|
-
# min_time: 100,
|
|
59
|
-
# max_depth: 3,
|
|
60
|
-
# details: true
|
|
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
|
|
61
51
|
# log_level: :info
|
|
62
52
|
# }
|
|
63
53
|
|
|
@@ -70,11 +60,13 @@ Decko.application.class.configure do
|
|
|
70
60
|
# # Expands the lines which load the assets
|
|
71
61
|
# config.assets.debug = false
|
|
72
62
|
#
|
|
73
|
-
# # This needs to be on for tinymce to work, because several important files
|
|
63
|
+
# # This needs to be on for tinymce to work, because several important files
|
|
64
|
+
# (themes, etc) are only served statically
|
|
74
65
|
# config.serve_static_files = ENV['STATIC_ASSETS'] || true
|
|
75
66
|
#
|
|
76
67
|
# # Setting a bogus directory so rails won't find public/assets in dev mode.
|
|
77
|
-
# # Normally you could skip that by not serving static assets, but that breaks
|
|
68
|
+
# # Normally you could skip that by not serving static assets, but that breaks
|
|
69
|
+
# tinymce (see above)
|
|
78
70
|
# config.assets.prefix = "dynamic-assets"
|
|
79
71
|
|
|
80
72
|
# Log the query plan for queries taking more than this (works
|
|
@@ -90,14 +82,13 @@ Decko.application.class.configure do
|
|
|
90
82
|
|
|
91
83
|
config.action_mailer.perform_deliveries = false
|
|
92
84
|
|
|
93
|
-
# config.active_job.queue_adapter = :delayed_job
|
|
94
|
-
|
|
95
85
|
# Use Pry instead of IRB
|
|
96
86
|
silence_warnings do
|
|
97
87
|
require "pry"
|
|
98
88
|
config.console = Pry
|
|
99
89
|
rescue LoadError
|
|
100
90
|
end
|
|
91
|
+
|
|
101
92
|
#config.session_store :cookie_store
|
|
102
93
|
end
|
|
103
94
|
|
|
@@ -64,4 +64,10 @@ 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
|
|
70
|
+
|
|
71
|
+
# if false, application will raise errors that make it to controller.
|
|
72
|
+
config.rescue_all_in_controller = true
|
|
67
73
|
end
|
|
@@ -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
|
data/lib/decko/engine.rb
CHANGED
|
File without changes
|
|
@@ -0,0 +1,133 @@
|
|
|
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 "storage.yml"
|
|
77
|
+
template "initializers/cypress.rb" if platypus?
|
|
78
|
+
template "puma.rb"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def public
|
|
83
|
+
inside "public" do
|
|
84
|
+
template "robots.txt"
|
|
85
|
+
inside("files") { template "htaccess", ".htaccess" }
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def spring
|
|
90
|
+
inside("bin") { erb_template "spring" }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def script
|
|
94
|
+
directory("script") { |content| "#{shebang}\n" + content }
|
|
95
|
+
chmod "script", 0o755 & ~File.umask, verbose: false
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def spec
|
|
99
|
+
inside "spec" do
|
|
100
|
+
if platypus?
|
|
101
|
+
jasmine_yml :decko
|
|
102
|
+
else
|
|
103
|
+
jasmine_yml :deck
|
|
104
|
+
template "spec_helper.rb"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
public_task :run_bundle
|
|
110
|
+
|
|
111
|
+
def seed_data
|
|
112
|
+
if options["interactive"]
|
|
113
|
+
Interactive.new(destination_root, (monkey? || platypus?)).run
|
|
114
|
+
else
|
|
115
|
+
puts "Now:
|
|
116
|
+
1. Run `cd #{File.basename(destination_root)}` to enter your new deck directory
|
|
117
|
+
2. Run `decko seed` to seed your database (see config/database.yml).
|
|
118
|
+
3. Run `decko server` to start your server"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
protected
|
|
123
|
+
|
|
124
|
+
def database_gemfile_entry
|
|
125
|
+
return [] if options[:skip_active_record]
|
|
126
|
+
gem_name, gem_version = gem_for_database
|
|
127
|
+
msg = "Use #{options[:database]} as the database for Active Record"
|
|
128
|
+
GemfileEntry.version gem_name, gem_version, msg
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|