-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorange-sparkles.thor
115 lines (93 loc) · 2.63 KB
/
orange-sparkles.thor
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
class OrangeSparkles < Thor::Group
include Thor::Actions
argument :name
class_options :edge => false, :type => :boolean, :aliases => "-e"
class_options :heroku => false, :type => :boolean, :aliases => "-h"
class_options :mate => true, :type => :boolean, :aliases => "-m"
class_options :bundler => true, :type => :boolean, :aliases => "-b"
def create_config_ru
create_file "#{name}/config.ru", <<-DOC
require "rubygems"
require "bundler"
Bundler.setup
Bundler.require
Orange.autoload!
run (Orange::SparklesApp.app{
main_users ["[email protected]"]
})
DOC
end
def create_gemfile
create_file "#{name}/Gemfile", <<-DOC
# Add custom gems like this:
# gem 'gemname'
#
# See http://gembundler.com/ for more details
source "http://rubygems.org"
gem "orange-core"#{options[:edge] ? ', :git => "git://github.com/therabidbanana/orange-core.git"' : ''}
gem "orange-more"#{options[:edge] ? ', :git => "git://github.com/therabidbanana/orange-more.git"' : ''}
gem "orange-sparkles"#{options[:edge] ? ', :git => "git://github.com/orange-project/orange-sparkles.git"' : ''}
gem "dm-postgres-adapter"
gem "dm-sqlite-adapter"
DOC
end
#
# def create_config_yml
# create_file "#{name}/config.yml", <<-DOC
#
# # google_analytics_key: "gawhatever"
# # s3_bucket: "orange-test"
#
# DOC
# end
#
# def assets_dir
# empty_directory "#{name}/assets/public/css"
# empty_directory "#{name}/assets/public/js"
# empty_directory "#{name}/assets/public/images"
# end
def create_readme
create_file "#{name}/README.markdown", <<-DOC
Heroku Orange Install Process:
=================================
Install bundler:
gem install bundler
Use Gemfile to get bundled gems
bundle install
Run heroku create (assuming you have a heroku account and heroku gem set up)
heroku create
Push to heroku
git push heroku master
DOC
end
#
# def create_templates_dir
# empty_directory "#{name}/templates"
# end
def git_init
puts "running git init"
`cd #{name}; git init`
end
def mate_it
if options[:mate]
hername = name.gsub(/[^0-9a-zA-Z-]/, '-')
puts "opening project in textmate..."
`mate #{name}`
end
end
def run_bundler
if options[:bundler]
puts "running bundle install..."
`gem install bundler`
`cd #{name}; bundle install`
end
end
def heroku_create
if options[:heroku]
hername = "orange" + name.gsub(/[^0-9a-zA-Z-]/, '-')
puts "creating #{hername} on heroku..."
`gem install heroku`
`cd #{name}; heroku create #{hername}`
end
end
end