wagn 1.18.6 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +2 -2
- data/bin/wagn +3 -3
- data/features/notifications.feature +1 -0
- data/features/rules.feature +2 -0
- data/features/step_definitions/email_steps.rb +10 -2
- data/features/step_definitions/history_steps.rb +1 -1
- data/features/step_definitions/wagn_steps.rb +72 -48
- data/features/step_definitions/web_steps.rb +12 -12
- data/features/step_definitions/window_steps.rb +3 -3
- data/features/structure.feature +1 -0
- data/features/support/delayed_job.rb +18 -0
- data/features/support/env.rb +43 -24
- data/features/support/paths.rb +4 -4
- data/features/support/scopes.rb +6 -6
- data/features/support/wagn_env.rb +2 -2
- data/features/table_of_contents.feature +1 -0
- data/features/update_includers.feature +2 -4
- data/lib/decko/engine.rb +29 -28
- data/lib/wagn.rb +1 -1
- data/lib/wagn/all.rb +1 -1
- data/lib/wagn/application.rb +9 -9
- data/lib/wagn/cli.rb +5 -5
- data/lib/wagn/commands.rb +48 -48
- data/lib/wagn/commands/application.rb +4 -4
- data/lib/wagn/config/environments/cucumber.rb +2 -0
- data/lib/wagn/config/environments/development.rb +2 -2
- data/lib/wagn/config/environments/production.rb +2 -2
- data/lib/wagn/config/environments/test.rb +12 -3
- data/lib/wagn/config/initializers/secret_token.rb +2 -2
- data/lib/wagn/generators/wagn/templates/Gemfile +38 -51
- data/lib/wagn/generators/wagn/templates/bin/spring +6 -6
- data/lib/wagn/generators/wagn/templates/config/application.rb +12 -1
- data/lib/wagn/generators/wagn/templates/spec/javascripts/support/deck_jasmine.yml +2 -2
- data/lib/wagn/generators/wagn/templates/spec/javascripts/support/wagn_jasmine.yml +15 -10
- data/lib/wagn/generators/wagn/templates/spec/spec_helper.rb +1 -1
- data/lib/wagn/generators/wagn/wagn_generator.rb +87 -87
- data/lib/wagn/generators/wagn/wagn_generator/interactive.rb +28 -28
- data/lib/wagn/mods_spec_helper.rb +9 -9
- data/lib/wagn/parser.rb +27 -27
- data/lib/wagn/response.rb +106 -0
- data/lib/wagn/script_wagn_loader.rb +4 -4
- data/lib/wagn/simplecov_helper.rb +19 -19
- data/lib/wagn/tasks/cucumber.rake +19 -19
- data/lib/wagn/tasks/db.rake +8 -8
- data/lib/wagn/tasks/test.rake +25 -25
- data/lib/wagn/tasks/wagn.rake +107 -110
- data/rails/application-routes.rb +2 -2
- data/rails/controllers/card_controller.rb +37 -196
- data/rails/engine-routes.rb +29 -29
- data/script/autospec +3 -3
- data/script/rails +3 -3
- data/script/test_filter +2 -2
- data/script/wagn +3 -3
- data/spec/controllers/card_controller_spec.rb +194 -170
- data/spec/controllers/location_spec.rb +10 -10
- data/spec/javascripts/support/jasmine.yml.erb +4 -4
- data/spec/javascripts/support/jasmine_config.rb +4 -4
- data/spec/javascripts/support/jasmine_runner.rb +5 -5
- data/test/performance/card_create_test.rb +5 -5
- data/test/performance/fetch_test.rb +3 -3
- data/test/performance/homepage_test.rb +3 -3
- data/test/performance/render_test.rb +3 -3
- data/test/test_helper.rb +14 -14
- data/wagn.gemspec +16 -16
- metadata +7 -5
data/features/structure.feature
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
Before("@delayed-jobs") do
|
2
|
+
Delayed::Worker.delay_jobs = true
|
3
|
+
end
|
4
|
+
|
5
|
+
After("@delayed-jobs") do
|
6
|
+
Delayed::Worker.delay_jobs = false
|
7
|
+
end
|
8
|
+
|
9
|
+
Before("@background-jobs") do
|
10
|
+
Delayed::Worker.delay_jobs = true
|
11
|
+
system "env RAILS_ENV=cucumber rake jobs:work &"
|
12
|
+
end
|
13
|
+
|
14
|
+
After("@background-jobs") do
|
15
|
+
Delayed::Worker.delay_jobs = false
|
16
|
+
system "ps -ef | grep 'rake jobs:work' | grep -v grep | awk '{print $2}' | "\
|
17
|
+
"xargs kill -9"
|
18
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,33 +1,49 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
-
ENV[
|
2
|
+
ENV["RAILS_ENV"] = "cucumber"
|
3
3
|
|
4
|
-
require File.expand_path(
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require File.expand_path("../../../lib/wagn/simplecov_helper.rb", __FILE__)
|
5
|
+
require "simplecov"
|
6
|
+
require "minitest/autorun"
|
7
7
|
|
8
|
-
require
|
8
|
+
require "rspec/expectations"
|
9
|
+
World(RSpec::Matchers)
|
10
|
+
require "rspec-html-matchers"
|
11
|
+
World(RSpecHtmlMatchers)
|
12
|
+
|
13
|
+
require "pry"
|
9
14
|
|
10
15
|
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
11
16
|
# It is recommended to regenerate this file in the future when you upgrade to a
|
12
17
|
# newer version of cucumber-rails. Consider adding your own code to a new file
|
13
|
-
# instead of editing this one. Cucumber will automatically load all
|
14
|
-
# files.
|
18
|
+
# instead of editing this one. Cucumber will automatically load all
|
19
|
+
# features/**/*.rb files.
|
20
|
+
Before("@background-jobs, @delayed-jobs, @javascript") do
|
21
|
+
DatabaseCleaner.strategy = :truncation
|
22
|
+
end
|
23
|
+
Before("~@background-jobs", "~@delayed-jobs", "~@javascript") do
|
24
|
+
DatabaseCleaner.strategy = :transaction
|
25
|
+
end
|
26
|
+
After("@background-jobs, @delayed-jobs, @javascript") do
|
27
|
+
Card.seed_test_db
|
28
|
+
end
|
15
29
|
|
16
|
-
require
|
30
|
+
require "cucumber/rails"
|
31
|
+
require "test_after_commit"
|
17
32
|
|
18
33
|
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
19
34
|
# order to ease the transition to Capybara we set the default here. If you'd
|
20
35
|
# prefer to use XPath just remove this line and adjust any selectors in your
|
21
36
|
# steps to use the XPath syntax.
|
22
37
|
Capybara.default_selector = :css
|
23
|
-
Capybara.default_wait_time =
|
38
|
+
Capybara.default_wait_time = 30
|
24
39
|
# By default, any exception happening in your Rails application will bubble up
|
25
40
|
# to Cucumber so that your scenario will fail. This is a different from how
|
26
|
-
# your application behaves in the production environment, where an error page
|
27
|
-
# be rendered instead.
|
41
|
+
# your application behaves in the production environment, where an error page
|
42
|
+
# will be rendered instead.
|
28
43
|
#
|
29
44
|
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
30
|
-
# exceptions and display an error page
|
45
|
+
# exceptions and display an error page
|
46
|
+
# (just like when the app is running in production).
|
31
47
|
# Typical scenarios where you want to do this is when you test your error pages.
|
32
48
|
# There are two ways to allow Rails to rescue exceptions:
|
33
49
|
#
|
@@ -39,26 +55,29 @@ Capybara.default_wait_time = 60
|
|
39
55
|
ActionController::Base.allow_rescue = false
|
40
56
|
|
41
57
|
# Remove/comment out the lines below if your app doesn't have a database.
|
42
|
-
# For some databases (like MongoDB and CouchDB) you may need to
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
58
|
+
# For some databases (like MongoDB and CouchDB) you may need to
|
59
|
+
# use :truncation instead.
|
60
|
+
# begin
|
61
|
+
# DatabaseCleaner.strategy = :transaction
|
62
|
+
# rescue NameError
|
63
|
+
# raise 'You need to add database_cleaner to your Gemfile (in the :test group)
|
64
|
+
# if you wish to use it.'
|
65
|
+
# end
|
48
66
|
|
49
|
-
# You may also want to configure DatabaseCleaner to use different strategies for
|
67
|
+
# You may also want to configure DatabaseCleaner to use different strategies for
|
68
|
+
# certain features and scenarios.
|
50
69
|
# See the DatabaseCleaner documentation for details. Example:
|
51
70
|
#
|
52
|
-
# Before('@no-txn,@selenium,@
|
71
|
+
# Before('@no-txn,@selenium,@celerity,@javascript') do
|
53
72
|
# DatabaseCleaner.strategy = :truncation, {except: %w[widgets]}
|
54
73
|
# end
|
55
74
|
#
|
56
|
-
# Before('~@no-txn', '~@selenium',
|
57
|
-
#
|
58
|
-
#
|
75
|
+
# Before('~@no-txn', '~@selenium', ~@celerity', '~@javascript') do
|
76
|
+
# DatabaseCleaner.strategy = :transaction
|
77
|
+
# end
|
59
78
|
#
|
60
79
|
|
61
80
|
# Possible values are :truncation and :transaction
|
62
81
|
# The :transaction strategy is faster, but might give you threading problems.
|
63
82
|
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
|
64
|
-
Cucumber::Rails::Database.javascript_strategy = :
|
83
|
+
Cucumber::Rails::Database.javascript_strategy = :truncation
|
data/features/support/paths.rb
CHANGED
@@ -10,13 +10,13 @@ module NavigationHelpers
|
|
10
10
|
case page_name
|
11
11
|
|
12
12
|
when /the home\s?page/
|
13
|
-
|
13
|
+
"/"
|
14
14
|
|
15
15
|
# Add more mappings here.
|
16
16
|
# Here is an example that pulls values out of the Regexp:
|
17
17
|
#
|
18
18
|
# when /^(.*)'s profile page$/i
|
19
|
-
# user_profile_path(Auth
|
19
|
+
# user_profile_path(Auth.find_account_by_email( $1 ))
|
20
20
|
|
21
21
|
when /card (.*) with (.*) layout$/
|
22
22
|
"/#{Regexp.last_match(1).to_name.url_key}?layout=$2"
|
@@ -40,7 +40,7 @@ module NavigationHelpers
|
|
40
40
|
"/new/#{Regexp.last_match(1).to_name.url_key}"
|
41
41
|
|
42
42
|
when /kml source/
|
43
|
-
|
43
|
+
"/House+*type+by_name.kml"
|
44
44
|
|
45
45
|
when /url "(.*)"/
|
46
46
|
Regexp.last_match(1).to_s
|
@@ -49,7 +49,7 @@ module NavigationHelpers
|
|
49
49
|
begin
|
50
50
|
page_name =~ /the (.*) page/
|
51
51
|
path_components = Regexp.last_match(1).split(/\s+/)
|
52
|
-
send(path_components.push(
|
52
|
+
send(path_components.push("path").join("_").to_sym)
|
53
53
|
rescue Object => e
|
54
54
|
raise "#{e.message} Can't find mapping from \"#{page_name}\" to a path.\n" \
|
55
55
|
"Now, go and add a mapping in #{__FILE__}"
|
data/features/support/scopes.rb
CHANGED
@@ -4,22 +4,22 @@ module ScopeHelpers
|
|
4
4
|
case section
|
5
5
|
|
6
6
|
when /main card content/
|
7
|
-
|
7
|
+
"#main > .card-slot > .card-frame > .card-content"
|
8
8
|
|
9
9
|
when /pointer card content/
|
10
|
-
|
10
|
+
"#main > .card-slot > .card-frame > .card-content > .pointer-list"
|
11
11
|
|
12
12
|
when /main card header/
|
13
|
-
|
13
|
+
"#main > .card-slot > .card-frame > .card-header"
|
14
14
|
|
15
15
|
when /main card menu/
|
16
|
-
|
16
|
+
"#main > .card-slot > .menu-slot > .card-menu"
|
17
17
|
|
18
18
|
when /main card toolbar/
|
19
|
-
|
19
|
+
"#main > .card-slot > .card-frame > nav.toolbar"
|
20
20
|
|
21
21
|
when /main card frame/
|
22
|
-
|
22
|
+
"#main > .card-slot > .card-frame"
|
23
23
|
|
24
24
|
else
|
25
25
|
raise "Can't find mapping from \"#{section}\" to a scope.\n" \
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@javascript @delayed-jobs
|
1
2
|
Feature: Updates for Children of watched cards
|
2
3
|
In order to keep track of changes that are important to me
|
3
4
|
As an Editor
|
@@ -16,7 +17,7 @@ Feature: Updates for Children of watched cards
|
|
16
17
|
#And He should see "added Ulysses+author" in the email -- FIXME need multiline matching
|
17
18
|
Then Joe Admin should be notified that "Joe User created \"Ulysses\+author\""
|
18
19
|
And Joe Camel should be notified that "Joe User created \"Ulysses\+author\""
|
19
|
-
When Joe Admin edits "Ulysses
|
20
|
+
When Joe Admin edits "Ulysses+author" setting content to "Jim"
|
20
21
|
Then Joe Camel should be notified that "Joe Admin updated \"Ulysses\+author\""
|
21
22
|
#And Joe Admin should be notified that "Joe User updated \"Ulysses\""
|
22
23
|
|
@@ -62,7 +63,6 @@ Feature: Updates for Children of watched cards
|
|
62
63
|
|color|flavor|
|
63
64
|
|green|mushy|
|
64
65
|
Then No notification should be sent
|
65
|
-
|
66
66
|
|
67
67
|
Scenario: Watching a plus card & including card on regular edit
|
68
68
|
When I create card "Ulysses+author" with content "Joyce"
|
@@ -70,5 +70,3 @@ Feature: Updates for Children of watched cards
|
|
70
70
|
When Joe Camel is watching "Ulysses+author+*self"
|
71
71
|
And I edit "Ulysses+author" setting content to "Jim"
|
72
72
|
Then Joe Camel should be notified that "Joe User updated \"Ulysses\+author\""
|
73
|
-
|
74
|
-
|
data/lib/decko/engine.rb
CHANGED
@@ -1,45 +1,46 @@
|
|
1
1
|
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "rails/all"
|
3
|
+
require "cardio"
|
4
4
|
|
5
5
|
# TODO: Move these to modules that use them
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
6
|
+
require "htmlentities"
|
7
|
+
require "recaptcha"
|
8
|
+
require "coderay"
|
9
|
+
require "haml"
|
10
|
+
require "kaminari"
|
11
|
+
require "bootstrap-kaminari-views"
|
12
|
+
require "diff/lcs"
|
13
|
+
require "builder"
|
14
14
|
|
15
|
-
require
|
15
|
+
require "wagn"
|
16
16
|
|
17
17
|
module Decko
|
18
18
|
class Engine < ::Rails::Engine
|
19
|
-
paths.add
|
20
|
-
paths.add
|
21
|
-
paths.add
|
22
|
-
paths.add
|
23
|
-
glob:
|
24
|
-
paths.
|
25
|
-
|
26
|
-
|
19
|
+
paths.add "app/controllers", with: "rails/controllers", eager_load: true
|
20
|
+
paths.add "gem-assets", with: "rails/assets"
|
21
|
+
paths.add "config/routes.rb", with: "rails/engine-routes.rb"
|
22
|
+
paths.add "lib/tasks", with: "#{::Wagn.gem_root}/lib/wagn/tasks",
|
23
|
+
glob: "**/*.rake"
|
24
|
+
paths["lib/tasks"] << "#{::Cardio.gem_root}/lib/card/tasks"
|
25
|
+
paths.add "lib/wagn/config/initializers",
|
26
|
+
with: File.join(Wagn.gem_root, "lib/wagn/config/initializers"),
|
27
|
+
glob: "**/*.rb"
|
27
28
|
|
28
|
-
initializer
|
29
|
+
initializer "decko.engine.load_config_initializers",
|
29
30
|
after: :load_config_initializers do
|
30
|
-
paths[
|
31
|
+
paths["lib/wagn/config/initializers"].existent.sort.each do |initializer|
|
31
32
|
load(initializer)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
initializer
|
36
|
-
before:
|
36
|
+
initializer "engine.copy_configs",
|
37
|
+
before: "decko.engine.load_config_initializers" do
|
37
38
|
# this code should all be in Wagn somewhere, and it is now, gem-wize
|
38
39
|
# Ideally railties would do this for us; this is needed for both use cases
|
39
|
-
Engine.paths[
|
40
|
-
Engine.paths[
|
41
|
-
Engine.paths[
|
42
|
-
Engine.paths[
|
40
|
+
Engine.paths["request_log"] = Wagn.paths["request_log"]
|
41
|
+
Engine.paths["log"] = Wagn.paths["log"]
|
42
|
+
Engine.paths["lib/tasks"] = Wagn.paths["lib/tasks"]
|
43
|
+
Engine.paths["config/routes"] = Wagn.paths["config/routes"]
|
43
44
|
end
|
44
45
|
|
45
46
|
initializer :connect_on_load do
|
@@ -48,7 +49,7 @@ module Decko
|
|
48
49
|
end
|
49
50
|
ActiveSupport.on_load(:after_initialize) do
|
50
51
|
begin
|
51
|
-
require_dependency
|
52
|
+
require_dependency "card" unless defined?(Card)
|
52
53
|
rescue ActiveRecord::StatementInvalid => e
|
53
54
|
::Rails.logger.warn "database not available[#{::Rails.env}] #{e}"
|
54
55
|
end
|
data/lib/wagn.rb
CHANGED
data/lib/wagn/all.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "wagn/application"
|
data/lib/wagn/application.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
require
|
3
|
+
require "decko/engine"
|
4
4
|
|
5
5
|
if defined?(Bundler)
|
6
6
|
# If you precompile assets before deploying to production, use this line
|
@@ -13,8 +13,8 @@ module Wagn
|
|
13
13
|
class Application < Rails::Application
|
14
14
|
initializer :load_wagn_environment_config,
|
15
15
|
before: :load_environment_config, group: :all do
|
16
|
-
add_path paths,
|
17
|
-
paths[
|
16
|
+
add_path paths, "lib/wagn/config/environments", glob: "#{Rails.env}.rb"
|
17
|
+
paths["lib/wagn/config/environments"].existent.each do |environment|
|
18
18
|
require environment
|
19
19
|
end
|
20
20
|
end
|
@@ -58,7 +58,7 @@ module Wagn
|
|
58
58
|
# config.active_record.raise_in_transactional_callbacks = true
|
59
59
|
|
60
60
|
config.assets.enabled = false
|
61
|
-
config.assets.version =
|
61
|
+
config.assets.version = "1.0"
|
62
62
|
|
63
63
|
config.filter_parameters += [:password]
|
64
64
|
config
|
@@ -70,13 +70,13 @@ module Wagn
|
|
70
70
|
paths = super
|
71
71
|
Cardio.set_paths paths
|
72
72
|
|
73
|
-
paths[
|
74
|
-
paths.add
|
73
|
+
paths["mod"] << "mod"
|
74
|
+
paths.add "files"
|
75
75
|
|
76
|
-
paths[
|
77
|
-
paths[
|
76
|
+
paths["app/models"] = []
|
77
|
+
paths["app/mailers"] = []
|
78
78
|
|
79
|
-
add_path paths,
|
79
|
+
add_path paths, "config/routes.rb", with: "rails/application-routes.rb"
|
80
80
|
|
81
81
|
Cardio.set_mod_paths # really this should happen later
|
82
82
|
|
data/lib/wagn/cli.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rbconfig"
|
2
|
+
require "wagn/script_wagn_loader"
|
3
3
|
|
4
4
|
# If we are inside a Wagn application this method performs an exec and thus
|
5
5
|
# the rest of this script is not run.
|
6
6
|
Wagn::ScriptWagnLoader.exec_script_wagn!
|
7
7
|
|
8
|
-
require
|
9
|
-
Signal.trap(
|
8
|
+
require "rails/ruby_version_check"
|
9
|
+
Signal.trap("INT") { puts; exit(1) }
|
10
10
|
|
11
11
|
# if ARGV.first == 'plugin'
|
12
12
|
# ARGV.shift
|
13
13
|
# require 'wagn/commands/plugin_new'
|
14
14
|
# else
|
15
15
|
|
16
|
-
require
|
16
|
+
require "wagn/commands/application"
|
17
17
|
# end
|
data/lib/wagn/commands.rb
CHANGED
@@ -1,87 +1,88 @@
|
|
1
|
-
require
|
1
|
+
require "optparse"
|
2
2
|
|
3
3
|
# add method in? to Object class
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "active_support/core_ext/object/inclusion"
|
5
|
+
require "wagn/parser"
|
6
6
|
|
7
7
|
def load_rake_tasks
|
8
|
-
require
|
9
|
-
require
|
8
|
+
require "./config/environment"
|
9
|
+
require "rake"
|
10
10
|
Wagn::Application.load_tasks
|
11
11
|
end
|
12
12
|
|
13
13
|
RAILS_COMMANDS = %w( generate destroy plugin benchmarker profiler console
|
14
14
|
server dbconsole application runner ).freeze
|
15
15
|
ALIAS = {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
"rs" => "rspec",
|
17
|
+
"cc" => "cucumber",
|
18
|
+
"jm" => "jasmine",
|
19
|
+
"g" => "generate",
|
20
|
+
"d" => "destroy",
|
21
|
+
"c" => "console",
|
22
|
+
"s" => "server",
|
23
|
+
"db" => "dbconsole",
|
24
|
+
"r" => "runner"
|
25
25
|
}.freeze
|
26
26
|
|
27
|
-
ARGV <<
|
27
|
+
ARGV << "--help" if ARGV.empty?
|
28
28
|
|
29
29
|
def supported_rails_command? arg
|
30
30
|
arg.in?(RAILS_COMMANDS) || ALIAS[arg].in?(RAILS_COMMANDS)
|
31
31
|
end
|
32
32
|
|
33
33
|
def find_spec_file filename, base_dir
|
34
|
-
file, line = filename.split(
|
35
|
-
if file.include?(
|
34
|
+
file, line = filename.split(":")
|
35
|
+
if file.include?("_spec.rb") && File.exist?(file)
|
36
36
|
filename
|
37
37
|
else
|
38
|
-
file = File.basename(file,
|
38
|
+
file = File.basename(file, ".rb").sub(/_spec$/, "")
|
39
39
|
Dir.glob("#{base_dir}/**/#{file}_spec.rb").flatten.map do |spec_file|
|
40
40
|
line ? "#{spec_file}:#{line}" : file
|
41
|
-
end.join(
|
41
|
+
end.join(" ")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def exit_with_child_status command
|
46
|
+
command += " 2>&1"
|
47
|
+
exit $CHILD_STATUS.exitstatus unless system command
|
48
|
+
end
|
49
|
+
|
45
50
|
WAGN_DB_TASKS = %w(seed reseed load update).freeze
|
46
51
|
|
47
52
|
if supported_rails_command? ARGV.first
|
48
|
-
ENV[
|
53
|
+
ENV["PRY_RESCUE_RAILS"] = "1" if ARGV.delete("--rescue")
|
49
54
|
command = ARGV.first
|
50
55
|
command = ALIAS[command] || command
|
51
56
|
|
52
57
|
# without this, the card generators don't list with: wagn g --help
|
53
|
-
require
|
54
|
-
require
|
58
|
+
require "generators/card" if command == "generate"
|
59
|
+
require "rails/commands"
|
55
60
|
else
|
56
61
|
command = ARGV.shift
|
57
62
|
command = ALIAS[command] || command
|
58
63
|
|
59
64
|
case command
|
60
|
-
when
|
61
|
-
require
|
62
|
-
require
|
63
|
-
feature_paths = Card::Loader.mod_dirs.map do |p|
|
65
|
+
when "cucumber"
|
66
|
+
require "wagn"
|
67
|
+
require "./config/environment"
|
68
|
+
feature_paths = Card::Mod::Loader.mod_dirs.map do |p|
|
64
69
|
Dir.glob "#{p}/features"
|
65
70
|
end.flatten
|
66
71
|
require_args = "-r #{Wagn.gem_root}/features "
|
67
|
-
require_args += feature_paths.map { |path| "-r #{path}" }.join(
|
68
|
-
feature_args = ARGV.empty? ? feature_paths.join(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
when
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
-
when 'rspec'
|
78
|
-
require 'rspec/core'
|
79
|
-
require 'wagn/application'
|
72
|
+
require_args += feature_paths.map { |path| "-r #{path}" }.join(" ")
|
73
|
+
feature_args = ARGV.empty? ? feature_paths.join(" ") : ARGV.shelljoin
|
74
|
+
exit_with_child_status "RAILS_ROOT=. bundle exec cucumber " \
|
75
|
+
"#{require_args} #{feature_args}"
|
76
|
+
when "jasmine"
|
77
|
+
exit_with_child_status "RAILS_ENV=test bundle exec rake spec:javascript"
|
78
|
+
when "rspec"
|
79
|
+
require "rspec/core"
|
80
|
+
require "wagn/application"
|
80
81
|
|
81
82
|
before_split = true
|
82
83
|
wagn_args, rspec_args =
|
83
84
|
ARGV.partition do |a|
|
84
|
-
before_split = (a ==
|
85
|
+
before_split = (a == "--" ? false : before_split)
|
85
86
|
end
|
86
87
|
rspec_args.shift
|
87
88
|
opts = {}
|
@@ -89,14 +90,13 @@ else
|
|
89
90
|
|
90
91
|
rspec_command =
|
91
92
|
"RAILS_ROOT=. #{opts[:simplecov]} #{opts[:executer]} " \
|
92
|
-
" #{opts[:rescue]} rspec #{rspec_args.shelljoin} #{opts[:files]}
|
93
|
-
|
94
|
-
|
95
|
-
when '--version', '-v'
|
93
|
+
" #{opts[:rescue]} rspec #{rspec_args.shelljoin} #{opts[:files]}"
|
94
|
+
exit_with_child_status rspec_command
|
95
|
+
when "--version", "-v"
|
96
96
|
puts "Wagn #{Card::Version.release}"
|
97
|
-
when
|
98
|
-
if ARGV.first.in?([
|
99
|
-
require
|
97
|
+
when "new"
|
98
|
+
if ARGV.first.in?(["-h", "--help"])
|
99
|
+
require "wagn/commands/application"
|
100
100
|
else
|
101
101
|
puts "Can't initialize a new deck within the directory of another, " \
|
102
102
|
"please change to a non-deck directory first.\n"
|
@@ -118,7 +118,7 @@ else
|
|
118
118
|
end
|
119
119
|
|
120
120
|
else
|
121
|
-
puts
|
121
|
+
puts "Error: Command not recognized" unless command.in?(["-h", "--help"])
|
122
122
|
puts <<-EOT
|
123
123
|
Usage: wagn COMMAND [ARGS]
|
124
124
|
|