distil 0.11.8 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/assets/distil.js +7 -1
- data/bin/distil +3 -4
- data/distil.gemspec +2 -2
- data/lib/distil/configurable.rb +4 -3
- data/lib/distil/product/javascript-product.rb +3 -2
- data/lib/distil/project/distil-project.rb +29 -26
- data/lib/distil/project/external-project.rb +6 -1
- data/lib/distil/project.rb +4 -0
- data/lib/distil/source-file.rb +0 -2
- data/lib/distil/target.rb +4 -16
- data/lib/distil.rb +8 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.12.0
|
data/assets/distil.js
CHANGED
@@ -246,7 +246,13 @@
|
|
246
246
|
var path= module.path;
|
247
247
|
|
248
248
|
for (var i=0, len=files.length; i<len; ++i)
|
249
|
-
|
249
|
+
{
|
250
|
+
// loadResource(path + files[i], null, null, null, resource);
|
251
|
+
if (distil.sync && '.js'===files[i].slice(-3).toLowerCase())
|
252
|
+
document.write('<script src="'+path+files[i]+'"></script>');
|
253
|
+
else
|
254
|
+
loadResource(path + files[i], null, null, null, resource);
|
255
|
+
}
|
250
256
|
};
|
251
257
|
|
252
258
|
distil.module= function(name, def)
|
data/bin/distil
CHANGED
@@ -20,12 +20,11 @@ ARGV.each { |v|
|
|
20
20
|
end
|
21
21
|
|
22
22
|
v= v.gsub(/^-+/, '')
|
23
|
-
v.gsub!("-", "_")
|
24
23
|
|
25
24
|
key,value= v.split("=")
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
key.gsub!("-", "_")
|
26
|
+
|
27
|
+
value=true if !value
|
29
28
|
|
30
29
|
if ("f"==key || "file"==key || "buildfile"==key)
|
31
30
|
project_file= value
|
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.
|
8
|
+
s.version = "0.12.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeff Watkins"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-07-08}
|
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/configurable.rb
CHANGED
@@ -27,7 +27,7 @@ class Configurable
|
|
27
27
|
keys= @@options.keys
|
28
28
|
values= @@options.map { |k,v| convert_type(v[:type], v[:value]) }
|
29
29
|
|
30
|
-
s= Struct.new(*keys).new(*values)
|
30
|
+
s= @options ? @options : (@options=Struct.new(*keys).new(*values))
|
31
31
|
return s if !settings
|
32
32
|
|
33
33
|
setting_keys= settings.keys.map { |key| key.to_s }
|
@@ -61,6 +61,7 @@ class Configurable
|
|
61
61
|
|
62
62
|
}
|
63
63
|
|
64
|
+
@extras.merge!(settings)
|
64
65
|
s
|
65
66
|
end
|
66
67
|
|
@@ -125,11 +126,11 @@ class Configurable
|
|
125
126
|
end
|
126
127
|
|
127
128
|
def initialize(options={}, parent=nil)
|
129
|
+
@extras= Hash.new
|
128
130
|
if (parent.is_a?(Configurable))
|
129
131
|
parent_options= parent.options
|
130
132
|
end
|
131
|
-
|
132
|
-
@extras= options
|
133
|
+
get_options(options, parent_options)
|
133
134
|
end
|
134
135
|
|
135
136
|
private
|
@@ -7,7 +7,7 @@ module Distil
|
|
7
7
|
|
8
8
|
option :global_export
|
9
9
|
option :additional_globals, [], :aliases=>['globals']
|
10
|
-
|
10
|
+
|
11
11
|
def before_externals(f)
|
12
12
|
f.puts("/*#nocode+*/")
|
13
13
|
f.puts(bootstrap_source) if bootstrap
|
@@ -80,6 +80,7 @@ EOS
|
|
80
80
|
extension "js"
|
81
81
|
|
82
82
|
option :global_export
|
83
|
+
option :synchronous_load, false, :aliases=>['sync']
|
83
84
|
|
84
85
|
def write_output
|
85
86
|
return if up_to_date
|
@@ -114,7 +115,7 @@ EOS
|
|
114
115
|
f.write("/*jsl:import #{relative_path(file)}*/\n")
|
115
116
|
}
|
116
117
|
f.write(<<-EOS)
|
117
|
-
|
118
|
+
distil.sync= #{synchronous_load ? 'true' : 'false'};
|
118
119
|
|
119
120
|
distil.module('#{target.name}', {
|
120
121
|
folder: '',
|
@@ -2,7 +2,7 @@ module Distil
|
|
2
2
|
|
3
3
|
class DistilProject < Project
|
4
4
|
|
5
|
-
attr_reader :project_file
|
5
|
+
attr_reader :project_file, :targets
|
6
6
|
|
7
7
|
option :ignore_warnings, false
|
8
8
|
|
@@ -11,30 +11,35 @@ module Distil
|
|
11
11
|
|
12
12
|
|
13
13
|
def initialize(project_file, settings={}, parent=nil)
|
14
|
-
@project_file= File.expand_path(project_file)
|
15
|
-
@projects_by_name={}
|
16
|
-
|
17
|
-
project_info= YAML.load_file(@project_file)
|
18
|
-
project_info.merge!(settings)
|
19
|
-
project_info["path"]= File.dirname(@project_file)
|
20
14
|
|
21
15
|
begin
|
22
16
|
|
17
|
+
@project_file= File.expand_path(project_file)
|
18
|
+
@projects_by_name={}
|
19
|
+
|
20
|
+
project_info= YAML.load_file(@project_file)
|
21
|
+
project_info["path"]= File.dirname(@project_file)
|
22
|
+
|
23
23
|
super(project_info, parent)
|
24
|
-
|
24
|
+
get_options(settings, parent)
|
25
25
|
|
26
|
+
FileUtils.mkdir_p(output_folder)
|
27
|
+
|
28
|
+
load_external_projects
|
29
|
+
find_targets
|
30
|
+
load_distileries
|
31
|
+
|
26
32
|
rescue ValidationError => err
|
27
33
|
puts "#{APP_NAME}: #{SourceFile.path_relative_to_folder(project_file, Dir.pwd)}: #{err.message}\n"
|
28
34
|
exit 1
|
29
35
|
end
|
36
|
+
|
30
37
|
end
|
31
38
|
|
32
|
-
def
|
33
|
-
@targets if @targets
|
34
|
-
|
39
|
+
def find_targets
|
35
40
|
@targets= []
|
36
41
|
target_list= @extras['targets']
|
37
|
-
|
42
|
+
|
38
43
|
if !target_list
|
39
44
|
@targets << Target.new(@extras.clone, self)
|
40
45
|
return @targets
|
@@ -44,7 +49,7 @@ module Distil
|
|
44
49
|
Target.new(target, self)
|
45
50
|
}
|
46
51
|
end
|
47
|
-
|
52
|
+
|
48
53
|
def load_external_projects
|
49
54
|
return if !external_projects
|
50
55
|
projects= []
|
@@ -82,14 +87,6 @@ module Distil
|
|
82
87
|
server.start
|
83
88
|
end
|
84
89
|
|
85
|
-
def build
|
86
|
-
FileUtils.mkdir_p(output_folder)
|
87
|
-
load_distileries
|
88
|
-
targets
|
89
|
-
build_external_projects
|
90
|
-
build_targets
|
91
|
-
end
|
92
|
-
|
93
90
|
def load_distileries
|
94
91
|
return if distileries.nil?
|
95
92
|
|
@@ -106,17 +103,23 @@ module Distil
|
|
106
103
|
require path
|
107
104
|
}
|
108
105
|
end
|
109
|
-
|
106
|
+
|
107
|
+
def up_to_date
|
108
|
+
return false if !external_projects.all?{ |project| project.up_to_date }
|
109
|
+
return targets.all? { |target| target.up_to_date }
|
110
|
+
end
|
111
|
+
|
112
|
+
def build
|
113
|
+
build_external_projects
|
114
|
+
build_targets
|
115
|
+
end
|
116
|
+
|
110
117
|
def build_external_projects
|
111
118
|
external_projects.each { |project|
|
112
119
|
project.build
|
113
120
|
}
|
114
121
|
end
|
115
122
|
|
116
|
-
def up_to_date
|
117
|
-
targets.all? { |target| target.up_to_date }
|
118
|
-
end
|
119
|
-
|
120
123
|
def build_targets
|
121
124
|
targets.each { |target|
|
122
125
|
target.build
|
@@ -19,7 +19,7 @@ module Distil
|
|
19
19
|
end
|
20
20
|
super(config, parent)
|
21
21
|
|
22
|
-
|
22
|
+
self.output_folder= File.join(parent.output_folder, name)
|
23
23
|
end
|
24
24
|
|
25
25
|
def product_name(product_type, extension)
|
@@ -28,6 +28,11 @@ module Distil
|
|
28
28
|
Interpolated.value_of(name, info)
|
29
29
|
end
|
30
30
|
|
31
|
+
def up_to_date
|
32
|
+
build
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
31
36
|
def build
|
32
37
|
wd= Dir.getwd
|
33
38
|
Dir.chdir(path)
|
data/lib/distil/project.rb
CHANGED
data/lib/distil/source-file.rb
CHANGED
data/lib/distil/target.rb
CHANGED
@@ -41,7 +41,7 @@ module Distil
|
|
41
41
|
self.exclude_files= FileSet.new
|
42
42
|
end
|
43
43
|
|
44
|
-
@options.global_export=name if true==global_export
|
44
|
+
@options.global_export=name.as_identifier if true==global_export
|
45
45
|
|
46
46
|
projects= []
|
47
47
|
include_projects.each { |name|
|
@@ -165,6 +165,8 @@ module Distil
|
|
165
165
|
product_folder= File.join(project.output_folder, f)
|
166
166
|
|
167
167
|
next if File.exists?(product_folder)
|
168
|
+
FileUtils.rm product_folder if File.symlink?(product_folder)
|
169
|
+
|
168
170
|
File.symlink src_folder, product_folder
|
169
171
|
}
|
170
172
|
end
|
@@ -206,9 +208,7 @@ module Distil
|
|
206
208
|
|
207
209
|
if !up_to_date
|
208
210
|
tasks.each { |t| t.process_files(files) }
|
209
|
-
|
210
211
|
products.each { |p| p.write_output }
|
211
|
-
|
212
212
|
build_assets
|
213
213
|
end
|
214
214
|
|
@@ -216,19 +216,7 @@ module Distil
|
|
216
216
|
end
|
217
217
|
|
218
218
|
def find_file(file, source_file=nil)
|
219
|
-
|
220
|
-
|
221
|
-
parts= file.split(File::SEPARATOR)
|
222
|
-
project_name= parts[0]
|
223
|
-
|
224
|
-
external_project= project.external_project_with_name(project_name)
|
225
|
-
return nil if !external_project
|
226
|
-
|
227
|
-
if 1==parts.length
|
228
|
-
return SourceFile::from_path(external_project.product_name(:import, source_file.extension))
|
229
|
-
else
|
230
|
-
return SourceFile::from_path(File.join(external_project.source_folder, *parts[1..-1]))
|
231
|
-
end
|
219
|
+
project.find_file(file, source_file)
|
232
220
|
end
|
233
221
|
|
234
222
|
def get_content_for_file(file)
|
data/lib/distil.rb
CHANGED
@@ -34,6 +34,14 @@ def exist?(path, file)
|
|
34
34
|
File.file?(File.join(path, file))
|
35
35
|
end
|
36
36
|
|
37
|
+
class String
|
38
|
+
def as_identifier
|
39
|
+
word= self.to_s.gsub(/(?:^|\W)(.)/) { $1.upcase }
|
40
|
+
word[0..0].downcase + word[1..-1]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
37
45
|
module Distil
|
38
46
|
|
39
47
|
FRAMEWORK_TYPE = "framework"
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 12
|
8
|
+
- 0
|
9
|
+
version: 0.12.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeff Watkins
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-07-08 00:00:00 -07:00
|
18
18
|
default_executable: distil
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|