wagn 1.15.7 → 1.16.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: 8f3588c3977600f8ff624293a399107540906264
4
- data.tar.gz: c3924c308a7f3d3378e5ac10464ef215379593f8
3
+ metadata.gz: 93d49fa7d1579cf958f00854309f3e7997242523
4
+ data.tar.gz: 5532cef0c6bf94de50006763ede9d58457d9190e
5
5
  SHA512:
6
- metadata.gz: b30cb5fff15f670cc4527dc2a5267ae79aea9bf7db6a4bb8a8859ffcafa988798de01be2257cc08aab2880b2dfd321bb7130e88388ee02f5f158248bc42ffce4
7
- data.tar.gz: fe7288bf0791c922aece0d94afca8c318633a16d84f414f5599cb08e829218aa79c0b3dcf7a484626a3ab84ba5a91408115318b50b656011f0f4d41aae0dad45
6
+ metadata.gz: 6b0c051fede97df0360f153491992e1710e5e8c0aa86211a42d7e59f83cad055b67e8b85a10a743e8eb3951ee441cd7cdfbb0e02994ae0ef63586c73fd7be03f
7
+ data.tar.gz: 6282214671c13d7d32d0b8d494008b1ac91750ae93d9ade65d5606b28786afb715be51d381a7afbc72d9485569dcd9c5351ddc3701a2f06bd3c9a97e3beb495b
@@ -6,7 +6,7 @@ Feature: Conflict
6
6
  Background:
7
7
  Given I am signed in as Joe Admin
8
8
  And I create Phrase card "Duck Soup" with content "Laurel and Hardy"
9
-
9
+
10
10
  Scenario: Two edits on a card at the same time
11
11
  When I edit "Duck Soup" filling in "Stan Hardy"
12
12
  And I open a new window for Joe User
@@ -16,7 +16,7 @@ Feature: Conflict
16
16
  # We resign-in as Joe Admin in Joe User's window so that we submit Joe Admin's edit as Joe Admin
17
17
  And I am signed out
18
18
  And I wait a sec
19
- And I am signed in as Joe Admin
19
+ And I am signed in as Joe Admin
20
20
  And I close window
21
21
  And I submit
22
22
  Then I should see "Conflict!"
@@ -34,7 +34,7 @@ Feature: Conflict
34
34
  And I close window
35
35
  And I submit
36
36
  Then I should see "Conflict!"
37
- And I should see "No difference between your changes and Joe User's version."
37
+ #And I should see "No difference between your changes and Joe User's version."
38
38
 
39
39
 
40
40
 
@@ -19,7 +19,8 @@ Feature: Follow interface
19
19
  And I open the main card menu
20
20
  And In the main card menu I should not see "unfollow"
21
21
  And In the main card menu I click "follow"
22
- And I follow "Close"
22
+ And I wait a sec
23
+ And I close the modal window
23
24
  And I wait a sec
24
25
  And I open the main card menu
25
26
  Then In the main card menu I should see "unfollow"
@@ -31,7 +32,8 @@ Feature: Follow interface
31
32
  And I am on the homepage
32
33
  And I open the main card menu
33
34
  And In the main card menu I click "unfollow"
34
- And I follow "Close"
35
+ And I wait a sec
36
+ And I close the modal window
35
37
  And I wait a sec
36
38
  And I open the main card menu
37
39
  Then In the main card menu I should see "follow"
@@ -12,7 +12,7 @@ Feature: Layouts
12
12
  And I create Pointer card "User+*type+*layout" with content "[[user layout]]"
13
13
  And I wait a sec
14
14
  And I create HTML card "user layout" with content "User Header {{_main}}"
15
- And I wait a sec
15
+ And I wait a sec
16
16
 
17
17
  Scenario: I visit a Basic card with the simple layout
18
18
  When I go to card "*account links"
@@ -1,4 +1,4 @@
1
- Feature: Set-based Rules
1
+ Feature: Set-based Rles
2
2
  In order to control settings in an efficient way
3
3
  As a Wagneer
4
4
  I want to be able to control rules for sets of cards
@@ -10,7 +10,7 @@ Feature: Set-based Rules
10
10
  Scenario: default setting and plus card override
11
11
  Given I create Phrase card "color+*right+*add help" with content "If colorblind, leave blank"
12
12
  And I am signed in as Joe User
13
- When I go to new card "Test"
13
+ When I go to new card named "Test"
14
14
  Then I should see "spicy"
15
15
  When I go to new card "Test+color"
16
16
  Then I should see "colorblind"
@@ -10,7 +10,7 @@ Feature: Signing up
10
10
  Given Joe Admin creates Pointer card "User+*type+*create" with content "[[Anyone]]"
11
11
  And I am signed out
12
12
  #This is the needed permission configuration to allow signups without approval
13
-
13
+
14
14
  When I go to the home page
15
15
  And I follow "Sign up"
16
16
  And I fill in "card_name" with "Wanna B"
@@ -19,20 +19,21 @@ Feature: Signing up
19
19
  And I press "Submit"
20
20
  Then I should see "Signup Success"
21
21
  And "wanna@wagn.org" should receive an email with subject "verification link for My Wagn"
22
-
22
+
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
-
27
- When I follow "Sign out"
26
+
27
+ When I go to the home page
28
+ And I follow "Sign out"
28
29
  Then I should not see "Wanna B"
29
-
30
+
30
31
  When I follow "Sign in"
31
32
  And I enter "wanna@wagn.org" into "*email"
32
33
  And I enter "wanna_pass" into "*password"
33
34
  And I press "Sign in"
34
35
  Then I should see "Wanna B"
35
-
36
+
36
37
  Scenario: Signing up with approval
37
38
  #When I go to card "AccountRequest"
38
39
  #And In the main card content I click "Wanna B"
@@ -42,6 +43,6 @@ Feature: Signing up
42
43
  #Then I should see "Success"
43
44
  #When I go to card "Wanna B"
44
45
  #Then I should see "life story"
45
-
46
+
46
47
  #Then I should see "sent"
47
48
 
@@ -68,7 +68,6 @@ When /^(.*) edits? "([^\"]*)" entering "([^\"]*)" into wysiwyg$/ do |username, c
68
68
  end
69
69
  end
70
70
 
71
-
72
71
  When /^(.*) edits? "([^\"]*)" setting (.*) to "([^\"]*)"$/ do |username, cardname, field, content|
73
72
  signed_in_as(username) do
74
73
  visit "/card/edit/#{cardname.to_name.url_key}"
@@ -94,7 +93,7 @@ end
94
93
 
95
94
  When /^(.*) creates?\s*a?\s*([^\s]*) card "(.*)" with content "(.*)"$/ do |username, cardtype, cardname, content|
96
95
  create_card(username, cardtype, cardname, content) do
97
- normal_textarea_card_type = ["JavaScript","CoffeeScript","HTML","CSS","SCS","Search"]
96
+ normal_textarea_card_type = ["JavaScript","CoffeeScript","HTML","CSS","SCSS","Search"]
98
97
  if not normal_textarea_card_type.include? cardtype or not page.evaluate_script "typeof ace != 'undefined'"
99
98
  fill_in("card[content]", :with=>content)
100
99
  else
@@ -164,8 +163,6 @@ Then /debug/ do
164
163
  nil
165
164
  end
166
165
 
167
-
168
-
169
166
  def create_card(username,cardtype,cardname,content="")
170
167
  signed_in_as(username) do
171
168
  if cardtype=='Pointer'
@@ -218,6 +215,10 @@ When /^I open the main card menu$/ do
218
215
  page.find('#main .menu-slot .card-menu a').click
219
216
  end
220
217
 
218
+ When /^I close the modal window$/ do
219
+ page.find('.modal-menu .close-modal').click
220
+ end
221
+
221
222
  When /^I pick (.*)$/ do |menu_item|
222
223
  end
223
224
 
@@ -11,11 +11,10 @@ Feature: Structure Rules
11
11
 
12
12
  Scenario: New structured card
13
13
  When I edit "Movie+*type+*structure"
14
- And I should see "{{+lead}}"
14
+ Then I should see "{{+lead}}"
15
15
  When I go to new Movie
16
16
  Then I should see "+director"
17
17
  And I should see "+lead"
18
- #And I should see "[+lead]"
19
18
 
20
19
  Scenario: Create and edit templated card
21
20
  When I create Movie card "Star Wars" with plusses:
@@ -31,7 +31,7 @@ module NavigationHelpers
31
31
  "/card/new?card[name]=#{CGI.escape($1)}"
32
32
 
33
33
  when /edit (.*)$/
34
- "/#{$1.to_name.url_key}?view=edit"
34
+ "/#{$1.to_name.url_key}?view=edit"
35
35
 
36
36
  when /new (.*)$/
37
37
  "/new/#{$1.to_name.url_key}"
@@ -1,5 +1,6 @@
1
1
 
2
2
  require 'rails/all'
3
+ require 'activerecord/session_store'
3
4
  require 'cardio'
4
5
 
5
6
  # TODO: Move these to modules that use them
@@ -20,7 +21,7 @@ module Decko
20
21
 
21
22
  paths.add "app/controllers", :with => 'rails/controllers', :eager_load => true
22
23
  paths.add 'gem-assets', :with => 'rails/assets'
23
- paths.add 'config/routes', :with => 'rails/engine-routes.rb'
24
+ paths.add 'config/routes.rb', :with => 'rails/engine-routes.rb'
24
25
  paths.add 'lib/tasks', :with => "#{::Wagn.gem_root}/lib/wagn/tasks", :glob => '**/*.rake'
25
26
  paths.add 'lib/wagn/config/initializers',
26
27
  :with => File.join( Wagn.gem_root, 'lib/wagn/config/initializers' ), :glob => "**/*.rb"
@@ -42,7 +43,7 @@ module Decko
42
43
 
43
44
  initializer :connect_on_load do
44
45
  ActiveSupport.on_load(:active_record) do
45
- ActiveRecord::Base.establish_connection(::Rails.env)
46
+ ActiveRecord::Base.establish_connection(::Rails.env.to_sym)
46
47
  end
47
48
  ActiveSupport.on_load(:after_initialize) do
48
49
  begin
@@ -9,14 +9,6 @@ if defined?(Bundler)
9
9
  # Bundler.require(:default, :assets, Rails.env)
10
10
  end
11
11
 
12
- module ActiveSupport::BufferedLogger::Severity
13
- WAGN = UNKNOWN + 1
14
-
15
- def wagn progname, &block
16
- add(WAGN, nil, progname, &block)
17
- end
18
- end
19
-
20
12
 
21
13
  module Wagn
22
14
  class Application < Rails::Application
@@ -39,19 +31,18 @@ module Wagn
39
31
 
40
32
  class << self
41
33
  def inherited(base)
42
- Rails.application = base.instance
43
- Rails.application.add_lib_to_load_path!
34
+ super
35
+ Rails.app_class = base
36
+ add_lib_to_load_path!(find_root(base.called_from))
44
37
  ActiveSupport.run_load_hooks(:before_configuration, base.instance)
45
38
  end
46
39
  end
47
40
 
48
41
  def add_path paths, path, options={}
49
42
  root = options.delete(:root) || Wagn.gem_root
50
- gem_path = File.join( root, path )
51
- with = options.delete(:with)
52
- with = with ? File.join(root, with) : gem_path
53
- #warn "add gem path #{path}, #{with}, #{gem_path}, #{options.inspect}"
54
- paths[path] = Rails::Paths::Path.new(paths, gem_path, with, options)
43
+ #gem_path = File.join( root, path )
44
+ options[:with] = File.join(root, (options[:with] || path) )
45
+ paths.add path, options
55
46
  end
56
47
 
57
48
 
@@ -62,7 +53,7 @@ module Wagn
62
53
  Cardio.set_config config
63
54
 
64
55
  config.i18n.enforce_available_locales = true
65
-
56
+ #config.active_record.raise_in_transactional_callbacks = true
66
57
 
67
58
  config.assets.enabled = false
68
59
  config.assets.version = '1.0'
@@ -81,7 +72,7 @@ module Wagn
81
72
  config
82
73
  end
83
74
  end
84
-
75
+
85
76
  def paths
86
77
  @paths ||= begin
87
78
  paths = super
@@ -93,12 +84,11 @@ module Wagn
93
84
  paths['app/models'] = []
94
85
  paths['app/mailers'] = []
95
86
 
96
- add_path paths, 'config/routes', :with => 'rails/application-routes.rb'
87
+ add_path paths, 'config/routes.rb', :with => 'rails/application-routes.rb'
97
88
 
98
89
  paths
99
90
  end
100
91
  end
101
-
102
92
  end
103
93
  end
104
94
 
@@ -3,6 +3,8 @@ Wagn.application.class.configure do
3
3
  # Edit at your own peril - it's recommended to regenerate this file
4
4
  # in the future when you upgrade to a newer version of Cucumber.
5
5
 
6
+ config.eager_load = false
7
+
6
8
  # IMPORTANT: Setting config.cache_classes to false is known to
7
9
  # break Cucumber's use_transactional_fixtures method.
8
10
  # For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
@@ -9,6 +9,8 @@ end
9
9
  Wagn.application.class.configure do
10
10
  # Settings specified here will take precedence over those in config/application.rb
11
11
 
12
+ config.eager_load = false
13
+
12
14
  # In the development environment your application's code is reloaded on
13
15
  # every request. This slows down response time but is perfect for development
14
16
  # since you don't have to restart the web server when you make code changes.
@@ -21,8 +23,8 @@ Wagn.application.class.configure do
21
23
  skip /view\=status/
22
24
  end
23
25
  end
24
-
25
-
26
+
27
+
26
28
  # Log error messages when you accidentally call methods on nil.
27
29
  config.whiny_nils = true
28
30
 
@@ -38,38 +40,37 @@ Wagn.application.class.configure do
38
40
 
39
41
  # See everything in the log (default is :info)
40
42
  config.log_level = :debug
41
-
42
- #change log_level to :wagn to activate performance logger
43
+
44
+ config.active_record.raise_in_transactional_callbacks = true
45
+
43
46
  # config.performance_logger = {
44
- # :methods => [:event, :search, :fetch, :view], # choose methods to log
45
- # :min_time => 100, # show only method calls that are slower than 100ms
47
+ # :methods => [:event, :search, :fetch, :view], # choose methods to log
48
+ # :min_time => 100, # show only method calls that are slower than 100ms
46
49
  # :max_depth => 3, # show nested method calls only up to depth 3
47
- # :details=> true # show method arguments and sql
50
+ # :details => true # show method arguments and sql
51
+ # :log_level => :info
48
52
  # }
49
-
53
+
50
54
  # Only use best-standards-support built into browsers
51
55
  config.action_dispatch.best_standards_support = :builtin
52
56
 
53
57
  # Do not compress assets
54
58
  # config.assets.compress = false
55
- #
59
+ #
56
60
  # # Expands the lines which load the assets
57
61
  # config.assets.debug = false
58
- #
62
+ #
59
63
  # # This needs to be on for tinymce to work, because several important files (themes, etc) are only served statically
60
- # config.serve_static_assets = ENV['STATIC_ASSETS'] || true
61
- #
64
+ # config.serve_static_files = ENV['STATIC_ASSETS'] || true
65
+ #
62
66
  # # Setting a bogus directory so rails won't find public/assets in dev mode.
63
67
  # # Normally you could skip that by not serving static assets, but that breaks tinymce (see above)
64
68
  # config.assets.prefix = "dynamic-assets"
65
69
 
66
- # Raise exception on mass assignment protection for Active Record models
67
- config.active_record.mass_assignment_sanitizer = :strict
68
-
69
70
  # Log the query plan for queries taking more than this (works
70
71
  # with SQLite, MySQL, and PostgreSQL)
71
- config.active_record.auto_explain_threshold_in_seconds = 0.5
72
-
72
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
73
+
73
74
 
74
75
  # if File.exists?(File.join(Rails.root,'tmp', 'debug.txt'))
75
76
  # require 'ruby-debug'
@@ -79,7 +80,7 @@ Wagn.application.class.configure do
79
80
  # end
80
81
 
81
82
  config.action_mailer.perform_deliveries = false
82
-
83
+
83
84
  # Use Pry instead of IRB
84
85
  silence_warnings do
85
86
  begin
@@ -91,4 +92,4 @@ Wagn.application.class.configure do
91
92
  end
92
93
 
93
94
 
94
-
95
+ #Paperclip.options[:command_path] = "/opt/local/bin"
@@ -2,6 +2,8 @@
2
2
  Wagn.application.class.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb
4
4
 
5
+ config.eager_load = true
6
+
5
7
  # Code is not reloaded between requests
6
8
  config.cache_classes = true
7
9
 
@@ -10,7 +12,7 @@ Wagn.application.class.configure do
10
12
  config.action_controller.perform_caching = true
11
13
 
12
14
  # Disable Rails's static asset server (Apache or nginx will already do this)
13
- config.serve_static_assets = defined?( Rails::Server )
15
+ config.serve_static_files = defined?( Rails::Server )
14
16
 
15
17
  # Compress JavaScripts and CSS
16
18
  config.assets.compress = true
@@ -32,7 +34,7 @@ Wagn.application.class.configure do
32
34
  # config.force_ssl = true
33
35
 
34
36
  # See everything in the log (default is :info)
35
- # config.log_level = :debug
37
+ config.log_level = :info
36
38
 
37
39
  # Use a different logger for distributed setups
38
40
  # config.logger = SyslogLogger.new
@@ -6,6 +6,8 @@ Wagn.application.class.configure do
6
6
  # approximation of performance. However, it should
7
7
  # definitely not use the production databse!
8
8
 
9
+ config.eager_load = true
10
+
9
11
  # Cache classes - otherwise your code
10
12
  # will run approximately 5 times slower and the
11
13
  # profiling results will be overwhelmed by Rails
@@ -2,6 +2,8 @@
2
2
  Wagn.application.class.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb
4
4
 
5
+ config.eager_load = false
6
+
5
7
  # The test environment is used exclusively to run your application's
6
8
  # test suite. You never need to work with it otherwise. Remember that
7
9
  # your test database is "scratch space" for the test suite and is wiped
@@ -12,7 +14,7 @@ Wagn.application.class.configure do
12
14
  config.assets.enabled = true if Object.const_defined?( :JasmineRails )
13
15
 
14
16
  # Configure static asset server for tests with Cache-Control for performance
15
- config.serve_static_assets = true
17
+ config.serve_static_files = true
16
18
  config.static_cache_control = "public, max-age=3600"
17
19
 
18
20
  # Log error messages when you accidentally call methods on nil
@@ -34,10 +36,10 @@ Wagn.application.class.configure do
34
36
  config.action_mailer.delivery_method = :test
35
37
  config.action_mailer.perform_deliveries = true
36
38
  config.action_mailer.default :charset=>"utf-8"
37
-
39
+
38
40
  #config.action_mailer.delivery_method = :smtp
39
41
  #config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
40
-
42
+
41
43
  # Use SQL instead of Active Record's schema dumper when creating the test database.
42
44
  # This is necessary if your schema can't be completely dumped by the schema dumper,
43
45
  # like if you have constraints or database-specific column types
@@ -49,7 +51,7 @@ Wagn.application.class.configure do
49
51
 
50
52
  # Print deprecation notices to the stderr
51
53
  config.active_support.deprecation = :stderr
52
-
54
+
53
55
  # Use Pry instead of IRB
54
56
  silence_warnings do
55
57
  begin
@@ -7,3 +7,4 @@
7
7
  # no regular words or you'll be exposed to dictionary attacks.
8
8
 
9
9
  Wagn.config.secret_token = '65632e048d6c80d1e63c911e1a40a51072413543f3182e0261b52e3812b2c9f0ee81828fa5688a34c13a78e438a4b56f497135dc079a4e4460733d555968a2f8'
10
+ Wagn.config.secret_key_base = '65632e048d6c80d1e63c911e1a40a51072413543f3182e0261b52e3812b2c9f0ee81828fa5688a34c13a78e438a4b56f497135dc079a4e4460733d555968a2f8'
@@ -6,4 +6,4 @@ Wagn.config.session_store :active_record_store
6
6
  # Use the database for sessions instead of the cookie-based default,
7
7
  # which shouldn't be used to store highly confidential information
8
8
  # (create the session table with "rails generate session_migration")
9
- # Cardio.config.session_store :active_record_store
9
+ Cardio.config.session_store :active_record_store
@@ -7,7 +7,11 @@ gem 'card', :path=>"<%= @gemfile_gem_path %>/card", :require => false
7
7
  gem 'wagn'
8
8
  <% end %>
9
9
 
10
- <%= database_gemfile_entry -%>
10
+ gem '<%= database_gemfile_entry.name %>'<%= %(, '#{database_gemfile_entry.version}') if database_gemfile_entry.version -%>
11
+
12
+ # Use Unicorn or Thin as server
13
+ # gem 'unicorn'
14
+ # gem 'thin'
11
15
 
12
16
  <% if options['mod-dev'] -%>
13
17
  group :test do
@@ -22,9 +26,12 @@ group :test, :development do
22
26
  gem 'jasmine-rails', :git=>"https://github.com/chuenlok/jasmine-rails.git"
23
27
  gem 'jasmine-jquery-rails'
24
28
  gem 'sprockets' # just so above works
25
- # gem 'spring'
26
- # gem 'spring-commands-rspec'
27
- # gem 'spring-commands-cucumber'
29
+ <%- if spring_install? %>
30
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
31
+ gem 'spring'
32
+ gem 'spring-commands-rspec'
33
+ gem 'spring-commands-cucumber'
34
+ <% end -%>
28
35
  # gem 'pry-rails'
29
36
  # gem 'pry-rescue'
30
37
  # gem 'pry-stack_explorer'
@@ -64,7 +71,7 @@ group :test do
64
71
  if RUBY_PLATFORM =~ /darwin/
65
72
  # gem 'terminal-notifier-guard', '~> 1.5' # use growler notifications on macs
66
73
  # gem 'rspec-legacy_formatters'
67
- # gem 'wagn-rspec-formatter', :path=>'/opt/wagn-rspec-formatter'
74
+ # gem 'wagn-rspec-formatter', :git=>'https://github.com/xithan/wagn-rspec-formatter.git'
68
75
  end
69
76
 
70
77
  # CUKES see features dir
@@ -79,22 +86,25 @@ group :test do
79
86
 
80
87
 
81
88
  gem 'email_spec' #
82
- gem 'database_cleaner', '~> 0.7' # used by cucumber for db transactions
89
+ gem 'database_cleaner', '~> 1.4' # used by cucumber for db transactions
83
90
 
84
- gem 'turn', "~>0.8.3", :require => false # Pretty printed test output. (version constraint is to avoid minitest requirement)
85
- gem 'minitest', "~>4.0"
91
+ gem 'turn', :require => false # Pretty printed test output. (version constraint is to avoid minitest requirement)
92
+ gem 'minitest'
86
93
  end
87
94
 
88
95
  gem 'ruby-prof', :group=>:profile # profiling
89
96
 
90
97
  group :development, :test do
98
+ <%- if spring_install? %>
99
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
91
100
  gem 'spring'
92
101
  gem 'spring-commands-rspec'
93
102
  gem 'spring-commands-cucumber'
94
103
  gem 'spring-watcher-listen'
104
+ <% end -%>
95
105
  gem 'pry-rails'
96
106
  gem 'pry-rescue'
97
- gem 'pry-stack_explorer'
107
+ # gem 'pry-stack_explorer'
98
108
  gem 'jasmine'
99
109
  gem 'jasmine-rails', :git=>"https://github.com/chuenlok/jasmine-rails.git"
100
110
  gem 'jasmine-jquery-rails'
@@ -107,6 +117,8 @@ group :debug do
107
117
  else
108
118
  gem 'debugger'
109
119
  end
120
+ gem 'better_errors', :git=>"https://github.com/xithan/better_errors.git"
121
+ gem 'binding_of_caller'
110
122
  end
111
123
  <% end %>
112
124
 
@@ -6,27 +6,29 @@ class WagnGenerator < Rails::Generators::AppBase
6
6
  #class WagnGenerator < Rails::Generators::AppGenerator
7
7
 
8
8
  source_root File.expand_path('../templates', __FILE__)
9
-
9
+
10
10
  argument :deck_path, :required=>false
11
11
 
12
12
  class_option :database, :type => :string, :aliases => "-d", :default => "mysql",
13
13
  :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
14
-
15
- class_option 'core-dev', :type => :boolean, aliases: '-c', :default => false, :group => :runtime,
14
+
15
+ class_option 'core-dev', :type => :boolean, aliases: '-c', :default => false, :group => :runtime,
16
16
  desc: "Prepare deck for wagn core testing"
17
-
18
- class_option 'gem-path', :type => :string, aliases: '-g', :default => false, :group => :runtime,
17
+
18
+ class_option 'gem-path', :type => :string, aliases: '-g', :default => false, :group => :runtime,
19
19
  desc: "Path to local gem installation (Default, use env WAGN_GEM_PATH)"
20
-
21
- class_option 'mod-dev', :type => :boolean, aliases: '-m', :default => false, :group => :runtime,
20
+
21
+ class_option 'mod-dev', :type => :boolean, aliases: '-m', :default => false, :group => :runtime,
22
22
  desc: "Prepare deck for mod testing"
23
-
24
- class_option 'interactive', :type => :boolean, aliases: '-i', :default => false, :group => :runtime,
23
+
24
+ class_option 'interactive', :type => :boolean, aliases: '-i', :default => false, :group => :runtime,
25
25
  desc: "Prompt with dynamic installation options"
26
-
26
+
27
+
28
+ public_task :set_default_accessors!
27
29
  public_task :create_root
28
-
29
- ## should probably eventually use rails-like AppBuilder approach, but this is a first step.
30
+
31
+ ## should probably eventually use rails-like AppBuilder approach, but this is a first step.
30
32
  def dev_setup
31
33
  # TODO: rename or split, gem_path points to the source repo, card and wagn gems are subdirs
32
34
  @gemfile_gem_path = @gem_path = options['gem-path']
@@ -35,7 +37,7 @@ class WagnGenerator < Rails::Generators::AppBase
35
37
  @gemfile_gem_path = %q{#{ENV['WAGN_GEM_PATH']}}
36
38
  @gem_path = env_gem_path
37
39
  end
38
-
40
+
39
41
  @include_jasmine_engine = false
40
42
  if options['core-dev']
41
43
  unless @gem_path
@@ -49,7 +51,7 @@ class WagnGenerator < Rails::Generators::AppBase
49
51
  inside 'spec' do
50
52
  copy_file File.join('javascripts', 'support', 'wagn_jasmine.yml'), File.join('javascripts', 'support','jasmine.yml')
51
53
  end
52
-
54
+
53
55
  @features_path = File.join @gem_path, 'wagn/features/' # ending slash is important in order to load support and step folders
54
56
  @simplecov_config = "card_core_dev_simplecov_filters"
55
57
  elsif options['mod-dev']
@@ -62,7 +64,7 @@ class WagnGenerator < Rails::Generators::AppBase
62
64
  copy_file File.join( 'javascripts', 'support', 'deck_jasmine.yml'), File.join('javascripts', 'support','jasmine.yml')
63
65
  end
64
66
  end
65
-
67
+
66
68
  if options['core-dev'] || options['mod-dev']
67
69
  template "rspec", ".rspec"
68
70
  template "simplecov", ".simplecov"
@@ -80,23 +82,23 @@ class WagnGenerator < Rails::Generators::AppBase
80
82
  # def readme
81
83
  # copy_file "README", "README.rdoc"
82
84
  # end
83
-
85
+
84
86
  def mod
85
- empty_directory_with_gitkeep 'mod'
87
+ empty_directory_with_keep_file 'mod'
86
88
  end
87
-
89
+
88
90
  def log
89
- empty_directory_with_gitkeep 'log'
91
+ empty_directory_with_keep_file 'log'
90
92
  end
91
-
93
+
92
94
  def files
93
- empty_directory_with_gitkeep 'files'
95
+ empty_directory_with_keep_file 'files'
94
96
  end
95
-
97
+
96
98
  def tmp
97
99
  empty_directory 'tmp'
98
100
  end
99
-
101
+
100
102
  def gemfile
101
103
  template "Gemfile"
102
104
  end
@@ -104,11 +106,11 @@ class WagnGenerator < Rails::Generators::AppBase
104
106
  def configru
105
107
  template "config.ru"
106
108
  end
107
-
109
+
108
110
  def gitignore
109
111
  copy_file "gitignore", ".gitignore"
110
112
  end
111
-
113
+
112
114
  def config
113
115
  empty_directory "config"
114
116
 
@@ -117,41 +119,41 @@ class WagnGenerator < Rails::Generators::AppBase
117
119
  template 'routes.erb', "routes.rb"
118
120
  template "environment.rb"
119
121
  template "boot.rb"
120
- template "databases/#{options[:database]}.yml", "database.yml"
122
+ template "databases/#{options[:database]}.yml", "database.yml"
121
123
  if options['core-dev']
122
124
  template "cucumber.yml"
123
125
  end
124
126
  end
125
127
  end
126
-
128
+
127
129
  def public
128
130
  empty_directory "public"
129
-
131
+
130
132
  inside "public" do
131
133
  template "robots.txt"
132
134
  empty_directory "files"
133
-
135
+
134
136
  inside "files" do
135
137
  template "htaccess", ".htaccess"
136
138
  end
137
139
  end
138
140
  end
139
-
141
+
140
142
  def script
141
143
  directory "script" do |content|
142
144
  "#{shebang}\n" + content
143
145
  end
144
146
  chmod "script", 0755 & ~File.umask, :verbose => false
145
147
  end
146
-
148
+
147
149
  public_task :run_bundle
148
-
150
+
149
151
  def seed_data
150
152
  if options['interactive']
151
153
 
152
154
  require File.join destination_root, 'config', 'application' # need this for Rails.env
153
155
  menu_options = ActiveSupport::OrderedHash.new()
154
-
156
+
155
157
  database_seeded = proc do
156
158
  menu_options['x'][:desc] = "exit"
157
159
  menu_options['r'] = {
@@ -160,67 +162,67 @@ class WagnGenerator < Rails::Generators::AppBase
160
162
  :code => proc { system "cd #{destination_root} && wagn server" }
161
163
  }
162
164
  end
163
-
164
- menu_options['d'] = {
165
+
166
+ menu_options['d'] = {
165
167
  :desc => 'edit database configuration file',
166
168
  :command => 'nano config/database.yml',
167
169
  :code => proc { system "nano #{File.join destination_root, 'config', 'database.yml'}" }
168
170
  }
169
- menu_options['c'] = {
171
+ menu_options['c'] = {
170
172
  :desc => 'configure Wagn (e.g. email settings)',
171
173
  :command => 'nano config/application.rb',
172
174
  :code => proc { system "nano #{File.join destination_root, 'config', 'application.rb'}" }
173
175
  }
174
- menu_options['s'] = {
176
+ menu_options['s'] = {
175
177
  :desc => "seed #{Rails.env}#{ " and test" if options['core-dev'] or options['mod-dev']} database",
176
178
  :command => 'wagn seed',
177
179
  :code => proc do
178
- system("cd #{destination_root} && bundle exec rake wagn:seed")
180
+ system("cd #{destination_root} && bundle exec rake wagn:seed")
179
181
  if options['core-dev'] or options['mod-dev']
180
- system("cd #{destination_root} && RAILS_ENV=test bundle exec rake wagn:seed")
182
+ system("cd #{destination_root} && RAILS_ENV=test bundle exec rake wagn:seed")
181
183
  end
182
184
  database_seeded.call
183
185
  end
184
186
  }
185
- menu_options['a'] = {
187
+ menu_options['a'] = {
186
188
  :desc => 'seed all databases (production, development, and test)',
187
189
  :command => 'wagn seed --all',
188
190
  :code => proc do
189
191
  %w( production development test ).each do |env|
190
- system("cd #{destination_root} && RAILS_ENV=#{env} bundle exec rake wagn:seed")
192
+ system("cd #{destination_root} && RAILS_ENV=#{env} bundle exec rake wagn:seed")
191
193
  end
192
194
  database_seeded.call
193
195
  end
194
196
  }
195
- menu_options['x'] = {
196
- :desc => "exit (run 'wagn seed' to complete the installation later)"
197
+ menu_options['x'] = {
198
+ :desc => "exit (run 'wagn seed' to complete the installation later)"
197
199
  }
198
-
199
-
200
+
201
+
200
202
  def build_menu options
201
203
  lines = ["What would you like to do next?"]
202
- lines += options.map do |key, v|
203
- command = ' '*(65-v[:desc].size) + '[' + v[:command] + ']' if v[:command]
204
+ lines += options.map do |key, v|
205
+ command = ' '*(65-v[:desc].size) + '[' + v[:command] + ']' if v[:command]
204
206
  " #{key} - #{v[:desc]}#{command if command}"
205
207
  end
206
208
  lines << "[#{options.keys.join}]"
207
209
  "\n#{lines.join("\n")}\n"
208
210
  end
209
-
210
- while (answer = ask(build_menu(menu_options))) != 'x'
211
- menu_options[answer][:code].call
211
+
212
+ while (answer = ask(build_menu(menu_options))) != 'x'
213
+ menu_options[answer][:code].call
212
214
  end
213
-
215
+
214
216
  else
215
217
  puts "Review the database configuration in config/database.yml and run 'wagn seed' to complete the installation.\nStart the server with 'wagn server'."
216
218
  end
217
219
  end
218
-
220
+
219
221
  protected
220
222
  def self.banner
221
223
  "wagn new #{self.arguments.map(&:usage).join(' ')} [options]"
222
224
  end
223
-
225
+
224
226
  def mysql_socket
225
227
  @mysql_socket ||= [
226
228
  "/tmp/mysql.sock", # default
@@ -234,11 +236,11 @@ class WagnGenerator < Rails::Generators::AppBase
234
236
  "/opt/lampp/var/mysql/mysql.sock" # xampp for linux
235
237
  ].find { |f| File.exist?(f) } unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
236
238
  end
237
-
239
+
238
240
  ### the following is straight from rails and is focused on checking the validity of the app name.
239
241
  ### needs wagn-specific tuning
240
-
241
-
242
+
243
+
242
244
  def app_name
243
245
  @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)
244
246
  end
@@ -253,12 +255,12 @@ class WagnGenerator < Rails::Generators::AppBase
253
255
  end
254
256
 
255
257
  alias :defined_app_const_base? :defined_app_const_base
256
-
258
+
257
259
  def app_const_base
258
260
  @app_const_base ||= defined_app_const_base || app_name.gsub(/\W/, '_').squeeze('_').camelize
259
261
  end
260
262
  alias :camelized :app_const_base
261
-
263
+
262
264
  def app_const
263
265
  @app_const ||= "#{app_const_base}::Application"
264
266
  end
@@ -3,7 +3,6 @@ require 'spork'
3
3
 
4
4
  ENV["RAILS_ENV"] = 'test'
5
5
 
6
-
7
6
  Spork.prefork do
8
7
 
9
8
  if ENV["RAILS_ROOT"]
@@ -105,7 +105,7 @@ namespace :wagn do
105
105
  stamp = ENV['STAMP_MIGRATIONS']
106
106
 
107
107
  puts 'migrating structure'
108
- Rake::Task['db:migrate'].invoke
108
+ Rake::Task['wagn:migrate:structure'].invoke
109
109
  if stamp
110
110
  Rake::Task['wagn:migrate:stamp'].invoke :structure
111
111
  end
@@ -118,6 +118,7 @@ namespace :wagn do
118
118
  Rake::Task['wagn:migrate:stamp'].invoke :core_cards
119
119
  end
120
120
 
121
+
121
122
  puts 'migrating deck cards'
122
123
  Rake::Task['wagn:migrate:deck_cards'].execute #not invoke because we don't want to reload environment
123
124
  if stamp
@@ -137,9 +138,9 @@ namespace :wagn do
137
138
 
138
139
  namespace :migrate do
139
140
  desc "migrate cards"
140
- task :cards do
141
+ task :cards => :environment do
141
142
  Rake::Task['wagn:migrate:core_cards'].invoke
142
- Rake::Task['wagn:migrate:deck_cards'].invoke
143
+ Rake::Task['wagn:migrate:deck_cards'].execute
143
144
  end
144
145
 
145
146
  desc "migrate structure"
@@ -160,8 +161,8 @@ namespace :wagn do
160
161
  ENV['SCHEMA'] ||= "#{Cardio.gem_root}/db/schema.rb"
161
162
  prepare_migration
162
163
  paths = ActiveRecord::Migrator.migrations_paths = Cardio.migration_paths(:core_cards)
164
+ Cardio.schema_mode :core_cards do
163
165
 
164
- Card::CoreMigration.schema_mode :core_cards do
165
166
  ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
166
167
  ActiveRecord::Migrator.migrate paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil
167
168
  end
@@ -27,6 +27,9 @@ class CardController < ActionController::Base
27
27
  attr_reader :card
28
28
 
29
29
 
30
+
31
+
32
+
30
33
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31
34
  # CORE METHODS
32
35
 
@@ -54,6 +57,7 @@ class CardController < ActionController::Base
54
57
  send_file_inside Decko::Engine.paths['gem-assets'].existent.first, [ params[:filename], params[:format] ].join('.'), :x_sendfile => true
55
58
  end
56
59
 
60
+
57
61
  private
58
62
 
59
63
  # make sure that filename doesn't leave allowed_path using ".."
@@ -219,7 +223,12 @@ class CardController < ActionController::Base
219
223
  render :text => target
220
224
  else
221
225
  @card = target
222
- self.params = self.params.merge new_params #need tests. insure we get slot, main...
226
+ #Card::Env[:params] =
227
+ if new_params.delete :soft_redirect
228
+ self.params = new_params
229
+ else
230
+ self.params.merge! new_params # #need tests. insure we get slot, main...
231
+ end
223
232
  show
224
233
  end
225
234
  end
@@ -235,8 +244,6 @@ class CardController < ActionController::Base
235
244
  show view, status
236
245
  end
237
246
 
238
-
239
-
240
247
  def show view = nil, status = 200
241
248
  # ActiveSupport::Notifications.instrument('card', message: 'CardController#show') do
242
249
  format = request.parameters[:format]
@@ -246,7 +253,7 @@ class CardController < ActionController::Base
246
253
  view ||= params[:view]
247
254
 
248
255
  if params[:edit_draft] && card.drafts.present?
249
- card.content = card.drafts.last.changes.last.value
256
+ card.content = card.drafts.last.card_changes.last.value
250
257
  end
251
258
  formatter = card.format(format.to_sym)
252
259
  result = formatter.show view, opts
@@ -1,49 +1,52 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
+
3
4
  Decko::Engine.routes.draw do
4
5
 
5
6
  #most common
6
- root :to => 'card#read', :via=>:get
7
- match "#{ Decko::Engine.config.files_web_path }/:id(-:size)-:rev_id.:format" =>
8
- 'card#read', :via=>:get, :id => /[^-]+/, :explicit_file=>true
9
- match "assets/*filename" => 'card#asset', :via=>:get
10
- match "javascripts/*filename" => 'card#asset', :via=>:get
11
- match "jasmine/*filename" => 'card#asset', :via=>:get
12
-
13
-
14
- match 'recent(.:format)' => 'card#read', :via=>:get, :id => ':recent' #obviate by making links use codename
15
- # match ':view:(:id(.:format))' => 'card#read', :via=>:get
16
- match '(/wagn)/:id(.:format)' => 'card#read', :via=>:get #/wagn is deprecated
17
-
7
+ root 'card#read'
8
+ get "#{ Decko::Engine.config.files_web_path }/:id(-:size)-:rev_id.:format" =>
9
+ 'card#read', :id => /[^-]+/, :explicit_file=>true
10
+ get "assets/*filename" => 'card#asset'
11
+ get "javascripts/*filename" => 'card#asset'
12
+ get "jasmine/*filename" => 'card#asset'
13
+
14
+ get 'recent(.:format)' => 'card#read', :id => ':recent' #obviate by making links use codename
15
+ # match ':view:(:id(.:format))' => 'card#read', :via=>:get
16
+ get '(/wagn)/:id(.:format)' => 'card#read' #/wagn is deprecated
17
+
18
+
18
19
  # RESTful
19
- root :to => 'card#create', :via=>:post
20
- root :to => 'card#update', :via=>:put
21
- root :to => 'card#delete', :via=>:delete
22
-
20
+ post '/' => 'card#create'
21
+ put '/' => 'card#update'
22
+ delete '/' => 'card#delete'
23
+
23
24
  match ':id(.:format)' => 'card#create', :via=>:post
24
25
  match ':id(.:format)' => 'card#update', :via=>:put
25
26
  match ':id(.:format)' => 'card#delete', :via=>:delete
26
27
 
27
28
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~
28
- # legacy
29
- match 'new/:type' => 'card#read', :view=>'new'
30
- match 'card/:view(/:id(.:format))' => 'card#read', :view=> /new|options|edit/
31
-
32
- match 'account/signin' => 'card#read', :id=>':signin'
33
- match 'account/signout' => 'card#delete', :id=>':signin'
34
- match 'account/signup' => 'card#read', :view=>'new', :card=>{ :type_code=>:signup }
35
- match 'account/invite' => 'card#read', :view=>'new', :card=>{ :type_code=>:signup }
36
- match 'account/accept' => 'card#read', :view=>'edit', :card=>{ :type_code=>:signup }
29
+ # legacy
30
+ get 'new/:type' => 'card#read', :view=>'new'
31
+ get 'card/:view(/:id(.:format))' => 'card#read', :view=> /new|options|edit/
32
+
33
+ get 'account/signin' => 'card#read', :id=>':signin'
34
+ get 'account/signout' => 'card#delete', :id=>':signin'
35
+ get 'account/signup' => 'card#read', :view=>'new', :card=>{ :type_code=>:signup }
36
+ get 'account/invite' => 'card#read', :view=>'new', :card=>{ :type_code=>:signup }
37
+ get 'account/accept' => 'card#read', :view=>'edit', :card=>{ :type_code=>:signup }
37
38
  # use type_code rather than id because in some cases (eg populating test data) routes must get loaded without loading Card
38
39
 
39
- match 'admin/stats' => 'card#read', :id=>':stats'
40
- match 'admin/:task' => 'card#update', :id=>':all'
40
+ get 'admin/stats' => 'card#read', :id=>':stats'
41
+ get 'admin/:task' => 'card#update', :id=>':all'
41
42
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~
42
-
43
- # standard non-RESTful
44
- match '(card)/:action(/:id(.:format))' => 'card', :action => /create|read|update|delete|asset/
45
43
 
44
+ # standard non-RESTful
45
+ get '(card)/:action(/:id(.:format))' => 'card', :action => /create|read|update|delete|asset/
46
+ match '(card)/create(/:id(.:format))' => 'card#create', :via=>[:post, :patch]
47
+ match '(card)/update(/:id(.:format))' => 'card#update', :via=>[:post, :put, :patch]
48
+ match '(card)/delete(/:id(.:format))' => 'card#delete', :via=>:delete
46
49
  # other
47
- match '*id' => 'card#read', :view => 'bad_address'
50
+ get '*id' => 'card#read', :view => 'bad_address'
48
51
 
49
52
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = version
8
8
  s.authors = ["Ethan McCutchen", "Lewis Hoffman", "Gerry Gleason", "Philipp Kühl"]
9
9
  s.email = ['info@wagn.org']
10
-
10
+
11
11
  # s.date = '2013-12-20'
12
12
  s.summary = "structured wiki web platform"
13
13
  s.description = "a wiki approach to stuctured data, dynamic interaction, and web design"
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.license = 'GPL'
16
16
 
17
17
  s.files = `git ls-files`.split($/)
18
-
18
+
19
19
  s.bindir = 'bin'
20
20
  s.executables = [ 'wagn' ]
21
21
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -24,10 +24,10 @@ Gem::Specification.new do |s|
24
24
  s.required_ruby_version = '>= 1.8.7'
25
25
 
26
26
  [
27
- [ 'rails', '3.2.16' ],
27
+ [ 'rails', '~> 4.2' ],
28
28
  [ 'card', version ]
29
29
  ].each do |dep|
30
30
  s.add_runtime_dependency *dep
31
31
  end
32
-
32
+
33
33
  end
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.15.7
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,36 +11,36 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-06-15 00:00:00.000000000 Z
14
+ date: 2015-07-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '='
20
+ - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: 3.2.16
22
+ version: '4.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '='
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.16
29
+ version: '4.2'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: card
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 1.15.7
36
+ version: 1.16.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.15.7
43
+ version: 1.16.0
44
44
  description: a wiki approach to stuctured data, dynamic interaction, and web design
45
45
  email:
46
46
  - info@wagn.org
@@ -794,3 +794,4 @@ test_files:
794
794
  - test/script/run_engine_deck.sh
795
795
  - test/script/run_mig.sh
796
796
  - test/test_helper.rb
797
+ has_rdoc: