wagn 1.14.4 → 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/card_controller.rb +4 -3
- data/db/bootstrap/card_actions.yml +597 -583
- data/db/bootstrap/card_acts.yml +2 -2
- data/db/bootstrap/card_changes.yml +297 -248
- data/db/bootstrap/card_references.yml +3111 -1284
- data/db/bootstrap/cards.yml +1067 -1022
- data/db/migrate_core_cards/20141208132416_partial_reference_type.rb +7 -0
- data/db/migrate_core_cards/20141208162106_add_ace_script.rb +12 -0
- data/db/migrate_core_cards/20141230204340_uri_codename.rb +13 -0
- data/db/version_core_cards.txt +1 -1
- data/features/history.feature +2 -1
- data/features/layouts.feature +4 -0
- data/features/navbox.feature +1 -0
- data/features/step_definitions/wagn_steps.rb +6 -1
- data/features/support/env.rb +1 -1
- data/lib/card/env.rb +1 -1
- data/lib/card/format.rb +35 -48
- data/lib/card/loader.rb +9 -9
- data/lib/card/mailer.rb +0 -2
- data/lib/card/query.rb +8 -8
- data/lib/card/query/{card_spec.rb → card_clause.rb} +42 -42
- data/lib/card/query/{spec.rb → clause.rb} +3 -3
- data/lib/card/query/ref_clause.rb +47 -0
- data/lib/card/query/value_clause.rb +65 -0
- data/lib/card/reference.rb +11 -20
- data/lib/card/set.rb +6 -6
- data/lib/card/set_pattern.rb +5 -1
- data/lib/wagn/commands.rb +28 -14
- data/lib/wagn/config/environments/test.rb +3 -0
- data/lib/wagn/generators/wagn/templates/Gemfile +6 -0
- data/lib/wagn/generators/wagn/templates/Rakefile +1 -0
- data/lib/wagn/generators/wagn/templates/config/application.rb +1 -0
- data/lib/wagn/generators/wagn/templates/spec/javascripts/support/deck_jasmine.yml +56 -0
- data/lib/wagn/generators/wagn/templates/spec/javascripts/support/wagn_jasmine.yml +69 -0
- data/lib/wagn/generators/wagn/wagn_generator.rb +19 -2
- data/lib/wagn/migration.rb +10 -0
- data/lib/wagn/spec_helper.rb +2 -0
- data/lib/wagn/tasks/wagn.rake +9 -16
- data/mod/01_core/chunk/link.rb +2 -2
- data/mod/01_core/chunk/uri.rb +4 -4
- data/mod/01_core/format/html_format.rb +43 -280
- data/mod/01_core/set/all/active_card.rb +2 -0
- data/mod/01_core/set/all/collection.rb +19 -1
- data/mod/01_core/set/all/fetch.rb +5 -0
- data/mod/01_core/set/all/initialize.rb +1 -1
- data/mod/01_core/set/all/references.rb +25 -8
- data/mod/01_core/set/all/templating.rb +1 -1
- data/mod/01_core/set/all/tracked_attributes.rb +1 -1
- data/mod/01_core/set/all/type.rb +1 -1
- data/mod/01_core/set/all/utils.rb +1 -0
- data/mod/01_core/set_pattern/07_type_plus_right.rb +2 -1
- data/mod/01_core/spec/format/html_format_spec.rb +0 -2
- data/mod/01_core/spec/set/all/initialize_spec.rb +4 -4
- data/mod/01_core/spec/set/all/notify_spec.rb +9 -9
- data/mod/02_basic_types/set/type/pointer.rb +19 -8
- data/mod/03_machines/lib/javascript/ace.js +18204 -0
- data/mod/03_machines/lib/javascript/jquery-ui.js +13109 -11440
- data/mod/03_machines/lib/javascript/jquery.autosize.js +52 -33
- data/mod/03_machines/lib/javascript/jquery.fileupload.js +10 -8
- data/mod/03_machines/lib/javascript/jquery.iframe-transport.js +44 -16
- data/mod/03_machines/lib/javascript/jquery.js +4 -9473
- data/mod/03_machines/lib/javascript/jquery_ujs.js +156 -116
- data/mod/03_machines/lib/javascript/jquerymobile.js +14890 -8236
- data/mod/03_machines/lib/javascript/theme-textmate.js +130 -0
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +50 -10
- data/mod/03_machines/set/self/script_ace.rb +8 -0
- data/mod/03_machines/set/type/coffee_script.rb +1 -1
- data/mod/03_machines/set/type/css.rb +0 -2
- data/mod/03_machines/set/type/java_script.rb +1 -1
- data/mod/03_machines/spec/lib/{machine_spec.rb → shared_machine_examples.rb} +0 -0
- data/mod/03_machines/spec/lib/{machine_input_spec.rb → shared_machine_input_examples.rb} +0 -0
- data/mod/03_machines/spec/set/type/scss_spec.rb +2 -2
- data/mod/04_settings/set/right/comment.rb +2 -2
- data/mod/04_settings/set/type/setting.rb +2 -2
- data/mod/04_settings/spec/set/right/structure_spec.rb +2 -2
- data/mod/04_settings/spec/set/right/style_spec.rb +1 -1
- data/mod/05_email/set/type/email_template.rb +3 -2
- data/mod/05_standard/set/all/all_css.rb +1 -1
- data/mod/05_standard/set/all/all_js.rb +1 -1
- data/mod/05_standard/set/all/attach.rb +8 -7
- data/mod/05_standard/set/all/base.rb +6 -34
- data/mod/05_standard/set/all/editing.rb +145 -0
- data/mod/05_standard/set/all/error.rb +203 -0
- data/mod/05_standard/set/all/follow.rb +2 -2
- data/mod/05_standard/set/all/form.rb +211 -0
- data/mod/05_standard/set/all/header.rb +60 -0
- data/mod/05_standard/set/all/history.rb +3 -3
- data/mod/05_standard/set/all/links.rb +101 -0
- data/mod/05_standard/set/all/rich_html.rb +14 -392
- data/mod/05_standard/set/all/wrapper.rb +74 -0
- data/mod/05_standard/set/right/account.rb +1 -2
- data/mod/05_standard/set/rstar/rules.rb +5 -5
- data/mod/05_standard/set/self/account_links.rb +8 -4
- data/mod/05_standard/set/self/head.rb +3 -3
- data/mod/05_standard/set/self/signin.rb +5 -3
- data/mod/05_standard/set/type/search_type.rb +25 -25
- data/mod/05_standard/set/type/set.rb +2 -2
- data/mod/05_standard/set/type/signup.rb +0 -2
- data/mod/05_standard/set/type/uri.rb +11 -0
- data/mod/05_standard/spec/set/all/rich_html_spec.rb +6 -6
- data/mod/05_standard/spec/set/all/rss_spec.rb +1 -1
- data/mod/05_standard/spec/set/type/signup_spec.rb +0 -1
- data/mod/05_standard/spec/set/type/uri_spec.rb +41 -0
- data/public/assets/ace/mode-coffee.js +1 -0
- data/public/assets/ace/mode-css.js +1 -0
- data/public/assets/ace/mode-html.js +1 -0
- data/public/assets/ace/mode-javascript.js +1 -0
- data/public/assets/ace/mode-json.js +1 -0
- data/public/assets/ace/mode-scss.js +922 -0
- data/public/assets/ace/theme-github.js +98 -0
- data/public/assets/ace/theme-textmate.js +1 -0
- data/public/assets/ace/worker-coffee.js +1 -0
- data/public/assets/ace/worker-css.js +1 -0
- data/public/assets/ace/worker-html.js +1 -0
- data/public/assets/ace/worker-javascript.js +1 -0
- data/public/assets/ace/worker-json.js +1 -0
- data/spec/controllers/card_controller_spec.rb +0 -1
- data/spec/controllers/location_spec.rb +0 -2
- data/spec/javascripts/helpers/jasmine-jquery.js +812 -0
- data/spec/javascripts/support/jasmine.yml +8 -6
- data/spec/javascripts/support/jasmine_config.rb +1 -1
- data/spec/javascripts/support/jasmine_runner.rb +1 -1
- data/spec/javascripts/wagn_spec.coffee +2 -0
- data/spec/lib/card/content_spec.rb +28 -6
- data/spec/lib/card/format_spec.rb +62 -15
- data/spec/lib/card/reference_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -2
- data/test/fixtures/card_actions.yml +1260 -1239
- data/test/fixtures/card_acts.yml +347 -341
- data/test/fixtures/card_changes.yml +2345 -2276
- data/test/fixtures/card_references.yml +4098 -1606
- data/test/fixtures/cards.yml +1950 -1887
- metadata +39 -13
- data/lib/card/query/ref_spec.rb +0 -37
- data/lib/card/query/value_spec.rb +0 -65
- data/lib/wagn/location.rb +0 -93
- data/spec/javascripts/helpers/jasmine-config.js +0 -2
- data/spec/javascripts/helpers/jasmine-jquery-1.3.1.js +0 -295
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
|
-
class Card::Query::
|
3
|
-
attr_accessor :
|
2
|
+
class Card::Query::Clause
|
3
|
+
attr_accessor :clause
|
4
4
|
|
5
5
|
def safe_sql(txt)
|
6
6
|
txt = txt.to_s
|
@@ -9,7 +9,7 @@ class Card::Query::Spec
|
|
9
9
|
|
10
10
|
def quote(v) ActiveRecord::Base.connection.quote(v) end
|
11
11
|
|
12
|
-
def match_prep(v
|
12
|
+
def match_prep(v)
|
13
13
|
cxn ||= ActiveRecord::Base.connection
|
14
14
|
[cxn, v]
|
15
15
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class Card::Query
|
2
|
+
class RefClause < Clause
|
3
|
+
REFERENCE_DEFINITIONS = {
|
4
|
+
# syntax:
|
5
|
+
# wql query key => [ direction, {reference_type} ]
|
6
|
+
# direction = :out | :in
|
7
|
+
# reference_type = 'L' | 'I' | 'P'
|
8
|
+
|
9
|
+
:refer_to => [ :out, 'L','I' ], :referred_to_by => [ :in, 'L','I' ],
|
10
|
+
:link_to => [ :out, 'L' ], :linked_to_by => [ :in, 'L' ],
|
11
|
+
:include => [ :out, 'I' ], :included_by => [ :in, 'I' ]
|
12
|
+
}
|
13
|
+
|
14
|
+
REFERENCE_FIELDS = {
|
15
|
+
:out => [ :referer_id, :referee_id ],
|
16
|
+
:in => [ :referee_id, :referer_id ]
|
17
|
+
}
|
18
|
+
|
19
|
+
def initialize key, val, parent
|
20
|
+
@key, @val, @parent = key, val, parent
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_sql *args
|
24
|
+
dir, *type = REFERENCE_DEFINITIONS[ @key.to_sym ]
|
25
|
+
field1, field2 = REFERENCE_FIELDS[ dir ]
|
26
|
+
cond = []
|
27
|
+
if type.present?
|
28
|
+
operator = (type.size==1 ? '=' : 'IN')
|
29
|
+
quoted_letters = type.map { |letter| "'#{letter}'" } * ', '
|
30
|
+
cond << "ref_type #{operator} (#{quoted_letters})"
|
31
|
+
end
|
32
|
+
|
33
|
+
sql = %[select distinct #{field1} as ref_id from card_references]
|
34
|
+
if @val == '_none'
|
35
|
+
cond << "present = 0"
|
36
|
+
else
|
37
|
+
cardclause = CardClause.build(:return=>'id', :_parent=>@parent).merge(@val)
|
38
|
+
sql << %[ join #{ cardclause.to_sql } as c on #{field2} = c.id]
|
39
|
+
end
|
40
|
+
sql << %[ where #{ cond * ' and ' }] if cond.any?
|
41
|
+
|
42
|
+
"(#{sql})"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class Card::Query
|
2
|
+
class ValueClause < Clause
|
3
|
+
def initialize clause, cardclause
|
4
|
+
@cardclause = cardclause
|
5
|
+
|
6
|
+
# bare value shortcut
|
7
|
+
@clause = case clause
|
8
|
+
when ValueClause; clause.instance_variable_get('@clause') # FIXME what a hack (what's this for?)
|
9
|
+
when Array; clause
|
10
|
+
when String; ['=', clause]
|
11
|
+
when Integer; ['=', clause]
|
12
|
+
else raise("Invalid Condition Clause #{clause.inspect}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# operator aliases
|
16
|
+
@clause[0] = @clause[0].to_s
|
17
|
+
if target = OPERATORS[@clause[0]]
|
18
|
+
@clause[0] = target
|
19
|
+
end
|
20
|
+
|
21
|
+
# check valid operator
|
22
|
+
raise("Invalid Operator #{@clause[0]}") unless OPERATORS.has_key?(@clause[0])
|
23
|
+
|
24
|
+
# handle IN #FIXME -- shouldn't this handle "not in", too?
|
25
|
+
if @clause[0]=='in' and !@clause[1].is_a?(CardClause) and !@clause[1].is_a?(RefClause)
|
26
|
+
@clause = [@clause[0], @clause[1..-1]]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def op
|
31
|
+
@clause[0]
|
32
|
+
end
|
33
|
+
|
34
|
+
def sqlize(v)
|
35
|
+
case v
|
36
|
+
when CardClause, RefClause, SqlCond; v.to_sql
|
37
|
+
when Array; "(" + v.flatten.collect {|x| sqlize(x)}.join(',') + ")"
|
38
|
+
else quote(v.to_s)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_sql field
|
43
|
+
op,v = @clause
|
44
|
+
#warn "to_sql(#{field}), #{op}, #{v}, #{@cardclause.inspect}"
|
45
|
+
v=@cardclause.selfname if v=='_self'
|
46
|
+
table = @cardclause.table_alias
|
47
|
+
|
48
|
+
#warn "to_sql #{field}, #{v} (#{op})"
|
49
|
+
field, v = case field
|
50
|
+
when "cond"; return "(#{sqlize(v)})"
|
51
|
+
when "name"; ["#{table}.key", [v].flatten.map(&:to_name).map(&:key)]
|
52
|
+
when "content"; ["#{table}.db_content", v]
|
53
|
+
else; ["#{table}.#{safe_sql(field)}", v]
|
54
|
+
end
|
55
|
+
|
56
|
+
v = v[0] if Array===v && v.length==1 && op != 'in'
|
57
|
+
if op=='~'
|
58
|
+
cxn, v = match_prep(v)
|
59
|
+
%{#{field} #{cxn.match(sqlize(v))}}
|
60
|
+
else
|
61
|
+
"#{field} #{op} #{sqlize(v)}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/card/reference.rb
CHANGED
@@ -40,30 +40,21 @@ class Card::Reference < ActiveRecord::Base
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def repair_missing_referees
|
43
|
-
|
43
|
+
#FIXME - should treat trashed cards as not existing
|
44
|
+
where( Card.where( :id=>arel_table[:referee_id], :trash=>false).exists.not ).update_all :referee_id=>nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete_missing_referers
|
48
|
+
where( Card.where( :id=>arel_table[:referer_id], :trash=>false).exists.not ).delete_all
|
44
49
|
end
|
45
50
|
|
46
51
|
def repair_all
|
47
|
-
|
48
|
-
Card.update_all :references_expired => 1
|
49
|
-
|
50
|
-
expired_cards_remain = true
|
51
|
-
batchsize, count_updated = 100, 0
|
52
|
-
|
53
|
-
while expired_cards_remain
|
54
|
-
batch = Card.find_all_by_references_expired(1, :order=>"name ASC", :limit=>batchsize)
|
55
|
-
if batch.empty?
|
56
|
-
expired_cards_remain = false
|
57
|
-
else
|
58
|
-
Rails.logger.debug "Updating references for '#{batch.first.name}' to '#{batch.last.name}' ... "; $stdout.flush
|
59
|
-
batch.each do |card|
|
60
|
-
count_updated += 1
|
61
|
-
card.update_references
|
62
|
-
end
|
63
|
-
Rails.logger.info "batch done. \t\t#{count_updated} total updated"
|
64
|
-
end
|
65
|
-
end
|
52
|
+
delete_missing_referers
|
66
53
|
|
54
|
+
Card.where(:trash=>false).find_each do |card|
|
55
|
+
Rails.logger.info "\n\n\nRepairing references for '#{card.name}' (id: #{card.id}) ... \n\n\n"
|
56
|
+
card.update_references
|
57
|
+
end
|
67
58
|
end
|
68
59
|
|
69
60
|
end
|
data/lib/card/set.rb
CHANGED
@@ -195,22 +195,23 @@ class Card
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
-
def write_tmp_file set_pattern,
|
198
|
+
def write_tmp_file set_pattern, anchors, from_file, seq
|
199
199
|
# FIXME - this does not properly handle anchorless sets
|
200
200
|
# There are special hacks for *all, but others (like *rstar) will not be found by
|
201
201
|
# include_set_modules, which will look for Card::Set::Rstar, not Card::Set::Rstar::Blah
|
202
202
|
|
203
|
-
to_file = "#{Wagn.paths['tmp/set'].first}/#{set_pattern}/#{seq}-#{
|
203
|
+
to_file = "#{Wagn.paths['tmp/set'].first}/#{set_pattern}/#{seq}-#{anchors.join '-'}.rb"
|
204
|
+
anchor_modules = anchors.map { |a| "module #{a.camelize};" }.join
|
204
205
|
file_content = <<EOF
|
205
206
|
# -*- encoding : utf-8 -*-
|
206
|
-
class Card; module Set; module #{set_pattern.camelize};
|
207
|
+
class Card; module Set; module #{set_pattern.camelize}; #{anchor_modules}
|
207
208
|
extend Card::Set
|
208
209
|
# ~~~~~~~~~~~ above autogenerated; below pulled from #{from_file} ~~~~~~~~~~~
|
209
210
|
|
210
211
|
#{ File.read from_file }
|
211
212
|
|
212
213
|
# ~~~~~~~~~~~ below autogenerated; above pulled from #{from_file} ~~~~~~~~~~~
|
213
|
-
end;end;end;
|
214
|
+
end;end;end;#{'end;'*anchors.size}
|
214
215
|
EOF
|
215
216
|
File.write to_file, file_content
|
216
217
|
to_file
|
@@ -275,8 +276,7 @@ EOF
|
|
275
276
|
first = 2 # shortname eliminates Card::Set
|
276
277
|
set_class = Card::SetPattern.find parts[first].underscore
|
277
278
|
|
278
|
-
last = first +
|
279
|
-
#FIXME - handle multi-anchor sets like type_plus_right
|
279
|
+
last = first + set_class.anchor_parts_count
|
280
280
|
parts[first..last].join '::'
|
281
281
|
end
|
282
282
|
|
data/lib/card/set_pattern.rb
CHANGED
@@ -2,7 +2,7 @@ class Card
|
|
2
2
|
class SetPattern
|
3
3
|
|
4
4
|
class << self
|
5
|
-
attr_accessor :pattern_code, :pattern_id, :junction_only, :assigns_type, :anchorless
|
5
|
+
attr_accessor :pattern_code, :pattern_id, :junction_only, :assigns_type, :anchorless, :anchor_parts_count
|
6
6
|
|
7
7
|
def find pattern_code
|
8
8
|
Card.set_patterns.find { |sub| sub.pattern_code == pattern_code }
|
@@ -39,6 +39,10 @@ class Card
|
|
39
39
|
junction_only? ? card.cardname.junction? : true
|
40
40
|
end
|
41
41
|
|
42
|
+
def anchor_parts_count
|
43
|
+
@anchor_parts_count ||= ( anchorless? ? 0 : 1 )
|
44
|
+
end
|
45
|
+
|
42
46
|
def write_tmp_file pattern_code, from_file, seq
|
43
47
|
to_file = "#{Wagn.paths['tmp/set_pattern'].first}/#{seq}-#{pattern_code}.rb"
|
44
48
|
klass = "Card::#{pattern_code.camelize}Set"
|
data/lib/wagn/commands.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'optparse'
|
2
|
-
require 'active_support/core_ext/object/inclusion' # adds method in? to Object class
|
2
|
+
require 'active_support/core_ext/object/inclusion' # adds method in? to Object class
|
3
3
|
|
4
4
|
def load_rake_tasks
|
5
5
|
require './config/environment'
|
@@ -11,6 +11,7 @@ RAILS_COMMANDS = %w( generate destroy plugin benchmarker profiler console server
|
|
11
11
|
ALIAS = {
|
12
12
|
"rs" => "rspec",
|
13
13
|
"cc" => "cucumber",
|
14
|
+
"jm" => "jasmine",
|
14
15
|
"g" => "generate",
|
15
16
|
"d" => "destroy",
|
16
17
|
"c" => "console",
|
@@ -48,7 +49,7 @@ else
|
|
48
49
|
|
49
50
|
case command
|
50
51
|
when 'seed'
|
51
|
-
envs = [
|
52
|
+
envs = []
|
52
53
|
parser = OptionParser.new do |parser|
|
53
54
|
parser.banner = "Usage: wagn seed [options]\n\nCreate and seed the production database specified in config/database.yml\n\n"
|
54
55
|
parser.on('--production','-p', 'seed production database (default)') do
|
@@ -61,13 +62,19 @@ else
|
|
61
62
|
envs = ['development']
|
62
63
|
end
|
63
64
|
parser.on('--all', '-a', 'seed production, test, and development database') do
|
64
|
-
envs = %w( production development test)
|
65
|
+
envs = %w( production development test)
|
65
66
|
end
|
66
67
|
end
|
67
68
|
parser.parse!(ARGV)
|
68
|
-
|
69
|
-
|
70
|
-
puts
|
69
|
+
task_cmd="bundle exec rake wagn:create"
|
70
|
+
if envs.empty?
|
71
|
+
puts task_cmd
|
72
|
+
puts `#{task_cmd}`
|
73
|
+
else
|
74
|
+
envs.each do |env|
|
75
|
+
puts "env RAILS_ENV=#{env} #{task_cmd}"
|
76
|
+
puts `env RAILS_ENV=#{env} #{task_cmd}`
|
77
|
+
end
|
71
78
|
end
|
72
79
|
when 'update'
|
73
80
|
load_rake_tasks
|
@@ -77,14 +84,20 @@ else
|
|
77
84
|
require_args = "-r #{Wagn.gem_root}/features "
|
78
85
|
require_args += feature_paths.map { |path| "-r #{path}"}.join(' ')
|
79
86
|
feature_args = ARGV.empty? ? feature_paths.join(' ') : ARGV.join(' ')
|
80
|
-
system "RAILS_ROOT=. bundle exec cucumber #{require_args} #{feature_args}"
|
87
|
+
unless system "RAILS_ROOT=. bundle exec cucumber #{require_args} #{feature_args} 2>&1"
|
88
|
+
exit $?.exitstatus
|
89
|
+
end
|
90
|
+
when 'jasmine'
|
91
|
+
unless system "RAILS_ENV=test bundle exec rake spec:javascript 2>&1"
|
92
|
+
exit $?.exitstatus
|
93
|
+
end
|
81
94
|
when 'rspec'
|
82
95
|
opts = {}
|
83
96
|
require 'rspec/core'
|
84
97
|
parser = RSpec::Core::Parser.new.parser(opts)
|
85
98
|
parser.banner = "Usage: wagn rspec [WAGN ARGS] -- [RSPEC ARGS]\n\nRSPEC ARGS"
|
86
|
-
parser.separator <<-WAGN
|
87
|
-
|
99
|
+
parser.separator <<-WAGN
|
100
|
+
|
88
101
|
WAGN ARGS
|
89
102
|
|
90
103
|
You don't have to give a full path for FILENAME, the basename is enough
|
@@ -128,8 +141,10 @@ WAGN
|
|
128
141
|
wagn_args, rspec_args = (' '<<ARGV.join(' ')).split(' -- ')
|
129
142
|
parser.parse!(wagn_args.split(' '))
|
130
143
|
|
131
|
-
rspec_command = "RAILS_ROOT=. #{opts[:simplecov]} #{opts[:executer]} #{opts[:rescue]} rspec #{rspec_args} #{opts[:files]}"
|
132
|
-
system rspec_command
|
144
|
+
rspec_command = "RAILS_ROOT=. #{opts[:simplecov]} #{opts[:executer]} #{opts[:rescue]} rspec #{rspec_args} #{opts[:files]} 2>&1"
|
145
|
+
unless system rspec_command
|
146
|
+
exit $?.exitstatus
|
147
|
+
end
|
133
148
|
when '--version', '-v'
|
134
149
|
puts "Wagn #{Wagn::Version.release}"
|
135
150
|
when 'new'
|
@@ -150,12 +165,12 @@ WAGN
|
|
150
165
|
new Create a new Wagn deck. "wagn new my_deck" creates a
|
151
166
|
new deck called MyDeck in "./my_deck"
|
152
167
|
seed Create and seed the database specified in config/database.yml
|
153
|
-
|
168
|
+
|
154
169
|
server Start the Rails server (short-cut alias: "s")
|
155
170
|
console Start the Rails console (short-cut alias: "c")
|
156
171
|
dbconsole Start a console for the database specified in config/database.yml
|
157
172
|
(short-cut alias: "db")
|
158
|
-
|
173
|
+
|
159
174
|
For core developers
|
160
175
|
cucumber Run cucumber features (short-cut alias: "cc")
|
161
176
|
rspec Run rspec tests (short-cut alias: "rs")
|
@@ -177,4 +192,3 @@ WAGN
|
|
177
192
|
end
|
178
193
|
|
179
194
|
|
180
|
-
|
@@ -8,6 +8,9 @@ Wagn.application.class.configure do
|
|
8
8
|
# and recreated between test runs. Don't rely on the data there!
|
9
9
|
config.cache_classes = true
|
10
10
|
|
11
|
+
|
12
|
+
config.assets.enabled = true if Object.const_defined?( :JasmineRails )
|
13
|
+
|
11
14
|
# Configure static asset server for tests with Cache-Control for performance
|
12
15
|
config.serve_static_assets = true
|
13
16
|
config.static_cache_control = "public, max-age=3600"
|
@@ -21,6 +21,9 @@ end
|
|
21
21
|
|
22
22
|
group :test, :development do
|
23
23
|
gem 'rails-dev-tweaks'
|
24
|
+
gem 'jasmine'
|
25
|
+
gem 'jasmine-rails', :git=>"https://github.com/chuenlok/jasmine-rails.git"
|
26
|
+
gem 'jasmine-jquery-rails'
|
24
27
|
gem 'sprockets' # just so above works
|
25
28
|
# gem 'spring'
|
26
29
|
# gem 'spring-commands-rspec'
|
@@ -97,6 +100,9 @@ group :development, :test do
|
|
97
100
|
gem 'pry-rails'
|
98
101
|
gem 'pry-rescue'
|
99
102
|
gem 'pry-stack_explorer'
|
103
|
+
gem 'jasmine'
|
104
|
+
gem 'jasmine-rails', :git=>"https://github.com/chuenlok/jasmine-rails.git"
|
105
|
+
gem 'jasmine-jquery-rails'
|
100
106
|
end
|
101
107
|
|
102
108
|
group :debug do
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# path to parent directory of src_files
|
2
|
+
# relative path from Rails.root
|
3
|
+
# defaults to app/assets/javascripts
|
4
|
+
# useless in wagn file structure
|
5
|
+
src_dir: "mod"
|
6
|
+
#"app/assets/javascripts"
|
7
|
+
|
8
|
+
# path to additional directory of source file that are not part of assets pipeline and need to be included
|
9
|
+
# relative path from Rails.root
|
10
|
+
# defaults to []
|
11
|
+
# include_dir:
|
12
|
+
# - ../mobile_app/public/js
|
13
|
+
|
14
|
+
# path to parent directory of css_files
|
15
|
+
# relative path from Rails.root
|
16
|
+
# defaults to app/assets/stylesheets
|
17
|
+
# useless in wagn file structure
|
18
|
+
css_dir: "mod"
|
19
|
+
|
20
|
+
# list of file expressions to include as source files
|
21
|
+
# relative path from src_dir
|
22
|
+
src_files:
|
23
|
+
- "**/*.{js.coffee,js,coffee}"
|
24
|
+
|
25
|
+
# list of file expressions to include as css files
|
26
|
+
# relative path from css_dir
|
27
|
+
css_files:
|
28
|
+
# - "**/*.{css,scss}"
|
29
|
+
# THIS IS IMPORTANT!!
|
30
|
+
include_dir: "mod"
|
31
|
+
#- <%= Wagn.gem_root+"/mod/03_machines/lib/javascript" %>
|
32
|
+
# path to parent directory of spec_files
|
33
|
+
# relative path from Rails.root
|
34
|
+
#
|
35
|
+
# Alternatively accept an array of directory to include external spec files
|
36
|
+
# spec_dir:
|
37
|
+
# - spec/javascripts
|
38
|
+
# - ../engine/spec/javascripts
|
39
|
+
#
|
40
|
+
# defaults to spec/javascripts
|
41
|
+
spec_dir: "spec/javascripts"
|
42
|
+
|
43
|
+
# list of file expressions to include as helpers into spec runner
|
44
|
+
# relative path from spec_dir
|
45
|
+
helpers:
|
46
|
+
- "helpers/**/*.{js.coffee,js,coffee}"
|
47
|
+
|
48
|
+
# list of file expressions to include as specs into spec runner
|
49
|
+
# relative path from spec_dir
|
50
|
+
spec_files:
|
51
|
+
- "**/*[Ss]pec.{js.coffee,js,coffee}"
|
52
|
+
|
53
|
+
# path to directory of temporary files
|
54
|
+
# (spec runner and asset cache)
|
55
|
+
# defaults to tmp/jasmine
|
56
|
+
tmp_dir: "tmp/jasmine"
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# path to parent directory of src_files
|
2
|
+
# relative path from Rails.root
|
3
|
+
# defaults to app/assets/javascripts
|
4
|
+
# useless for wagn file structure
|
5
|
+
src_dir: <%= Wagn.gem_root+"/mod/03_machines/lib/javascript" %>
|
6
|
+
#"app/assets/javascripts"
|
7
|
+
|
8
|
+
# path to additional directory of source file that are not part of assets pipeline and need to be included
|
9
|
+
# relative path from Rails.root
|
10
|
+
# defaults to []
|
11
|
+
# include_dir:
|
12
|
+
# - ../mobile_app/public/js
|
13
|
+
|
14
|
+
# path to parent directory of css_files
|
15
|
+
# relative path from Rails.root
|
16
|
+
# defaults to app/assets/stylesheets
|
17
|
+
# useless for wagn file structure
|
18
|
+
css_dir: <%= Wagn.gem_root+"/mod/03_machines/lib/stylesheets" %>
|
19
|
+
|
20
|
+
# list of file expressions to include as source files
|
21
|
+
# relative path from src_dir
|
22
|
+
src_files:
|
23
|
+
- jquery.js
|
24
|
+
- tinymce.js
|
25
|
+
- wagn_mod.js.coffee
|
26
|
+
- wagn.js.coffee
|
27
|
+
- wagn_menu.js
|
28
|
+
# - jquerymobile.js
|
29
|
+
- jquery-ui.js
|
30
|
+
- jquery.ui.autocomplete.html.js
|
31
|
+
- jquery.autosize.js
|
32
|
+
- jquery.fileupload.js
|
33
|
+
- jquery.iframe-transport.js
|
34
|
+
- jquery_ujs.js
|
35
|
+
- ace.js
|
36
|
+
#- "**/*.{js.coffee,js,coffee}"
|
37
|
+
|
38
|
+
# list of file expressions to include as css files
|
39
|
+
# relative path from css_dir
|
40
|
+
css_files:
|
41
|
+
# - "**/*.{css,scss}"
|
42
|
+
# THIS IS IMPORTANT!!!
|
43
|
+
include_dir:
|
44
|
+
- <%= Wagn.gem_root+"/mod/03_machines/lib/javascript" %>
|
45
|
+
# path to parent directory of spec_files
|
46
|
+
# relative path from Rails.root
|
47
|
+
#
|
48
|
+
# Alternatively accept an array of directory to include external spec files
|
49
|
+
# spec_dir:
|
50
|
+
# - spec/javascripts
|
51
|
+
# - ../engine/spec/javascripts
|
52
|
+
#
|
53
|
+
# defaults to spec/javascripts
|
54
|
+
spec_dir: <%= Wagn.gem_root+"/spec/javascripts" %>
|
55
|
+
|
56
|
+
# list of file expressions to include as helpers into spec runner
|
57
|
+
# relative path from spec_dir
|
58
|
+
helpers:
|
59
|
+
- "helpers/**/*.{js.coffee,js,coffee}"
|
60
|
+
|
61
|
+
# list of file expressions to include as specs into spec runner
|
62
|
+
# relative path from spec_dir
|
63
|
+
spec_files:
|
64
|
+
- "**/*[Ss]pec.{js.coffee,js,coffee}"
|
65
|
+
|
66
|
+
# path to directory of temporary files
|
67
|
+
# (spec runner and asset cache)
|
68
|
+
# defaults to tmp/jasmine
|
69
|
+
tmp_dir: "tmp/jasmine"
|