decko 0.10.0 → 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.
- 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 +1 -1
- data/lib/decko/config/environments/cypress.rb +0 -2
- data/lib/decko/config/environments/development.rb +9 -18
- 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 +132 -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/{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 +3 -4
- data/lib/decko/response.rb +1 -0
- 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
- metadata +61 -76
- data/GPL +0 -331
- data/LICENSE +0 -16
- data/README.rdoc +0 -151
- data/app/assets/images/body-bg.bmp +0 -0
- data/app/assets/images/body-bg.png +0 -0
- data/app/assets/images/external_link.png +0 -0
- data/app/assets/images/smoothness/animated-overlay.gif +0 -0
- data/app/assets/images/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/smoothness/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- 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
- data/rails/application-routes.rb +0 -3
- data/rails/assets/external_link.png +0 -0
- data/rails/assets/jasmine/404.html +0 -27
- data/rails/assets/jasmine/500.html +0 -28
- data/rails/assets/jasmine/card_form.html +0 -13
- data/rails/assets/jquery.min.map +0 -1
- data/rails/controllers/application_controller.rb +0 -2
- data/rails/controllers/card_controller.rb +0 -151
- data/rails/engine-routes.rb +0 -53
- data/script/autospec +0 -4
- data/script/decko +0 -6
- data/script/rails +0 -6
- data/script/test_filter +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7224a35bbfe70eb0161da009005fed740cc35ee689af6adfa980b3ed0f2170df
|
|
4
|
+
data.tar.gz: 289ac9de6b45e6eda87c7e4348eafc92d08c8fb7d8b83702f15c1c3ad4b74f51
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc0b3db286b9c49e7011d6be0a5392203393eb95621ee3b19abdc06bec656be1820fb7f845e2e2fddb3d03fae7c21710dcd9f7a38a9dcbb2b3190adb10a72644
|
|
7
|
+
data.tar.gz: f2bfe942fed37c30724f92f7bd7048af9445de4dcb8a41b66491c52016b0192974e24b674010022f51b341fdbd847479e595ac774b4685de7138403d97865329
|
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
|
|
@@ -35,7 +35,7 @@ module Decko
|
|
|
35
35
|
opts[:files] = find_mod_file(file, Cardio.gem_root)
|
|
36
36
|
end
|
|
37
37
|
parser.on("-s", "--[no-]simplecov", "Run with simplecov") do |s|
|
|
38
|
-
opts[:simplecov] = s ? "" : "
|
|
38
|
+
opts[:simplecov] = s ? "TMPSETS=true" : ""
|
|
39
39
|
end
|
|
40
40
|
parser.on("--rescue", "Run with pry-rescue") do
|
|
41
41
|
process_rescue_opts opts
|
|
@@ -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
|
|
|
@@ -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,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
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
module Decko
|
|
2
|
+
module Generators
|
|
3
|
+
module Deck
|
|
4
|
+
class DeckGenerator
|
|
5
|
+
# Protected helper methods for DeckGenerator.
|
|
6
|
+
# Many methods are called from .erb files.
|
|
7
|
+
module DeckHelper
|
|
8
|
+
protected
|
|
9
|
+
|
|
10
|
+
def shark?
|
|
11
|
+
!(monkey? || platypus?)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def monkey?
|
|
15
|
+
options[:monkey]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def platypus?
|
|
19
|
+
options[:platypus]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def erb_template name
|
|
23
|
+
template "#{name}.erb", name
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def repo_path
|
|
27
|
+
@repo_path ||= determine_repo_path
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def expanded_repo_path
|
|
31
|
+
@expanded_repo_path ||= File.expand_path repo_path
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def determine_repo_path
|
|
35
|
+
@repo_path_determined ? (return nil) : (@repo_path_determined = true)
|
|
36
|
+
path = options["repo-path"]
|
|
37
|
+
path = ENV["DECKO_REPO_PATH"] if path.blank?
|
|
38
|
+
path = prompt_for_repo_path if path.blank? && platypus?
|
|
39
|
+
path.to_s
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def repo_path_constraint
|
|
43
|
+
repo_path.present? ? %(, path: "#{repo_path}") : ""
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def prompt_for_repo_path
|
|
47
|
+
@repo_path = ask "Enter the path to your local decko repository: "
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def spec_path
|
|
51
|
+
@spec_path ||= platypus? ? repo_path : "mod/"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def spec_helper_path
|
|
55
|
+
@spec_helper_path ||=
|
|
56
|
+
platypus? ? "#{repo_path}/card/spec/spec_helper" : "./spec/spec_helper"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def features_path
|
|
60
|
+
@features_path ||=
|
|
61
|
+
platypus? ? File.expand_path("#{repo_path}/decko/features/") : "mod/"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# FIXME: these gem roots are not correct unless repo_path is specified
|
|
65
|
+
def cardio_gem_root
|
|
66
|
+
@cardio_gem_root ||= File.join repo_path, "card"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def decko_gem_root
|
|
70
|
+
@decko_gem_root ||= File.join repo_path, "decko"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def database_gem_and_version
|
|
74
|
+
entry = database_gemfile_entry
|
|
75
|
+
text = %('#{entry.name}')
|
|
76
|
+
text << %(, '#{entry.version}') if entry.version
|
|
77
|
+
# single quotes to prevent, eg: `gem "pg", ">= 0.18', '< 2.0"`
|
|
78
|
+
text
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def simplecov_config
|
|
82
|
+
"" # TODO: add simplecov configs here
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def jasmine_yml prefix
|
|
86
|
+
inside("javascripts/support") do
|
|
87
|
+
template "#{prefix}_jasmine.yml.erb", "jasmine.yml"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def mysql_socket
|
|
92
|
+
return if RbConfig::CONFIG["host_os"].match?(/mswin|mingw/)
|
|
93
|
+
|
|
94
|
+
@mysql_socket ||= [
|
|
95
|
+
"/tmp/mysql.sock", # default
|
|
96
|
+
"/var/run/mysqld/mysqld.sock", # debian/gentoo
|
|
97
|
+
"/var/tmp/mysql.sock", # freebsd
|
|
98
|
+
"/var/lib/mysql/mysql.sock", # fedora
|
|
99
|
+
"/opt/local/lib/mysql/mysql.sock", # fedora
|
|
100
|
+
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
|
|
101
|
+
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
|
|
102
|
+
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
|
|
103
|
+
"/opt/lampp/var/mysql/mysql.sock" # xampp for linux
|
|
104
|
+
].find { |f| File.exist?(f) }
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|