badger-rails 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.
- data/BadgerGit.png +0 -0
- data/COPYING +674 -0
- data/LICENSING +30 -0
- data/Manifest +112 -0
- data/README.md +80 -0
- data/Rakefile +36 -0
- data/badger-rails.gemspec +34 -0
- data/bin/badger +486 -0
- data/lib/badger/Capfile +1 -0
- data/lib/badger/config/deploy.rb +211 -0
- data/lib/badger/config/rails-app.yml +6 -0
- data/lib/badger/config/rails-app.yml.bk +6 -0
- data/lib/badger/core/claws/app.claw +112 -0
- data/lib/badger/core/claws/db-app.claw +59 -0
- data/lib/badger/core/claws/rails-app.claw +125 -0
- data/lib/badger/core/files/badger/info +0 -0
- data/lib/badger/core/files/cap/Capfile +4 -0
- data/lib/badger/core/files/cap/deploy/production-app.rb +139 -0
- data/lib/badger/core/files/cap/deploy/production.rb +136 -0
- data/lib/badger/core/files/cap/deploy/staging-app.rb +139 -0
- data/lib/badger/core/files/cap/deploy/staging.rb +134 -0
- data/lib/badger/core/files/cap/deploy.rb +6 -0
- data/lib/badger/core/files/git/git +0 -0
- data/lib/badger/core/files/god/angel/resque-dev.god +54 -0
- data/lib/badger/core/files/god/angel/resque-stg.god +54 -0
- data/lib/badger/core/files/god/angel/resque.god +55 -0
- data/lib/badger/core/files/god/angel/unicorn-stg.god +62 -0
- data/lib/badger/core/files/god/angel/unicorn.god +62 -0
- data/lib/badger/core/files/god/god +108 -0
- data/lib/badger/core/files/god/unicorn-stg.rb +70 -0
- data/lib/badger/core/files/god/unicorn.rb +70 -0
- data/lib/badger/core/files/logrotate/logrotate.conf +23 -0
- data/lib/badger/core/files/logrotate/logrotate.cron +8 -0
- data/lib/badger/core/files/mysql/database.yml.bk +18 -0
- data/lib/badger/core/files/mysql/db_stats +0 -0
- data/lib/badger/core/files/mysql/my.cnf +11 -0
- data/lib/badger/core/files/nginx/nginx +106 -0
- data/lib/badger/core/files/nginx/nginx.conf +30 -0
- data/lib/badger/core/files/nginx/sites/port443.btl +42 -0
- data/lib/badger/core/files/nginx/sites/port80.btl +39 -0
- data/lib/badger/core/files/nginx/sites/production-web +117 -0
- data/lib/badger/core/files/nginx/sites/staging-web +41 -0
- data/lib/badger/core/files/postfix/main.cf +678 -0
- data/lib/badger/core/files/postfix/master.cf +81 -0
- data/lib/badger/core/files/redis/redis-server +59 -0
- data/lib/badger/core/files/redis/redis.conf +444 -0
- data/lib/badger/core/files/resque/resque.rb +5 -0
- data/lib/badger/core/files/resque/resque.yml +19 -0
- data/lib/badger/core/files/resque/resque_web.rb +2 -0
- data/lib/badger/core/files/ssh/authorized_keys +0 -0
- data/lib/badger/core/functions +174 -0
- data/lib/badger/core/scripts/app_info +40 -0
- data/lib/badger/core/scripts/app_scale +15 -0
- data/lib/badger/core/scripts/remove_app +25 -0
- data/lib/badger/core/scripts/remove_app_db +30 -0
- data/lib/badger/core/scripts/remove_gems +2 -0
- data/lib/badger/core/teeth/automake.th +9 -0
- data/lib/badger/core/teeth/badger.th +27 -0
- data/lib/badger/core/teeth/bison.th +20 -0
- data/lib/badger/core/teeth/bundler.th +4 -0
- data/lib/badger/core/teeth/capistrano-ext.th +37 -0
- data/lib/badger/core/teeth/chkconfig.th +4 -0
- data/lib/badger/core/teeth/curl.th +24 -0
- data/lib/badger/core/teeth/faac.th +11 -0
- data/lib/badger/core/teeth/ffmpeg.th +28 -0
- data/lib/badger/core/teeth/firewall.th +70 -0
- data/lib/badger/core/teeth/gcc-c++.th +9 -0
- data/lib/badger/core/teeth/gcc.th +9 -0
- data/lib/badger/core/teeth/git.th +23 -0
- data/lib/badger/core/teeth/god.th +17 -0
- data/lib/badger/core/teeth/lame.th +9 -0
- data/lib/badger/core/teeth/libffi.th +4 -0
- data/lib/badger/core/teeth/libid3tag.th +10 -0
- data/lib/badger/core/teeth/libmad.th +11 -0
- data/lib/badger/core/teeth/libogg.th +9 -0
- data/lib/badger/core/teeth/libtool.th +9 -0
- data/lib/badger/core/teeth/libxml2.th +19 -0
- data/lib/badger/core/teeth/libxslt.th +19 -0
- data/lib/badger/core/teeth/libyaml.th +19 -0
- data/lib/badger/core/teeth/logrotate.th +19 -0
- data/lib/badger/core/teeth/madplay.th +10 -0
- data/lib/badger/core/teeth/make.th +9 -0
- data/lib/badger/core/teeth/mysql-config.th +40 -0
- data/lib/badger/core/teeth/mysql-server.th +16 -0
- data/lib/badger/core/teeth/mysql.th +14 -0
- data/lib/badger/core/teeth/nginx.th +56 -0
- data/lib/badger/core/teeth/ntp.th +15 -0
- data/lib/badger/core/teeth/openssl.th +19 -0
- data/lib/badger/core/teeth/pcre.th +9 -0
- data/lib/badger/core/teeth/plugins.th +14 -0
- data/lib/badger/core/teeth/postfix.th +11 -0
- data/lib/badger/core/teeth/pwgen.th +9 -0
- data/lib/badger/core/teeth/rake.th +12 -0
- data/lib/badger/core/teeth/readline.th +19 -0
- data/lib/badger/core/teeth/redis.th +18 -0
- data/lib/badger/core/teeth/resque.th +12 -0
- data/lib/badger/core/teeth/ruby.th +52 -0
- data/lib/badger/core/teeth/rubygems.th +17 -0
- data/lib/badger/core/teeth/san_juan.th +4 -0
- data/lib/badger/core/teeth/sox.th +12 -0
- data/lib/badger/core/teeth/speex.th +12 -0
- data/lib/badger/core/teeth/sqlite3.th +14 -0
- data/lib/badger/core/teeth/ssh_keys.th +10 -0
- data/lib/badger/core/teeth/sshpass.th +9 -0
- data/lib/badger/core/teeth/sudo.th +9 -0
- data/lib/badger/core/teeth/syslog-ng.th +16 -0
- data/lib/badger/core/teeth/sysv-rc-conf.th +4 -0
- data/lib/badger/core/teeth/x264.th +11 -0
- data/lib/badger/core/teeth/xvid.th +11 -0
- data/lib/badger/core/teeth/yasm.th +11 -0
- data/lib/badger/core/teeth/zlib.th +9 -0
- data/lib/core.rb +313 -0
- data/lib/errors.rb +202 -0
- metadata +297 -0
data/lib/core.rb
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
module Methods
|
|
2
|
+
attr_accessor :yml
|
|
3
|
+
|
|
4
|
+
def initialize
|
|
5
|
+
@errors = Errors.new
|
|
6
|
+
spec = Gem::Specification.find_by_name("badger-rails")
|
|
7
|
+
@badger_root = spec.gem_dir + "/lib/"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def badger_logs
|
|
11
|
+
gem_setup
|
|
12
|
+
Dir.chdir(@badger_root + "badger/")
|
|
13
|
+
if ARGV[1] == "tail"
|
|
14
|
+
trap("INT") do
|
|
15
|
+
puts
|
|
16
|
+
puts "Killing tail signal.."
|
|
17
|
+
puts
|
|
18
|
+
end
|
|
19
|
+
`cap rails-app logs -s brat=tail`
|
|
20
|
+
else
|
|
21
|
+
`cap rails-app logs -s brat=nil`
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def database_server(app_claw)
|
|
26
|
+
command = "#{app_claw}db-app.claw > #{app_claw}app.tmp; mv #{app_claw}app.tmp #{app_claw}db-app.claw"
|
|
27
|
+
case @yml['db']['redis']
|
|
28
|
+
when true
|
|
29
|
+
`sed 's/.*install_source_redis.*/install_source_redis/g' #{command}`
|
|
30
|
+
when false
|
|
31
|
+
`sed 's/.*install_source_redis.*/#install_source_redis/g' #{command}`
|
|
32
|
+
else
|
|
33
|
+
`sed 's/.*install_source_redis.*/#install_source_redis/g' #{command}`
|
|
34
|
+
end
|
|
35
|
+
`cap db-app db_setup;
|
|
36
|
+
cap db-app db_sync;
|
|
37
|
+
cap db-app db_deploy`
|
|
38
|
+
puts <<EOF
|
|
39
|
+
|
|
40
|
+
Database server deployed.
|
|
41
|
+
|
|
42
|
+
If you do not have a web project built.
|
|
43
|
+
Run: badger create < name >
|
|
44
|
+
|
|
45
|
+
Or if a project already exists.
|
|
46
|
+
Run: git commit -m "database config"
|
|
47
|
+
Run: git push badger master
|
|
48
|
+
Run: badger deploy
|
|
49
|
+
|
|
50
|
+
EOF
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def db
|
|
54
|
+
gem_setup('db')
|
|
55
|
+
Dir.chdir(@badger_root + "badger/")
|
|
56
|
+
app_claw = @badger_root + "badger/core/claws/"
|
|
57
|
+
ensure_ssh
|
|
58
|
+
database_server(app_claw)
|
|
59
|
+
#TODO write to info file.
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def create(app = nil)
|
|
63
|
+
gem_setup
|
|
64
|
+
Dir.chdir(@badger_root + "badger/")
|
|
65
|
+
app_claw = @badger_root + "badger/core/claws/"
|
|
66
|
+
ensure_ssh
|
|
67
|
+
if app.nil?
|
|
68
|
+
rails_server(app_claw)
|
|
69
|
+
else
|
|
70
|
+
worker_server(app_claw, app)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def ensure_badger_yml
|
|
75
|
+
if not File.exists?("badger.yml")
|
|
76
|
+
@errors.errors('yaml exists')
|
|
77
|
+
exit
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def ensure_external_db
|
|
82
|
+
@yml = YAML.load_file(@rails_root + "/config/badger.yml")
|
|
83
|
+
if @yml['local_db'].nil? or @yml['local_db'] == true
|
|
84
|
+
@errors.errors('local db')
|
|
85
|
+
exit
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def ensure_rails_root
|
|
90
|
+
config_dir = Dir.exists?("config/")
|
|
91
|
+
if config_dir
|
|
92
|
+
@rails_root = Dir.pwd
|
|
93
|
+
Dir.chdir("config/")
|
|
94
|
+
else
|
|
95
|
+
while not Dir.pwd == "/"
|
|
96
|
+
if Dir.exists?("config/")
|
|
97
|
+
break
|
|
98
|
+
else
|
|
99
|
+
Dir.chdir("..")
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
if Dir.pwd == "/"
|
|
103
|
+
@errors.errors('rails root')
|
|
104
|
+
exit
|
|
105
|
+
else
|
|
106
|
+
@rails_root = Dir.pwd
|
|
107
|
+
Dir.chdir("config/")
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def ensure_ssh
|
|
113
|
+
if not File.exists?("#{Dir.home}/.ssh/id_rsa.pub")
|
|
114
|
+
@errors.errors('ssh')
|
|
115
|
+
exit
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def exists_error
|
|
120
|
+
@errors.errors('rails project')
|
|
121
|
+
exit
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def gem_setup(db = nil)
|
|
125
|
+
ensure_badger_yml
|
|
126
|
+
@yml = YAML.load_file(@rails_root + "/config/badger.yml")
|
|
127
|
+
`echo git@#{@yml['domain']}:/opt/git/#{ARGV[1]}.git > #{@badger_root}badger/core/files/git/git`
|
|
128
|
+
`echo #{ARGV[1]} > #{@badger_root}badger/core/files/badger/info`
|
|
129
|
+
FileUtils.cp(Dir.pwd + "/badger.yml", @badger_root + "badger/config/rails-app.yml")
|
|
130
|
+
unless db.nil?
|
|
131
|
+
db_yml = YAML.load_file(Dir.pwd + "/database_example.yml")
|
|
132
|
+
if @yml['db']['connection_internal'] == true
|
|
133
|
+
connection = '10%'
|
|
134
|
+
else
|
|
135
|
+
connection = '%'
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
db_settings = <<-eos
|
|
139
|
+
#{db_yml['staging']['username']}
|
|
140
|
+
#{db_yml['staging']['password']}
|
|
141
|
+
#{db_yml['staging']['database']}
|
|
142
|
+
#{db_yml['production']['username']}
|
|
143
|
+
#{db_yml['production']['password']}
|
|
144
|
+
#{db_yml['production']['database']}
|
|
145
|
+
#{connection}
|
|
146
|
+
eos
|
|
147
|
+
|
|
148
|
+
File.open(@badger_root + "badger/core/files/mysql/db_stats", 'w') {|f| f.write(db_settings)}
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def git_msg
|
|
153
|
+
puts <<EOF
|
|
154
|
+
|
|
155
|
+
Badger is now setup.
|
|
156
|
+
A remote has been added for git@#{@yml['domain']}:/opt/git/#{ARGV[1]}.git
|
|
157
|
+
|
|
158
|
+
Usage:
|
|
159
|
+
git add .
|
|
160
|
+
git commit -m "first badger commit"
|
|
161
|
+
git push badger master
|
|
162
|
+
badger deploy
|
|
163
|
+
|
|
164
|
+
EOF
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def info
|
|
168
|
+
gem_setup
|
|
169
|
+
Dir.chdir(@badger_root + "badger/")
|
|
170
|
+
app_claw = @badger_root + "badger/core/claws/"
|
|
171
|
+
ensure_ssh
|
|
172
|
+
exists = `cap #{ARGV[1]} createExists`
|
|
173
|
+
info_error if exists.chomp == "false"
|
|
174
|
+
`cap rails-app info`
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def info_error
|
|
178
|
+
@errors.errors('info error')
|
|
179
|
+
exit
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def rails_server(app_claw)
|
|
183
|
+
command = "#{app_claw}rails-app.claw > #{app_claw}app.tmp; mv #{app_claw}app.tmp #{app_claw}rails-app.claw"
|
|
184
|
+
case @yml['redis']
|
|
185
|
+
when true
|
|
186
|
+
`sed 's/.*install_source_redis.*/install_source_redis/g' #{command}`
|
|
187
|
+
when false
|
|
188
|
+
`sed 's/.*install_source_redis.*/#install_source_redis/g' #{command}`
|
|
189
|
+
else
|
|
190
|
+
`sed 's/.*install_source_redis.*/#install_source_redis/g' #{command}`
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if @yml['environment'] == "production"
|
|
194
|
+
`sed 's/.*config_capistrano.*/config_capistrano production/g' #{command}`
|
|
195
|
+
elsif @yml['environment'] == "staging"
|
|
196
|
+
`sed 's/.*config_capistrano.*/config_capistrano staging/g' #{command}`
|
|
197
|
+
else
|
|
198
|
+
@errors.errors('environment')
|
|
199
|
+
exit
|
|
200
|
+
end
|
|
201
|
+
exists = `cap #{ARGV[1]} createExists`
|
|
202
|
+
exists_error if exists.chomp == "true"
|
|
203
|
+
`cap #{ARGV[1]} setup`
|
|
204
|
+
`cap #{ARGV[1]} sync`
|
|
205
|
+
`cap #{ARGV[1]} git`
|
|
206
|
+
Dir.chdir(@rails_root)
|
|
207
|
+
`git init`
|
|
208
|
+
`git remote add badger git@#{@yml['domain']}:/opt/git/#{ARGV[1]}.git`
|
|
209
|
+
git_msg
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def rake_tasks
|
|
213
|
+
gem_setup
|
|
214
|
+
arguments = ""
|
|
215
|
+
ARGV[1..-1].each do |a|
|
|
216
|
+
arguments << a << " "
|
|
217
|
+
end
|
|
218
|
+
Dir.chdir(@badger_root + "badger/")
|
|
219
|
+
`cap rails-app rake -s brat=#{arguments.gsub!(" ", "^")}`
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def scale(workers, app)
|
|
223
|
+
gem_setup
|
|
224
|
+
Dir.chdir(@badger_root + "badger/")
|
|
225
|
+
app_claw = @badger_root + "badger/core/claws/"
|
|
226
|
+
ensure_ssh
|
|
227
|
+
`cap #{app} scale -s workers=#{workers}`
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def update
|
|
231
|
+
gem_setup
|
|
232
|
+
Dir.chdir(@badger_root + "badger/")
|
|
233
|
+
app_claw = @badger_root + "badger/core/claws/"
|
|
234
|
+
ensure_ssh
|
|
235
|
+
command = "#{app_claw}rails-app.claw > #{app_claw}app.tmp; mv #{app_claw}app.tmp #{app_claw}rails-app.claw"
|
|
236
|
+
case @yml['redis']
|
|
237
|
+
when true
|
|
238
|
+
`sed 's/.*install_source_redis.*/install_source_redis/g' #{command}`
|
|
239
|
+
when false
|
|
240
|
+
`sed 's/.*install_source_redis.*/#install_source_redis/g' #{command}`
|
|
241
|
+
else
|
|
242
|
+
`sed 's/.*install_source_redis.*/#install_source_redis/g' #{command}`
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if @yml['environment'] == "production"
|
|
246
|
+
`sed 's/.*config_capistrano.*/config_capistrano production/g' #{command}`
|
|
247
|
+
elsif @yml['environment'] == "staging"
|
|
248
|
+
`sed 's/.*config_capistrano.*/config_capistrano staging/g' #{command}`
|
|
249
|
+
else
|
|
250
|
+
@errors.errors('environment')
|
|
251
|
+
exit
|
|
252
|
+
end
|
|
253
|
+
exists = `cap #{ARGV[1]} exists`
|
|
254
|
+
update_error if not exists.chomp == "true"
|
|
255
|
+
`cap #{ARGV[1]} sync`
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def update_error
|
|
259
|
+
@errors.errors('update error')
|
|
260
|
+
exit
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def worker_server(app_claw, app)
|
|
264
|
+
command = "#{app_claw}app.claw > #{app_claw}app.tmp; mv #{app_claw}app.tmp #{app_claw}app.claw"
|
|
265
|
+
if @yml['environment'] == "production"
|
|
266
|
+
`sed 's/.*config_capistrano.*/config_capistrano production-app #{app}/g' #{command}`
|
|
267
|
+
elsif @yml['environment'] == "staging"
|
|
268
|
+
`sed 's/.*config_capistrano.*/config_capistrano staging-app #{app}/g' #{command}`
|
|
269
|
+
else
|
|
270
|
+
@errors.errors('environment')
|
|
271
|
+
exit
|
|
272
|
+
end
|
|
273
|
+
case @yml[app]['media']
|
|
274
|
+
when true
|
|
275
|
+
while true
|
|
276
|
+
puts <<EOF
|
|
277
|
+
|
|
278
|
+
Badger-Rails does not provide licensing for the following installations. You will need to check your use case and compare to the following GPL licenses.
|
|
279
|
+
FFMPEG, X264, LAME, LIBMAD, LIBID3TAG, MADPLAY, SOX, FAAC, XVID
|
|
280
|
+
|
|
281
|
+
Do you wish to continue with ffmpeg installation? [ y/n ]
|
|
282
|
+
|
|
283
|
+
EOF
|
|
284
|
+
response = STDIN.gets.chomp
|
|
285
|
+
if response == "y"
|
|
286
|
+
`sed 's/.*install_media_group.*/install_media_group/g' #{command}`
|
|
287
|
+
break
|
|
288
|
+
elsif response == "n"
|
|
289
|
+
`sed 's/.*install_media_group.*/#install_media_group/g' #{command}`
|
|
290
|
+
break
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
when false
|
|
294
|
+
`sed 's/.*install_media_group.*/#install_media_group/g' #{command}`
|
|
295
|
+
else
|
|
296
|
+
`sed 's/.*install_media_group.*/#install_media_group/g' #{command}`
|
|
297
|
+
end
|
|
298
|
+
`echo #{@yml['password']} > #{@badger_root}badger/core/files/ssh/app;
|
|
299
|
+
echo #{@yml['domain']} >> #{@badger_root}badger/core/files/ssh/app;
|
|
300
|
+
cap #{app} app_setup;
|
|
301
|
+
cap #{app} app_sync;
|
|
302
|
+
cap #{app} app_deploy`
|
|
303
|
+
|
|
304
|
+
puts
|
|
305
|
+
puts "Worker server deployed."
|
|
306
|
+
puts
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
class Core
|
|
312
|
+
include Methods
|
|
313
|
+
end
|
data/lib/errors.rb
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
module ErrorList
|
|
2
|
+
|
|
3
|
+
def errors(error)
|
|
4
|
+
case error
|
|
5
|
+
when 'rails' #----------------
|
|
6
|
+
puts <<EOF
|
|
7
|
+
|
|
8
|
+
There is no Rails project on this server.
|
|
9
|
+
|
|
10
|
+
EOF
|
|
11
|
+
when 'scale int' #----------------
|
|
12
|
+
puts <<EOF
|
|
13
|
+
|
|
14
|
+
Error: scale requiers an Integer value.
|
|
15
|
+
Usage: < badger [app#] scale [number_of_workers] >
|
|
16
|
+
|
|
17
|
+
EOF
|
|
18
|
+
when 'scale' #----------------
|
|
19
|
+
puts <<EOF
|
|
20
|
+
|
|
21
|
+
Error: did you mean scale?
|
|
22
|
+
Usage: < badger [app#] scale [#] >
|
|
23
|
+
|
|
24
|
+
EOF
|
|
25
|
+
when 'app build' #----------------
|
|
26
|
+
puts <<EOF
|
|
27
|
+
|
|
28
|
+
Error: did you mean build?
|
|
29
|
+
Usage: < badger [app#] build >
|
|
30
|
+
|
|
31
|
+
EOF
|
|
32
|
+
when 'app usage' #----------------
|
|
33
|
+
puts <<EOF
|
|
34
|
+
|
|
35
|
+
Usage:
|
|
36
|
+
< badger [app#] scale [#} >
|
|
37
|
+
< badger [app#] build >
|
|
38
|
+
|
|
39
|
+
EOF
|
|
40
|
+
when 'name' #----------------
|
|
41
|
+
puts <<EOF
|
|
42
|
+
|
|
43
|
+
Error: name of rails app is required.
|
|
44
|
+
Usage: badger create < name_of_rails_app >
|
|
45
|
+
|
|
46
|
+
EOF
|
|
47
|
+
when 'specific name' #----------------
|
|
48
|
+
puts <<EOF
|
|
49
|
+
|
|
50
|
+
Error: name of project cannot be < db > or start with < app >.
|
|
51
|
+
|
|
52
|
+
EOF
|
|
53
|
+
when 'db build' #----------------
|
|
54
|
+
puts <<EOF
|
|
55
|
+
|
|
56
|
+
Error: did you mean build?
|
|
57
|
+
Usage: badger db build
|
|
58
|
+
|
|
59
|
+
EOF
|
|
60
|
+
when 'plugins' #----------------
|
|
61
|
+
puts <<EOF
|
|
62
|
+
|
|
63
|
+
Error: Plugin already exists.
|
|
64
|
+
|
|
65
|
+
EOF
|
|
66
|
+
when 'rails root' #----------------
|
|
67
|
+
puts <<EOF
|
|
68
|
+
|
|
69
|
+
Error: could not locate rails application.
|
|
70
|
+
Enter the root of your rails application and try again.
|
|
71
|
+
|
|
72
|
+
EOF
|
|
73
|
+
when 'badger yaml' #----------------
|
|
74
|
+
puts <<EOF
|
|
75
|
+
|
|
76
|
+
Error: badger.yml already exists.
|
|
77
|
+
|
|
78
|
+
EOF
|
|
79
|
+
when 'yaml exists' #----------------
|
|
80
|
+
puts <<EOF
|
|
81
|
+
|
|
82
|
+
Error: could not locate badger.yml file.
|
|
83
|
+
A config/badger.yml file is required for server configuration.
|
|
84
|
+
|
|
85
|
+
EOF
|
|
86
|
+
when 'environment' #----------------
|
|
87
|
+
puts <<EOF
|
|
88
|
+
|
|
89
|
+
Error: no envirionment specified.
|
|
90
|
+
Please add an either staging or production to the config/badger.yml file.
|
|
91
|
+
|
|
92
|
+
EOF
|
|
93
|
+
when 'generate plugins' #----------------
|
|
94
|
+
puts <<EOF
|
|
95
|
+
|
|
96
|
+
Error: no generate specified.
|
|
97
|
+
Badger does not know what to generate. Did you mean plugins?
|
|
98
|
+
|
|
99
|
+
EOF
|
|
100
|
+
when 'generate yaml' #----------------
|
|
101
|
+
puts <<EOF
|
|
102
|
+
|
|
103
|
+
Error: no generate specified.
|
|
104
|
+
Badger does not know what to generate. Did you mean yml?
|
|
105
|
+
|
|
106
|
+
EOF
|
|
107
|
+
when 'generate' #----------------
|
|
108
|
+
puts <<EOF
|
|
109
|
+
|
|
110
|
+
Error: no gererate specified.
|
|
111
|
+
< badger generate yml >
|
|
112
|
+
< badger generate plugins >
|
|
113
|
+
|
|
114
|
+
EOF
|
|
115
|
+
when 'gemset clear' #----------------
|
|
116
|
+
puts <<EOF
|
|
117
|
+
|
|
118
|
+
Command not understood did you mean badger gemset clear?
|
|
119
|
+
|
|
120
|
+
EOF
|
|
121
|
+
when 'usage' #----------------
|
|
122
|
+
puts <<EOF
|
|
123
|
+
|
|
124
|
+
Usage:
|
|
125
|
+
< badger create [project-name] >
|
|
126
|
+
< badger remove [project-name] >
|
|
127
|
+
< badger update [project-name] >
|
|
128
|
+
< badger deploy >
|
|
129
|
+
< badger deploy --with-workers >
|
|
130
|
+
< badger gemset clear >
|
|
131
|
+
< badger generate [generator] >
|
|
132
|
+
< badger rake [rake command] >
|
|
133
|
+
< badger db build >
|
|
134
|
+
< badger app[number] build >
|
|
135
|
+
< badger info >
|
|
136
|
+
< badger logs >
|
|
137
|
+
< badger logs tail >
|
|
138
|
+
g, gen, generate - yml, plugins
|
|
139
|
+
|
|
140
|
+
EOF
|
|
141
|
+
when 'rubyracer' #----------------
|
|
142
|
+
puts <<EOF
|
|
143
|
+
|
|
144
|
+
Error: Gemfile is missing therubyracer.
|
|
145
|
+
Add therubyracter, :platform => :ruby to your Gemfile
|
|
146
|
+
and run bundle update.
|
|
147
|
+
|
|
148
|
+
EOF
|
|
149
|
+
when 'mysql2' #----------------
|
|
150
|
+
puts <<EOF
|
|
151
|
+
|
|
152
|
+
Error: Gemfile is missing mysql2 adapter.
|
|
153
|
+
Add mysql2 to your Gemfile and run bundle update.
|
|
154
|
+
|
|
155
|
+
EOF
|
|
156
|
+
when 'unicorn' #----------------
|
|
157
|
+
puts <<EOF
|
|
158
|
+
|
|
159
|
+
Error: Gemfile is missing unicorn.
|
|
160
|
+
Add unicorn to your Gemfile and run bundle update.
|
|
161
|
+
|
|
162
|
+
EOF
|
|
163
|
+
when 'ssh' #----------------
|
|
164
|
+
puts <<EOF
|
|
165
|
+
|
|
166
|
+
Error: no ssh key found.
|
|
167
|
+
Generate a ssh key via < ssh-keygen -t rsa >.
|
|
168
|
+
|
|
169
|
+
EOF
|
|
170
|
+
when 'rails project' #----------------
|
|
171
|
+
puts <<EOF
|
|
172
|
+
|
|
173
|
+
Rails project already exists.
|
|
174
|
+
|
|
175
|
+
EOF
|
|
176
|
+
when 'info error' #----------------
|
|
177
|
+
puts <<EOF
|
|
178
|
+
|
|
179
|
+
No Rails project found.
|
|
180
|
+
|
|
181
|
+
EOF
|
|
182
|
+
when 'update error' #----------------
|
|
183
|
+
puts <<EOF
|
|
184
|
+
|
|
185
|
+
Rails project #{ARGV[1]} was not found.
|
|
186
|
+
|
|
187
|
+
EOF
|
|
188
|
+
when 'local db'
|
|
189
|
+
puts <<EOF
|
|
190
|
+
|
|
191
|
+
Error: cannot deploy app withou local_db set to false.
|
|
192
|
+
Place local_db: false in your config/badger.yml
|
|
193
|
+
|
|
194
|
+
EOF
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
class Errors
|
|
201
|
+
include ErrorList
|
|
202
|
+
end
|