distil 0.14.0.b → 0.14.0.c
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/distil +26 -6
- data/distil.gemspec +2 -2
- data/lib/distil/library.rb +3 -6
- data/lib/distil/project.rb +25 -14
- data/lib/distil/server.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.0.
|
1
|
+
0.14.0.c
|
data/bin/distil
CHANGED
@@ -6,7 +6,7 @@ module Distil
|
|
6
6
|
VENDOR_DIR= File.expand_path(File.join(File.dirname(__FILE__), "..", "vendor"))
|
7
7
|
ASSETS_DIR= File.expand_path(File.join(File.dirname(__FILE__), "..", "assets"))
|
8
8
|
APP_NAME= File.basename($0)
|
9
|
-
APP_SCRIPT= $0
|
9
|
+
APP_SCRIPT= File.expand_path($0)
|
10
10
|
|
11
11
|
$:.unshift(LIB_DIR)
|
12
12
|
|
@@ -24,23 +24,43 @@ module Distil
|
|
24
24
|
opts.banner = help
|
25
25
|
|
26
26
|
opts.on("--server [PORT]", "Start web server (default port 8888)") do |port|
|
27
|
-
options[
|
28
|
-
options[
|
27
|
+
options[:server] = true
|
28
|
+
options[:server_port] = port unless port.nil?
|
29
29
|
end
|
30
30
|
|
31
31
|
opts.on("--base URL", "The base path for the server") do |url|
|
32
|
-
options[
|
32
|
+
options[:server_url]= url
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("--project PROJECT", "The project to build") do |project|
|
36
|
+
options[:project_file]= project
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on("--output-folder FOLDER", "Where to put the build products") do |output_folder|
|
40
|
+
options[:output_path]= File.expand_path(output_folder)
|
33
41
|
end
|
34
42
|
end
|
35
43
|
opts.parse!
|
44
|
+
|
45
|
+
if options[:project_file]
|
46
|
+
if !File.exist?(options[:project_file])
|
47
|
+
puts "#{APP_NAME}: No such file: #{options[:project_file]}"
|
48
|
+
exit 1
|
49
|
+
end
|
50
|
+
project= Project.from_file(options[:project_file])
|
51
|
+
else
|
52
|
+
project= Project.find(Dir.pwd)
|
53
|
+
end
|
36
54
|
|
37
|
-
project= Project.find(Dir.pwd)
|
38
55
|
unless project
|
39
56
|
puts "#{APP_NAME}: Could not find project to build"
|
40
57
|
exit 1
|
41
58
|
end
|
42
59
|
|
43
|
-
|
60
|
+
if options[:output_path]
|
61
|
+
project.output_path= options[:output_path]
|
62
|
+
end
|
63
|
+
|
44
64
|
commands= ARGV.empty? ? ['build'] : ARGV
|
45
65
|
commands.each { |cmd|
|
46
66
|
project.send cmd
|
data/distil.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{distil}
|
8
|
-
s.version = "0.14.0.
|
8
|
+
s.version = "0.14.0.c"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeff Watkins"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-22}
|
13
13
|
s.default_executable = %q{distil}
|
14
14
|
s.description = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
|
15
15
|
s.executables = ["distil"]
|
data/lib/distil/library.rb
CHANGED
@@ -55,8 +55,7 @@ module Distil
|
|
55
55
|
when File.exist?("Buildfile") || File.exists?("buildfile") || File.exist?("#{name}.jsproj")
|
56
56
|
@build_command= APP_SCRIPT
|
57
57
|
remote_project= Project.find(path)
|
58
|
-
|
59
|
-
@product_path= File.join(path, output_folder)
|
58
|
+
@product_path= remote_project ? remote_project.output_path : File.join(path, 'build')
|
60
59
|
when File.exist?("Makefile") || File.exist?("makefile")
|
61
60
|
@build_command= "make"
|
62
61
|
when File.exists?("Rakefile") || File.exists?("rakefile")
|
@@ -68,7 +67,7 @@ module Distil
|
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
71
|
-
build
|
70
|
+
# build
|
72
71
|
end
|
73
72
|
|
74
73
|
def to_s
|
@@ -169,7 +168,7 @@ module Distil
|
|
169
168
|
end
|
170
169
|
|
171
170
|
def output_path
|
172
|
-
|
171
|
+
File.join(project.output_path, name)
|
173
172
|
end
|
174
173
|
|
175
174
|
def up_to_date?
|
@@ -204,8 +203,6 @@ module Distil
|
|
204
203
|
end
|
205
204
|
|
206
205
|
File.unlink(output_path) if File.symlink?(output_path)
|
207
|
-
|
208
|
-
# FileUtils.rm_rf(project_path) if File.directory?(project_path)
|
209
206
|
File.symlink(project.relative_output_path_for(product_path), output_path)
|
210
207
|
end
|
211
208
|
|
data/lib/distil/project.rb
CHANGED
@@ -12,7 +12,7 @@ module Distil
|
|
12
12
|
include FileVendor
|
13
13
|
include JavascriptFileValidator
|
14
14
|
|
15
|
-
attr_reader :name, :path, :folder, :source_folder, :
|
15
|
+
attr_reader :name, :path, :folder, :source_folder, :output_path, :include_paths
|
16
16
|
attr_reader :assets, :asset_aliases
|
17
17
|
attr_reader :libraries_by_name, :libraries
|
18
18
|
attr_reader :languages, :project_type
|
@@ -58,9 +58,10 @@ module Distil
|
|
58
58
|
|
59
59
|
def initialize(path, config={}, parent=nil)
|
60
60
|
@path= path
|
61
|
+
@parent= parent
|
61
62
|
@folder= File.dirname(@path)
|
62
63
|
@source_folder= @folder
|
63
|
-
@
|
64
|
+
@output_path= File.join(@folder, DEFAULT_OUTPUT_FOLDER)
|
64
65
|
@include_paths= [@folder]
|
65
66
|
@include_files= []
|
66
67
|
@asset_aliases= {}
|
@@ -88,9 +89,8 @@ module Distil
|
|
88
89
|
end
|
89
90
|
|
90
91
|
c.with :output_folder do |output_folder|
|
91
|
-
|
92
|
+
self.output_path= File.expand_path(output_folder)
|
92
93
|
end
|
93
|
-
FileUtils.mkdir_p output_folder
|
94
94
|
|
95
95
|
c.with :source_folder do |source_folder|
|
96
96
|
@source_folder= source_folder
|
@@ -115,8 +115,8 @@ module Distil
|
|
115
115
|
@libraries_by_name[asset.name]= asset
|
116
116
|
end
|
117
117
|
|
118
|
-
c.
|
119
|
-
|
118
|
+
c.with :source do |source_files|
|
119
|
+
@raw_sources= source_files
|
120
120
|
end
|
121
121
|
|
122
122
|
c.with_each :targets do |target|
|
@@ -138,6 +138,10 @@ module Distil
|
|
138
138
|
return if @source_files_computed
|
139
139
|
@source_files_computed= true
|
140
140
|
|
141
|
+
@raw_sources.each { |f|
|
142
|
+
include_file(f)
|
143
|
+
}
|
144
|
+
|
141
145
|
inspected= Set.new
|
142
146
|
ordered_files= []
|
143
147
|
|
@@ -181,6 +185,12 @@ module Distil
|
|
181
185
|
end
|
182
186
|
|
183
187
|
def build
|
188
|
+
libraries.each { |lib|
|
189
|
+
lib.build
|
190
|
+
}
|
191
|
+
|
192
|
+
puts "\n#{name}:\n\n" unless @parent
|
193
|
+
|
184
194
|
subprojects.each { |subproject|
|
185
195
|
subproject.build
|
186
196
|
}
|
@@ -207,8 +217,9 @@ module Distil
|
|
207
217
|
"<#{self.class}:0x#{object_id.to_s(16)} name=#{name}>"
|
208
218
|
end
|
209
219
|
|
210
|
-
def output_path
|
211
|
-
@output_path
|
220
|
+
def output_path=(path)
|
221
|
+
@output_path= path
|
222
|
+
FileUtils.mkdir_p @output_path
|
212
223
|
end
|
213
224
|
|
214
225
|
def relative_path_for(thing)
|
@@ -258,7 +269,7 @@ module Distil
|
|
258
269
|
|
259
270
|
parts= File.dirname(path).split(File::SEPARATOR)
|
260
271
|
if ('.'==parts[0])
|
261
|
-
product_path= File.join(
|
272
|
+
product_path= File.join(output_path, path)
|
262
273
|
FileUtils.rm product_path if File.exists? product_path
|
263
274
|
File.symlink path, product_path
|
264
275
|
next
|
@@ -280,7 +291,7 @@ module Distil
|
|
280
291
|
|
281
292
|
def copy_assets
|
282
293
|
assets.each { |a|
|
283
|
-
a.copy_to(
|
294
|
+
a.copy_to(output_path, source_folder)
|
284
295
|
}
|
285
296
|
end
|
286
297
|
|
@@ -342,12 +353,12 @@ module Distil
|
|
342
353
|
files= []
|
343
354
|
|
344
355
|
parts= path.split(File::SEPARATOR)
|
345
|
-
|
356
|
+
library_name= parts[0]
|
346
357
|
file_path= File.join(parts.slice(1..-1))
|
347
358
|
|
348
|
-
if (@libraries_by_name.include?(
|
349
|
-
|
350
|
-
return Dir.glob(File.join(
|
359
|
+
if (@libraries_by_name.include?(library_name))
|
360
|
+
library= @libraries_by_name[library_name]
|
361
|
+
return Dir.glob(File.join(library.output_path, file_path))
|
351
362
|
end
|
352
363
|
|
353
364
|
files.concat(Dir.glob(path));
|
data/lib/distil/server.rb
CHANGED
@@ -11,7 +11,7 @@ module Distil
|
|
11
11
|
}
|
12
12
|
|
13
13
|
server= WEBrick::HTTPServer.new(config)
|
14
|
-
server.mount(path || '/', WEBrick::HTTPServlet::FileHandler, project.
|
14
|
+
server.mount(path || '/', WEBrick::HTTPServlet::FileHandler, project.output_path)
|
15
15
|
|
16
16
|
['INT', 'TERM'].each { |signal|
|
17
17
|
trap(signal){ server.shutdown }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 88
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 14
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.14.0.
|
10
|
+
- c
|
11
|
+
version: 0.14.0.c
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Jeff Watkins
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-12-
|
19
|
+
date: 2010-12-22 00:00:00 -08:00
|
20
20
|
default_executable: distil
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|