forked from spree/spree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
71 lines (60 loc) · 1.7 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'rake'
require 'rake/gempackagetask'
require 'thor/group'
PROJECTS = %w(core api auth dash sample) #TODO - spree_promotions
spec = eval(File.read('spree.gemspec'))
Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
end
desc "Release all gems to gemcutter. Package rails, package & push components, then push spree"
task :release => :release_projects do
require 'rake/gemcutter'
Rake::Gemcutter::Tasks.new(spec).define
Rake::Task['gem:push'].invoke
end
desc "Creates a sandbox application for testing your Spree code"
task :sandbox do
class SandboxGenerator < Thor::Group
include Thor::Actions
def generate_app
remove_directory_if_exists("sandbox")
run "rails new sandbox -GJT"
end
def append_gemfile
inside "sandbox" do
append_file "Gemfile" do
<<-gems
gem 'spree', :path => '../' \n
gem 'devise', :git => 'git://github.com/plataformatec/devise.git'\n
gems
end
end
end
def install_generators
inside "sandbox" do
run 'bundle install'
run 'rails g spree:site -f'
run 'rake spree:install'
run 'rake spree_sample:install'
end
end
def run_bootstrap
inside "sandbox" do
run 'rake db:bootstrap AUTO_ACCEPT=true'
end
end
private
def remove_directory_if_exists(path)
run "rm -r #{path}" if File.directory?(path)
end
end
SandboxGenerator.start
end
# desc "Release all components to gemcutter."
# task :release_projects => :package do
# errors = []
# PROJECTS.each do |project|
# system(%(cd #{project} && #{$0} release)) || errors << project
# end
# fail("Errors in #{errors.join(', ')}") unless errors.empty?
# end