-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathRakefile
55 lines (46 loc) · 1.53 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$:.push File.expand_path("../lib", __FILE__)
ENV['RAILS_ENV'] ||= 'test'
require 'ecrire'
require_relative 'test/task'
task default: :test
namespace :test do
['editor', 'onboarding', 'theme'].each do |name|
Ecrire::Test::Task.new(name) do |t|
t.libs << "test"
t.test_files = FileList["test/#{name}/**/*_test.rb"]
t.verbose = true
end
end
end
task :test do
%w(test:editor test:onboarding test:theme).each do |name|
Rake::Task[name].invoke
end
end
namespace :template do
desc 'Run a server set to use the template theme'
task :server do
require 'ecrire/commands/server'
Dir.chdir 'lib/ecrire/theme/template'
ENV[Ecrire::SECRET_ENVIRONMENT_KEY] = {onboarding: false}.to_json
Rails.env = ENV['RAILS_ENV'] = 'development'
Ecrire::Commands::Server.new(Port: 3000).run!
end
desc 'Run console for template development'
task :console do
require 'ecrire/commands/console'
Dir.chdir 'lib/ecrire/theme/template'
Rails.env = ENV['RAILS_ENV'] = 'development'
Ecrire::Commands::Console.new.run!
end
desc 'Routes available in your current template configuration'
task :routes do
Dir.chdir 'lib/ecrire/theme/template'
Rails.env = ENV['RAILS_ENV'] = 'development'
Ecrire::Application.initialize!
all_routes = Ecrire::Application.routes.routes
require 'action_dispatch/routing/inspector'
inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
puts inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, ENV['CONTROLLER'])
end
end