bonethug 0.0.95 → 0.0.96
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bonethug/version.rb +2 -2
- data/lib/bonethug/watcher.rb +152 -145
- data/scripts/ubuntu-14.04 +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76ee7a1a1c01e92421aaffac567e2e6e117d1efa
|
4
|
+
data.tar.gz: a811529a39df0e3eec4ddceec51f4b8736c11612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b2aa45843c795a1ff6526a43c23af0dadd352a50e35fd330a7b76debcb05b65625c3d9fe31789c263b7cca5f9a6717f901e57ec54975adb718a650f883eeaa8
|
7
|
+
data.tar.gz: b1c4dc896616d5ecbccfa7d9104eb79439c2c6a8143a1b382dc0111347b2d7e520c5ae4187de578be2067b29a8ef7383a37451e18c4b46e4c7fad72247f4e6e0
|
data/lib/bonethug/version.rb
CHANGED
data/lib/bonethug/watcher.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# Todo
|
2
2
|
# ----------------
|
3
3
|
# - sass minification isn't working
|
4
4
|
# - actually add the filter to filter by type
|
@@ -14,182 +14,189 @@ require 'rbconfig'
|
|
14
14
|
|
15
15
|
module Bonethug
|
16
16
|
|
17
|
-
|
17
|
+
class Watcher
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
include FileUtils
|
20
|
+
include Digest
|
21
21
|
|
22
|
-
|
22
|
+
def self.watch(type = nil, target = '.', watch_only = nil)
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
# create full path
|
25
|
+
target = File.expand_path target
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
# load config
|
28
|
+
puts "Parsing Config..."
|
29
|
+
unless conf = Conf.new.add(target + '/config/cnf.yml')
|
30
|
+
puts "Couldn't find project configuration"
|
31
|
+
return
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
# project type
|
35
|
+
project_type = conf.get('deploy.project_type')
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
# end now if its a rails project
|
38
|
+
if ['rails','rails3'].include? project_type
|
39
|
+
puts "Rails doesn't require watching"
|
40
|
+
return
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
43
|
+
sass = []
|
44
|
+
if sasses = conf.get('watch.sass')
|
45
|
+
sasses.each do |index, watch|
|
46
|
+
sass.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), all_on_start: watch.get('onstart').to_bool, type: :sass)
|
48
47
|
end
|
48
|
+
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
50
|
+
coffee = []
|
51
|
+
if coffees = conf.get('watch.coffee')
|
52
|
+
coffees.each do |index, watch|
|
53
|
+
coffee.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), all_on_start: watch.get('onstart').to_bool, type: :coffee)
|
55
54
|
end
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
57
|
+
# concat doesn't support array based input just yet
|
58
|
+
concat_js = []
|
59
|
+
if js_concats = conf.get('watch.concat_js')
|
60
|
+
js_concats.each do |index, watch|
|
61
|
+
concat_js.push(src: watch.get('src'), dest: watch.get('dest'), filter: watch.get('filter','Array'), all_on_start: watch.get('onstart').to_bool, type: :concat_js)
|
63
62
|
end
|
63
|
+
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
65
|
+
# concat doesn't support array based input just yet
|
66
|
+
concat_css = []
|
67
|
+
if css_concats = conf.get('watch.concat_css')
|
68
|
+
css_concats.each do |index, watch|
|
69
|
+
concat_css.push(src: watch.get('src'), dest: watch.get('dest'), filter: watch.get('filter','Array'), all_on_start: watch.get('onstart').to_bool, type: :concat_css)
|
71
70
|
end
|
71
|
+
end
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
73
|
+
# uglify doesn't support array based input just yet
|
74
|
+
uglify = []
|
75
|
+
if uglifies = conf.get('watch.uglify')
|
76
|
+
uglifies.each do |index, watch|
|
77
|
+
uglify.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), all_on_start: watch.get('onstart').to_bool, type: :uglify)
|
79
78
|
end
|
79
|
+
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
end
|
81
|
+
# erb doesn't support array based input just yet
|
82
|
+
erb = []
|
83
|
+
if erbs = conf.get('watch.erb')
|
84
|
+
erbs.each do |index, watch|
|
85
|
+
erb.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), all_on_start: watch.get('onstart').to_bool, type: :erb)
|
87
86
|
end
|
87
|
+
end
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
89
|
+
# slim doesn't support aray based inputs just yet
|
90
|
+
slim = []
|
91
|
+
if slims = conf.get('watch.slim')
|
92
|
+
slims.each do |index, watch|
|
93
|
+
slim.push(src: watch.get('src','Array'), dest: watch.get('dest'), filter: watch.get('filter'), all_on_start: watch.get('onstart').to_bool, type: :slim)
|
95
94
|
end
|
95
|
+
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
97
|
+
# combine the watches
|
98
|
+
watches = coffee + sass + concat_js + concat_css + uglify + erb + slim
|
99
|
+
|
100
|
+
# Generate Guardfile
|
101
|
+
puts 'Generating Guardfile...'
|
102
|
+
|
103
|
+
guardfile_content = ''
|
104
|
+
watches.each do |watch|
|
105
|
+
|
106
|
+
case watch[:filter].class.name
|
107
|
+
when 'NilClass'
|
108
|
+
watch_val = ''
|
109
|
+
when 'String'
|
110
|
+
watch_val = "'#{watch[:filter]}'"
|
111
|
+
when 'Regexp'
|
112
|
+
watch_val = watch[:filter].inspect
|
113
|
+
when 'Array'
|
114
|
+
watch_val = "%w(#{watch[:filter].join(' ')})"
|
115
|
+
else
|
116
|
+
raise "invalid filter type: " + watch[:filter].class.name
|
117
|
+
end
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
119
|
+
if watch[:filter].class.name == 'Array'
|
120
|
+
filter = watch_val
|
121
|
+
else
|
122
|
+
filter = watch[:filter] ? "watch #{watch_val}" : ""
|
123
|
+
end
|
124
124
|
|
125
|
-
|
126
|
-
|
125
|
+
case type
|
126
|
+
when 'sprockets'
|
127
|
+
guardfile_content += "
|
128
|
+
guard 'sprockets', :minify => true, :destination => '#{watch[:dest]}', :asset_paths => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
129
|
+
#{filter}
|
130
|
+
end
|
131
|
+
"
|
132
|
+
else
|
133
|
+
if watch[:type] == :coffee
|
127
134
|
guardfile_content += "
|
128
|
-
|
135
|
+
coffeescript_options = {
|
136
|
+
input: '#{watch[:src].to_s}',
|
137
|
+
output: '#{watch[:dest]}',
|
138
|
+
all_on_start: #{watch[:all_on_start].to_s},
|
139
|
+
patterns: [#{watch_val.to_s}]
|
140
|
+
}
|
141
|
+
|
142
|
+
guard 'coffeescript', coffeescript_options do
|
143
|
+
coffeescript_options[:patterns].each { |pattern| watch(pattern) }
|
144
|
+
end
|
145
|
+
"
|
146
|
+
elsif watch[:type] == :sass
|
147
|
+
guardfile_content += "
|
148
|
+
guard :sass, :style => :compressed, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
149
|
+
#{filter}
|
150
|
+
end
|
151
|
+
"
|
152
|
+
elsif watch[:type] == :concat_css
|
153
|
+
guardfile_content += "
|
154
|
+
guard :concat, :output => '#{watch[:dest]}', :input_dir => '#{watch[:src]}', :type => 'css', :files => #{filter}, :all_on_start => #{watch[:all_on_start].to_s}
|
155
|
+
"
|
156
|
+
elsif watch[:type] == :concat_js
|
157
|
+
guardfile_content += "
|
158
|
+
guard :concat, :output => '#{watch[:dest]}', :input_dir => '#{watch[:src]}', :type => 'js', :files => #{filter}, :all_on_start => #{watch[:all_on_start].to_s}
|
159
|
+
"
|
160
|
+
elsif watch[:type] == :uglify
|
161
|
+
guardfile_content += "
|
162
|
+
guard 'uglify', :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
163
|
+
#{filter}
|
164
|
+
end
|
165
|
+
"
|
166
|
+
elsif watch[:type] == :erb
|
167
|
+
guardfile_content += "
|
168
|
+
guard :erb, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
169
|
+
#{filter}
|
170
|
+
end
|
171
|
+
"
|
172
|
+
elsif watch[:type] == :slim
|
173
|
+
guardfile_content += "
|
174
|
+
guard :slim, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
129
175
|
#{filter}
|
130
176
|
end
|
131
177
|
"
|
132
|
-
else
|
133
|
-
if watch[:type] == :coffee
|
134
|
-
guardfile_content += "
|
135
|
-
guard :coffeescript, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
136
|
-
#{filter}
|
137
|
-
end
|
138
|
-
"
|
139
|
-
elsif watch[:type] == :sass
|
140
|
-
guardfile_content += "
|
141
|
-
guard :sass, :style => :compressed, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
142
|
-
#{filter}
|
143
|
-
end
|
144
|
-
"
|
145
|
-
elsif watch[:type] == :concat_css
|
146
|
-
guardfile_content += "
|
147
|
-
guard :concat, :output => '#{watch[:dest]}', :input_dir => '#{watch[:src]}', :type => 'css', :files => #{filter}, :all_on_start => #{watch[:all_on_start].to_s}
|
148
|
-
"
|
149
|
-
elsif watch[:type] == :concat_js
|
150
|
-
guardfile_content += "
|
151
|
-
guard :concat, :output => '#{watch[:dest]}', :input_dir => '#{watch[:src]}', :type => 'js', :files => #{filter}, :all_on_start => #{watch[:all_on_start].to_s}
|
152
|
-
"
|
153
|
-
elsif watch[:type] == :uglify
|
154
|
-
guardfile_content += "
|
155
|
-
guard 'uglify', :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
156
|
-
#{filter}
|
157
|
-
end
|
158
|
-
"
|
159
|
-
elsif watch[:type] == :erb
|
160
|
-
guardfile_content += "
|
161
|
-
guard :erb, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
162
|
-
#{filter}
|
163
|
-
end
|
164
|
-
"
|
165
|
-
elsif watch[:type] == :slim
|
166
|
-
guardfile_content += "
|
167
|
-
guard :slim, :debug_info => true, :output => '#{watch[:dest]}', :input => #{watch[:src].to_s}, :all_on_start => #{watch[:all_on_start].to_s} do
|
168
|
-
#{filter}
|
169
|
-
end
|
170
|
-
"
|
171
|
-
end
|
172
178
|
end
|
173
|
-
|
174
|
-
end
|
175
|
-
|
176
|
-
# save the guardfile
|
177
|
-
guardfile = target + '/.bonethug/Guardfile'
|
178
|
-
FileUtils.rm_rf guardfile
|
179
|
-
File.open(guardfile,'w') do |file|
|
180
|
-
file.puts guardfile_content
|
181
179
|
end
|
182
180
|
|
183
|
-
|
184
|
-
# guard 2.0.x polling fix
|
185
|
-
# poll = RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i ? '--force-polling' : ''
|
186
|
-
poll = ''
|
187
|
-
cmd = 'bundle exec guard --debug ' + poll + ' --guardfile "' + target + '/.bonethug/Guardfile"'
|
188
|
-
puts cmd
|
189
|
-
exec cmd
|
181
|
+
end
|
190
182
|
|
183
|
+
# save the guardfile
|
184
|
+
guardfile = target + '/.bonethug/Guardfile'
|
185
|
+
FileUtils.rm_rf guardfile
|
186
|
+
File.open(guardfile,'w') do |file|
|
187
|
+
file.puts guardfile_content
|
191
188
|
end
|
192
189
|
|
190
|
+
puts 'Starting Watch Daemon...'
|
191
|
+
# guard 2.0.x polling fix
|
192
|
+
# poll = RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i ? '--force-polling' : ''
|
193
|
+
poll = ''
|
194
|
+
cmd = 'bundle exec guard --debug ' + poll + ' --guardfile "' + target + '/.bonethug/Guardfile"'
|
195
|
+
puts cmd
|
196
|
+
exec cmd
|
197
|
+
|
193
198
|
end
|
194
199
|
|
195
|
-
end
|
200
|
+
end
|
201
|
+
|
202
|
+
end
|
data/scripts/ubuntu-14.04
CHANGED
@@ -66,8 +66,8 @@ update-alternatives --set ruby /usr/bin/ruby2.1
|
|
66
66
|
# config modules
|
67
67
|
|
68
68
|
# php fpm
|
69
|
-
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 <Directory />\nRequire all granted\n </Directory>\n </IfModule>" sudo tee /etc/apache2/conf-available/
|
70
|
-
sudo a2enconf
|
69
|
+
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 <Directory />\nRequire all granted\n </Directory>\n </IfModule>" sudo tee /etc/apache2/conf-available/php5-fpm.conf
|
70
|
+
sudo a2enconf php5-fpm.conf
|
71
71
|
|
72
72
|
# DDoS Protection
|
73
73
|
sudo mkdir -p /var/log/apache2/evasive
|
@@ -91,7 +91,7 @@ sudo a2enconf phpmyadmin.conf
|
|
91
91
|
# Install Gems
|
92
92
|
# -----------------------------------------------------
|
93
93
|
|
94
|
-
# install some gems
|
94
|
+
# install some gems
|
95
95
|
sudo gem install bundler
|
96
96
|
|
97
97
|
# install passenger
|
@@ -112,3 +112,10 @@ sudo npm install bower -g
|
|
112
112
|
|
113
113
|
sudo service apache2 restart
|
114
114
|
sudo service php5-fpm restart
|
115
|
+
|
116
|
+
# -----------------------------------------------------
|
117
|
+
# Install composer
|
118
|
+
# -----------------------------------------------------
|
119
|
+
|
120
|
+
curl -sS https://getcomposer.org/installer | php
|
121
|
+
mv composer.phar /usr/local/bin/composer
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonethug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.96
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azt3k
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|