cake 0.3.12 → 0.3.13
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/bin/cake +63 -56
- data/lib/bake.jar +0 -0
- data/lib/cake.jar +0 -0
- metadata +3 -3
data/bin/cake
CHANGED
@@ -71,15 +71,15 @@ def add_opt!(key, *vals)
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def parse_opts!
|
74
|
-
ARGV.unshift('run', '--global') if ARGV.first.index('/')
|
75
|
-
ARGV.unshift('default')
|
74
|
+
ARGV.unshift('run', '--global') if ARGV.any? and ARGV.first.index('/')
|
75
|
+
ARGV.unshift('default') if ARGV.empty? or ARGV.first[0,1] == '-'
|
76
76
|
$command = ARGV.shift.to_sym
|
77
77
|
$opts = {}
|
78
78
|
ARGV.each do |opt|
|
79
79
|
case opt
|
80
|
-
when /^-(\w
|
81
|
-
when /^--?([-\w]
|
82
|
-
when /^--?([-\w]
|
80
|
+
when /^-(\w+)$/ then $1.split('').each {|c| add_opt!(c, '')}
|
81
|
+
when /^--?([-\w]+)=([\S]+)$/ then add_opt!($1, *$2.split(','))
|
82
|
+
when /^--?([-\w]+)$/ then add_opt!($1, "")
|
83
83
|
else add_opt!($command, opt)
|
84
84
|
end
|
85
85
|
end
|
@@ -87,6 +87,61 @@ def parse_opts!
|
|
87
87
|
end
|
88
88
|
parse_opts!
|
89
89
|
|
90
|
+
def debug?
|
91
|
+
ENV['CAKE_DEBUG'] or $opts[:d] or $opts[:debug]
|
92
|
+
end
|
93
|
+
|
94
|
+
def verbose?
|
95
|
+
debug? or $opts[:v] or $opts[:verbose]
|
96
|
+
end
|
97
|
+
|
98
|
+
def restart?
|
99
|
+
$opts[:r] or $opts[:restart] or [:stop, :restart].include?($command)
|
100
|
+
end
|
101
|
+
|
102
|
+
def admin_command?
|
103
|
+
[:start, :stop, :reload, :restart].include?($command)
|
104
|
+
end
|
105
|
+
|
106
|
+
def log(command, *message)
|
107
|
+
message.each do |line|
|
108
|
+
printf("%11s %s\n", "[#{command}]", line)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class Configuration < Hash
|
113
|
+
def initialize(*paths)
|
114
|
+
paths.each do |path|
|
115
|
+
File.open(path, 'r') do |file|
|
116
|
+
file.each do |line|
|
117
|
+
next if ['#', '!'].include?(line[0,1])
|
118
|
+
key, value = line.split('=', 2)
|
119
|
+
next unless key and value
|
120
|
+
self[key.strip] = value.strip
|
121
|
+
end
|
122
|
+
end if File.exists?(path)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def [](*keys)
|
127
|
+
if keys.first.kind_of?(Symbol)
|
128
|
+
key = keys.join('.') + '.'
|
129
|
+
clone.delete_if {|k,v| not k.index(key) == 0}
|
130
|
+
else
|
131
|
+
super
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def config
|
137
|
+
@config ||= Configuration.new("#{$home}/.cake/config", ".cake/config")
|
138
|
+
end
|
139
|
+
|
140
|
+
if debug?
|
141
|
+
puts "opts: #{$opts.inspect}"
|
142
|
+
puts "config: #{$config.inspect}"
|
143
|
+
end
|
144
|
+
|
90
145
|
GLOBAL_DEFAULT_PROJECT = <<END
|
91
146
|
(defproject global "0.0.0"
|
92
147
|
:description "Don't rename this project, though you can change the version to your heart's content."
|
@@ -198,56 +253,6 @@ def newer?(file1, file2)
|
|
198
253
|
not File.exists?(file2) or test(?>, file1, file2)
|
199
254
|
end
|
200
255
|
|
201
|
-
def debug?
|
202
|
-
ENV['CAKE_DEBUG'] or $opts[:d] or $opts[:debug]
|
203
|
-
end
|
204
|
-
|
205
|
-
def verbose?
|
206
|
-
debug? or $opts[:v] or $opts[:verbose]
|
207
|
-
end
|
208
|
-
|
209
|
-
def restart?
|
210
|
-
$opts[:r] or $opts[:restart] or [:stop, :restart].include?($command)
|
211
|
-
end
|
212
|
-
|
213
|
-
def admin_command?
|
214
|
-
[:start, :stop, :reload, :restart].include?($command)
|
215
|
-
end
|
216
|
-
|
217
|
-
def log(command, *message)
|
218
|
-
message.each do |line|
|
219
|
-
printf("%11s %s\n", "[#{command}]", line)
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
class Configuration < Hash
|
224
|
-
def initialize(*paths)
|
225
|
-
paths.each do |path|
|
226
|
-
File.open(path, 'r') do |file|
|
227
|
-
file.each do |line|
|
228
|
-
next if ['#', '!'].include?(line[0,1])
|
229
|
-
key, value = line.split('=', 2)
|
230
|
-
next unless key and value
|
231
|
-
self[key.strip] = value.strip
|
232
|
-
end
|
233
|
-
end if File.exists?(path)
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
def [](*keys)
|
238
|
-
if keys.first.kind_of?(Symbol)
|
239
|
-
key = keys.join('.') + '.'
|
240
|
-
clone.delete_if {|k,v| not k.index(key) == 0}
|
241
|
-
else
|
242
|
-
super
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
def config
|
248
|
-
@config ||= Configuration.new("#{$home}/.cake/config", ".cake/config")
|
249
|
-
end
|
250
|
-
|
251
256
|
def ps
|
252
257
|
`jps -v`.split("\n").select {|l| l =~ /cake\.project/}
|
253
258
|
end
|
@@ -418,7 +423,9 @@ class JVM
|
|
418
423
|
end
|
419
424
|
|
420
425
|
def eval(forms = $opts[:eval])
|
421
|
-
forms = forms.
|
426
|
+
forms = forms.collect do |form|
|
427
|
+
form == '-' ? $stdin.gets(nil) : form
|
428
|
+
end.join(' ')
|
422
429
|
with_socket do |socket|
|
423
430
|
log(:eval, forms) if debug?
|
424
431
|
socket.write(':eval [' + forms + ']')
|
data/lib/bake.jar
CHANGED
Binary file
|
data/lib/cake.jar
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 13
|
10
|
+
version: 0.3.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Balthrop
|