wagn 1.14.0 → 1.14.1
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 +5 -13
- data/VERSION +1 -1
- data/app/controllers/card_controller.rb +1 -1
- data/db/bootstrap/card_actions.yml +544 -544
- data/db/bootstrap/card_acts.yml +2 -2
- data/db/bootstrap/card_changes.yml +552 -562
- data/db/bootstrap/card_references.yml +340 -347
- data/db/bootstrap/cards.yml +2328 -2327
- data/db/migrate/20141121172918_rename_card_migration_table.rb +8 -0
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +0 -8
- data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +15 -0
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +10 -0
- data/db/schema.rb +3 -3
- data/db/version.txt +1 -0
- data/db/version_core_cards.txt +1 -0
- data/features/{watch.feature → follow.feature} +3 -2
- data/features/notifications.feature +5 -5
- data/features/setup.feature +1 -1
- data/features/step_definitions/email_steps.rb +18 -18
- data/features/step_definitions/wagn_steps.rb +14 -8
- data/features/step_definitions/web_steps.rb +2 -2
- data/lib/card/action.rb +2 -2
- data/lib/card/codename.rb +18 -12
- data/lib/card/generators/card_migration/card_migration_generator.rb +2 -1
- data/lib/wagn/application.rb +1 -1
- data/lib/wagn/cache.rb +9 -0
- data/{config → lib/wagn/config}/routes.rb +0 -0
- data/lib/wagn/core_migration.rb +2 -2
- data/lib/wagn/generators/wagn/wagn_generator.rb +1 -2
- data/lib/wagn/migration.rb +8 -14
- data/lib/wagn/tasks/wagn.rake +4 -4
- data/lib/wagn/version.rb +11 -4
- data/mod/01_core/set/all/collection.rb +1 -1
- data/mod/01_core/set/all/content.rb +6 -2
- data/mod/01_core/set/all/phases.rb +1 -1
- data/mod/01_core/set/all/tracked_attributes.rb +1 -1
- data/mod/02_basic_types/set/type/pointer.rb +9 -8
- data/mod/03_machines/set/right/machine_output.rb +1 -1
- data/mod/05_standard/set/all/attach.rb +2 -2
- data/mod/05_standard/set/all/follow.rb +2 -2
- data/mod/05_standard/set/all/rss.rb +2 -2
- data/mod/05_standard/set/type/signup.rb +3 -3
- data/test/fixtures/card_actions.yml +954 -954
- data/test/fixtures/card_acts.yml +196 -196
- data/test/fixtures/card_changes.yml +2609 -2619
- data/test/fixtures/card_references.yml +495 -502
- data/test/fixtures/cards.yml +2870 -2869
- metadata +13 -12
- data/Rakefile +0 -7
- data/config/samples/cucumber.yml +0 -8
- data/config/version.txt +0 -1
- data/config/version_cards.txt +0 -1
@@ -119,14 +119,6 @@ class AddEmailCards < Wagn::CoreMigration
|
|
119
119
|
email_config_card.delete!
|
120
120
|
end
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
# move old send rule to on_create
|
125
|
-
#fields = %w( to from cc bcc subject message attach )
|
126
|
-
Card.search(:right=>"*send").each do |send_rule|
|
127
|
-
Card.create! :name=>"#{send_rule.left_name}+*on create", :content=>send_rule.content, :type_code=>:pointer
|
128
|
-
send_rule.delete #@ethn: keep old rule for safety reasons?
|
129
|
-
end
|
130
122
|
|
131
123
|
# the new following rule
|
132
124
|
Card.create! :name => '*following', :type_code=>:pointer, :codename=>'following'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
class MakeSymlinksRelative < Wagn::Migration
|
4
|
+
def up
|
5
|
+
Wagn.paths['files'].each do |file_path|
|
6
|
+
files = Dir.glob(File.join file_path, '**', '*')
|
7
|
+
symlinks = files.select {|f| File.symlink? f }
|
8
|
+
symlinks.each do |symlink|
|
9
|
+
base = File.basename( File.readlink(symlink) )
|
10
|
+
File.delete symlink
|
11
|
+
File.symlink base, symlink
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
class FixNotificationHtmlMessage < Wagn::CoreMigration
|
4
|
+
def up
|
5
|
+
codename = :follower_notification_email
|
6
|
+
dir = File.join data_path, 'mailer'
|
7
|
+
html_message = Card[codename].fetch :trait=>'html_message'
|
8
|
+
html_message.update_attributes! :content=>File.read( File.join( dir, "#{codename}.html" ))
|
9
|
+
end
|
10
|
+
end
|
data/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20141121172918) do
|
15
15
|
|
16
16
|
create_table "card_actions", :force => true do |t|
|
17
17
|
t.integer "card_id"
|
@@ -90,11 +90,11 @@ ActiveRecord::Schema.define(:version => 20141001105348) do
|
|
90
90
|
add_index "cards", ["right_id"], :name => "index_cards_on_tag_id"
|
91
91
|
add_index "cards", ["type_id"], :name => "card_type_index"
|
92
92
|
|
93
|
-
create_table "
|
93
|
+
create_table "schema_migrations_core_cards", :id => false, :force => true do |t|
|
94
94
|
t.string "version", :null => false
|
95
95
|
end
|
96
96
|
|
97
|
-
add_index "
|
97
|
+
add_index "schema_migrations_core_cards", ["version"], :name => "unique_schema_migrations_cards", :unique => true
|
98
98
|
|
99
99
|
create_table "schema_migrations_deck_cards", :id => false, :force => true do |t|
|
100
100
|
t.string "version", :null => false
|
data/db/version.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
20141121172918
|
@@ -0,0 +1 @@
|
|
1
|
+
20141120120605
|
@@ -26,8 +26,9 @@ Feature: Watch interface
|
|
26
26
|
Given Joe User is watching "Home"
|
27
27
|
And I am on the homepage
|
28
28
|
And I hover over the main menu
|
29
|
-
And In the main card menu I
|
30
|
-
#note: turns to "unfollow on mouseover
|
29
|
+
And In the main card menu I find link with class "watch-toggle-off" and click it
|
30
|
+
#note: the link name turns from "follwing" to "unfollow" on mouseover and because we don't control the mouse's position
|
31
|
+
# this test randomly fails if we use the link name
|
31
32
|
Then In the main card menu I should see "follow"
|
32
33
|
And the card Joe User+*following should not contain "Home"
|
33
34
|
|
@@ -3,16 +3,16 @@ Feature: Notifications
|
|
3
3
|
Users should be able to track changes to Wagn cards from their email
|
4
4
|
|
5
5
|
Scenario: Watching a Card
|
6
|
-
Given Joe Admin is watching "
|
6
|
+
Given Joe Admin is watching "All Eyes On Me"
|
7
7
|
And I am signed in as Joe Admin
|
8
|
-
When Joe User edits "
|
9
|
-
Then Joe Admin should be notified that "Joe User updated \"
|
10
|
-
And the card Joe Admin+*following should contain "
|
8
|
+
When Joe User edits "All Eyes On Me" setting content to "Boo"
|
9
|
+
Then Joe Admin should be notified that "Joe User updated \"All Eyes On Me\""
|
10
|
+
And the card Joe Admin+*following should contain "All Eyes On Me"
|
11
11
|
# FIXME:need multiline matching
|
12
12
|
#And He should see "was just edited by Joe User" in the email
|
13
13
|
#And He should see "You received this email because you're watching Home" in the email
|
14
14
|
When I follow "Unfollow" in the email
|
15
|
-
Then the card Joe Admin+*following should not contain "
|
15
|
+
Then the card Joe Admin+*following should not contain "All Eyes On Me"
|
16
16
|
|
17
17
|
Scenario: Watching a Type Card
|
18
18
|
Given Joe Admin is watching "Phrase"
|
data/features/setup.feature
CHANGED
@@ -50,16 +50,16 @@ end
|
|
50
50
|
#
|
51
51
|
|
52
52
|
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount|
|
53
|
-
unread_emails_for(address).size.
|
53
|
+
expect(unread_emails_for(address).size).to eq(parse_email_count(amount))
|
54
54
|
end
|
55
55
|
|
56
56
|
Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amount|
|
57
|
-
mailbox_for(address).size.
|
57
|
+
expect(mailbox_for(address).size).to eq(parse_email_count(amount))
|
58
58
|
end
|
59
59
|
|
60
60
|
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject|
|
61
61
|
# address = address_for_user address
|
62
|
-
unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size.
|
62
|
+
expect(unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size).to eq(parse_email_count(amount))
|
63
63
|
end
|
64
64
|
|
65
65
|
Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
|
@@ -88,31 +88,31 @@ end
|
|
88
88
|
#
|
89
89
|
|
90
90
|
Then /^(?:I|they) should see "([^"]*?)" in the email subject$/ do |text|
|
91
|
-
current_email.
|
91
|
+
expect(current_email).to have_subject(text)
|
92
92
|
end
|
93
93
|
|
94
94
|
Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text|
|
95
|
-
current_email.
|
95
|
+
expect(current_email).to have_subject(Regexp.new(text))
|
96
96
|
end
|
97
97
|
|
98
98
|
Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text|
|
99
|
-
current_email.body.
|
99
|
+
expect(current_email.body).to include(text)
|
100
100
|
end
|
101
101
|
|
102
102
|
Then /^(?:I|they) should see \/([^"]*?)\/ in the email body$/ do |text|
|
103
|
-
current_email.body.
|
103
|
+
expect(current_email.body).to match(Regexp.new(text))
|
104
104
|
end
|
105
105
|
|
106
106
|
Then /^(?:I|they) should see the email delivered from "([^"]*?)"$/ do |text|
|
107
|
-
current_email.
|
107
|
+
expect(current_email).to be_delivered_from(text)
|
108
108
|
end
|
109
109
|
|
110
110
|
Then /^(?:I|they) should see "([^\"]*)" in the email "([^"]*?)" header$/ do |text, name|
|
111
|
-
current_email.
|
111
|
+
expect(current_email).to have_header(name, text)
|
112
112
|
end
|
113
113
|
|
114
114
|
Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |text, name|
|
115
|
-
current_email.
|
115
|
+
expect(current_email).to have_header(name, Regexp.new(text))
|
116
116
|
end
|
117
117
|
|
118
118
|
#
|
@@ -120,28 +120,28 @@ end
|
|
120
120
|
#
|
121
121
|
|
122
122
|
Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amount|
|
123
|
-
current_email_attachments.size.
|
123
|
+
expect(current_email_attachments.size).to eq(parse_email_count(amount))
|
124
124
|
end
|
125
125
|
|
126
126
|
Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
|
127
|
-
current_email_attachments.select { |a| a.original_filename == filename }.size.
|
127
|
+
expect(current_email_attachments.select { |a| a.original_filename == filename }.size).to eq(parse_email_count(amount))
|
128
128
|
end
|
129
129
|
|
130
130
|
Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
|
131
|
-
current_email_attachments[(index.to_i - 1)].original_filename.
|
131
|
+
expect(current_email_attachments[(index.to_i - 1)].original_filename).to eq(filename)
|
132
132
|
end
|
133
133
|
|
134
134
|
Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
|
135
|
-
current_email_attachments.select { |a| a.content_type == content_type }.size.
|
135
|
+
expect(current_email_attachments.select { |a| a.content_type == content_type }.size).to eq(parse_email_count(amount))
|
136
136
|
end
|
137
137
|
|
138
138
|
Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
|
139
|
-
current_email_attachments[(index.to_i - 1)].content_type.
|
139
|
+
expect(current_email_attachments[(index.to_i - 1)].content_type).to eq(content_type)
|
140
140
|
end
|
141
141
|
|
142
142
|
Then /^all attachments should not be blank$/ do
|
143
143
|
current_email_attachments.each do |attachment|
|
144
|
-
attachment.size.
|
144
|
+
expect(attachment.size).not_to eq(0)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
@@ -196,11 +196,11 @@ Then /^(.*) should be notified that "(.*)"$/ do |username, subject|
|
|
196
196
|
end
|
197
197
|
|
198
198
|
Then /^No notification should be sent$/ do
|
199
|
-
all_emails.
|
199
|
+
expect(all_emails).to be_empty
|
200
200
|
end
|
201
201
|
|
202
202
|
|
203
203
|
def address_for_user username
|
204
204
|
card_with_acct = username=='I' ? Auth.current : Card[username]
|
205
205
|
card_with_acct ? card_with_acct.account.email : username
|
206
|
-
end
|
206
|
+
end
|
@@ -196,6 +196,12 @@ When /^In (.*) I click "(.*)"$/ do |section, link|
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
+
When /^In (.*) I find link with class "(.*)" and click it$/ do |section, css_class|
|
200
|
+
within scope_of(section) do
|
201
|
+
find("a.#{css_class}").click
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
199
205
|
Then /I submit$/ do
|
200
206
|
click_button("Submit")
|
201
207
|
end
|
@@ -210,30 +216,30 @@ end
|
|
210
216
|
Then /the card (.*) should contain "([^\"]*)"$/ do |cardname, content|
|
211
217
|
visit path_to("card #{cardname}")
|
212
218
|
within scope_of("main card content") do
|
213
|
-
page.
|
219
|
+
expect(page).to have_content(content)
|
214
220
|
end
|
215
221
|
end
|
216
222
|
|
217
223
|
Then /the card (.*) should not contain "([^\"]*)"$/ do |cardname, content|
|
218
224
|
visit path_to("card #{cardname}")
|
219
225
|
within scope_of("main card content") do
|
220
|
-
page.
|
226
|
+
expect(page).not_to have_content(content)
|
221
227
|
end
|
222
228
|
end
|
223
229
|
|
224
230
|
Then /^In (.*) I should see "([^\"]*)"$/ do |section, text|
|
225
231
|
within scope_of(section) do
|
226
232
|
if text.index('|')
|
227
|
-
text.split('|').any? {|t| have_content(t)}.
|
233
|
+
expect(text.split('|').any? {|t| have_content(t)}).to be
|
228
234
|
else
|
229
|
-
page.
|
235
|
+
expect(page).to have_content(text)
|
230
236
|
end
|
231
237
|
end
|
232
238
|
end
|
233
239
|
|
234
240
|
Then /^In (.*) I should not see "([^\"]*)"$/ do |section, text|
|
235
241
|
within scope_of(section) do
|
236
|
-
page.
|
242
|
+
expect(page).not_to have_content(text)
|
237
243
|
end
|
238
244
|
end
|
239
245
|
|
@@ -246,11 +252,11 @@ Then /^In (.*) I should (not )?see a ([^\"]*) with class "([^\"]*)"$/ do |select
|
|
246
252
|
end
|
247
253
|
|
248
254
|
Then /^the "([^"]*)" field should contain "([^"]*)"$/ do |field, value|
|
249
|
-
field_labeled(field).value.
|
255
|
+
expect(field_labeled(field).value).to match(/#{value}/)
|
250
256
|
end
|
251
257
|
|
252
258
|
Then /^"([^"]*)" should be selected for "([^"]*)"$/ do |value, field|
|
253
|
-
field_labeled(field).element.search(".//option[@selected = 'selected']").inner_html.
|
259
|
+
expect(field_labeled(field).element.search(".//option[@selected = 'selected']").inner_html).to match(/#{value}/)
|
254
260
|
end
|
255
261
|
|
256
262
|
When /^I press enter to search$/ do
|
@@ -259,7 +265,7 @@ end
|
|
259
265
|
|
260
266
|
## variants of standard steps to handle """ style quoted args
|
261
267
|
Then /^I should see$/ do |text|
|
262
|
-
page.
|
268
|
+
expect(page).to have_content(text)
|
263
269
|
end
|
264
270
|
|
265
271
|
Then /^I should see "([^\"]*)" in (.*)$/ do |text, css_class|
|
@@ -126,11 +126,11 @@ When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
|
126
126
|
end
|
127
127
|
|
128
128
|
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
129
|
-
page.
|
129
|
+
expect(page).to have_content(text)
|
130
130
|
end
|
131
131
|
|
132
132
|
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
133
|
-
page.
|
133
|
+
expect(page).to_not have_content(text)
|
134
134
|
end
|
135
135
|
|
136
136
|
|
data/lib/card/action.rb
CHANGED
@@ -46,8 +46,8 @@ class Card
|
|
46
46
|
belongs_to :act, :foreign_key=>:card_act_id, :inverse_of=>:actions
|
47
47
|
has_many :changes, :foreign_key=>:card_action_id, :inverse_of=>:action, :dependent=>:delete_all
|
48
48
|
|
49
|
-
belongs_to :super_action, class_name
|
50
|
-
has_many :sub_actions, class_name
|
49
|
+
belongs_to :super_action, :class_name=> "Action", :inverse_of=>:sub_actions
|
50
|
+
has_many :sub_actions, :class_name=> "Action", :inverse_of=>:super_action
|
51
51
|
|
52
52
|
scope :created_by, lambda { |actor_id| joins(:act).where('card_acts.actor_id = ?', actor_id) }
|
53
53
|
|
data/lib/card/codename.rb
CHANGED
@@ -20,29 +20,35 @@ class Card
|
|
20
20
|
|
21
21
|
def reset_cache
|
22
22
|
@@codehash = nil
|
23
|
+
cache.write 'CODEHASH', nil
|
23
24
|
end
|
24
25
|
|
25
26
|
#only used in migration
|
26
27
|
def bootdata hash
|
27
28
|
@@codehash = hash
|
28
29
|
end
|
29
|
-
|
30
|
-
|
30
|
+
|
31
|
+
|
31
32
|
private
|
33
|
+
|
34
|
+
def cache
|
35
|
+
Wagn::Cache[Codename]
|
36
|
+
end
|
32
37
|
|
33
38
|
def load_hash
|
34
|
-
@@codehash =
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
@@codehash = cache.read('CODEHASH') || begin
|
40
|
+
codehash = {}
|
41
|
+
sql = 'select id, codename from cards where codename is not NULL'
|
42
|
+
ActiveRecord::Base.connection.select_all(sql).each do |row|
|
43
|
+
#FIXME: remove duplicate checks, put them in other tools
|
44
|
+
code, cid = row['codename'].to_sym, row['id'].to_i
|
45
|
+
if codehash.has_key?(code) or codehash.has_key?(cid)
|
46
|
+
warn "dup code ID:#{cid} (#{codehash[code]}), CD:#{code} (#{codehash[cid]})"
|
47
|
+
end
|
48
|
+
codehash[code] = cid; codehash[cid] = code
|
41
49
|
end
|
42
|
-
|
50
|
+
cache.write 'CODEHASH', codehash
|
43
51
|
end
|
44
|
-
|
45
|
-
@@codehash
|
46
52
|
end
|
47
53
|
end
|
48
54
|
|
@@ -8,7 +8,8 @@ class CardMigrationGenerator < ActiveRecord::Generators::Base
|
|
8
8
|
desc: "Create card migration for wagn core"
|
9
9
|
|
10
10
|
def create_migration_file
|
11
|
-
|
11
|
+
migration_type = options['core'] ? :core_cards : :deck_cards
|
12
|
+
root = Wagn::Migration.paths(migration_type).first
|
12
13
|
set_local_assigns!
|
13
14
|
migration_template @migration_template, File.join( root, "#{file_name}.rb")
|
14
15
|
end
|
data/lib/wagn/application.rb
CHANGED
@@ -89,7 +89,7 @@ module Wagn
|
|
89
89
|
add_gem_path paths, "app/assets", :glob => "*"
|
90
90
|
add_gem_path paths, "app/controllers", :eager_load => true
|
91
91
|
add_gem_path paths, "lib/tasks", :with => "lib/wagn/tasks", :glob => "**/*.rake"
|
92
|
-
add_gem_path paths, "config/routes", :with => "config/routes.rb"
|
92
|
+
add_gem_path paths, "config/routes", :with => "lib/wagn/config/routes.rb"
|
93
93
|
add_gem_path paths, "db"
|
94
94
|
add_gem_path paths, "db/migrate"
|
95
95
|
add_gem_path paths, "db/migrate_core_cards"
|
data/lib/wagn/cache.rb
CHANGED
@@ -119,6 +119,15 @@ module Wagn
|
|
119
119
|
def read_local key
|
120
120
|
@local[key]
|
121
121
|
end
|
122
|
+
|
123
|
+
def write_variable key, variable, value
|
124
|
+
key = @prefix + key
|
125
|
+
if @store and object = @store.read(key)
|
126
|
+
object.instance_variable_set "@#{ variable }", value
|
127
|
+
@store.write key, object
|
128
|
+
end
|
129
|
+
value
|
130
|
+
end
|
122
131
|
|
123
132
|
def write key, value
|
124
133
|
@store.write(@prefix + key, value) if @store
|
File without changes
|
data/lib/wagn/core_migration.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
class Wagn::CoreMigration < Wagn::Migration
|
4
4
|
def migration_paths
|
5
|
-
Wagn::Migration.
|
5
|
+
Wagn::Migration.paths :core_cards
|
6
6
|
end
|
7
7
|
|
8
8
|
def schema_mode
|
9
|
-
Wagn::Migration.schema_mode :
|
9
|
+
Wagn::Migration.schema_mode :core_cards
|
10
10
|
end
|
11
11
|
|
12
12
|
def import_json filename
|
@@ -29,8 +29,7 @@ class WagnGenerator < Rails::Generators::AppBase
|
|
29
29
|
## should probably eventually use rails-like AppBuilder approach, but this is a first step.
|
30
30
|
def dev_setup
|
31
31
|
if options['core-dev']
|
32
|
-
@wagn_path = options['gem-path'] || ask("Enter the path to your local wagn installation: ")
|
33
|
-
#@wagndev_path = ask "Please enter the path to your local wagn-dev installation (leave empty to use the wagn-dev gem): "
|
32
|
+
@wagn_path = options['gem-path'] || ask("Enter the path to your local wagn gem installation: ")
|
34
33
|
@spec_path = @wagn_path
|
35
34
|
@spec_helper_path = File.join @spec_path, 'spec', 'spec_helper'
|
36
35
|
@features_path = File.join @wagn_path, 'features/' # ending slash is important in order to load support and step folders
|
data/lib/wagn/migration.rb
CHANGED
@@ -1,31 +1,25 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
class Wagn::Migration < ActiveRecord::Migration
|
4
|
-
def self.
|
5
|
-
Wagn.paths[
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.deck_card_migration_paths
|
9
|
-
Wagn.paths['db/migrate_deck_cards'].to_a
|
4
|
+
def self.paths type
|
5
|
+
Wagn.paths["db/migrate#{schema_suffix type}"].to_a
|
10
6
|
end
|
11
7
|
|
12
8
|
def self.schema_suffix type
|
13
|
-
|
14
|
-
when :core_cards then '_cards'
|
15
|
-
when :deck_cards then '_deck_cards'
|
16
|
-
else ''
|
17
|
-
end
|
9
|
+
Wagn::Version.schema_suffix type
|
18
10
|
end
|
19
11
|
|
20
12
|
def self.schema_mode type
|
21
13
|
new_suffix = Wagn::Migration.schema_suffix type
|
22
|
-
|
23
14
|
original_suffix = ActiveRecord::Base.table_name_suffix
|
15
|
+
|
24
16
|
ActiveRecord::Base.table_name_suffix = new_suffix
|
25
17
|
yield
|
26
18
|
ActiveRecord::Base.table_name_suffix = original_suffix
|
27
19
|
end
|
28
20
|
|
21
|
+
|
22
|
+
|
29
23
|
def contentedly &block
|
30
24
|
Wagn::Cache.reset_global
|
31
25
|
Wagn::Migration.schema_mode '' do
|
@@ -61,11 +55,11 @@ class Wagn::Migration < ActiveRecord::Migration
|
|
61
55
|
|
62
56
|
|
63
57
|
def schema_mode
|
64
|
-
Wagn::Migration.schema_mode :
|
58
|
+
Wagn::Migration.schema_mode :deck_cards
|
65
59
|
end
|
66
60
|
|
67
61
|
def migration_paths
|
68
|
-
Wagn::Migration.
|
62
|
+
Wagn::Migration.paths :deck_cards
|
69
63
|
end
|
70
64
|
|
71
65
|
|