decko 0.1 → 0.2
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 +4 -4
- data/decko.gemspec +3 -3
- data/features/attach.feature +11 -7
- data/features/follow.feature +45 -44
- data/features/navbox.feature +1 -1
- data/features/notifications.feature +1 -1
- data/features/pointer_inputs.feature +7 -0
- data/features/reference.feature +5 -1
- data/features/step_definitions/email_steps.rb +4 -0
- data/features/step_definitions/wagn_steps.rb +6 -3
- data/features/step_definitions/web_steps.rb +1 -0
- data/features/support/delayed_job.rb +1 -0
- data/features/support/env.rb +5 -2
- data/features/toolbar.feature +13 -11
- data/lib/decko/application.rb +1 -0
- data/lib/decko/commands/cucumber_command.rb +2 -2
- data/lib/decko/commands/cucumber_command/parser.rb +8 -0
- data/lib/decko/commands/rspec_command.rb +3 -3
- data/lib/decko/config/environments/development.rb +3 -2
- data/lib/decko/config/environments/production.rb +4 -0
- data/lib/decko/config/environments/test.rb +2 -2
- data/lib/decko/config/initializers/sedate_parser.rb +7 -0
- data/lib/decko/engine.rb +1 -1
- data/lib/decko/generators/decko/templates/Gemfile +16 -22
- data/lib/decko/mods_spec_helper.rb +0 -1
- data/lib/decko/response.rb +18 -12
- data/lib/decko/tasks/alias.rb +31 -0
- data/lib/decko/tasks/decko.rake +16 -43
- data/lib/decko/tasks/decko/bootstrap.rake +65 -62
- data/lib/decko/tasks/test.rake +10 -3
- data/rails/controllers/card_controller.rb +16 -10
- data/rails/engine-routes.rb +4 -1
- data/spec/controllers/card_controller_spec.rb +77 -58
- data/spec/controllers/location_spec.rb +4 -4
- metadata +10 -9
- data/lib/decko/tasks/decko/migrate.rake +0 -77
@@ -25,6 +25,14 @@ module Decko
|
|
25
25
|
parser.on("-s", "--step", "Pause after each step") do |a|
|
26
26
|
opts[:env] << "STEP=1" if a
|
27
27
|
end
|
28
|
+
parser.on("--[no-]spring", "Run with spring") do |spring|
|
29
|
+
opts[:executer] =
|
30
|
+
if spring
|
31
|
+
"spring"
|
32
|
+
else
|
33
|
+
"bundle exec"
|
34
|
+
end
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
30
38
|
end
|
@@ -13,9 +13,9 @@ module Decko
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def command
|
16
|
-
"#{env_args} #{@opts[:executer]} " \
|
17
|
-
"
|
18
|
-
"
|
16
|
+
"#{env_args} #{@opts[:executer]} #{@opts[:rescue]}" \
|
17
|
+
"rspec #{@rspec_args.shelljoin} #{@opts[:files]} "\
|
18
|
+
"--exclude-pattern \"./card/vendor/**/*\""
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -40,7 +40,6 @@ Decko.application.class.configure do
|
|
40
40
|
# See everything in the log (default is :info)
|
41
41
|
config.log_level = :debug
|
42
42
|
|
43
|
-
config.active_record.raise_in_transactional_callbacks = true
|
44
43
|
|
45
44
|
# config.performance_logger = {
|
46
45
|
# methods: [:event, :search, :fetch, :view], # choose methods to log
|
@@ -79,11 +78,13 @@ Decko.application.class.configure do
|
|
79
78
|
|
80
79
|
config.action_mailer.perform_deliveries = false
|
81
80
|
|
81
|
+
|
82
|
+
|
82
83
|
# Use Pry instead of IRB
|
83
84
|
silence_warnings do
|
84
85
|
begin
|
85
86
|
require "pry"
|
86
|
-
|
87
|
+
config.console = Pry
|
87
88
|
rescue LoadError
|
88
89
|
end
|
89
90
|
end
|
@@ -4,6 +4,10 @@ Decko.application.class.configure do
|
|
4
4
|
|
5
5
|
config.eager_load = true
|
6
6
|
|
7
|
+
# temporary fix for formerly autoloaded files that stopped autoloading in Rails 5
|
8
|
+
# TODO: configure eager_load_paths explicitly (and remove this)
|
9
|
+
config.enable_dependency_loading = true
|
10
|
+
|
7
11
|
# Code is not reloaded between requests
|
8
12
|
config.cache_classes = true
|
9
13
|
|
@@ -58,13 +58,13 @@ Decko.application.class.configure do
|
|
58
58
|
# true in your test
|
59
59
|
Delayed::Worker.delay_jobs = false
|
60
60
|
|
61
|
-
|
61
|
+
|
62
62
|
|
63
63
|
# Use Pry instead of IRB
|
64
64
|
silence_warnings do
|
65
65
|
begin
|
66
66
|
require "pry"
|
67
|
-
|
67
|
+
config.console = Pry
|
68
68
|
rescue LoadError
|
69
69
|
end
|
70
70
|
end
|
data/lib/decko/engine.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
<% if @gem_path.present? %>
|
4
|
-
gem '
|
5
|
-
gem 'card',
|
4
|
+
gem 'decko', :path=>"<%= @gemfile_gem_path %>/decko"
|
5
|
+
gem 'card', :path=>"<%= @gemfile_gem_path %>/card", :require => false
|
6
|
+
gem 'cardname', :path=>"<%= @gemfile_gem_path %>/cardname", :require => false
|
6
7
|
<% else %>
|
7
|
-
gem '
|
8
|
+
gem 'decko'
|
8
9
|
<% end %>
|
9
10
|
|
10
11
|
gem '<%= database_gemfile_entry.name %>'<%= %(, '#{database_gemfile_entry.version}') if database_gemfile_entry.version %>
|
@@ -24,7 +25,8 @@ gem '<%= database_gemfile_entry.name %>'<%= %(, '#{database_gemfile_entry.versio
|
|
24
25
|
|
25
26
|
<% if options['mod-dev'] || options['core-dev'] -%>
|
26
27
|
group :test do
|
27
|
-
gem '
|
28
|
+
gem 'rails-controller-testing'
|
29
|
+
gem 'rspec'
|
28
30
|
gem 'rspec-rails' # behavior-driven-development suite
|
29
31
|
gem 'spork', '>=0.9'
|
30
32
|
gem 'rubocop'
|
@@ -38,7 +40,6 @@ group :test, :development do
|
|
38
40
|
gem 'jasmine-jquery-rails'
|
39
41
|
gem 'sprockets' # just so above works
|
40
42
|
gem 'phantomjs', '1.9.7.1' #locked because 1.9.8.0 is breaking
|
41
|
-
gem 'test_after_commit'
|
42
43
|
gem 'colorize'
|
43
44
|
gem 'delayed_job_active_record', '~> 4.1'
|
44
45
|
|
@@ -55,19 +56,15 @@ group :debug do
|
|
55
56
|
gem 'pry-rails'
|
56
57
|
gem 'pry-rescue'
|
57
58
|
gem 'pry-stack_explorer'
|
58
|
-
|
59
|
-
gem 'pry-byebug'
|
60
|
-
else
|
61
|
-
gem 'debugger'
|
62
|
-
end
|
59
|
+
gem 'pry-byebug'
|
63
60
|
end
|
64
61
|
<% end -%>
|
65
62
|
|
66
63
|
<% if options['core-dev'] -%>
|
67
64
|
group :assets do
|
68
|
-
gem 'jquery-rails', '~> 3
|
69
|
-
gem 'jquery-ui-rails', '~>
|
70
|
-
gem "jquery_mobile_rails", "~> 1.4.
|
65
|
+
gem 'jquery-rails', '~> 4.3' # main js framework, along with rails-specific unobtrusive lib
|
66
|
+
gem 'jquery-ui-rails', '~> 6.0' # main js framework, along with rails-specific unobtrusive lib
|
67
|
+
gem "jquery_mobile_rails", "~> 1.4.5"
|
71
68
|
|
72
69
|
gem 'tinymce-rails', '~> 3.4' # wysiwyg editor
|
73
70
|
end
|
@@ -75,7 +72,8 @@ end
|
|
75
72
|
group :test do
|
76
73
|
gem 'fog'
|
77
74
|
gem 'fog-aws'
|
78
|
-
gem '
|
75
|
+
gem 'rails-controller-testing'
|
76
|
+
gem 'rspec-html-matchers', '0.9.1'
|
79
77
|
gem 'rr' #, '=1.0.0'
|
80
78
|
gem 'simplecov', '~> 0.7.1', :require => false #test coverage
|
81
79
|
gem 'codeclimate-test-reporter', require: nil
|
@@ -88,10 +86,10 @@ group :test do
|
|
88
86
|
end
|
89
87
|
|
90
88
|
# CUKES see features dir
|
91
|
-
gem 'cucumber-rails', '~> 1.
|
92
|
-
gem 'capybara', '~> 2.
|
89
|
+
gem 'cucumber-rails', '~> 1.5', :require=>false # feature-driven-development suite
|
90
|
+
gem 'capybara', '~> 2.14'
|
93
91
|
gem 'selenium-webdriver', '~> 3.3'
|
94
|
-
gem 'chromedriver-helper', '~> 1.
|
92
|
+
gem 'chromedriver-helper', '~> 1.1.0'
|
95
93
|
# gem 'capybara-webkit'
|
96
94
|
gem 'launchy' # lets cucumber launch browser windows
|
97
95
|
|
@@ -104,11 +102,7 @@ group :test do
|
|
104
102
|
gem 'turn', :require => false # Pretty printed test output. (version constraint is to avoid minitest requirement)
|
105
103
|
gem 'minitest'
|
106
104
|
|
107
|
-
if
|
108
|
-
puts "Warning: Can't install i18-tasks without Ruby 2.1+: will not be able to test if I18n keys are missing"
|
109
|
-
else
|
110
|
-
gem 'i18n-tasks', '~> 0.9.5' # See if I18n keys are missing or unused
|
111
|
-
end
|
105
|
+
gem 'i18n-tasks', '~> 0.9.5' # See if I18n keys are missing or unused
|
112
106
|
end
|
113
107
|
|
114
108
|
gem 'ruby-prof', :group=>:profile # profiling
|
data/lib/decko/response.rb
CHANGED
@@ -2,7 +2,6 @@ module Decko
|
|
2
2
|
# methods for managing decko responses
|
3
3
|
module Response
|
4
4
|
private
|
5
|
-
|
6
5
|
def card_redirect url
|
7
6
|
url = card_url url # make sure we have absolute url
|
8
7
|
if Card::Env.ajax?
|
@@ -16,14 +15,14 @@ module Decko
|
|
16
15
|
end
|
17
16
|
|
18
17
|
def deliver format, result, status
|
19
|
-
if
|
20
|
-
send_file(*result)
|
21
|
-
elsif status == 302
|
18
|
+
if status == 302
|
22
19
|
card_redirect result
|
20
|
+
elsif format.is_a?(Card::Format::FileFormat) && status == 200
|
21
|
+
send_file(*result)
|
23
22
|
else
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
render body: result.html_safe,
|
24
|
+
status: status,
|
25
|
+
content_type: format.mime_type
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
@@ -39,7 +38,7 @@ module Decko
|
|
39
38
|
self.params = success.params
|
40
39
|
else
|
41
40
|
# need tests. insure we get slot, main...
|
42
|
-
params.merge
|
41
|
+
self.params = params.merge success.params
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
@@ -51,7 +50,11 @@ module Decko
|
|
51
50
|
send_file File.join(path, filename), x_sendfile: true
|
52
51
|
end
|
53
52
|
|
54
|
-
def format_from_params
|
53
|
+
def format_from_params card
|
54
|
+
card.format format_name_from_params
|
55
|
+
end
|
56
|
+
|
57
|
+
def format_name_from_params
|
55
58
|
return :file if params[:explicit_file]
|
56
59
|
format = request.parameters[:format]
|
57
60
|
# unknown format
|
@@ -61,9 +64,12 @@ module Decko
|
|
61
64
|
|
62
65
|
def interpret_id id
|
63
66
|
case id
|
64
|
-
when "*previous" then
|
65
|
-
|
66
|
-
|
67
|
+
when "*previous" then
|
68
|
+
return card_redirect(Card::Env.previous_location)
|
69
|
+
when nil then
|
70
|
+
determine_id
|
71
|
+
else
|
72
|
+
validate_id_encoding id
|
67
73
|
end
|
68
74
|
end
|
69
75
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
def alias_task name, old_name
|
2
|
+
t = Rake::Task[old_name]
|
3
|
+
desc t.full_comment if t.full_comment
|
4
|
+
task name, *t.arg_names do |_, args|
|
5
|
+
# values_at is broken on Rake::TaskArguments
|
6
|
+
args = t.arg_names.map { |a| args[a] }
|
7
|
+
t.invoke(args)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def append_to_namespace namespace, part
|
12
|
+
[namespace, part].compact.join(":")
|
13
|
+
end
|
14
|
+
|
15
|
+
def link_task task, from: nil, to: nil, namespace: nil
|
16
|
+
case task
|
17
|
+
when Hash
|
18
|
+
task.each do |key, val|
|
19
|
+
link_task val, from: from, to: to ,
|
20
|
+
namespace: append_to_namespace(namespace, key)
|
21
|
+
|
22
|
+
end
|
23
|
+
when Array
|
24
|
+
task.each do |t|
|
25
|
+
link_task t, from: from, to: to, namespace: namespace
|
26
|
+
end
|
27
|
+
else
|
28
|
+
shared_part = append_to_namespace namespace, task
|
29
|
+
alias_task "#{from}:#{shared_part}", "#{to}:#{shared_part}"
|
30
|
+
end
|
31
|
+
end
|
data/lib/decko/tasks/decko.rake
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
require "decko/application"
|
2
|
+
require_relative "alias"
|
3
|
+
require_relative "../../../../card/db/seed_consts"
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
CARD_TASKS =
|
6
|
+
[
|
7
|
+
:migrate,
|
8
|
+
{ migrate: [:cards, :structure, :core_cards, :deck_cards, :redo, :stamp] },
|
9
|
+
:reset_cache
|
10
|
+
]
|
11
|
+
|
12
|
+
link_task CARD_TASKS, from: :decko, to: :card
|
8
13
|
|
9
14
|
namespace :decko do
|
10
15
|
desc "create a decko database from scratch, load initial data"
|
@@ -72,61 +77,29 @@ namespace :decko do
|
|
72
77
|
task :update do
|
73
78
|
ENV["NO_RAILS_CACHE"] = "true"
|
74
79
|
# system 'bundle update'
|
75
|
-
if
|
76
|
-
FileUtils.rm_rf
|
80
|
+
if Decko.paths["tmp"].existent
|
81
|
+
FileUtils.rm_rf Decko.paths["tmp"].first, secure: true
|
77
82
|
end
|
78
|
-
Dir.mkdir
|
83
|
+
Dir.mkdir Decko.paths["tmp"].first
|
79
84
|
Rake::Task["decko:migrate"].invoke
|
80
85
|
# FIXME: remove tmp dir / clear cache
|
81
86
|
puts "set symlink for assets"
|
82
87
|
Rake::Task["decko:update_assets_symlink"].invoke
|
83
88
|
end
|
84
89
|
|
85
|
-
|
86
|
-
task reset_cache: :environment do
|
87
|
-
Card::Cache.reset_all
|
88
|
-
Card.reset_all_machines
|
89
|
-
end
|
90
|
+
|
90
91
|
|
91
92
|
desc "set symlink for assets"
|
92
93
|
task :update_assets_symlink do
|
93
94
|
assets_path = File.join(Rails.public_path, "assets")
|
94
|
-
if Rails.root.to_s !=
|
95
|
+
if Rails.root.to_s != Decko.gem_root && !File.exist?(assets_path)
|
95
96
|
FileUtils.rm assets_path if File.symlink? assets_path
|
96
97
|
FileUtils.ln_s(Decko::Engine.paths["gem-assets"].first, assets_path)
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
100
|
-
desc "migrate structure and cards"
|
101
|
-
task migrate: :environment do
|
102
|
-
ENV["NO_RAILS_CACHE"] = "true"
|
103
|
-
ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
|
104
|
-
|
105
|
-
stamp = ENV["STAMP_MIGRATIONS"]
|
106
101
|
|
107
|
-
|
108
|
-
Rake::Task["decko:migrate:structure"].invoke
|
109
|
-
Rake::Task["decko:migrate:stamp"].invoke :structure if stamp
|
110
|
-
|
111
|
-
puts "migrating core cards"
|
112
|
-
Card::Cache.reset_all
|
113
|
-
# not invoke because we don't want to reload environment
|
114
|
-
Rake::Task["decko:migrate:core_cards"].execute
|
115
|
-
if stamp
|
116
|
-
Rake::Task["decko:migrate:stamp"].reenable
|
117
|
-
Rake::Task["decko:migrate:stamp"].invoke :core_cards
|
118
|
-
end
|
119
|
-
|
120
|
-
puts "migrating deck cards"
|
121
|
-
# not invoke because we don't want to reload environment
|
122
|
-
Rake::Task["decko:migrate:deck_cards"].execute
|
123
|
-
if stamp
|
124
|
-
Rake::Task["decko:migrate:stamp"].reenable
|
125
|
-
Rake::Task["decko:migrate:stamp"].invoke :deck_cards
|
126
|
-
end
|
127
|
-
|
128
|
-
Card::Cache.reset_all
|
129
|
-
end
|
102
|
+
alias_task :migrate, "card:migrate"
|
130
103
|
|
131
104
|
desc "insert existing card migrations into schema_migrations_cards to avoid re-migrating"
|
132
105
|
task :assume_card_migrations do
|
@@ -4,9 +4,12 @@ namespace :decko do
|
|
4
4
|
"and references"
|
5
5
|
task clean: :environment do
|
6
6
|
Card::Cache.reset_all
|
7
|
-
|
7
|
+
|
8
8
|
delete_unwanted_cards
|
9
9
|
Card.empty_trash
|
10
|
+
Rake::Task["decko:bootstrap:copy_mod_files"].invoke
|
11
|
+
make_machine_output_coded
|
12
|
+
clear_history
|
10
13
|
correct_time_and_user_stamps
|
11
14
|
Card::Cache.reset_all
|
12
15
|
end
|
@@ -15,30 +18,23 @@ namespace :decko do
|
|
15
18
|
task dump: :environment do
|
16
19
|
Card::Cache.reset_all
|
17
20
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
Card[:all, :style].make_machine_output_coded
|
22
|
-
Card[:script_html5shiv_printshiv].make_machine_output_coded
|
23
|
-
|
24
|
-
YAML::ENGINE.yamler = "syck" if RUBY_VERSION !~ /^(2|1\.9)/
|
25
|
-
# use old engine while we're supporting ruby 1.8.7 because it can't
|
26
|
-
# support Psych, which dumps with slashes that syck can't understand
|
21
|
+
# YAML::ENGINE.yamler = "syck" if RUBY_VERSION !~ /^(2|1\.9)/
|
22
|
+
# # use old engine while we're supporting ruby 1.8.7 because it can't
|
23
|
+
# # support Psych, which dumps with slashes that syck can't understand
|
27
24
|
|
28
25
|
DECKO_SEED_TABLES.each do |table|
|
29
26
|
i = "000"
|
27
|
+
data = ActiveRecord::Base.connection.select_all "select * from #{table}"
|
28
|
+
|
30
29
|
File.open(File.join(DECKO_SEED_PATH, "#{table}.yml"), "w") do |file|
|
31
|
-
data = ActiveRecord::Base.connection.select_all(
|
32
|
-
"select * from #{table}"
|
33
|
-
)
|
34
30
|
file.write YAML.dump(data.each_with_object({}) do |record, hash|
|
35
31
|
record["trash"] = false if record.key? "trash"
|
36
32
|
record["draft"] = false if record.key? "draft"
|
37
|
-
if record.key? "content"
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
33
|
+
# if record.key? "content"
|
34
|
+
# record["content"] = record["content"].gsub(/\u00A0/, " ")
|
35
|
+
# # sych was handling nonbreaking spaces oddly.
|
36
|
+
# # would not be needed with psych.
|
37
|
+
# end
|
42
38
|
hash["#{table}_#{i.succ!}"] = record
|
43
39
|
end)
|
44
40
|
end
|
@@ -49,21 +45,10 @@ namespace :decko do
|
|
49
45
|
task copy_mod_files: :environment do
|
50
46
|
# mark mod files as mod files
|
51
47
|
Card::Auth.as_bot do
|
52
|
-
|
53
|
-
if card.coded? || card.codename == "new_file" ||
|
54
|
-
card.codename == "new_image"
|
55
|
-
puts "skipping #{card.name}: already in code"
|
56
|
-
next
|
57
|
-
else
|
58
|
-
puts "working on #{card.name}"
|
59
|
-
end
|
60
|
-
|
48
|
+
each_file_card do |card|
|
61
49
|
# make card a mod file card
|
62
|
-
mod_name =
|
63
|
-
|
64
|
-
else
|
65
|
-
"standard"
|
66
|
-
end
|
50
|
+
mod_name =
|
51
|
+
card.left&.type_id == Card::SkinID ? "bootstrap" : "standard"
|
67
52
|
card.update_attributes! storage_type: :coded,
|
68
53
|
mod: mod_name,
|
69
54
|
empty_ok: true
|
@@ -79,43 +64,61 @@ namespace :decko do
|
|
79
64
|
Rake::Task["db:seed"].invoke
|
80
65
|
end
|
81
66
|
end
|
82
|
-
end
|
83
67
|
|
84
|
-
def
|
85
|
-
|
86
|
-
|
87
|
-
|
68
|
+
def each_file_card
|
69
|
+
Card.search(type: %w(in Image File), ne: "").each do |card|
|
70
|
+
if card.coded? || card.codename == "new_file" ||
|
71
|
+
card.codename == "new_image"
|
72
|
+
puts "skipping #{card.name}: already in code"
|
73
|
+
else
|
74
|
+
puts "working on #{card.name}"
|
75
|
+
yield card
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def correct_time_and_user_stamps
|
81
|
+
conn = ActiveRecord::Base.connection
|
82
|
+
who_and_when = [Card::WagnBotID, Time.now.utc.to_s(:db)]
|
83
|
+
card_sql = "update cards set creator_id=%1$s, created_at='%2$s', " \
|
88
84
|
"updater_id=%1$s, updated_at='%2$s'"
|
89
|
-
|
90
|
-
|
91
|
-
end
|
85
|
+
conn.update(card_sql % who_and_when)
|
86
|
+
conn.update("update card_acts set actor_id=%s, acted_at='%s'" % who_and_when)
|
87
|
+
end
|
92
88
|
|
93
|
-
def delete_unwanted_cards
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
Card.
|
102
|
-
|
103
|
-
|
89
|
+
def delete_unwanted_cards
|
90
|
+
# we have to change the actors so that
|
91
|
+
# we can delete unwanted user cards that made changes
|
92
|
+
Card::Act.update_all actor_id: Card::WagnBotID
|
93
|
+
Card::Auth.as_bot do
|
94
|
+
if (ignoramus = Card["*ignore"])
|
95
|
+
ignoramus.item_cards.each(&:delete!)
|
96
|
+
end
|
97
|
+
Card::Cache.reset_all
|
98
|
+
# FIXME: can this be associated with the machine module somehow?
|
99
|
+
%w(machine_input machine_output).each do |codename|
|
100
|
+
Card.search(right: { codename: codename }).each do |card|
|
101
|
+
FileUtils.rm_rf File.join("files", card.id.to_s), secure: true
|
102
|
+
card.delete!
|
103
|
+
end
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
107
|
-
end
|
108
107
|
|
109
|
-
def
|
110
|
-
|
111
|
-
|
108
|
+
def make_machine_output_coded
|
109
|
+
[[:all, :script], [:all, :style], [:script_html5shiv_printshiv]].each do |name|
|
110
|
+
Card[*name].make_machine_output_coded
|
111
|
+
end
|
112
|
+
end
|
112
113
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
114
|
+
def clear_history
|
115
|
+
puts "clearing history"
|
116
|
+
act = Card::Act.create! actor_id: Card::WagnBotID,
|
117
|
+
card_id: Card::WagnBotID
|
118
|
+
Card::Action.make_current_state_the_initial_state act
|
119
|
+
#conn.execute("truncate card_acts")
|
120
|
+
ActiveRecord::Base.connection.execute("truncate sessions")
|
120
121
|
end
|
121
122
|
end
|
123
|
+
|
124
|
+
|