-
Notifications
You must be signed in to change notification settings - Fork 47
/
Rakefile
56 lines (48 loc) · 1.52 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
56
begin
require "bundler/setup"
rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
require "rdoc/task"
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "Godmin"
rdoc.options << "--line-numbers"
rdoc.rdoc_files.include("README.rdoc")
rdoc.rdoc_files.include("lib/**/*.rb")
end
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load "rails/tasks/engine.rake"
Bundler::GemHelper.install_tasks
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "lib"
t.libs << "test"
t.pattern = "test/**/*_test.rb"
t.warning = false
t.verbose = false
end
task default: :test
namespace :sandbox do
desc "Generate the Sandbox app then push it to GitHub which deploys it to Heroku"
task :deploy do
message = "Generated from: https://github.com/varvet/godmin/commit/#{`git rev-parse HEAD`.strip}"
template_path = File.expand_path("../template.rb", __FILE__)
Bundler.with_unbundled_env do
Dir.mktmpdir do |dir|
Dir.chdir(dir)
system("git clone git@github.com:varvet/godmin-sandbox.git")
if $CHILD_STATUS.success?
Dir.chdir("godmin-sandbox")
system("rm -rf *")
system("rails _5.2.5_ new . -d postgresql -m #{template_path} --without-engine --skip-spring")
if $CHILD_STATUS.success?
system("git add --all")
system("git commit -m '#{message}'")
system("git push origin master")
end
end
end
end
end
end