wagn 1.13.0.pre → 1.13.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/controllers/card_controller.rb +4 -2
  4. data/db/bootstrap/card_references.yml +443 -408
  5. data/db/bootstrap/card_revisions.yml +1025 -1116
  6. data/db/bootstrap/cards.yml +2168 -2151
  7. data/db/migrate_cards/20140512155840_add_script_cards.rb +1 -0
  8. data/features/step_definitions/wagn_steps.rb +16 -3
  9. data/features/watch.feature +1 -1
  10. data/lib/card/content.rb +1 -1
  11. data/lib/card/format.rb +6 -4
  12. data/lib/card/generators/card_migration/USAGE +1 -1
  13. data/lib/card/mailer.rb +2 -1
  14. data/lib/card/mailer/confirmation_email.html.erb +6 -2
  15. data/lib/wagn/all.rb +0 -8
  16. data/lib/wagn/application.rb +29 -19
  17. data/lib/wagn/commands.rb +104 -2
  18. data/{config → lib/wagn/config}/environments/cucumber.rb +0 -0
  19. data/{config → lib/wagn/config}/environments/development.rb +0 -0
  20. data/{config → lib/wagn/config}/environments/production.rb +0 -0
  21. data/{config → lib/wagn/config}/environments/profile.rb +0 -0
  22. data/{config → lib/wagn/config}/environments/test.rb +0 -0
  23. data/{config → lib/wagn/config}/initializers/01_init_ruby_extensions.rb +0 -0
  24. data/{config → lib/wagn/config}/initializers/airbrake.rb +0 -1
  25. data/{config → lib/wagn/config}/initializers/inflections.rb +0 -0
  26. data/{config → lib/wagn/config}/initializers/mime_types.rb +0 -0
  27. data/{config → lib/wagn/config}/initializers/notification.rb +0 -0
  28. data/{config → lib/wagn/config}/initializers/recaptcha.rb +0 -0
  29. data/{config → lib/wagn/config}/initializers/secret_token.rb +0 -0
  30. data/{config → lib/wagn/config}/initializers/session_store.rb +0 -0
  31. data/{config → lib/wagn/config}/initializers/uuid_state_file.rb +0 -0
  32. data/lib/wagn/generators/wagn/USAGE +5 -4
  33. data/lib/wagn/generators/wagn/templates/Gemfile +67 -2
  34. data/lib/wagn/generators/wagn/templates/config/application.rb +1 -1
  35. data/lib/wagn/generators/wagn/templates/config/cucumber.yml +1 -0
  36. data/lib/wagn/generators/wagn/templates/config/databases/frontbase.yml +4 -2
  37. data/lib/wagn/generators/wagn/templates/config/databases/ibm_db.yml +4 -2
  38. data/lib/wagn/generators/wagn/templates/config/databases/jdbc.yml +5 -3
  39. data/lib/wagn/generators/wagn/templates/config/databases/jdbcmysql.yml +4 -2
  40. data/lib/wagn/generators/wagn/templates/config/databases/jdbcpostgresql.yml +4 -2
  41. data/lib/wagn/generators/wagn/templates/config/databases/jdbcsqlite3.yml +4 -2
  42. data/lib/wagn/generators/wagn/templates/config/databases/mysql.yml +5 -10
  43. data/lib/wagn/generators/wagn/templates/config/databases/oracle.yml +4 -2
  44. data/lib/wagn/generators/wagn/templates/config/databases/postgresql.yml +4 -15
  45. data/lib/wagn/generators/wagn/templates/config/databases/sqlite3.yml +4 -6
  46. data/lib/wagn/generators/wagn/templates/rspec +5 -0
  47. data/lib/wagn/generators/wagn/wagn_generator.rb +84 -1
  48. data/lib/wagn/mods_spec_helper.rb +66 -0
  49. data/lib/wagn/tasks/db.rake +2 -1
  50. data/lib/wagn/tasks/wagn.rake +5 -1
  51. data/lib/wagn/wagn_spec_helper.rb +49 -0
  52. data/mods/core/sets/all/content.rb +3 -3
  53. data/mods/core/sets/all/phases.rb +1 -2
  54. data/mods/standard/sets/all/attach.rb +1 -1
  55. data/mods/standard/sets/all/comment.rb +3 -3
  56. data/mods/standard/sets/all/rich_html.rb +6 -7
  57. data/mods/standard/sets/right/account.rb +14 -5
  58. data/mods/standard/sets/rstar/rules.rb +17 -4
  59. data/mods/standard/sets/self/signin.rb +2 -2
  60. data/mods/standard/sets/type/pointer.rb +1 -3
  61. data/mods/standard/sets/type/scss.rb +1 -1
  62. data/mods/standard/sets/type/signup.rb +33 -12
  63. data/mods/standard/sets/type/user.rb +1 -1
  64. data/spec/javascripts/support/jasmine_runner.rb +1 -1
  65. data/spec/mods/standard/sets/all/base_spec.rb +4 -0
  66. data/spec/mods/standard/sets/type/signup_spec.rb +52 -15
  67. data/spec/spec_helper.rb +12 -53
  68. data/test/fixtures/card_references.yml +688 -653
  69. data/test/fixtures/card_revisions.yml +1741 -1832
  70. data/test/fixtures/cards.yml +3484 -3467
  71. metadata +20 -21
  72. data/Gemfile +0 -77
  73. data/config/application.rb +0 -15
  74. data/config/boot.rb +0 -8
  75. data/config/environment.rb +0 -8
  76. data/lib/wagn/generators/wagn/templates/config/database.yml +0 -35
@@ -61,6 +61,7 @@ class AddScriptCards < ActiveRecord::Migration
61
61
  default_rule_ending = "#{ Card[:right].name }+#{ Card[ :default ].name }"
62
62
  Card.create! :name=>'*machine output', :codename=>:machine_output
63
63
  Card.create! :name=>"*machine output+#{default_rule_ending}", :type_id=>Card::FileID
64
+ Card.create! :name=>"*machine output+#{ Card[:right].name}+#{Card[:read].name}", :content=>'_left'
64
65
  Card.create! :name=>'*machine input', :codename=>:machine_input
65
66
  Card.create! :name=>"*machine input+#{default_rule_ending}", :type_id=>Card::PointerID
66
67
 
@@ -2,7 +2,12 @@
2
2
  require 'uri'
3
3
  require 'cgi'
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
- require 'debugger'
5
+
6
+ if RUBY_VERSION =~ /^2/
7
+ require 'byebug'
8
+ else
9
+ require 'debugger'
10
+ end
6
11
 
7
12
 
8
13
  Given /^site simulates setup need$/ do
@@ -134,7 +139,11 @@ Then /what/ do
134
139
  end
135
140
 
136
141
  Then /debug/ do
137
- debugger
142
+ if RUBY_VERSION =~ /^2/
143
+ byebug
144
+ else
145
+ debugger
146
+ end
138
147
  nil
139
148
  end
140
149
 
@@ -200,7 +209,11 @@ end
200
209
 
201
210
  Then /^In (.*) I should see "([^\"]*)"$/ do |section, text|
202
211
  within scope_of(section) do
203
- page.should have_content(text)
212
+ if text.index('|')
213
+ text.split('|').any? {|t| have_content(t)}.should be
214
+ else
215
+ page.should have_content(text)
216
+ end
204
217
  end
205
218
  end
206
219
 
@@ -17,7 +17,7 @@ Feature: Watch interface
17
17
  When I go to the homepage
18
18
  And I hover over the main menu
19
19
  And In the main card menu I click "follow"
20
- Then In the main card menu I should see "unfollow"
20
+ Then In the main card menu I should see "following|unfollow"
21
21
  # assumes focus still on that link. otherwise "following"
22
22
  # selenium behavior not totally consistent here.
23
23
  And the card Home+*watchers should contain "Joe User"
@@ -28,7 +28,7 @@ class Card
28
28
  case __getobj__
29
29
  when Array; map(&:to_s)*''
30
30
  when String; __getobj__
31
- when NilClass; raise "Nil Card::Content"
31
+ when NilClass; '' #raise "Nil Card::Content"
32
32
  else __getobj__.to_s
33
33
  end
34
34
  end
@@ -352,11 +352,11 @@ class Card
352
352
 
353
353
  def process_content_object content=nil, opts={}
354
354
  return content unless card
355
- content = card.content if content.blank?
355
+ content = card.content if content.nil?
356
356
 
357
357
  obj_content = Card::Content===content ? content : Card::Content.new( content, format=self )
358
358
 
359
- card.update_references( obj_content, true ) if card.references_expired # I thik we need this genralized
359
+ card.update_references( obj_content, true ) if card.references_expired # I thik we need this generalized
360
360
 
361
361
  obj_content.process_content_object do |chunk_opts|
362
362
  prepare_nest chunk_opts.merge(opts) { yield }
@@ -483,9 +483,10 @@ class Card
483
483
  end
484
484
 
485
485
  def nest nested_card, opts={}
486
+ #ActiveSupport::Notifications.instrument('wagn', message: "nest: #{nested_card.name}, #{opts}") do
486
487
  opts.delete_if { |k,v| v.nil? }
487
488
  opts.reverse_merge! inclusion_defaults
488
-
489
+
489
490
  sub = subformat nested_card
490
491
  sub.inclusion_opts = opts[:items] ? opts[:items].clone : {}
491
492
 
@@ -506,8 +507,9 @@ class Card
506
507
  when @mode == :closed ; !nested_card.known? ? :closed_missing : :closed_content
507
508
  else ; view
508
509
  end
509
-
510
+
510
511
  sub.render view, opts
512
+ #end
511
513
  end
512
514
 
513
515
  def get_inclusion_content cardname
@@ -3,7 +3,7 @@ Description:
3
3
  Generates a migration of database content
4
4
 
5
5
  Example:
6
- rails generate card_migration better_commented_search_cards
6
+ wagn generate card_migration better_commented_search_cards
7
7
 
8
8
  This will create:
9
9
 
@@ -15,7 +15,8 @@ class Card
15
15
 
16
16
  def confirmation_email account
17
17
  @site = Card.setting :title
18
- @link = wagn_url "/update/#{account.left.cardname.url_key}?token=#{account.token}"
18
+ @token = account.token
19
+ @link = wagn_url "/update/#{ account.left.cardname.url_key }?token=#{ @token }"
19
20
  @expiry = Wagn.config.token_expiry
20
21
 
21
22
  confirm_from = token_emails_from(account)
@@ -2,7 +2,11 @@
2
2
  <html>
3
3
  <body style="text-align:center">
4
4
  <h1>Thank you for signing up with <%= @site %></h1>
5
- <div>Please <a href="<%= @link %>">follow this link</a> to verify this email address and activate your account.</div>
6
- <div>(link will remain valid for <%= @expiry / 1.day %> days)</div>
5
+ <%- if @token %>
6
+ <div>Please <a href="<%= @link %>">follow this link</a> to verify this email address and activate your account.</div>
7
+ <div>(link will remain valid for <%= @expiry / 1.day %> days)</div>
8
+ <%- else %>
9
+ <div>You will receive further notification when your account is approved</div>
10
+ <%- end %>
7
11
  </body>
8
12
  </html>
@@ -1,13 +1,5 @@
1
1
  require 'rails/all'
2
2
 
3
- if Rails.env.development?
4
- if $LOAD_PATH.find { |path| File.exists? "#{path}/wagn/dev.rb" }
5
- require 'wagn/dev'
6
- else
7
- puts "WARNING: the gem wagn-dev is strongly recommended when running wagn in development mode but is not found"
8
- end
9
- end
10
-
11
3
  require 'htmlentities'
12
4
  require 'recaptcha'
13
5
  require 'airbrake'
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'wagn/all'
4
4
  require 'active_support/core_ext/numeric/time'
5
-
6
5
  if defined?(Bundler)
7
6
  # If you precompile assets before deploying to production, use this line
8
7
  Bundler.require *Rails.groups(:assets => %w(development test))
@@ -14,6 +13,20 @@ end
14
13
  module Wagn
15
14
  class Application < Rails::Application
16
15
 
16
+ initializer :load_wagn_environment_config, :before => :load_environment_config, :group => :all do
17
+ add_gem_path paths, "lib/wagn/config/environments", :glob => "#{Rails.env}.rb"
18
+ paths["lib/wagn/config/environments"].existent.each do |environment|
19
+ require environment
20
+ end
21
+ end
22
+
23
+ initializer :load_wagn_config_initializers, :before => :load_config_initializers do
24
+ add_gem_path paths, 'lib/wagn/config/initializers', :glob => "**/*.rb"
25
+ config.paths['lib/wagn/config/initializers'].existent.sort.each do |initializer|
26
+ load(initializer)
27
+ end
28
+ end
29
+
17
30
  class << self
18
31
  def inherited(base)
19
32
  Rails.application = base.instance
@@ -62,20 +75,17 @@ module Wagn
62
75
  def paths
63
76
  @paths ||= begin
64
77
  paths = super
65
- add_wagn_path paths, "app", :eager_load => true, :glob => "*"
66
- add_wagn_path paths, "app/assets", :glob => "*"
67
- add_wagn_path paths, "app/controllers", :eager_load => true
68
- add_wagn_path paths, "lib/tasks", :with => "lib/wagn/tasks", :glob => "**/*.rake"
69
- add_wagn_path paths, "config"
70
- add_wagn_path paths, "config/environments", :glob => "#{Rails.env}.rb"
71
- add_wagn_path paths, "config/initializers", :glob => "**/*.rb"
72
- add_wagn_path paths, "config/routes", :with => "config/routes.rb"
73
- add_wagn_path paths, "db"
74
- add_wagn_path paths, "db/migrate"
75
- add_wagn_path paths, "db/migrate_cards"
76
- add_wagn_path paths, "db/seeds", :with => "db/seeds.rb"
77
- add_wagn_path paths, 'gem-mods', :with => 'mods'
78
- add_wagn_path paths, 'gem-assets', :with => 'public/assets'
78
+ add_gem_path paths, "app", :eager_load => true, :glob => "*"
79
+ add_gem_path paths, "app/assets", :glob => "*"
80
+ add_gem_path paths, "app/controllers", :eager_load => true
81
+ add_gem_path paths, "lib/tasks", :with => "lib/wagn/tasks", :glob => "**/*.rake"
82
+ add_gem_path paths, "config/routes", :with => "config/routes.rb"
83
+ add_gem_path paths, "db"
84
+ add_gem_path paths, "db/migrate"
85
+ add_gem_path paths, "db/migrate_cards"
86
+ add_gem_path paths, "db/seeds", :with => "db/seeds.rb"
87
+ add_gem_path paths, 'gem-mods', :with => 'mods'
88
+ add_gem_path paths, 'gem-assets', :with => 'public/assets'
79
89
 
80
90
  paths['app/models'] = []
81
91
  paths['app/mailers'] = []
@@ -94,11 +104,11 @@ module Wagn
94
104
  Wagn.gem_root.to_s == config.root.to_s
95
105
  end
96
106
 
97
- def add_wagn_path paths, path, options={}
98
- wagn_path = File.join( Wagn.gem_root, path )
107
+ def add_gem_path paths, path, options={}
108
+ gem_path = File.join( Wagn.gem_root, path )
99
109
  options[:with] &&= File.join( Wagn.gem_root, options[:with])
100
- with = options[:with] || wagn_path
101
- paths[path] = Rails::Paths::Path.new(paths, wagn_path, with, options)
110
+ with = options[:with] || gem_path
111
+ paths[path] = Rails::Paths::Path.new(paths, gem_path, with, options)
102
112
  end
103
113
 
104
114
  def load_tasks(app=self)
@@ -1,2 +1,104 @@
1
- require 'wagn'
2
- require 'rails/commands'
1
+ def load_rake_tasks
2
+ require './config/environment'
3
+ require 'rake'
4
+ Wagn::Application.load_tasks
5
+ end
6
+
7
+ require 'active_support/core_ext/object/inclusion' # adds method in? to Object class
8
+
9
+ ARGV << '--help' if ARGV.empty?
10
+
11
+ aliases = {
12
+ "rs" => "rspec",
13
+ "cc" => "cucumber",
14
+ "g" => "generate",
15
+ "d" => "destroy",
16
+ "c" => "console",
17
+ "s" => "server",
18
+ "db" => "dbconsole",
19
+ "r" => "runner"
20
+ }
21
+
22
+ rails_commands = %w( generate destroy plugin benchmarker profiler console server dbconsole application runner )
23
+
24
+ if ARGV.first.in? rails_commands or aliases[ARGV.first].in? rails_commands
25
+ require 'wagn'
26
+ require 'rails/commands'
27
+ else
28
+ command = ARGV.shift
29
+ command = aliases[command] || command
30
+
31
+ case command
32
+ when 'seed'
33
+ #load_rake_tasks we can't load config/environment if the database doesn't exist, use config/application instead
34
+ require './config/application'
35
+ require 'wagn/migration_helper'
36
+ require 'rake'
37
+ Wagn::Application.load_tasks
38
+ Rake::Task['wagn:create'].invoke
39
+ if ARGV.include? "--test-data"
40
+ ENV['RELOAD_TEST_DATA'] = 'true'
41
+ Rake::Task['db:test:prepare'].invoke
42
+ end
43
+ when 'update'
44
+ load_rake_tasks
45
+ Rake::Taske['wagn:update'].invoke
46
+ when 'cucumber'
47
+ system "RAILS_ROOT=. bundle exec cucumber #{ ARGV.join(' ') }"
48
+ when 'rspec'
49
+ if index = ( ARGV.index("-s") || ARGV.index("--spec" ))
50
+ ARGV.delete_at(index)
51
+ files = Dir.glob("mods/**/#{ARGV[index]}_spec.rb").flatten.join(' ')
52
+ ARGV.delete_at(index)
53
+ end
54
+ if index = ( ARGV.index("-m") || ARGV.index("--mod" ))
55
+ ARGV.delete_at(index)
56
+ files = "mods/#{ARGV[index]}"
57
+ ARGV.delete_at(index)
58
+ end
59
+ system "RAILS_ROOT=. bundle exec rspec #{ARGV.join(' ')} #{files}"
60
+ when '--version', '-v'
61
+ puts "Wagn #{Wagn::Version.release}"
62
+ when 'new'
63
+ if ARGV.first.in?(['-h', '--help'])
64
+ require 'wagn/commands/application'
65
+ else
66
+ puts "Can't initialize a new deck within the directory of another, please change to a non-deck directory first.\n"
67
+ puts "Type 'wagn' for help."
68
+ exit(1)
69
+ end
70
+
71
+ else
72
+ puts "Error: Command not recognized" unless command.in?(['-h', '--help'])
73
+ puts <<-EOT
74
+ Usage: wagn COMMAND [ARGS]
75
+
76
+ The most common wagn commands are:
77
+ new Create a new Wagn deck. "wagn new my_deck" creates a
78
+ new deck called MyDeck in "./my_deck"
79
+ seed Create and seed the database specified in config/database.yml
80
+
81
+ server Start the Rails server (short-cut alias: "s")
82
+ console Start the Rails console (short-cut alias: "c")
83
+ dbconsole Start a console for the database specified in config/database.yml
84
+ (short-cut alias: "db")
85
+
86
+ For core developers
87
+ cucumber Run cucumber features (short-cut alias: "cc")
88
+ rspec Run rspec tests (short-cut alias: "rs")
89
+ update Run card migrations
90
+
91
+ In addition to those, there are the standard rails commands:
92
+ generate Generate new code (short-cut alias: "g")
93
+ application Generate the Rails application code
94
+ destroy Undo code generated with "generate" (short-cut alias: "d")
95
+ benchmarker See how fast a piece of code runs
96
+ profiler Get profile information from a piece of code
97
+ plugin Install a plugin
98
+ runner Run a piece of code in the application environment (short-cut alias: "r")
99
+
100
+ All commands can be run with -h (or --help) for more information.
101
+ EOT
102
+ exit(1)
103
+ end
104
+ end
@@ -1,5 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
-
3
2
  filename = '/etc/airbrake.key'
4
3
  if File.exists? filename
5
4
  key = File.read( filename ).strip
@@ -1,8 +1,9 @@
1
1
  Description:
2
- Explain the generator
2
+ The 'wagn new' command creates a new Wagn deck with a default
3
+ directory structure and configuration at the path you specify.
3
4
 
4
5
  Example:
5
- rails generate wagn Thing
6
+ wagn new ~/Poker/FullHouse
7
+
8
+ This generates a new deck in ~/Poker/FullHouse.
6
9
 
7
- This will create:
8
- what/will/it/create
@@ -1,7 +1,72 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'wagn'
3
+ gem 'wagn'<%= ", :path=>'#{@wagn_path}'" if @wagn_path.present? %>
4
4
 
5
5
  <%= database_gemfile_entry -%>
6
6
 
7
- #gem 'wagn-dev', :group=>'development'
7
+ <% if options['mod-dev'] %>
8
+ gem 'rspec-rails', "~> 2.6" # behavior-driven-development suite
9
+ gem 'spork', '>=0.9'
10
+ <% end %>
11
+
12
+ <% if options['core-dev'] %>
13
+ group :assets do
14
+ gem 'jquery-rails', '~> 3.1' # main js framework, along with rails-specific unobtrusive lib
15
+ gem 'jquery-ui-rails', '~> 4.2' # main js framework, along with rails-specific unobtrusive lib
16
+ gem "jquery_mobile_rails", "~> 1.4.1"
17
+
18
+ gem 'tinymce-rails', '~> 3.4' # wysiwyg editor
19
+
20
+ # execjs is necessary for developing coffeescript. mac users have execjs built-in; don't need this one
21
+ gem 'therubyrhino', :platform=>:ruby # :ruby is MRI rubies, so if you use a mac ruby ...
22
+ end
23
+
24
+
25
+ group :test do
26
+ gem 'simplecov', '~> 0.7.1', :require => false #test coverage
27
+
28
+ # SPECS see spec dir
29
+ gem 'rspec-rails', "~> 2.6" # behavior-driven-development suite
30
+
31
+ gem 'guard-rspec', '~> 4.2' # trigger test runs based on file edits
32
+ if RUBY_PLATFORM =~ /darwin/
33
+ gem 'terminal-notifier-guard', '~> 1.5' # use growler notifications on macs
34
+ end
35
+
36
+ # CUKES see features dir
37
+ gem 'cucumber-rails', '~> 1.3', :require=>false # feature-driven-development suite
38
+ gem 'capybara', '~> 2.2.1' # note, selectors were breaking when we used 2.0.1
39
+ gem 'selenium-webdriver', '~> 2.39'
40
+ # gem 'capybara-webkit'
41
+ gem 'launchy' # lets cucumber launch browser windows
42
+
43
+ gem 'timecop', '=0.3.5' # not clear on use/need. referred to in shared_data.rb
44
+ # NOTE: had weird errors with timecop 0.4.4. would like to update when possible
45
+
46
+ gem 'spork', '>=0.9'
47
+
48
+ gem 'rr'#, '=1.0.0'
49
+
50
+ gem 'email_spec' #
51
+ gem 'database_cleaner', '~> 0.7' # used by cucumber for db transactions
52
+
53
+ gem 'turn', "~>0.8.3", :require => false # Pretty printed test output. (version constraint is to avoid minitest requirement)
54
+ gem 'minitest', "~>4.0"
55
+
56
+
57
+
58
+ #windows stuff
59
+ gem 'win32console', '~> 1.3', :platforms => ['mingw', 'mswin']
60
+ gem 'win32-process', '~> 0.6', :platforms => ['mingw', 'mswin']
61
+ end
62
+
63
+ gem 'ruby-prof', '~>0.12.1', :group=>:profile # profiling
64
+
65
+ group :debug do
66
+ if RUBY_VERSION =~ /^2/
67
+ gem 'byebug'
68
+ else
69
+ gem 'debugger'
70
+ end
71
+ end
72
+ <% end %>