decko 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/decko.gemspec +1 -1
- data/features/layouts.feature +4 -4
- data/features/presetting_content.feature +1 -1
- data/features/reference.feature +5 -5
- data/features/rules.feature +1 -1
- data/features/setup.feature +2 -2
- data/features/step_definitions/wagn_steps.rb +9 -1
- data/features/step_definitions/web_steps.rb +2 -1
- data/features/structure.feature +1 -1
- data/features/support/delayed_job.rb +2 -1
- data/features/support/env.rb +2 -2
- data/features/support/wagn_env.rb +1 -2
- data/features/table_of_contents.feature +1 -1
- data/features/toolbar.feature +1 -1
- data/features/update_includers.feature +2 -0
- data/lib/decko/application.rb +5 -3
- data/lib/decko/config/environments/test.rb +0 -2
- data/lib/decko/generators/decko/templates/Gemfile +1 -1
- data/lib/decko/generators/decko/templates/config/deck.yml +10 -0
- data/lib/decko/tasks/decko.rake +46 -28
- data/rails/controllers/card_controller.rb +4 -10
- data/spec/javascripts/wagn_spec.coffee +6 -6
- data/test/performance/render_test.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 953bbfc987bc5b3777a2aa3eac096a7637eb2248
|
4
|
+
data.tar.gz: 51d1f2f8032fbd00f56b97beb53076a5387aa751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564a3f49721deba98ae3de3c0f326da1861aaf8800bef5ebfc624d6b855e927cb4ec970b77096dae606237004258b204d9f1c8bc9dd248869e0d83ec281bdef6
|
7
|
+
data.tar.gz: 732ee8bebbedfd297aad152c368c5ca4bf478e66629f96dfcbe80b030126aac4c8b8a9e0fad5d099236edccac685d0dbeb74f9689a15364c7c2ee0039659e144
|
data/README.rdoc
CHANGED
@@ -17,7 +17,7 @@ Try it out with automated setup at Cloudstore[https://cldstr.com/wagn.org/wagn]
|
|
17
17
|
|
18
18
|
==System Requirements
|
19
19
|
|
20
|
-
Ruby[http://www.ruby-lang.org/en/]:: version 2.
|
20
|
+
Ruby[http://www.ruby-lang.org/en/]:: version 2.3 or higher
|
21
21
|
Bundler[http://gembundler.com/]:: version 1.0 or higher
|
22
22
|
ImageMagick[http://www.imagemagick.org/]::
|
23
23
|
A database engine:: Either MySQL[http://www.mysql.com/] or PostgreSQL[http://www.postgresql.org/]
|
data/decko.gemspec
CHANGED
data/features/layouts.feature
CHANGED
@@ -6,11 +6,8 @@ Feature: Layouts
|
|
6
6
|
|
7
7
|
Background:
|
8
8
|
Given I am signed in as Joe Admin
|
9
|
-
And I create
|
9
|
+
And I create Layout card "simple layout" with content "Simple Header {{_main}} Simple Footer"
|
10
10
|
And the card "*all+*layout" contains "[[simple layout]]"
|
11
|
-
And I create Pointer card "User+*type+*layout" with content "[[user layout]]"
|
12
|
-
And I create HTML card "user layout" with content "User Header {{_main}}"
|
13
|
-
And I wait for ajax response
|
14
11
|
|
15
12
|
Scenario: I visit a Basic card with the simple layout
|
16
13
|
When I go to card "*account links"
|
@@ -18,6 +15,9 @@ Feature: Layouts
|
|
18
15
|
And I should see "Joe Admin"
|
19
16
|
|
20
17
|
Scenario: I visit a User card with the user layout
|
18
|
+
Given I create Layout card "user layout" with content "User Header {{_main}}"
|
19
|
+
And I create Pointer card "User+*type+*layout" with content "[[user layout]]"
|
20
|
+
And I wait 1 seconds
|
21
21
|
When I go to card "Joe User"
|
22
22
|
Then I should see "User Header"
|
23
23
|
|
data/features/reference.feature
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@javascript
|
2
2
|
Feature: Reference
|
3
3
|
In order to connect related cards
|
4
|
-
As a
|
4
|
+
As a Decker
|
5
5
|
|
6
6
|
Background:
|
7
7
|
Given I am signed in as Joe Admin
|
@@ -10,16 +10,16 @@ Feature: Reference
|
|
10
10
|
Scenario: Renaming a embed card
|
11
11
|
When I create PlainText card "Vignesh" with content "Indian"
|
12
12
|
And I wait for ajax response
|
13
|
-
And I wait 2 seconds
|
14
13
|
And I create PlainText card "Kawaii Man" with content "[[Vignesh]]"
|
15
14
|
And I wait for ajax response
|
15
|
+
Then I should see "Vignesh"
|
16
|
+
And I wait for ajax response
|
16
17
|
And I go to rename "Vignesh"
|
17
18
|
And I fill in "card_name" with "Srivigneshwar"
|
18
19
|
And I press "Rename"
|
19
|
-
And I wait
|
20
|
+
And I wait 2 seconds
|
20
21
|
And I press "Rename and Update"
|
21
|
-
And I wait
|
22
|
-
And I wait 4 seconds
|
22
|
+
And I wait 2 seconds
|
23
23
|
Then I go to card "Kawaii Man"
|
24
24
|
And I should see "Srivigneshwar"
|
25
25
|
|
data/features/rules.feature
CHANGED
data/features/setup.feature
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Feature: Setting up
|
2
2
|
In order to be able to start a new Wagn site
|
3
|
-
As a
|
3
|
+
As a Decker
|
4
4
|
I want to setup an initial account
|
5
5
|
|
6
6
|
Background:
|
7
7
|
|
8
|
-
Scenario:
|
8
|
+
Scenario: Decker visits site for first time
|
9
9
|
Given site simulates setup need
|
10
10
|
#done here bc cache gets cleared otherwise
|
11
11
|
|
@@ -186,7 +186,7 @@ When /I wait a sec/ do
|
|
186
186
|
sleep 1
|
187
187
|
end
|
188
188
|
|
189
|
-
When /I wait (\d+) seconds
|
189
|
+
When /I wait (\d+) seconds?$/ do |period|
|
190
190
|
sleep period.to_i
|
191
191
|
end
|
192
192
|
|
@@ -293,6 +293,14 @@ Given /^Jobs are dispatched$/ do
|
|
293
293
|
Delayed::Worker.new.work_off
|
294
294
|
end
|
295
295
|
|
296
|
+
Then /^No errors in the job queue$/ do
|
297
|
+
if (last = Delayed::Job.last) && (last.last_error)
|
298
|
+
puts last.last_error
|
299
|
+
expect(last.last_error).to be_blank
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
|
296
304
|
Then /I submit$/ do
|
297
305
|
click_button "Submit"
|
298
306
|
end
|
@@ -25,7 +25,7 @@ end
|
|
25
25
|
|
26
26
|
When /^(?:|I )press "([^"]*)"$/ do |button|
|
27
27
|
click_button(button)
|
28
|
-
wait_for_ajax if button == "Submit"
|
28
|
+
wait_for_ajax if @javascript && (button == "Submit" || button =~ /rename/i)
|
29
29
|
end
|
30
30
|
|
31
31
|
When /^(?:|I )follow "([^"]*)"$/ do |link|
|
@@ -34,6 +34,7 @@ end
|
|
34
34
|
|
35
35
|
When /^(?:|I )click on "([^"]*)"$/ do |link|
|
36
36
|
click_link_or_button(link)
|
37
|
+
wait_for_ajax
|
37
38
|
end
|
38
39
|
|
39
40
|
When /^(?:|I )follow "([^"]*)" within "([^"]*)"$/ do |link, parent|
|
data/features/structure.feature
CHANGED
data/features/support/env.rb
CHANGED
@@ -20,7 +20,7 @@ $feature_seeded ||= ::Set.new
|
|
20
20
|
# newer version of cucumber-rails. Consider adding your own code to a new file
|
21
21
|
# instead of editing this one. Cucumber will automatically load all
|
22
22
|
# features/**/*.rb files.
|
23
|
-
Before("@background-jobs
|
23
|
+
Before("@background-jobs or @delayed-jobs or @javascript") do |scenario|
|
24
24
|
# DatabaseCleaner.strategy = :truncation
|
25
25
|
Card.seed_test_db unless $feature_seeded.include?(scenario.feature.name)
|
26
26
|
end
|
@@ -47,7 +47,7 @@ Before("@javascript") do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
Before do
|
50
|
-
Capybara.page.current_window.resize_to
|
50
|
+
Capybara.page.current_window.resize_to 1440, 1280
|
51
51
|
end
|
52
52
|
|
53
53
|
require "cucumber/rails"
|
data/features/toolbar.feature
CHANGED
@@ -51,12 +51,14 @@ Feature: Updates for Children of watched cards
|
|
51
51
|
When I edit "Banana" with plusses:
|
52
52
|
|color|flavor|
|
53
53
|
|spotted|mushy|
|
54
|
+
And I wait 1 second
|
54
55
|
Then Joe Camel should be notified that "Joe User updated \"Banana\""
|
55
56
|
When Joe Camel is watching "Banana+*self"
|
56
57
|
And I wait a sec
|
57
58
|
And I edit "Banana" with plusses:
|
58
59
|
|color|flavor|
|
59
60
|
|green|mushy|
|
61
|
+
And I wait 1 second
|
60
62
|
Then Joe Camel should be notified that "Joe User updated \"Banana\""
|
61
63
|
Given a clear email queue
|
62
64
|
And I edit "Banana" with plusses:
|
data/lib/decko/application.rb
CHANGED
@@ -20,6 +20,10 @@ module Decko
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
initializer :load_card, after: :load_config_initializers, group: :all do
|
24
|
+
Card
|
25
|
+
end
|
26
|
+
|
23
27
|
class << self
|
24
28
|
def inherited base
|
25
29
|
super
|
@@ -58,6 +62,7 @@ module Decko
|
|
58
62
|
config.i18n.enforce_available_locales = true
|
59
63
|
# config.active_record.raise_in_transactional_callbacks = true
|
60
64
|
|
65
|
+
config.allow_concurrency = false
|
61
66
|
config.assets.enabled = false
|
62
67
|
config.assets.version = "1.0"
|
63
68
|
|
@@ -71,7 +76,6 @@ module Decko
|
|
71
76
|
paths = super
|
72
77
|
Cardio.set_paths paths
|
73
78
|
|
74
|
-
paths["mod"] << "mod"
|
75
79
|
paths.add "files"
|
76
80
|
|
77
81
|
paths["app/models"] = []
|
@@ -82,8 +86,6 @@ module Decko
|
|
82
86
|
with: "rails/application-routes.rb"
|
83
87
|
end
|
84
88
|
|
85
|
-
Cardio.set_mod_paths # really this should happen later
|
86
|
-
|
87
89
|
paths
|
88
90
|
end
|
89
91
|
end
|
@@ -27,7 +27,7 @@ gem '<%= database_gemfile_entry.name %>'<%= %(, '#{database_gemfile_entry.versio
|
|
27
27
|
group :test do
|
28
28
|
gem 'rails-controller-testing'
|
29
29
|
gem 'rspec'
|
30
|
-
gem 'rspec-rails' # behavior-driven-development suite
|
30
|
+
gem 'rspec-rails', '~>3.6.1' # behavior-driven-development suite
|
31
31
|
gem 'spork', '>=0.9'
|
32
32
|
gem 'rubocop'
|
33
33
|
gem 'rubocop-decko'
|
data/lib/decko/tasks/decko.rake
CHANGED
@@ -11,35 +11,27 @@ CARD_TASKS =
|
|
11
11
|
|
12
12
|
link_task CARD_TASKS, from: :decko, to: :card
|
13
13
|
|
14
|
-
namespace :decko do
|
14
|
+
decko_namespace = namespace :decko do
|
15
15
|
desc "create a decko database from scratch, load initial data"
|
16
16
|
task :seed do
|
17
|
-
|
18
|
-
|
19
|
-
# FIXME: this should be an option, but should not happen on standard
|
20
|
-
# creates!
|
21
|
-
begin
|
22
|
-
Rake::Task["db:drop"].invoke
|
23
|
-
rescue
|
24
|
-
puts "not dropped"
|
25
|
-
end
|
26
|
-
|
27
|
-
puts "creating"
|
28
|
-
Rake::Task["db:create"].invoke
|
29
|
-
|
30
|
-
puts "loading schema"
|
31
|
-
Rake::Task["db:schema:load"].invoke
|
17
|
+
seed
|
18
|
+
end
|
32
19
|
|
33
|
-
|
20
|
+
desc "create a decko database from scratch, load initial data, don't reset the cache"
|
21
|
+
task :seed_without_reset do
|
22
|
+
# This variant is needed to generate test databases for decks
|
23
|
+
# with custom codenames.
|
24
|
+
# The cache reset loads the environment. That tends to fail
|
25
|
+
# because of missing codenames that are added after the intial decko seed.
|
26
|
+
seed with_cache_reset: false
|
34
27
|
end
|
35
28
|
|
36
29
|
desc "clear and load fixtures with existing tables"
|
37
30
|
task reseed: :environment do
|
38
31
|
ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
Rake::Task["decko:load"].invoke
|
33
|
+
decko_namespace["clear"].invoke
|
34
|
+
decko_namespace["load"].invoke
|
43
35
|
end
|
44
36
|
|
45
37
|
desc "empty the card tables"
|
@@ -54,23 +46,27 @@ namespace :decko do
|
|
54
46
|
|
55
47
|
desc "Load bootstrap data into database"
|
56
48
|
task :load do
|
49
|
+
decko_namespace["load_without_reset"].invoke
|
50
|
+
puts "reset cache"
|
51
|
+
system "bundle exec rake decko:reset_cache" # needs loaded environment
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Load bootstrap data into database but don't reset cache"
|
55
|
+
task :load_without_reset do
|
57
56
|
require "decko/engine"
|
58
57
|
puts "update card_migrations"
|
59
|
-
|
58
|
+
decko_namespace["assume_card_migrations"].invoke
|
60
59
|
|
61
60
|
if Rails.env == "test" && !ENV["GENERATE_FIXTURES"]
|
62
61
|
puts "loading test fixtures"
|
63
62
|
Rake::Task["db:fixtures:load"].invoke
|
64
63
|
else
|
65
64
|
puts "loading bootstrap"
|
66
|
-
|
65
|
+
decko_namespace["bootstrap:load"].invoke
|
67
66
|
end
|
68
67
|
|
69
68
|
puts "set symlink for assets"
|
70
|
-
|
71
|
-
|
72
|
-
puts "reset cache"
|
73
|
-
system "bundle exec rake decko:reset_cache" # needs loaded environment
|
69
|
+
decko_namespace["update_assets_symlink"].invoke
|
74
70
|
end
|
75
71
|
|
76
72
|
desc "update decko gems and database"
|
@@ -81,10 +77,10 @@ namespace :decko do
|
|
81
77
|
FileUtils.rm_rf Decko.paths["tmp"].first, secure: true
|
82
78
|
end
|
83
79
|
Dir.mkdir Decko.paths["tmp"].first
|
84
|
-
|
80
|
+
decko_namespace["migrate"].invoke
|
85
81
|
# FIXME: remove tmp dir / clear cache
|
86
82
|
puts "set symlink for assets"
|
87
|
-
|
83
|
+
decko_namespace["update_assets_symlink"].invoke
|
88
84
|
end
|
89
85
|
|
90
86
|
desc "set symlink for assets"
|
@@ -106,6 +102,28 @@ namespace :decko do
|
|
106
102
|
Cardio.assume_migrated_upto_version :core_cards
|
107
103
|
end
|
108
104
|
|
105
|
+
def seed with_cache_reset: true
|
106
|
+
ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
|
107
|
+
# FIXME: this should be an option, but should not happen on standard
|
108
|
+
# creates!
|
109
|
+
begin
|
110
|
+
Rake::Task["db:drop"].invoke
|
111
|
+
rescue
|
112
|
+
puts "not dropped"
|
113
|
+
end
|
114
|
+
|
115
|
+
puts "creating"
|
116
|
+
Rake::Task["db:create"].invoke
|
117
|
+
|
118
|
+
puts "loading schema"
|
119
|
+
|
120
|
+
Rake::Task["db:schema:load"].invoke
|
121
|
+
|
122
|
+
load_task = "decko:load"
|
123
|
+
load_task << "_without_reset" unless with_cache_reset
|
124
|
+
Rake::Task[load_task].invoke
|
125
|
+
end
|
126
|
+
|
109
127
|
namespace :emergency do
|
110
128
|
task rescue_watchers: :environment do
|
111
129
|
follower_hash = Hash.new { |h, v| h[v] = [] }
|
@@ -60,13 +60,6 @@ class CardController < ActionController::Base
|
|
60
60
|
Card::Machine.refresh_script_and_style if Rails.env.development?
|
61
61
|
Card::Cache.renew
|
62
62
|
Card::Env.reset controller: self
|
63
|
-
# unprotect_card_params!
|
64
|
-
end
|
65
|
-
|
66
|
-
def unprotect_card_params!
|
67
|
-
# FIXME: always wear protection
|
68
|
-
return unless params[:card].is_a? ActionController::Parameters
|
69
|
-
params[:card].to_unsafe_h
|
70
63
|
end
|
71
64
|
|
72
65
|
def authenticate
|
@@ -99,11 +92,11 @@ class CardController < ActionController::Base
|
|
99
92
|
|
100
93
|
def render_success
|
101
94
|
success = Card::Env.success
|
102
|
-
success.name_context = @card.
|
95
|
+
success.name_context = @card.name
|
103
96
|
if !Card::Env.ajax? || success.hard_redirect?
|
104
97
|
card_redirect success.to_url
|
105
98
|
elsif success.target.is_a? String
|
106
|
-
render text: success.target
|
99
|
+
render! text: success.target
|
107
100
|
else
|
108
101
|
reset_card success.target
|
109
102
|
show
|
@@ -118,10 +111,11 @@ class CardController < ActionController::Base
|
|
118
111
|
|
119
112
|
view ||= params[:view]
|
120
113
|
result = card.act do
|
121
|
-
format.page view, Card::Env.slot_opts
|
114
|
+
format.page self, view, Card::Env.slot_opts
|
122
115
|
end
|
123
116
|
|
124
117
|
status = format.error_status || status
|
118
|
+
# puts "RESULT: #{format.class}/#{status}"
|
125
119
|
deliver format, result, status
|
126
120
|
end
|
127
121
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
describe "Global
|
2
|
+
describe "Global decko variable", ->
|
3
3
|
it "should be defined", ->
|
4
4
|
expect(decko).toBeDefined
|
5
5
|
|
@@ -13,21 +13,21 @@ describe "card-form", ->
|
|
13
13
|
|
14
14
|
it "should be able to populate the content field based on nearby selector", ->
|
15
15
|
$('.tinymce-textarea').setContentField -> 1+2
|
16
|
-
expect($('.card-content')).toHaveValue '3'
|
16
|
+
expect($('.d0-card-content')).toHaveValue '3'
|
17
17
|
|
18
18
|
it "should be able to populate all content fields in a form", ->
|
19
19
|
$('form').setContentFields '.tinymce-textarea', -> 2+2
|
20
|
-
expect($('.card-content')).toHaveValue '4'
|
20
|
+
expect($('.d0-card-content')).toHaveValue '4'
|
21
21
|
|
22
22
|
it "should be able to populate content fields from a map", ->
|
23
23
|
$('form').setContentFieldsFromMap { '.tinymce-textarea': -> 3+2 }
|
24
|
-
expect($('.card-content')).toHaveValue '5'
|
24
|
+
expect($('.d0-card-content')).toHaveValue '5'
|
25
25
|
|
26
26
|
it "should be able to find the slot from any element within", ->
|
27
|
-
expect($('.card-content').slot()).toHaveClass 'card-slot'
|
27
|
+
expect($('.d0-card-content').slot()).toHaveClass 'card-slot'
|
28
28
|
|
29
29
|
it "should be able to populate slot from any element within", ->
|
30
|
-
$('.card-content').setSlotContent '<div class="card-slot">whoopee</div>'
|
30
|
+
$('.d0-card-content').setSlotContent '<div class="card-slot">whoopee</div>'
|
31
31
|
expect($('.card-slot')).toHaveHtml 'whoopee'
|
32
32
|
|
33
33
|
|
@@ -5,6 +5,6 @@ require "rails/performance_test_help"
|
|
5
5
|
class RenderTest < ActionDispatch::PerformanceTest
|
6
6
|
Card
|
7
7
|
def render_test
|
8
|
-
Card.new(name: "hi", content: "{{+plus1}} {{+plus2}} {{+plus3}}" .format).render :core
|
8
|
+
Card.new(name: "hi", content: "{{+plus1}} {{+plus2}} {{+plus3}}" .format).render! :core
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-10-
|
14
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -33,14 +33,14 @@ dependencies:
|
|
33
33
|
requirements:
|
34
34
|
- - '='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 1.
|
36
|
+
version: 1.93.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.
|
43
|
+
version: 1.93.0
|
44
44
|
description: a wiki approach to stuctured data, dynamic interaction, and web design
|
45
45
|
email:
|
46
46
|
- info@decko.org
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/decko/generators/decko/templates/config/databases/oracle.yml
|
152
152
|
- lib/decko/generators/decko/templates/config/databases/postgresql.yml
|
153
153
|
- lib/decko/generators/decko/templates/config/databases/sqlite3.yml
|
154
|
+
- lib/decko/generators/decko/templates/config/deck.yml
|
154
155
|
- lib/decko/generators/decko/templates/config/environment.rb
|
155
156
|
- lib/decko/generators/decko/templates/config/routes.erb
|
156
157
|
- lib/decko/generators/decko/templates/gitignore
|
@@ -769,7 +770,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
769
770
|
requirements:
|
770
771
|
- - ">="
|
771
772
|
- !ruby/object:Gem::Version
|
772
|
-
version: 2.
|
773
|
+
version: '2.3'
|
773
774
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
774
775
|
requirements:
|
775
776
|
- - ">="
|