bonethug 0.0.67 → 0.0.68
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/.gitignore +1 -0
- data/Gemfile +0 -0
- data/ISSUES.txt +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/TODO.txt +5 -4
- data/bin/bonethug +0 -0
- data/bin/thug +0 -0
- data/bonethug.gemspec +0 -0
- data/config/backup.rb +0 -0
- data/config/cnf.yml +184 -177
- data/config/deploy.rb +68 -26
- data/config/schedule.rb +0 -0
- data/config/syncer.rb +0 -0
- data/lib/bonethug/cli.rb +242 -242
- data/lib/bonethug/conf.rb +0 -0
- data/lib/bonethug/installer.rb +378 -378
- data/lib/bonethug/utils.rb +0 -0
- data/lib/bonethug/version.rb +2 -2
- data/lib/bonethug/watcher.rb +0 -0
- data/lib/bonethug.rb +0 -0
- data/lib/tasks/bonethug.rake +0 -0
- data/scripts/ubuntu_setup.sh +0 -0
- data/scripts/ubuntu_setup_2.4.sh +106 -0
- data/skel/base/.gitignore +0 -0
- data/skel/base/Gemfile +0 -0
- data/skel/base/README.md +0 -0
- data/skel/base/config/example/.gitkeep +0 -0
- data/skel/base/lib/.gitkeep +0 -0
- data/skel/base/log/.gitkeep +0 -0
- data/skel/base/public/favicon.ico +0 -0
- data/skel/base/public/robots.txt +0 -0
- data/skel/project_types/drupal/.gitignore +0 -0
- data/skel/project_types/drupal/composer.json +0 -0
- data/skel/project_types/drupal/lib/flush_drupal_cache.php +0 -0
- data/skel/project_types/drupal/public/sites/all/themes/project/.keep +0 -0
- data/skel/project_types/drupal/public/sites/default/development.settings.php +0 -0
- data/skel/project_types/drupal/public/sites/default/production.settings.php +0 -0
- data/skel/project_types/drupal/public/sites/default/settings.php +0 -0
- data/skel/project_types/drupal/public/sites/default/staging.settings.php +0 -0
- data/skel/project_types/drupal6/.gitignore +0 -0
- data/skel/project_types/drupal6/composer.json +0 -0
- data/skel/project_types/drupal6/lib/flush_drupal_cache.php +0 -0
- data/skel/project_types/drupal6/public/sites/all/themes/project/.keep +0 -0
- data/skel/project_types/drupal6/public/sites/default/development.settings.php +0 -0
- data/skel/project_types/drupal6/public/sites/default/production.settings.php +0 -0
- data/skel/project_types/drupal6/public/sites/default/settings.php +0 -0
- data/skel/project_types/drupal6/public/sites/default/staging.settings.php +0 -0
- data/skel/project_types/drupal7/.gitignore +0 -0
- data/skel/project_types/drupal7/composer.json +0 -0
- data/skel/project_types/drupal7/lib/flush_drupal_cache.php +0 -0
- data/skel/project_types/drupal7/public/sites/all/themes/project/.keep +0 -0
- data/skel/project_types/drupal7/public/sites/default/development.settings.php +0 -0
- data/skel/project_types/drupal7/public/sites/default/production.settings.php +0 -0
- data/skel/project_types/drupal7/public/sites/default/settings.php +0 -0
- data/skel/project_types/drupal7/public/sites/default/staging.settings.php +0 -0
- data/skel/project_types/drupal8/.gitignore +0 -0
- data/skel/project_types/drupal8/composer.json +0 -0
- data/skel/project_types/drupal8/lib/flush_drupal_cache.php +0 -0
- data/skel/project_types/drupal8/public/sites/all/themes/project/.keep +0 -0
- data/skel/project_types/drupal8/public/sites/default/development.settings.php +0 -0
- data/skel/project_types/drupal8/public/sites/default/production.settings.php +0 -0
- data/skel/project_types/drupal8/public/sites/default/settings.php +0 -0
- data/skel/project_types/drupal8/public/sites/default/staging.settings.php +0 -0
- data/skel/project_types/php/.gitignore +0 -0
- data/skel/project_types/php/composer.json +0 -0
- data/skel/project_types/rails3/Gemfile +0 -0
- data/skel/project_types/rails3/README.md +0 -0
- data/skel/project_types/rails4/Gemfile +0 -0
- data/skel/project_types/rails4/README.md +0 -0
- data/skel/project_types/rails4/app/assets/fonts/.keep +0 -0
- data/skel/project_types/rails4/app/assets/images/.keep +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-114x114.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-120x120.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-144x144.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-152x152.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-57x57.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-60x60.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-72x72.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon-76x76.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/apple-touch-icon.png +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/favicon.ico +0 -0
- data/skel/project_types/rails4/app/assets/images/favicons/iconifier-readme.txt +0 -0
- data/skel/project_types/rails4/app/assets/javascripts/application.js +0 -0
- data/skel/project_types/rails4/app/assets/javascripts/lte-ie8-shims.js +0 -0
- data/skel/project_types/rails4/app/assets/javascripts/main.js.coffee +0 -0
- data/skel/project_types/rails4/app/assets/stylesheets/application.css.scss +0 -0
- data/skel/project_types/rails4/app/assets/stylesheets/main.scss +0 -0
- data/skel/project_types/rails4/app/controllers/errors_controller.rb +0 -0
- data/skel/project_types/rails4/app/helpers/application_helper.rb +0 -0
- data/skel/project_types/rails4/app/views/application/index.html.erb +0 -0
- data/skel/project_types/rails4/app/views/errors/not_found.html.erb +0 -0
- data/skel/project_types/rails4/app/views/errors/server_error.html.erb +0 -0
- data/skel/project_types/rails4/app/views/layouts/application.html.erb +0 -0
- data/skel/project_types/rails4/config/application.rb +0 -0
- data/skel/project_types/rails4/config/environments/development.rb +0 -0
- data/skel/project_types/rails4/config/environments/production.rb +0 -0
- data/skel/project_types/rails4/config/environments/staging.rb +0 -0
- data/skel/project_types/rails4/config/environments/test.rb +0 -0
- data/skel/project_types/rails4/config/routes.rb +0 -0
- data/skel/project_types/silverstripe3/.bowerrc +0 -0
- data/skel/project_types/silverstripe3/.gitignore +0 -0
- data/skel/project_types/silverstripe3/README.md +0 -0
- data/skel/project_types/silverstripe3/bower.json +0 -0
- data/skel/project_types/silverstripe3/composer.json +26 -26
- data/skel/project_types/silverstripe3/lib/ss_loadconf.php +0 -0
- data/skel/project_types/silverstripe3/public/.htaccess +0 -0
- data/skel/project_types/silverstripe3/public/_ss_environment.php +0 -0
- data/skel/project_types/silverstripe3/public/assets/error-404.html +0 -0
- data/skel/project_types/silverstripe3/public/assets/error-500.html +0 -0
- data/skel/project_types/silverstripe3/public/index.php.bak +0 -0
- data/skel/project_types/silverstripe3/public/project/.htaccess +0 -0
- data/skel/project_types/silverstripe3/public/project/_config/config.yml +0 -0
- data/skel/project_types/silverstripe3/public/project/_config.php +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Controllers/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Extensions/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Forms/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Objects/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Pages/HomePage.php +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Pages/Page.php +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Pages/RootPage.php +0 -0
- data/skel/project_types/silverstripe3/public/project/code/Tasks/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/project/coffee/application.js.coffee +0 -0
- data/skel/project_types/silverstripe3/public/project/javascript/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/silverstripe-cache/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/css/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/css/editor.css +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/css/typography.css +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-114x114.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-120x120.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-144x144.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-152x152.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-57x57.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-60x60.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-72x72.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon-76x76.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/apple-touch-icon.png +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/favicon.ico +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/images/favicons/iconifier-readme.txt +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/scss/_functions.scss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/scss/_mixins.scss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/scss/_vars.scss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/scss/main.scss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/scss/typography.scss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/templates/Includes/.gitkeep +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/templates/Layout/Page.ss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/templates/Layout/Security.ss +0 -0
- data/skel/project_types/silverstripe3/public/themes/project/templates/Page.ss +0 -0
- data/skel/skel.yml +0 -0
- metadata +3 -2
data/lib/bonethug/cli.rb
CHANGED
@@ -1,243 +1,243 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
module Bonethug
|
4
|
-
class CLI
|
5
|
-
|
6
|
-
def self.handle(bin_name = 'thug')
|
7
|
-
|
8
|
-
# what are we doing?
|
9
|
-
task = ARGV[0] || 'help'
|
10
|
-
|
11
|
-
case task
|
12
|
-
|
13
|
-
when 'help'
|
14
|
-
|
15
|
-
display_help
|
16
|
-
|
17
|
-
when 'version'
|
18
|
-
|
19
|
-
puts 'bonethug v' + VERSION + ' - build date: ' + BUILD_DATE
|
20
|
-
exit
|
21
|
-
|
22
|
-
when 'auth'
|
23
|
-
|
24
|
-
# handle args
|
25
|
-
env = ARGV[1]
|
26
|
-
|
27
|
-
# validate
|
28
|
-
unless env
|
29
|
-
puts 'Usage: ' + bin_name + ' auth [environment]'
|
30
|
-
return
|
31
|
-
end
|
32
|
-
|
33
|
-
exec "export to=#{env} && bundle exec mina -f .bonethug/deploy.rb auth --verbose"
|
34
|
-
|
35
|
-
when 'install'
|
36
|
-
|
37
|
-
# handle args
|
38
|
-
type = ARGV[1]
|
39
|
-
location = ARGV[2] || '.'
|
40
|
-
|
41
|
-
# validate
|
42
|
-
unless type
|
43
|
-
puts 'Usage: ' + bin_name + ' install [type] [location]'
|
44
|
-
return
|
45
|
-
end
|
46
|
-
|
47
|
-
# run the installer
|
48
|
-
Installer.install type, location
|
49
|
-
|
50
|
-
when 'init-db', 'init-local-db'
|
51
|
-
|
52
|
-
# handle args
|
53
|
-
env = ARGV.last
|
54
|
-
admin_user = ARGV.length == 3 ? ARGV[1] : 'root'
|
55
|
-
|
56
|
-
# validate
|
57
|
-
unless env
|
58
|
-
puts 'Usage: ' + bin_name + ' ' + task + ' [admin_user] [environment]'
|
59
|
-
return
|
60
|
-
end
|
61
|
-
|
62
|
-
if task == 'init-local-db'
|
63
|
-
Installer.execute_init_mysql_db_script env, admin_user
|
64
|
-
else
|
65
|
-
exec "export to=#{env} && export admin_user=#{admin_user} && bundle exec mina -f .bonethug/deploy.rb init_db --verbose"
|
66
|
-
end
|
67
|
-
|
68
|
-
when 'setup-env'
|
69
|
-
|
70
|
-
# handle args
|
71
|
-
env = ARGV.last
|
72
|
-
|
73
|
-
# validate
|
74
|
-
unless env
|
75
|
-
puts 'Usage: ' + bin_name + ' setup-env [environment]'
|
76
|
-
return
|
77
|
-
end
|
78
|
-
|
79
|
-
# find the file
|
80
|
-
gem_dir = File.expand_path File.dirname(__FILE__) + '/../..'
|
81
|
-
script = gem_dir + '/scripts/ubuntu_setup.sh'
|
82
|
-
|
83
|
-
if env == 'show'
|
84
|
-
|
85
|
-
puts "---------------"
|
86
|
-
puts "Pre"
|
87
|
-
puts "---------------\n"
|
88
|
-
puts File.read script
|
89
|
-
|
90
|
-
puts "\n---------------"
|
91
|
-
puts "Parsed"
|
92
|
-
puts "---------------"
|
93
|
-
puts Installer.parse_sh File.read(script)
|
94
|
-
|
95
|
-
elsif env == 'local'
|
96
|
-
exec 'sudo bash ' + script
|
97
|
-
|
98
|
-
else
|
99
|
-
exec "export to=#{env} && bundle exec mina -f .bonethug/deploy.rb setup_env --verbose"
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
when 'init', 'update'
|
104
|
-
|
105
|
-
# handle args
|
106
|
-
location = ARGV[1] || '.'
|
107
|
-
|
108
|
-
# validate
|
109
|
-
unless location
|
110
|
-
puts 'Usage: ' + bin_name + ' #{task} [location]'
|
111
|
-
return
|
112
|
-
end
|
113
|
-
|
114
|
-
# run the initaliser
|
115
|
-
Installer.bonethugise(location, task.to_sym)
|
116
|
-
|
117
|
-
when 'run',
|
118
|
-
'rake',
|
119
|
-
'drush',
|
120
|
-
'drush-local',
|
121
|
-
'sake'
|
122
|
-
|
123
|
-
# get env
|
124
|
-
environment = ARGV.last
|
125
|
-
|
126
|
-
# handle args
|
127
|
-
if task == 'run'
|
128
|
-
cmd_task = ARGV[1]
|
129
|
-
args = ARGV[2..(ARGV.length-2)]
|
130
|
-
else
|
131
|
-
case task
|
132
|
-
when 'rake'
|
133
|
-
cmd_task = 'rake'
|
134
|
-
when 'drush', 'drush-local'
|
135
|
-
cmd_task = File.expand_path('./vendor/drush/drush/drush') + ' -r ' + File.expand_path('./public')
|
136
|
-
when 'sake'
|
137
|
-
cmd_task = 'public/framework/sake'
|
138
|
-
end
|
139
|
-
args = ARGV[1..(ARGV.length-2)]
|
140
|
-
end
|
141
|
-
|
142
|
-
if task == 'drush-local'
|
143
|
-
|
144
|
-
env_cmd = RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i ? 'set' : 'export'
|
145
|
-
cmd = env_cmd + " APPLICATION_ENV=#{environment} && #{cmd_task} #{args.join(' ')}"
|
146
|
-
puts
|
147
|
-
exec cmd
|
148
|
-
|
149
|
-
else
|
150
|
-
|
151
|
-
# build command
|
152
|
-
run = "\"run[#{cmd_task} #{args.join(' ')}]\""
|
153
|
-
|
154
|
-
# do it!
|
155
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb #{run} --verbose"
|
156
|
-
|
157
|
-
end
|
158
|
-
|
159
|
-
when 'deploy',
|
160
|
-
'setup',
|
161
|
-
'remote-backup',
|
162
|
-
'local-backup',
|
163
|
-
'sync-backup-to',
|
164
|
-
'sync-backup-from',
|
165
|
-
'sync-local-to',
|
166
|
-
'sync-local-from',
|
167
|
-
'init-db',
|
168
|
-
'force-unlock',
|
169
|
-
'cleanup'
|
170
|
-
|
171
|
-
# handle args
|
172
|
-
environment = ARGV[1]
|
173
|
-
|
174
|
-
# validate
|
175
|
-
unless environment
|
176
|
-
puts 'Usage: thug #{task} [environment]'
|
177
|
-
return
|
178
|
-
end
|
179
|
-
|
180
|
-
case task
|
181
|
-
|
182
|
-
# Setup and Deploy
|
183
|
-
when 'deploy'
|
184
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb deploy --verbose"
|
185
|
-
when 'setup'
|
186
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb setup --verbose"
|
187
|
-
|
188
|
-
# remote mina scripts
|
189
|
-
when 'init-db'
|
190
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb init_db --verbose"
|
191
|
-
when 'force-unlock'
|
192
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb deploy:force_unlock --verbose"
|
193
|
-
when 'cleanup'
|
194
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb deploy:cleanup --verbose"
|
195
|
-
|
196
|
-
# Snapshot Backup
|
197
|
-
when 'remote-backup'
|
198
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb backup --verbose"
|
199
|
-
when 'local-backup'
|
200
|
-
exec "export to=#{environment} && bundle exec astrails-safe .bonethug/backup.rb"
|
201
|
-
|
202
|
-
# Synchronised backup
|
203
|
-
when 'sync-backup-to'
|
204
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb sync_to --verbose"
|
205
|
-
when 'sync-backup-from'
|
206
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb sync_from --verbose"
|
207
|
-
|
208
|
-
when 'sync-local-to'
|
209
|
-
exec "ruby .bonethug/syncer.rb sync_local_to #{environment}"
|
210
|
-
when 'sync-local-from'
|
211
|
-
exec "ruby .bonethug/syncer.rb sync_local_from #{environment}"
|
212
|
-
end
|
213
|
-
|
214
|
-
when 'watch'
|
215
|
-
|
216
|
-
# handle args
|
217
|
-
type = ARGV[1] || 'coffee_sass'
|
218
|
-
location = ARGV[2] || '.'
|
219
|
-
watch_only = ARGV[3] || nil
|
220
|
-
|
221
|
-
# run the installer
|
222
|
-
Watcher.watch type, location, watch_only
|
223
|
-
|
224
|
-
when 'clean'
|
225
|
-
|
226
|
-
location = ARGV[1] || '.'
|
227
|
-
Installer.clean location
|
228
|
-
|
229
|
-
else
|
230
|
-
|
231
|
-
# We didn't find a task
|
232
|
-
puts 'Task not found'
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|
237
|
-
|
238
|
-
def self.display_help(bin_name = 'thug')
|
239
|
-
puts 'Usage: ' + bin_name + ' task [argument]...'
|
240
|
-
end
|
241
|
-
|
242
|
-
end
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
module Bonethug
|
4
|
+
class CLI
|
5
|
+
|
6
|
+
def self.handle(bin_name = 'thug')
|
7
|
+
|
8
|
+
# what are we doing?
|
9
|
+
task = ARGV[0] || 'help'
|
10
|
+
|
11
|
+
case task
|
12
|
+
|
13
|
+
when 'help'
|
14
|
+
|
15
|
+
display_help
|
16
|
+
|
17
|
+
when 'version'
|
18
|
+
|
19
|
+
puts 'bonethug v' + VERSION + ' - build date: ' + BUILD_DATE
|
20
|
+
exit
|
21
|
+
|
22
|
+
when 'auth'
|
23
|
+
|
24
|
+
# handle args
|
25
|
+
env = ARGV[1]
|
26
|
+
|
27
|
+
# validate
|
28
|
+
unless env
|
29
|
+
puts 'Usage: ' + bin_name + ' auth [environment]'
|
30
|
+
return
|
31
|
+
end
|
32
|
+
|
33
|
+
exec "export to=#{env} && bundle exec mina -f .bonethug/deploy.rb auth --verbose"
|
34
|
+
|
35
|
+
when 'install'
|
36
|
+
|
37
|
+
# handle args
|
38
|
+
type = ARGV[1]
|
39
|
+
location = ARGV[2] || '.'
|
40
|
+
|
41
|
+
# validate
|
42
|
+
unless type
|
43
|
+
puts 'Usage: ' + bin_name + ' install [type] [location]'
|
44
|
+
return
|
45
|
+
end
|
46
|
+
|
47
|
+
# run the installer
|
48
|
+
Installer.install type, location
|
49
|
+
|
50
|
+
when 'init-db', 'init-local-db'
|
51
|
+
|
52
|
+
# handle args
|
53
|
+
env = ARGV.last
|
54
|
+
admin_user = ARGV.length == 3 ? ARGV[1] : 'root'
|
55
|
+
|
56
|
+
# validate
|
57
|
+
unless env
|
58
|
+
puts 'Usage: ' + bin_name + ' ' + task + ' [admin_user] [environment]'
|
59
|
+
return
|
60
|
+
end
|
61
|
+
|
62
|
+
if task == 'init-local-db'
|
63
|
+
Installer.execute_init_mysql_db_script env, admin_user
|
64
|
+
else
|
65
|
+
exec "export to=#{env} && export admin_user=#{admin_user} && bundle exec mina -f .bonethug/deploy.rb init_db --verbose"
|
66
|
+
end
|
67
|
+
|
68
|
+
when 'setup-env'
|
69
|
+
|
70
|
+
# handle args
|
71
|
+
env = ARGV.last
|
72
|
+
|
73
|
+
# validate
|
74
|
+
unless env
|
75
|
+
puts 'Usage: ' + bin_name + ' setup-env [environment]'
|
76
|
+
return
|
77
|
+
end
|
78
|
+
|
79
|
+
# find the file
|
80
|
+
gem_dir = File.expand_path File.dirname(__FILE__) + '/../..'
|
81
|
+
script = gem_dir + '/scripts/ubuntu_setup.sh'
|
82
|
+
|
83
|
+
if env == 'show'
|
84
|
+
|
85
|
+
puts "---------------"
|
86
|
+
puts "Pre"
|
87
|
+
puts "---------------\n"
|
88
|
+
puts File.read script
|
89
|
+
|
90
|
+
puts "\n---------------"
|
91
|
+
puts "Parsed"
|
92
|
+
puts "---------------"
|
93
|
+
puts Installer.parse_sh File.read(script)
|
94
|
+
|
95
|
+
elsif env == 'local'
|
96
|
+
exec 'sudo bash ' + script
|
97
|
+
|
98
|
+
else
|
99
|
+
exec "export to=#{env} && bundle exec mina -f .bonethug/deploy.rb setup_env --verbose"
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
when 'init', 'update'
|
104
|
+
|
105
|
+
# handle args
|
106
|
+
location = ARGV[1] || '.'
|
107
|
+
|
108
|
+
# validate
|
109
|
+
unless location
|
110
|
+
puts 'Usage: ' + bin_name + ' #{task} [location]'
|
111
|
+
return
|
112
|
+
end
|
113
|
+
|
114
|
+
# run the initaliser
|
115
|
+
Installer.bonethugise(location, task.to_sym)
|
116
|
+
|
117
|
+
when 'run',
|
118
|
+
'rake',
|
119
|
+
'drush',
|
120
|
+
'drush-local',
|
121
|
+
'sake'
|
122
|
+
|
123
|
+
# get env
|
124
|
+
environment = ARGV.last
|
125
|
+
|
126
|
+
# handle args
|
127
|
+
if task == 'run'
|
128
|
+
cmd_task = ARGV[1]
|
129
|
+
args = ARGV[2..(ARGV.length-2)]
|
130
|
+
else
|
131
|
+
case task
|
132
|
+
when 'rake'
|
133
|
+
cmd_task = 'rake'
|
134
|
+
when 'drush', 'drush-local'
|
135
|
+
cmd_task = File.expand_path('./vendor/drush/drush/drush') + ' -r ' + File.expand_path('./public')
|
136
|
+
when 'sake'
|
137
|
+
cmd_task = 'public/framework/sake'
|
138
|
+
end
|
139
|
+
args = ARGV[1..(ARGV.length-2)]
|
140
|
+
end
|
141
|
+
|
142
|
+
if task == 'drush-local'
|
143
|
+
|
144
|
+
env_cmd = RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i ? 'set' : 'export'
|
145
|
+
cmd = env_cmd + " APPLICATION_ENV=#{environment} && #{cmd_task} #{args.join(' ')}"
|
146
|
+
puts
|
147
|
+
exec cmd
|
148
|
+
|
149
|
+
else
|
150
|
+
|
151
|
+
# build command
|
152
|
+
run = "\"run[#{cmd_task} #{args.join(' ')}]\""
|
153
|
+
|
154
|
+
# do it!
|
155
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb #{run} --verbose"
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
when 'deploy',
|
160
|
+
'setup',
|
161
|
+
'remote-backup',
|
162
|
+
'local-backup',
|
163
|
+
'sync-backup-to',
|
164
|
+
'sync-backup-from',
|
165
|
+
'sync-local-to',
|
166
|
+
'sync-local-from',
|
167
|
+
'init-db',
|
168
|
+
'force-unlock',
|
169
|
+
'cleanup'
|
170
|
+
|
171
|
+
# handle args
|
172
|
+
environment = ARGV[1]
|
173
|
+
|
174
|
+
# validate
|
175
|
+
unless environment
|
176
|
+
puts 'Usage: thug #{task} [environment]'
|
177
|
+
return
|
178
|
+
end
|
179
|
+
|
180
|
+
case task
|
181
|
+
|
182
|
+
# Setup and Deploy
|
183
|
+
when 'deploy'
|
184
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb deploy --verbose"
|
185
|
+
when 'setup'
|
186
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb setup --verbose"
|
187
|
+
|
188
|
+
# remote mina scripts
|
189
|
+
when 'init-db'
|
190
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb init_db --verbose"
|
191
|
+
when 'force-unlock'
|
192
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb deploy:force_unlock --verbose"
|
193
|
+
when 'cleanup'
|
194
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb deploy:cleanup --verbose"
|
195
|
+
|
196
|
+
# Snapshot Backup
|
197
|
+
when 'remote-backup'
|
198
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb backup --verbose"
|
199
|
+
when 'local-backup'
|
200
|
+
exec "export to=#{environment} && bundle exec astrails-safe .bonethug/backup.rb"
|
201
|
+
|
202
|
+
# Synchronised backup
|
203
|
+
when 'sync-backup-to'
|
204
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb sync_to --verbose"
|
205
|
+
when 'sync-backup-from'
|
206
|
+
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb sync_from --verbose"
|
207
|
+
|
208
|
+
when 'sync-local-to'
|
209
|
+
exec "ruby .bonethug/syncer.rb sync_local_to #{environment}"
|
210
|
+
when 'sync-local-from'
|
211
|
+
exec "ruby .bonethug/syncer.rb sync_local_from #{environment}"
|
212
|
+
end
|
213
|
+
|
214
|
+
when 'watch'
|
215
|
+
|
216
|
+
# handle args
|
217
|
+
type = ARGV[1] || 'coffee_sass'
|
218
|
+
location = ARGV[2] || '.'
|
219
|
+
watch_only = ARGV[3] || nil
|
220
|
+
|
221
|
+
# run the installer
|
222
|
+
Watcher.watch type, location, watch_only
|
223
|
+
|
224
|
+
when 'clean'
|
225
|
+
|
226
|
+
location = ARGV[1] || '.'
|
227
|
+
Installer.clean location
|
228
|
+
|
229
|
+
else
|
230
|
+
|
231
|
+
# We didn't find a task
|
232
|
+
puts 'Task not found'
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
def self.display_help(bin_name = 'thug')
|
239
|
+
puts 'Usage: ' + bin_name + ' task [argument]...'
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
243
|
end
|
data/lib/bonethug/conf.rb
CHANGED
File without changes
|