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
@@ -41,7 +41,7 @@ module <%= app_const_base %>
41
41
 
42
42
  # config.override_protocol = nil
43
43
  # don't autodetect protocol (http/https) from web requests
44
-
44
+
45
45
 
46
46
  end
47
47
  end
@@ -0,0 +1 @@
1
+ default: '<%= @features_path %>'
@@ -16,14 +16,16 @@ development:
16
16
  # Warning: The database defined as "test" will be erased and
17
17
  # re-generated from your development database when you run "rake".
18
18
  # Do not set this db to the same as development or production.
19
- test:
19
+ test: &test
20
20
  adapter: frontbase
21
21
  host: localhost
22
22
  database: <%= app_name %>_test
23
23
  username: <%= app_name %>
24
24
  password: ''
25
25
 
26
- production:
26
+ cucumber: *test
27
+
28
+ production:
27
29
  adapter: frontbase
28
30
  host: localhost
29
31
  database: <%= app_name %>_production
@@ -51,7 +51,7 @@ development:
51
51
  #authentication: SERVER
52
52
  #parameterized: false
53
53
 
54
- test:
54
+ test: &test
55
55
  adapter: ibm_db
56
56
  username: db2inst1
57
57
  password:
@@ -68,7 +68,9 @@ test:
68
68
  #authentication: SERVER
69
69
  #parameterized: false
70
70
 
71
- production:
71
+ cucumber: *test
72
+
73
+ production:
72
74
  adapter: ibm_db
73
75
  username: db2inst1
74
76
  password:
@@ -16,7 +16,7 @@
16
16
  # re-generated from your development database when you run "rake".
17
17
  # Do not set this db to the same as development or production.
18
18
  #
19
- #test:
19
+ #test: &test
20
20
  # adapter: mssql
21
21
  # username: <%= app_name %>
22
22
  # password:
@@ -47,14 +47,16 @@ development:
47
47
  # re-generated from your development database when you run "rake".
48
48
  # Do not set this db to the same as development or production.
49
49
 
50
- test:
50
+ test: &test
51
51
  adapter: jdbc
52
52
  username: <%= app_name %>
53
53
  password:
54
54
  driver:
55
55
  url: jdbc:db://localhost/<%= app_name %>_test
56
56
 
57
- production:
57
+ cucumber: *test
58
+
59
+ production:
58
60
  adapter: jdbc
59
61
  username: <%= app_name %>
60
62
  password:
@@ -18,14 +18,16 @@ development:
18
18
  # Warning: The database defined as "test" will be erased and
19
19
  # re-generated from your development database when you run "rake".
20
20
  # Do not set this db to the same as development or production.
21
- test:
21
+ test: &test
22
22
  adapter: mysql
23
23
  database: <%= app_name %>_test
24
24
  username: root
25
25
  password:
26
26
  host: localhost
27
27
 
28
- production:
28
+ cucumber: *test
29
+
30
+ production:
29
31
  adapter: mysql
30
32
  database: <%= app_name %>_production
31
33
  username: root
@@ -28,14 +28,16 @@ development:
28
28
  # Warning: The database defined as "test" will be erased and
29
29
  # re-generated from your development database when you run "rake".
30
30
  # Do not set this db to the same as development or production.
31
- test:
31
+ test: &test
32
32
  adapter: postgresql
33
33
  encoding: unicode
34
34
  database: <%= app_name %>_test
35
35
  username: <%= app_name %>
36
36
  password:
37
37
 
38
- production:
38
+ cucumber: *test
39
+
40
+ production:
39
41
  adapter: postgresql
40
42
  encoding: unicode
41
43
  database: <%= app_name %>_production
@@ -11,10 +11,12 @@ development:
11
11
  # Warning: The database defined as "test" will be erased and
12
12
  # re-generated from your development database when you run "rake".
13
13
  # Do not set this db to the same as development or production.
14
- test:
14
+ test: &test
15
15
  adapter: sqlite3
16
16
  database: db/test.sqlite3
17
17
 
18
- production:
18
+ cucumber: *test
19
+
20
+ production:
19
21
  adapter: sqlite3
20
22
  database: db/production.sqlite3
@@ -1,12 +1,5 @@
1
1
  # MySQL. Versions 4.1 and 5.0 are recommended.
2
- #
3
- # Install the MYSQL driver
4
- # gem install mysql2
5
- #
6
- # Ensure the MySQL gem is defined in your Gemfile
7
- # gem 'mysql2'
8
- #
9
- # And be sure to use new-style password hashing:
2
+ # Be sure to use new-style password hashing:
10
3
  # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
4
  development:
12
5
  adapter: mysql2
@@ -25,7 +18,7 @@ development:
25
18
  # Warning: The database defined as "test" will be erased and
26
19
  # re-generated from your development database when you run "rake".
27
20
  # Do not set this db to the same as development or production.
28
- test:
21
+ test: &test
29
22
  adapter: mysql2
30
23
  encoding: utf8
31
24
  reconnect: false
@@ -39,7 +32,9 @@ test:
39
32
  host: localhost
40
33
  <% end -%>
41
34
 
42
- production:
35
+ cucumber: *test
36
+
37
+ production:
43
38
  adapter: mysql2
44
39
  encoding: utf8
45
40
  reconnect: false
@@ -26,13 +26,15 @@ development:
26
26
  # Warning: The database defined as "test" will be erased and
27
27
  # re-generated from your development database when you run "rake".
28
28
  # Do not set this db to the same as development or production.
29
- test:
29
+ test: &test
30
30
  adapter: oracle
31
31
  database: <%= app_name %>_test
32
32
  username: <%= app_name %>
33
33
  password:
34
34
 
35
- production:
35
+ cucumber: *test
36
+
37
+ production:
36
38
  adapter: oracle
37
39
  database: <%= app_name %>_production
38
40
  username: <%= app_name %>
@@ -1,17 +1,4 @@
1
1
  # PostgreSQL. Versions 8.2 and up are supported.
2
- #
3
- # Install the pg driver:
4
- # gem install pg
5
- # On Mac OS X with macports:
6
- # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
7
- # On Windows:
8
- # gem install pg
9
- # Choose the win32 build.
10
- # Install PostgreSQL and put its /bin directory on your path.
11
- #
12
- # Configure Using Gemfile
13
- # gem 'pg'
14
- #
15
2
  development:
16
3
  adapter: postgresql
17
4
  encoding: unicode
@@ -38,7 +25,7 @@ development:
38
25
  # Warning: The database defined as "test" will be erased and
39
26
  # re-generated from your development database when you run "rake".
40
27
  # Do not set this db to the same as development or production.
41
- test:
28
+ test: &test
42
29
  adapter: postgresql
43
30
  encoding: unicode
44
31
  database: <%= app_name %>_test
@@ -46,7 +33,9 @@ test:
46
33
  username: <%= app_name %>
47
34
  password:
48
35
 
49
- production:
36
+ cucumber: *test
37
+
38
+ production:
50
39
  adapter: postgresql
51
40
  encoding: unicode
52
41
  database: <%= app_name %>_production
@@ -1,8 +1,4 @@
1
1
  # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
2
  development:
7
3
  adapter: sqlite3
8
4
  database: db/development.sqlite3
@@ -12,13 +8,15 @@ development:
12
8
  # Warning: The database defined as "test" will be erased and
13
9
  # re-generated from your development database when you run "rake".
14
10
  # Do not set this db to the same as development or production.
15
- test:
11
+ test: &test
16
12
  adapter: sqlite3
17
13
  database: db/test.sqlite3
18
14
  pool: 5
19
15
  timeout: 5000
20
16
 
21
- production:
17
+ cucumber: *test
18
+
19
+ production:
22
20
  adapter: sqlite3
23
21
  database: db/production.sqlite3
24
22
  pool: 5
@@ -0,0 +1,5 @@
1
+ --color
2
+ --profile
3
+ --backtrace
4
+ --default-path '<%= @spec_path %>'
5
+ --require '<%= @spec_helper_path %>'
@@ -1,17 +1,45 @@
1
1
  require 'rails/generators/app_base'
2
2
 
3
+
3
4
  class WagnGenerator < Rails::Generators::AppBase
4
5
 
5
6
  #class WagnGenerator < Rails::Generators::AppGenerator
6
7
 
8
+
9
+
7
10
  source_root File.expand_path('../templates', __FILE__)
8
11
 
9
12
  class_option :database, :type => :string, :aliases => "-d", :default => "mysql",
10
13
  :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
11
-
14
+
15
+ class_option 'core-dev', :type => :boolean, aliases: '-c', :default => false, :group => :runtime,
16
+ desc: "Prepare deck for wagn core testing"
17
+
18
+ class_option 'mod-dev', :type => :boolean, aliases: '-m', :default => false, :group => :runtime,
19
+ desc: "Prepare deck for mod testing"
20
+
21
+ class_option 'interactive', :type => :boolean, aliases: '-i', :default => false, :group => :runtime,
22
+ desc: "Prompt with dynamic installation options"
23
+
12
24
  public_task :create_root
13
25
 
14
26
  ## should probably eventually use rails-like AppBuilder approach, but this is a first step.
27
+ def core_dev_setup
28
+ if options['core-dev']
29
+ @wagn_path = ask "Enter the path to your local wagn installation: "
30
+ #@wagndev_path = ask "Please enter the path to your local wagn-dev installation (leave empty to use the wagn-dev gem): "
31
+ @spec_path = File.join @wagn_path, 'spec'
32
+ @spec_helper_path = File.join @spec_path, 'spec_helper'
33
+ @features_path = File.join @wagn_path, 'features/' # ending slash is important in order to load support and step folders
34
+
35
+ template "rspec", ".rspec"
36
+ elsif options['mod-dev']
37
+ @spec_path = 'mods/'
38
+ @spec_helper_path = 'wagn/mods_spec_helper'
39
+ template "rspec", ".rspec"
40
+ end
41
+ end
42
+
15
43
 
16
44
  def rakefile
17
45
  template "Rakefile"
@@ -57,6 +85,9 @@ class WagnGenerator < Rails::Generators::AppBase
57
85
  template "environment.rb"
58
86
  template "boot.rb"
59
87
  template "databases/#{options[:database]}.yml", "database.yml"
88
+ if options['core-dev']
89
+ template "cucumber.yml"
90
+ end
60
91
  end
61
92
  end
62
93
 
@@ -82,7 +113,56 @@ class WagnGenerator < Rails::Generators::AppBase
82
113
 
83
114
  public_task :run_bundle
84
115
 
116
+ def seed_data
117
+ if options['interactive']
118
+ seeded = false
119
+ require File.join destination_root, 'config', 'application' # need this for Rails.env
120
+ while (answer = ask( <<-TEXT
121
+
122
+ What would you like to do next?
123
+ e - edit database configuration file (config/database.yml)
124
+ s - seed #{Rails.env}#{ " and test" if options['core-dev'] or options['mod-dev']} database
125
+ a - seed all databases (production, development, and test)
126
+ x - exit #{ seeded ? "\n r - run wagn server" : "(run 'wagn seed' to complete the installation later)"}
127
+ [esax#{'r' if seeded}]
128
+ TEXT
129
+ )) != 'x'
130
+ case answer
131
+ when 'e'
132
+ system "nano #{File.join destination_root, 'config', 'database.yml'}"
133
+ when 's'
134
+ require 'wagn/migration_helper'
135
+ require 'rake'
136
+ Wagn::Application.load_tasks
137
+ Rake::Task['wagn:create'].invoke
138
+ if options['core-dev'] or options['mod-dev']
139
+ ENV['RELOAD_TEST_DATA'] = 'true'
140
+ Rake::Task['db:test:prepare'].invoke
141
+ end
142
+ seeded = true
143
+ when 'a'
144
+ %w( production development test ).each do |env|
145
+ system("cd #{destination_root} && RAILS_ENV=#{env} rake wagn:create")
146
+ # tried to set rails environment and invoke the task three times but it was only execute once, so I'm using 'system'
147
+ end
148
+ seeded = true
149
+ when 'r'
150
+ if seeded
151
+ system "cd #{destination_root} && wagn server"
152
+ else
153
+ puts "You have to seed the database first before you can start the server."
154
+ end
155
+ end
156
+ end
157
+ else
158
+ puts "Review the database configuration in config/database.yml and run 'wagn seed' to complete the installation.\nStart the server with 'wagn s'."
159
+ end
160
+ end
161
+
85
162
  protected
163
+ def self.banner
164
+ "wagn new #{self.arguments.map(&:usage).join(' ')} [options]"
165
+ end
86
166
 
87
167
  def mysql_socket
88
168
  @mysql_socket ||= [
@@ -136,4 +216,7 @@ class WagnGenerator < Rails::Generators::AppBase
136
216
  end
137
217
  end
138
218
 
219
+
220
+
221
+
139
222
  end
@@ -0,0 +1,66 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'spork'
3
+
4
+ ENV["RAILS_ENV"] = 'test'
5
+
6
+ #require File.expand_path( '../../../spec/mods/standard/lib/machine_spec.rb', __FILE__ )
7
+ #require File.expand_path( '../../../spec/mods/standard/lib/machine_input_spec.rb', __FILE__ )
8
+
9
+ Spork.prefork do
10
+ if ENV["RAILS_ROOT"]
11
+ require File.join( ENV["RAILS_ROOT"], '/config/environment')
12
+ else
13
+ require File.expand_path( '../../config/environment', __FILE__ )
14
+ end
15
+
16
+ require 'rspec/rails'
17
+
18
+ # Requires supporting ruby files with custom matchers and macros, etc,
19
+ # in spec/support/ and its subdirectories.
20
+ # Dir[ File.join(Wagn.gem_root, "spec/support/**/*.rb") ].each { |f| require f }
21
+
22
+ # FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
23
+ JOE_USER_ID = Card['joe_user'].id
24
+
25
+ RSpec.configure do |config|
26
+
27
+ config.include RSpec::Rails::Matchers::RoutingMatchers, :example_group => {
28
+ :file_path => /\bspec\/controllers\//
29
+ }
30
+
31
+ format_index = ARGV.find_index {|arg| arg =~ /--format/ }
32
+ formatter = format_index ? ARGV[ format_index + 1 ] : 'documentation'
33
+ config.add_formatter formatter
34
+
35
+ #config.include CustomMatchers
36
+ #config.include ControllerMacros, :type=>:controllers
37
+
38
+ # == Mock Framework
39
+ # If you prefer to mock with mocha, flexmock or RR, uncomment the appropriate symbol:
40
+ # :mocha, :flexmock, :rr
41
+
42
+ # config.mock_with :rr
43
+
44
+ config.use_transactional_fixtures = true
45
+ config.use_instantiated_fixtures = false
46
+
47
+
48
+ config.before(:each) do
49
+ Card::Auth.current_id = JOE_USER_ID
50
+ Wagn::Cache.restore
51
+ Card::Env.reset
52
+ end
53
+ config.after(:each) do
54
+ Timecop.return
55
+ end
56
+ end
57
+ end
58
+
59
+
60
+ Spork.each_run do
61
+ # This code will be run each time you run your specs.
62
+ end
63
+
64
+ require 'wagn/wagn_spec_helper'
65
+ RSpec::Core::ExampleGroup.send :include, Wagn::WagnSpecHelper
66
+