wagn 1.16.15 → 1.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91193f2217c2ee149afd3789dd7d13ef3b87831d
4
- data.tar.gz: 997c9cb094906484298a44ece969f143282859e8
3
+ metadata.gz: 7fe31485e1ace44582b1be0422e6669462f1dcb4
4
+ data.tar.gz: 16a2fb47d3f565766c96d6a6a053391801bddc64
5
5
  SHA512:
6
- metadata.gz: b036a8603a038b8cfcdad0594c4aecac81fda0e609e55c9c8f731eef827b21e5dda4487f3cac2d981b71b09442d81838baf5b3bbfb392abe3381ea53e4bae77a
7
- data.tar.gz: 451b6152b9ef511a1ec0a019b843c3016da86bb2a9d4aa75acdc660482fc2f7fda1efcc4bfd7af89dd5c387b5a2d19f313554af81151d7f2c653003adcf0b745
6
+ metadata.gz: f427c740a3e6b5d0535f2f6f0b356779061213f9d4e5bcb4967195c8c6c55b7350ae211f71a8b249038a453eca6cafeba1bb1e609224fe8b32602c97971b6926
7
+ data.tar.gz: 551e5a86477b36aab96f9f3b2a6edecb4025ca7d5797163798255f65d66d11c665291aeab437b5d55e88334c82723dba2a1012c74976ffbee4e890a8b81d21b1
@@ -23,6 +23,7 @@ Feature: Signing up
23
23
  When I open the email
24
24
  And I click the first link in the email
25
25
  Then I should see "Wanna B"
26
+ And "Wanna B" should be signed in
26
27
 
27
28
  When I go to the home page
28
29
  And I follow "Sign out"
@@ -33,7 +34,7 @@ Feature: Signing up
33
34
  And I enter "wanna_pass" into "*password"
34
35
  And I press "Sign in"
35
36
  Then I should see "Wanna B"
36
-
37
+ And "Wanna B" should be signed in
37
38
  Scenario: Signing up with approval
38
39
  #When I go to card "AccountRequest"
39
40
  #And In the main card content I click "Wanna B"
@@ -341,6 +341,10 @@ Then /^"([^"]*)" should be selected for "([^"]*)"$/ do |value, field|
341
341
  expect(selected.inner_html).to match /#{value}/
342
342
  end
343
343
 
344
+ Then /^"([^"]*)" should be signed in$/ do |user| # "
345
+ has_css?('#my-card-link', text: user)
346
+ end
347
+
344
348
  When /^I press enter to search$/ do
345
349
  find('#_keyword').native.send_keys(:return)
346
350
  end
data/lib/wagn/commands.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require 'optparse'
2
- require 'active_support/core_ext/object/inclusion' # adds method in? to Object class
2
+
3
+ # add method in? to Object class
4
+ require 'active_support/core_ext/object/inclusion'
5
+ require 'wagn/parser'
3
6
 
4
7
  def load_rake_tasks
5
8
  require './config/environment'
@@ -7,7 +10,8 @@ def load_rake_tasks
7
10
  Wagn::Application.load_tasks
8
11
  end
9
12
 
10
- RAILS_COMMANDS = %w( generate destroy plugin benchmarker profiler console server dbconsole application runner )
13
+ RAILS_COMMANDS = %w( generate destroy plugin benchmarker profiler console
14
+ server dbconsole application runner )
11
15
  ALIAS = {
12
16
  'rs' => 'rspec',
13
17
  'cc' => 'cucumber',
@@ -23,65 +27,51 @@ ALIAS = {
23
27
  ARGV << '--help' if ARGV.empty?
24
28
 
25
29
  def supported_rails_command? arg
26
- arg.in? RAILS_COMMANDS or ALIAS[arg].in? RAILS_COMMANDS
30
+ arg.in?(RAILS_COMMANDS) || ALIAS[arg].in?(RAILS_COMMANDS)
27
31
  end
28
32
 
29
33
  def find_spec_file filename, base_dir
30
34
  file, line = filename.split(':')
31
- if file.include? '_spec.rb' and File.exist?(file)
35
+ if file.include?('_spec.rb') && File.exist?(file)
32
36
  filename
33
37
  else
34
- file = File.basename(file,".rb").sub(/_spec$/,'')
35
- Dir.glob("#{base_dir}/**/#{file}_spec.rb").flatten.map{ |file| line ? "#{file}:#{line}" : file}.join(' ')
38
+ file = File.basename(file, '.rb').sub(/_spec$/, '')
39
+ Dir.glob("#{base_dir}/**/#{file}_spec.rb").flatten.map do |spec_file|
40
+ line ? "#{spec_file}:#{line}" : file
41
+ end.join(' ')
36
42
  end
37
43
  end
38
44
 
39
- TASK_COMMANDS = %w[seed reseed load update]
45
+ WAGN_DB_TASKS = %w[seed reseed load update]
40
46
 
41
47
  if supported_rails_command? ARGV.first
42
48
  if ARGV.delete('--rescue')
43
- ENV["PRY_RESCUE_RAILS"]="1"
49
+ ENV['PRY_RESCUE_RAILS'] = '1'
44
50
  end
45
51
  command = ARGV.first
46
52
  command = ALIAS[command] || command
47
- require 'generators/card' if command == 'generate' # without this, the card generators don't list with: wagn g --help
53
+
54
+ # without this, the card generators don't list with: wagn g --help
55
+ require 'generators/card' if command == 'generate'
48
56
  require 'rails/commands'
49
57
  else
50
58
  command = ARGV.shift
51
59
  command = ALIAS[command] || command
52
60
 
53
61
  case command
54
- when *TASK_COMMANDS
55
- envs = []
56
- parser = OptionParser.new do |parser|
57
- parser.banner = "Usage: wagn #{command} [options]\n\nRun wagn:#{command} task on the production database specified in config/database.yml\n\n"
58
- parser.on('--production','-p', "#{command} production database (default)") do
59
- envs = ['production']
60
- end
61
- parser.on('--test','-t', "#{command} test database") do
62
- envs = ['test']
63
- end
64
- parser.on('--development', '-d', "#{command} development database") do
65
- envs = ['development']
66
- end
67
- parser.on('--all', '-a', "#{command} production, test, and development database") do
68
- envs = %w( production development test)
69
- end
70
- end
71
- parser.parse!(ARGV)
72
- task_cmd="bundle exec rake wagn:#{command}"
73
- if envs.empty?
62
+ when *WAGN_DB_TASKS
63
+ opts = {}
64
+ Wagn::Parser.db_task(command, opts).parse!(ARGV)
65
+ task_cmd = "bundle exec rake wagn:#{command}"
66
+ if !opts[:envs] || opts[:envs].empty?
74
67
  puts task_cmd
75
68
  puts `#{task_cmd}`
76
69
  else
77
- envs.each do |env|
70
+ opts[:envs].each do |env|
78
71
  puts "env RAILS_ENV=#{env} #{task_cmd}"
79
72
  puts `env RAILS_ENV=#{env} #{task_cmd}`
80
73
  end
81
74
  end
82
- # when 'update'
83
- # load_rake_tasks
84
- # Rake::Task['wagn:update'].invoke
85
75
  when 'cucumber'
86
76
  require 'wagn'
87
77
  require './config/environment'
@@ -89,76 +79,31 @@ else
89
79
  Dir.glob "#{p}/features"
90
80
  end.flatten
91
81
  require_args = "-r #{Wagn.gem_root}/features "
92
- require_args += feature_paths.map { |path| "-r #{path}"}.join(' ')
82
+ require_args += feature_paths.map { |path| "-r #{path}" }.join(' ')
93
83
  feature_args = ARGV.empty? ? feature_paths.join(' ') : ARGV.join(' ')
94
- unless system "RAILS_ROOT=. bundle exec cucumber #{require_args} #{feature_args} 2>&1"
84
+ unless system 'RAILS_ROOT=. bundle exec cucumber ' \
85
+ "#{require_args} #{feature_args} 2>&1"
95
86
  exit $?.exitstatus
96
87
  end
97
88
  when 'jasmine'
98
- unless system "RAILS_ENV=test bundle exec rake spec:javascript 2>&1"
89
+ unless system 'RAILS_ENV=test bundle exec rake spec:javascript 2>&1'
99
90
  exit $?.exitstatus
100
91
  end
101
92
  when 'rspec'
102
- opts = {}
103
93
  require 'rspec/core'
104
94
  require 'wagn/application'
105
- parser = RSpec::Core::Parser.new.parser(opts)
106
- parser.banner = "Usage: wagn rspec [WAGN ARGS] -- [RSPEC ARGS]\n\nRSPEC ARGS"
107
- parser.separator <<-WAGN
108
-
109
- WAGN ARGS
110
-
111
- You don't have to give a full path for FILENAME, the basename is enough
112
- If FILENAME does not include '_spec' rspec searches for the corresponding spec file.
113
- The line number always referes to example in the (corresponding) spec file.
114
-
115
- WAGN
116
-
117
- parser.on('-d', '--spec FILENAME(:LINE)', 'Run spec for a Wagn deck file') do |file|
118
- opts[:files] = find_spec_file( file, "#{Wagn.root}/mod")
119
- end
120
- parser.on('-c', '--core-spec FILENAME(:LINE)', 'Run spec for a Wagn core file') do |file|
121
- opts[:files] = find_spec_file( file, Cardio.gem_root)
122
- end
123
- parser.on('-m', '--mod MODNAME', 'Run all specs for a mod or matching a mod') do |file|
124
- if File.exists? mod_path = "mod/#{file}"
125
- opts[:files] = "#{Cardio.gem_root}/mod/#{file}"
126
- elsif File.exists? mod_path = "#{Cardio.gem_root}/mod/#{file}"
127
- opts[:files] = "#{Cardio.gem_root}/mod/#{file}"
128
- elsif (opts[:files] = find_spec_file( file, "mod")).present?
129
- else
130
- opts[:files] = find_spec_file( file, "#{Cardio.gem_root}/mod")
131
- end
132
- end
133
- parser.on('-s', '--[no-]simplecov', 'Run with simplecov') do |s|
134
- opts[:simplecov] = s ? '' : 'COVERAGE=false'
135
- end
136
- parser.on('--rescue', 'Run with pry-rescue') do
137
- if opts[:executer] == 'spring'
138
- puts "Disabled pry-rescue. Not compatible with spring."
139
- else
140
- opts[:rescue] = 'rescue '
141
- end
142
- end
143
- parser.on('--[no-]spring', 'Run with spring') do |spring|
144
- if spring
145
- opts[:executer] = 'spring'
146
- if opts[:rescue]
147
- opts[:rescue] = ''
148
- puts "Disabled pry-rescue. Not compatible with spring."
149
- end
150
- else
151
- opts[:executer] = 'bundle exec'
152
- end
153
- end
154
- parser.separator "\n"
155
95
 
156
96
  before_split = true
157
- wagn_args, rspec_args = ARGV.partition {|a| before_split = a=='--' ? false : before_split}
97
+ wagn_args, rspec_args =
98
+ ARGV.partition do |a|
99
+ before_split = (a == '--' ? false : before_split)
100
+ end
158
101
  rspec_args.shift
159
-
160
- parser.parse!(wagn_args)
161
- rspec_command = "RAILS_ROOT=. #{opts[:simplecov]} #{opts[:executer]} #{opts[:rescue]} rspec #{rspec_args*' '} #{opts[:files]} 2>&1"
102
+ opts = {}
103
+ Wagn::Parser.rspec(opts).parse!(wagn_args)
104
+ rspec_command =
105
+ "RAILS_ROOT=. #{opts[:simplecov]} #{opts[:executer]} " \
106
+ " #{opts[:rescue]} rspec #{rspec_args.join(' ')} #{opts[:files]} 2>&1"
162
107
  unless system rspec_command
163
108
  exit $?.exitstatus
164
109
  end
@@ -168,13 +113,14 @@ WAGN
168
113
  if ARGV.first.in?(['-h', '--help'])
169
114
  require 'wagn/commands/application'
170
115
  else
171
- puts "Can't initialize a new deck within the directory of another, please change to a non-deck directory first.\n"
116
+ puts "Can't initialize a new deck within the directory of another, " \
117
+ "please change to a non-deck directory first.\n"
172
118
  puts "Type 'wagn' for help."
173
119
  exit(1)
174
120
  end
175
121
 
176
122
  else
177
- puts "Error: Command not recognized" unless command.in?(['-h', '--help'])
123
+ puts 'Error: Command not recognized' unless command.in?(['-h', '--help'])
178
124
  puts <<-EOT
179
125
  Usage: wagn COMMAND [ARGS]
180
126
 
@@ -192,6 +138,7 @@ WAGN
192
138
  cucumber Run cucumber features (short-cut alias: "cc")
193
139
  rspec Run rspec tests (short-cut alias: "rs")
194
140
  update Run card migrations
141
+ load Load bootstrap data into database
195
142
 
196
143
  In addition to those, there are the standard rails commands:
197
144
  generate Generate new code (short-cut alias: "g")
@@ -207,5 +154,3 @@ WAGN
207
154
  exit(1)
208
155
  end
209
156
  end
210
-
211
-
@@ -60,9 +60,9 @@ group :development do
60
60
  end
61
61
 
62
62
  group :test do
63
- gem 'rspec'
64
- gem 'rspec-rails', '~> 3.1.0' # behavior-driven-development suite
65
- gem 'rspec-html-matchers', "0.6.1"
63
+ gem 'rspec', '~> 3.4'
64
+ gem 'rspec-rails' # behavior-driven-development suite
65
+ gem 'rspec-html-matchers'
66
66
  gem 'spork', '>=0.9'
67
67
  gem 'rr'#, '=1.0.0'
68
68
  gem 'simplecov', '~> 0.7.1', :require => false #test coverage
@@ -8,14 +8,6 @@ module <%= app_const_base %>
8
8
 
9
9
  # Wagn inherits Rails configuration options. See http://guides.rubyonrails.org/configuring.html
10
10
 
11
- config.recaptcha_public_key = '6LdhRssSAAAAAFfLt1Wkw43hoaA8RTIgso9-tvtc'
12
- config.recaptcha_private_key = '6LdhRssSAAAAAGwzl069pJQBdmzCZigm1nV-dmqK'
13
- # config.recaptcha_proxy = ...
14
- #
15
- # IMPORTANT: please be sure to register for your own recaptcha keys before deploying a live site
16
- # It's quick and easy. Just follow instructions at https://www.google.com/recaptcha/admin/create
17
-
18
-
19
11
  # Email configuration
20
12
 
21
13
  config.action_mailer.perform_deliveries = false
@@ -0,0 +1,93 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module Wagn
4
+ class Parser
5
+ class << self
6
+ def db_task command, opts
7
+ OptionParser.new do |parser|
8
+ parser.banner = "Usage: wagn #{command} [options]\n\n" \
9
+ "Run wagn:#{command} task on the production "\
10
+ " database specified in config/database.yml\n\n"
11
+ parser.on('--production', '-p',
12
+ "#{command} production database (default)") do
13
+ opts[:envs] = ['production']
14
+ end
15
+ parser.on('--test', '-t',
16
+ "#{command} test database") do
17
+ opts[:envs] = ['test']
18
+ end
19
+ parser.on('--development', '-d',
20
+ "#{command} development database") do
21
+ opts[:envs] = ['development']
22
+ end
23
+ parser.on('--all', '-a',
24
+ "#{command} production, test, and development database") do
25
+ opts[:envs] = %w( production development test)
26
+ end
27
+ end
28
+ end
29
+
30
+ def rspec opts
31
+ OptionParser.new do |parser|
32
+ parser.banner = "Usage: wagn rspec [WAGN ARGS] -- [RSPEC ARGS]\n\n" \
33
+ 'RSPEC ARGS'
34
+ parser.separator <<-WAGN
35
+
36
+ WAGN ARGS
37
+
38
+ You don't have to give a full path for FILENAME, the basename is enough
39
+ If FILENAME does not include '_spec' rspec searches for the
40
+ corresponding spec file.
41
+ The line number always referes to example in the (corresponding) spec
42
+ file.
43
+
44
+ WAGN
45
+
46
+ parser.on('-d', '--spec FILENAME(:LINE)',
47
+ 'Run spec for a Wagn deck file') do |file|
48
+ opts[:files] = find_spec_file(file, "#{Wagn.root}/mod")
49
+ end
50
+ parser.on('-c', '--core-spec FILENAME(:LINE)',
51
+ 'Run spec for a Wagn core file') do |file|
52
+ opts[:files] = find_spec_file(file, Cardio.gem_root)
53
+ end
54
+ parser.on('-m', '--mod MODNAME',
55
+ 'Run all specs for a mod or matching a mod') do |file|
56
+ opts[:files] =
57
+ if File.exists?("mod/#{file}")
58
+ "#{Cardio.gem_root}/mod/#{file}"
59
+ elsif File.exists?("#{Cardio.gem_root}/mod/#{file}")
60
+ "#{Cardio.gem_root}/mod/#{file}"
61
+ elsif (files = find_spec_file(file, 'mod')) && files.present?
62
+ files
63
+ else
64
+ find_spec_file(file, "#{Cardio.gem_root}/mod")
65
+ end
66
+ end
67
+ parser.on('-s', '--[no-]simplecov', 'Run with simplecov') do |s|
68
+ opts[:simplecov] = s ? '' : 'COVERAGE=false'
69
+ end
70
+ parser.on('--rescue', 'Run with pry-rescue') do
71
+ if opts[:executer] == 'spring'
72
+ puts 'Disabled pry-rescue. Not compatible with spring.'
73
+ else
74
+ opts[:rescue] = 'rescue '
75
+ end
76
+ end
77
+ parser.on('--[no-]spring', 'Run with spring') do |spring|
78
+ if spring
79
+ opts[:executer] = 'spring'
80
+ if opts[:rescue]
81
+ opts[:rescue] = ''
82
+ puts 'Disabled pry-rescue. Not compatible with spring.'
83
+ end
84
+ else
85
+ opts[:executer] = 'bundle exec'
86
+ end
87
+ end
88
+ parser.separator "\n"
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -7,7 +7,7 @@ WAGN_SEED_PATH = File.join(
7
7
  )
8
8
 
9
9
  def prepare_migration
10
- Card::Cache.reset_global
10
+ Card::Cache.reset_all
11
11
  Card.config.action_mailer.perform_deliveries = false
12
12
  Card.reset_column_information
13
13
  # this is needed in production mode to insure core db
@@ -93,7 +93,7 @@ namespace :wagn do
93
93
 
94
94
  desc 'reset cache'
95
95
  task reset_cache: :environment do
96
- Card::Cache.reset_global
96
+ Card::Cache.reset_all
97
97
  end
98
98
 
99
99
  desc 'set symlink for assets'
@@ -119,7 +119,7 @@ namespace :wagn do
119
119
  end
120
120
 
121
121
  puts 'migrating core cards'
122
- Card::Cache.reset_global
122
+ Card::Cache.reset_all
123
123
  Rake::Task['wagn:migrate:core_cards'].execute #not invoke because we don't want to reload environment
124
124
  if stamp
125
125
  Rake::Task['wagn:migrate:stamp'].reenable
@@ -134,7 +134,7 @@ namespace :wagn do
134
134
  Rake::Task['wagn:migrate:stamp'].invoke :deck_cards
135
135
  end
136
136
 
137
- Card::Cache.reset_global
137
+ Card::Cache.reset_all
138
138
  end
139
139
 
140
140
  desc 'insert existing card migrations into schema_migrations_cards to avoid re-migrating'
@@ -165,7 +165,7 @@ namespace :wagn do
165
165
  task core_cards: :environment do
166
166
  require 'card/core_migration'
167
167
 
168
- Card::Cache.reset_global
168
+ Card::Cache.reset_all
169
169
  ENV['SCHEMA'] ||= "#{Cardio.gem_root}/db/schema.rb"
170
170
  prepare_migration
171
171
  paths = Cardio.migration_paths(:core_cards)
@@ -183,7 +183,7 @@ namespace :wagn do
183
183
  task deck_cards: :environment do
184
184
  require 'card/migration'
185
185
 
186
- Card::Cache.reset_global
186
+ Card::Cache.reset_all
187
187
  ENV['SCHEMA'] ||= "#{Cardio.gem_root}/db/schema.rb"
188
188
  prepare_migration
189
189
  paths = ActiveRecord::Migrator.migrations_paths = Cardio.migration_paths(:deck_cards)
@@ -247,17 +247,17 @@ namespace :wagn do
247
247
  namespace :bootstrap do
248
248
  desc 'rid template of unneeded cards, acts, actions, changes, and references'
249
249
  task clean: :environment do
250
- Card::Cache.reset_global
250
+ Card::Cache.reset_all
251
251
  clear_history
252
252
  delete_unwanted_cards
253
253
  Card.empty_trash
254
254
  correct_time_and_user_stamps
255
- Card::Cache.reset_global
255
+ Card::Cache.reset_all
256
256
  end
257
257
 
258
258
  desc 'dump db to bootstrap fixtures'
259
259
  task dump: :environment do
260
- Card::Cache.reset_global
260
+ Card::Cache.reset_all
261
261
 
262
262
  # FIXME temporarily taking this out!!
263
263
  Rake::Task['wagn:bootstrap:copy_mod_files'].invoke
@@ -354,7 +354,7 @@ def delete_unwanted_cards
354
354
  card.delete!
355
355
  end
356
356
  end
357
- Card::Cache.reset_global
357
+ Card::Cache.reset_all
358
358
  # FIXME: can this be associated with the machine module somehow?
359
359
  %w{ machine_input machine_output }.each do |codename|
360
360
  Card.search(:right=>{:codename=>codename }).each do |card|
@@ -128,7 +128,7 @@ class CardController < ActionController::Base
128
128
  when Card::Format.tagged(params[:view], :unknown_ok)
129
129
  ''
130
130
  else
131
- Card.setting(:home) || 'Home'
131
+ Card.global_setting(:home) || 'Home'
132
132
  end
133
133
  end
134
134
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wagn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.15
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-01-06 00:00:00.000000000 Z
14
+ date: 2016-01-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -33,14 +33,14 @@ dependencies:
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 1.16.15
36
+ version: 1.17.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 1.16.15
43
+ version: 1.17.0
44
44
  description: a wiki approach to stuctured data, dynamic interaction, and web design
45
45
  email:
46
46
  - info@wagn.org
@@ -155,6 +155,7 @@ files:
155
155
  - lib/wagn/generators/wagn/templates/spec/spec_helper.rb
156
156
  - lib/wagn/generators/wagn/wagn_generator.rb
157
157
  - lib/wagn/mods_spec_helper.rb
158
+ - lib/wagn/parser.rb
158
159
  - lib/wagn/script_wagn_loader.rb
159
160
  - lib/wagn/simplecov_helper.rb
160
161
  - lib/wagn/tasks/.gitkeep