bonethug 0.0.63 → 0.0.66
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/Gemfile +4 -1
- data/README.md +171 -12
- data/TODO.txt +2 -1
- data/bonethug.gemspec +3 -0
- data/config/deploy.rb +31 -0
- data/lib/bonethug/cli.rb +60 -11
- data/lib/bonethug/installer.rb +40 -0
- data/lib/bonethug/version.rb +2 -2
- data/lib/bonethug/watcher.rb +31 -3
- data/scripts/ubuntu_setup.sh +1 -1
- data/skel/project_types/drupal6/.gitignore +39 -0
- data/skel/project_types/drupal6/composer.json +21 -0
- data/skel/project_types/drupal6/lib/flush_drupal_cache.php +7 -0
- data/skel/project_types/drupal6/public/sites/all/themes/project/.keep +0 -0
- data/skel/project_types/drupal7/.gitignore +39 -0
- data/skel/project_types/drupal7/composer.json +21 -0
- data/skel/project_types/drupal7/lib/flush_drupal_cache.php +7 -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 +564 -0
- data/skel/project_types/drupal7/public/sites/default/production.settings.php +564 -0
- data/skel/project_types/drupal7/public/sites/default/settings.php +18 -0
- data/skel/project_types/drupal7/public/sites/default/staging.settings.php +564 -0
- data/skel/project_types/drupal8/.gitignore +39 -0
- data/skel/project_types/drupal8/composer.json +21 -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 +259 -0
- data/skel/project_types/drupal8/public/sites/default/production.settings.php +259 -0
- data/skel/project_types/drupal8/public/sites/default/settings.php +17 -0
- data/skel/project_types/drupal8/public/sites/default/staging.settings.php +260 -0
- data/skel/project_types/silverstripe3/README.md +1 -1
- data/skel/project_types/silverstripe3/public/project/_config.php +1 -1
- metadata +74 -9
- data/skel/project_types/drupal/.gitignore +0 -11
- data/skel/project_types/drupal/composer.json +0 -6
- /data/skel/project_types/{drupal → drupal6}/public/sites/default/development.settings.php +0 -0
- /data/skel/project_types/{drupal → drupal6}/public/sites/default/production.settings.php +0 -0
- /data/skel/project_types/{drupal → drupal6}/public/sites/default/settings.php +0 -0
- /data/skel/project_types/{drupal → drupal6}/public/sites/default/staging.settings.php +0 -0
- /data/skel/project_types/{drupal → drupal8}/lib/flush_drupal_cache.php +0 -0
data/Gemfile
CHANGED
@@ -28,11 +28,14 @@ gem 'uglifier'
|
|
28
28
|
gem 'sass-rails'
|
29
29
|
gem 'coffee-rails'
|
30
30
|
|
31
|
-
# asset pipeline - guard
|
31
|
+
# asset pipeline - guard not sprockets
|
32
32
|
gem 'coffee-script'
|
33
33
|
gem 'sass'
|
34
34
|
gem 'guard-sass'
|
35
35
|
gem 'guard-coffeescript'
|
36
|
+
gem 'guard-erb'
|
37
|
+
gem 'guard-slim'
|
38
|
+
gem 'guard-livereload'
|
36
39
|
|
37
40
|
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
|
38
41
|
|
data/README.md
CHANGED
@@ -3,7 +3,22 @@ Bonethug
|
|
3
3
|
|
4
4
|
|
5
5
|
|
6
|
-
Project
|
6
|
+
(Project) Bones in the basement and a thug to do the things you don't want to
|
7
|
+
dirty your hands with.
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
Bonethug could loosely be considered a "web project meta framework". It uses a
|
12
|
+
single configuration file (although it merges in the database.yml file for rails
|
13
|
+
projects) for all project types and includes adapters to interface with project
|
14
|
+
specific configs. This keeps you configuration in one place and has the benefit
|
15
|
+
of being able to drive the automation of a number of other repeatitious taks
|
16
|
+
like deployment, task scheduling, backups and asset / db synchronisation.
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
The goal of the project is to be able to handle the complete project life cycle
|
21
|
+
using only bonethug, git and package managers - no ssh, ftp, mysqldump etc.
|
7
22
|
|
8
23
|
|
9
24
|
|
@@ -25,7 +40,7 @@ Or install it yourself as:
|
|
25
40
|
|
26
41
|
|
27
42
|
Update
|
28
|
-
|
43
|
+
------
|
29
44
|
|
30
45
|
execute:
|
31
46
|
|
@@ -48,7 +63,7 @@ Usage
|
|
48
63
|
|
49
64
|
**Set up a project Skeleton**
|
50
65
|
|
51
|
-
`thug install {rails3|silverstripe3|drupal|php|sinatra}`
|
66
|
+
`thug install {rails3|rails4|silverstripe3|drupal|php|sinatra}`
|
52
67
|
|
53
68
|
|
54
69
|
|
@@ -87,9 +102,27 @@ the info contained in cnf.yml*
|
|
87
102
|
|
88
103
|
|
89
104
|
|
105
|
+
**Setup local server**
|
106
|
+
|
107
|
+
*You sets up the local machine (if you are on ubuntu)*
|
108
|
+
|
109
|
+
`thug setup-env local`
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
**Initialise local DB**
|
114
|
+
|
115
|
+
*Uses the local mysql client to create a user and a database according to the
|
116
|
+
settings in your config/cnf.yml file*
|
117
|
+
|
118
|
+
`thug init-local-db [admin_user=root] {development|staging|production}`
|
119
|
+
|
120
|
+
|
121
|
+
|
90
122
|
### Remote Commands
|
91
123
|
|
92
|
-
*UPDATE:* Bonethug now supports interactive prompts so this may no longer be
|
124
|
+
*UPDATE:* Bonethug now supports interactive prompts so this may no longer be
|
125
|
+
necessary
|
93
126
|
|
94
127
|
Most of these are piped through mina. Mina uses SSH to send a bash script to
|
95
128
|
the remote server where it is executed. For these commands to work you need to
|
@@ -105,16 +138,32 @@ Host *
|
|
105
138
|
UserKnownHostsFile=/dev/null
|
106
139
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
107
140
|
|
141
|
+
|
142
|
+
|
108
143
|
**Setup a remote server**
|
109
144
|
|
110
|
-
*This
|
111
|
-
|
145
|
+
*This installs all the required software on a remote server using mina to call
|
146
|
+
all the commands*
|
147
|
+
|
148
|
+
`thug setup-env {development|staging|production}`
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
**Initialise remote DB**
|
153
|
+
|
154
|
+
*Uses the mysql client in the remote environment to create a user and a database
|
155
|
+
according to the settings in your config/cnf.yml file*
|
156
|
+
|
157
|
+
`thug init-db [admin_user=root] {development|staging|production}`
|
158
|
+
|
159
|
+
|
112
160
|
|
113
161
|
**Setup and Deploy to Remote Server**
|
114
162
|
|
115
163
|
*This wraps mina and deploys using the information contained in cnf.yml*
|
116
164
|
|
117
|
-
`thug setup {development|staging|production}`
|
165
|
+
`thug setup {development|staging|production}`
|
166
|
+
|
118
167
|
`thug deploy {develoment|staging|production}`
|
119
168
|
|
120
169
|
|
@@ -146,14 +195,124 @@ wipe the files from your deploy copy.
|
|
146
195
|
|
147
196
|
`thug sync-to {develoment|staging|production}`
|
148
197
|
|
149
|
-
|
198
|
+
|
199
|
+
|
200
|
+
Example Workflow
|
201
|
+
----------------
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
### New SilverStripe3 project
|
206
|
+
|
207
|
+
|
208
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
209
|
+
# install bonethug in the global scope (or use: bundle exec thug)
|
210
|
+
gem install bonethug
|
211
|
+
|
212
|
+
# set up project bones in the current folder
|
213
|
+
thug install silverstripe3
|
214
|
+
bundle install --path vendor
|
215
|
+
php composer.phar install
|
216
|
+
bower install
|
217
|
+
|
218
|
+
# --> edit the config/cnf.yml file!!
|
219
|
+
|
220
|
+
# watch for changes to sass and coffeescript
|
221
|
+
thug watch
|
222
|
+
|
223
|
+
# --> actually write some code!!
|
224
|
+
|
225
|
+
# commit work
|
226
|
+
git remote add origin git@git.domain.com:namespace/project-name.git
|
227
|
+
git add -A && git commit -am "initial commit"
|
228
|
+
git push -u origin master
|
229
|
+
|
230
|
+
# setup the deployment env and do a deploy
|
231
|
+
thug auth staging
|
232
|
+
thug setup-env staging
|
233
|
+
thug init-db staging
|
234
|
+
thug setup staging
|
235
|
+
thug deploy staging
|
236
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
### Deploying an existing project
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
245
|
+
# clone the repo and install the gems
|
246
|
+
git clone git@git.domain.com:namespace/project-name.git .
|
247
|
+
bundle install --path vendor
|
248
|
+
|
249
|
+
# only do this if its a fresh deploy target
|
250
|
+
thug auth staging
|
251
|
+
thug setup-env staging
|
252
|
+
thug init-db staging
|
253
|
+
thug setup staging
|
254
|
+
|
255
|
+
# deploy
|
256
|
+
thug deploy staging
|
257
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
What isn't implemented yet?
|
262
|
+
---------------------------
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
### Setup an existing project and mirror a remote environment (WIP)
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
271
|
+
# clone the repo and install the gems
|
272
|
+
git clone git@git.domain.com:namespace/project-name.git .
|
273
|
+
bundle install --path vendor
|
274
|
+
|
275
|
+
# setup local db
|
276
|
+
thug init-local-db staging
|
277
|
+
|
278
|
+
# add ssh key
|
279
|
+
thug auth staging
|
280
|
+
|
281
|
+
# do file sync
|
282
|
+
thug sync-from staging
|
283
|
+
|
284
|
+
# do db sync
|
285
|
+
thug sync-local-db staging development
|
286
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
### Push local assets etc to a remote (WIP)
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
295
|
+
# add ssh key
|
296
|
+
thug auth staging
|
297
|
+
|
298
|
+
# do file sync
|
299
|
+
thug sync-to staging
|
300
|
+
|
301
|
+
# do db sync
|
302
|
+
thug sync-remote-db development staging
|
303
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
304
|
+
|
150
305
|
|
151
306
|
|
152
307
|
Contributing
|
153
308
|
------------
|
154
309
|
|
155
|
-
1. Fork it
|
156
|
-
|
157
|
-
|
158
|
-
|
310
|
+
1. Fork it
|
311
|
+
|
312
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
313
|
+
|
314
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
315
|
+
|
316
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
317
|
+
|
159
318
|
5. Create new Pull Request
|
data/TODO.txt
CHANGED
data/bonethug.gemspec
CHANGED
@@ -47,6 +47,9 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_dependency 'sass'
|
48
48
|
spec.add_dependency 'guard-sass'
|
49
49
|
spec.add_dependency 'guard-coffeescript'
|
50
|
+
spec.add_dependency 'guard-erb'
|
51
|
+
spec.add_dependency 'guard-slim'
|
52
|
+
spec.add_dependency 'guard-livereload'
|
50
53
|
|
51
54
|
# asset pipeline guard sprockets
|
52
55
|
spec.add_dependency 'guard-sprockets'
|
data/config/deploy.rb
CHANGED
@@ -135,9 +135,40 @@ task :setup_env => :environment do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
desc "add your ssh key to the remote"
|
139
|
+
task :auth => :environment do
|
140
|
+
pub_key = File.read File.expand_path('~/.ssh/id_rsa.pub')
|
141
|
+
queue! %[echo "#{pub_key}" >> ~/.ssh/authourized_keys]
|
142
|
+
end
|
143
|
+
|
144
|
+
desc "init a db based on the settings in your cnf file"
|
145
|
+
task :init_db => :environment do
|
146
|
+
|
147
|
+
conf.get('dbs').each do |name,envs|
|
148
|
+
|
149
|
+
db = envs.get env
|
150
|
+
cmd = Bonethug::Installer.init_mysql_db_script db, deploy_to + 'current', ENV['admin_user']
|
151
|
+
queue! %[#{cmd}]
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
138
157
|
desc "Initialises the db"
|
139
158
|
task :init_db => :environment do
|
159
|
+
|
160
|
+
#rails
|
140
161
|
queue! %[cd #{deploy_to}/current && bundle exec rake db:reset RAILS_ENV="#{env}"] if deploy.get('project_type') =~ /rails[0-9]?/
|
162
|
+
|
163
|
+
# drpual
|
164
|
+
if deploy.get('project_type') =~ /drupal[0-9]?/
|
165
|
+
conf.get('dbs').each do |name,envs|
|
166
|
+
db = envs.get env
|
167
|
+
db_url = "mysql://#{db.get('user')}:#{db.get('pass')}@#{db.get('host')}/#{db.get('name')}"
|
168
|
+
queue! %[export APPLICATION_ENV=#{env} && cd #{deploy_to}/current/public && ../vendor/bin/drush site-install standard --account-name=admin --account-pass=admin --db-url=#{db_url}"]
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
141
172
|
end
|
142
173
|
|
143
174
|
desc "Restores application state to the most recent backup"
|
data/lib/bonethug/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
1
3
|
module Bonethug
|
2
4
|
class CLI
|
3
5
|
|
@@ -17,6 +19,19 @@ module Bonethug
|
|
17
19
|
puts 'bonethug v' + VERSION + ' - build date: ' + BUILD_DATE
|
18
20
|
exit
|
19
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
|
+
|
20
35
|
when 'install'
|
21
36
|
|
22
37
|
# handle args
|
@@ -32,14 +47,32 @@ module Bonethug
|
|
32
47
|
# run the installer
|
33
48
|
Installer.install type, location
|
34
49
|
|
35
|
-
when '
|
50
|
+
when 'init-db', 'init-local-db'
|
36
51
|
|
37
52
|
# handle args
|
38
|
-
env = ARGV
|
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
|
39
72
|
|
40
73
|
# validate
|
41
74
|
unless env
|
42
|
-
puts 'Usage: ' + bin_name + '
|
75
|
+
puts 'Usage: ' + bin_name + ' setup-env [environment]'
|
43
76
|
return
|
44
77
|
end
|
45
78
|
|
@@ -48,11 +81,15 @@ module Bonethug
|
|
48
81
|
script = gem_dir + '/scripts/ubuntu_setup.sh'
|
49
82
|
|
50
83
|
if env == 'show'
|
51
|
-
|
84
|
+
|
85
|
+
puts "---------------"
|
52
86
|
puts "Pre"
|
87
|
+
puts "---------------\n"
|
53
88
|
puts File.read script
|
54
89
|
|
90
|
+
puts "\n---------------"
|
55
91
|
puts "Parsed"
|
92
|
+
puts "---------------"
|
56
93
|
puts Installer.parse_sh File.read(script)
|
57
94
|
|
58
95
|
elsif env == 'local'
|
@@ -61,7 +98,7 @@ module Bonethug
|
|
61
98
|
else
|
62
99
|
exec "export to=#{env} && bundle exec mina -f .bonethug/deploy.rb setup_env --verbose"
|
63
100
|
|
64
|
-
end
|
101
|
+
end
|
65
102
|
|
66
103
|
when 'init', 'update'
|
67
104
|
|
@@ -80,6 +117,7 @@ module Bonethug
|
|
80
117
|
when 'run',
|
81
118
|
'rake',
|
82
119
|
'drush',
|
120
|
+
'drush-local',
|
83
121
|
'sake'
|
84
122
|
|
85
123
|
# get env
|
@@ -93,19 +131,30 @@ module Bonethug
|
|
93
131
|
case task
|
94
132
|
when 'rake'
|
95
133
|
cmd_task = 'rake'
|
96
|
-
when 'drush'
|
97
|
-
cmd_task = 'vendor/drush/drush'
|
134
|
+
when 'drush', 'drush-local'
|
135
|
+
cmd_task = File.expand_path('./vendor/drush/drush/drush') + ' -r ' + File.expand_path('./public')
|
98
136
|
when 'sake'
|
99
137
|
cmd_task = 'public/framework/sake'
|
100
138
|
end
|
101
139
|
args = ARGV[1..(ARGV.length-2)]
|
102
140
|
end
|
103
141
|
|
104
|
-
|
105
|
-
|
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"
|
106
156
|
|
107
|
-
|
108
|
-
exec "export to=#{environment} && bundle exec mina -f .bonethug/deploy.rb #{run} --verbose"
|
157
|
+
end
|
109
158
|
|
110
159
|
when 'deploy',
|
111
160
|
'setup',
|
data/lib/bonethug/installer.rb
CHANGED
@@ -130,6 +130,42 @@ module Bonethug
|
|
130
130
|
self
|
131
131
|
end
|
132
132
|
|
133
|
+
# Prepares init db scripts
|
134
|
+
# --------------------------
|
135
|
+
|
136
|
+
def self.init_mysql_db_script(db, path, admin_user = 'root')
|
137
|
+
|
138
|
+
script_content = "
|
139
|
+
CREATE DATABASE IF NOT EXISTS " + db.get('name') + ";
|
140
|
+
GRANT ALL ON " + db.get('name') + ".* TO " + db.get('user') + "@" + db.get('host') + (db.get('pass') ? " IDENTIFIED BY " + db.get('pass') : "") + ";
|
141
|
+
FLUSH PRIVILEGES;
|
142
|
+
"
|
143
|
+
cmd = 'cd ' + path + ' && ' +
|
144
|
+
'echo "' + script_content + '" > .bonethug/sql.txt && ' +
|
145
|
+
'mysql -h ' + db.get('host') + ' -u ' + admin_user + ' -p < .bonethug/sql.txt'
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.execute_init_mysql_db_script(env, admin_user = 'root', path = '.')
|
150
|
+
|
151
|
+
exec_path = File.expand_path(path)
|
152
|
+
conf = Bonethug::Conf.new.add(exec_path + '/config/cnf.yml')
|
153
|
+
conf.add(exec_path + '/config/database.yml' => { root: 'dbs.default' }) if File.exist? exec_path + '/config/database.yml'
|
154
|
+
|
155
|
+
conf.get('dbs').each do |name,envs|
|
156
|
+
|
157
|
+
db = envs.get env
|
158
|
+
puts "creating: " + db.get('name')
|
159
|
+
system Bonethug::Installer.init_mysql_db_script(db, path, admin_user)
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
# Reads system setup scripts
|
167
|
+
# --------------------------
|
168
|
+
|
133
169
|
def self.get_setup_script
|
134
170
|
@@bonthug_gem_dir + '/scripts/ubuntu_setup.sh'
|
135
171
|
end
|
@@ -146,6 +182,10 @@ module Bonethug
|
|
146
182
|
content.split("\n").select { |line| !(line =~ /^[\s\t]+$/ || line =~ /^[\s\t]*#/ || line.strip.length == 0) }
|
147
183
|
end
|
148
184
|
|
185
|
+
# ---------
|
186
|
+
# Protected
|
187
|
+
# ---------
|
188
|
+
|
149
189
|
protected
|
150
190
|
|
151
191
|
def self.try_delete(file)
|
data/lib/bonethug/version.rb
CHANGED
data/lib/bonethug/watcher.rb
CHANGED
@@ -19,7 +19,7 @@ module Bonethug
|
|
19
19
|
include FileUtils
|
20
20
|
include Digest
|
21
21
|
|
22
|
-
def self.watch(type =
|
22
|
+
def self.watch(type = nil, target = '.', watch_only = nil)
|
23
23
|
|
24
24
|
# create full path
|
25
25
|
target = File.expand_path target
|
@@ -54,8 +54,24 @@ module Bonethug
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
# erb doesn't support array based input just yet
|
58
|
+
erb = []
|
59
|
+
if erbs = conf.get('watch.erb')
|
60
|
+
erbs.each do |index, watch|
|
61
|
+
erb.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), type: :erb)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# slim doesn't support aray based inputs just yet
|
66
|
+
slim = []
|
67
|
+
if slims = conf.get('watch.slim')
|
68
|
+
slims.each do |index, watch|
|
69
|
+
slim.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), type: :slim)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
57
73
|
# combine the watches
|
58
|
-
watches = coffee + sass
|
74
|
+
watches = coffee + sass + erb + slim
|
59
75
|
|
60
76
|
# Generate Guardfile
|
61
77
|
puts 'Generating Guardfile...'
|
@@ -83,7 +99,7 @@ module Bonethug
|
|
83
99
|
#{filter}
|
84
100
|
end
|
85
101
|
"
|
86
|
-
|
102
|
+
else
|
87
103
|
if watch[:type] == :coffee
|
88
104
|
guardfile_content += "
|
89
105
|
guard :coffeescript, :minify => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s} do
|
@@ -96,6 +112,18 @@ module Bonethug
|
|
96
112
|
#{filter}
|
97
113
|
end
|
98
114
|
"
|
115
|
+
elsif watch[:type] == :erb
|
116
|
+
guardfile_content += "
|
117
|
+
guard :erb, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s} do
|
118
|
+
#{filter}
|
119
|
+
end
|
120
|
+
"
|
121
|
+
elsif watch[:type] == :slim
|
122
|
+
guardfile_content += "
|
123
|
+
guard :slim, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s} do
|
124
|
+
#{filter}
|
125
|
+
end
|
126
|
+
"
|
99
127
|
end
|
100
128
|
end
|
101
129
|
|
data/scripts/ubuntu_setup.sh
CHANGED
@@ -57,7 +57,7 @@ sudo apt-get install git ruby1.9.3 wkhtmltopdf nodejs npm
|
|
57
57
|
# " > /etc/apache2/conf.d/php-fpm.conf
|
58
58
|
# sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
|
59
59
|
|
60
|
-
sed -i -e "s/listen = \/var\/run\/php5-fpm.sock
|
60
|
+
sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
|
61
61
|
sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
|
62
62
|
|
63
63
|
# Apache
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# project framework
|
2
|
+
/.bundle
|
3
|
+
/vendor
|
4
|
+
/bin
|
5
|
+
/log/*
|
6
|
+
/backups/*
|
7
|
+
/db_dumps
|
8
|
+
/tmp/*
|
9
|
+
/composer.phar
|
10
|
+
.sass-cache
|
11
|
+
|
12
|
+
# drupal, good times...
|
13
|
+
# block all files in the public dir then unblock the dirs
|
14
|
+
/public/*
|
15
|
+
!/public/*/
|
16
|
+
|
17
|
+
# block the core dirs
|
18
|
+
/public/includes
|
19
|
+
/public/misc
|
20
|
+
/public/modules
|
21
|
+
/public/profiles
|
22
|
+
/public/scripts
|
23
|
+
/public/themes
|
24
|
+
|
25
|
+
# block some autogenerated files in the sites dir
|
26
|
+
/public/sites/example.sites.php
|
27
|
+
/public/sites/README.txt
|
28
|
+
/public/sites/*/README.txt
|
29
|
+
|
30
|
+
# block any modules tracked by composer
|
31
|
+
/public/sites/all/modules/*
|
32
|
+
|
33
|
+
# project files
|
34
|
+
*.sublime-workspace
|
35
|
+
*.sublime-project
|
36
|
+
|
37
|
+
# files to keep
|
38
|
+
!.gitkeep
|
39
|
+
!.keep
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"name": "bonethug/drupal7-skel",
|
3
|
+
"repositories": [
|
4
|
+
{
|
5
|
+
"type": "vcs",
|
6
|
+
"url": "git@github.com:azt3k/drupal.git"
|
7
|
+
}
|
8
|
+
],
|
9
|
+
"require": {
|
10
|
+
"symfony/yaml" : "2.3.*@dev",
|
11
|
+
"drush/drush" : "dev-master",
|
12
|
+
"thecodingmachine/drupal" : "7.*@dev"
|
13
|
+
},
|
14
|
+
"extra": {
|
15
|
+
"installer-paths": {
|
16
|
+
"vendor": [],
|
17
|
+
"public": [],
|
18
|
+
"public/vendor/{$name}": []
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# project framework
|
2
|
+
/.bundle
|
3
|
+
/vendor
|
4
|
+
/bin
|
5
|
+
/log/*
|
6
|
+
/backups/*
|
7
|
+
/db_dumps
|
8
|
+
/tmp/*
|
9
|
+
/composer.phar
|
10
|
+
.sass-cache
|
11
|
+
|
12
|
+
# drupal, good times...
|
13
|
+
# block all files in the public dir then unblock the dirs
|
14
|
+
/public/*
|
15
|
+
!/public/*/
|
16
|
+
|
17
|
+
# block the core dirs
|
18
|
+
/public/includes
|
19
|
+
/public/misc
|
20
|
+
/public/modules
|
21
|
+
/public/profiles
|
22
|
+
/public/scripts
|
23
|
+
/public/themes
|
24
|
+
|
25
|
+
# block some autogenerated files in the sites dir
|
26
|
+
/public/sites/example.sites.php
|
27
|
+
/public/sites/README.txt
|
28
|
+
/public/sites/*/README.txt
|
29
|
+
|
30
|
+
# block any modules tracked by composer
|
31
|
+
/public/sites/all/modules/*
|
32
|
+
|
33
|
+
# project files
|
34
|
+
*.sublime-workspace
|
35
|
+
*.sublime-project
|
36
|
+
|
37
|
+
# files to keep
|
38
|
+
!.gitkeep
|
39
|
+
!.keep
|