distil 0.14.0.i → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -2
- data/assets/distil.js +354 -304
- data/assets/mime.types +1240 -0
- data/distil.gemspec +7 -3
- data/lib/distil/javascript-file-validator.rb +1 -1
- data/lib/distil/product/javascript-product.rb +11 -4
- data/lib/distil/project.rb +25 -7
- data/lib/distil/source-file/javascript-file.rb +21 -3
- metadata +30 -17
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"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
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{2011-03-
|
12
|
+
s.date = %q{2011-03-17}
|
13
13
|
s.description = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
|
14
14
|
s.executables = ["distil", "jsl"]
|
15
15
|
s.extensions = ["vendor/extconf.rb"]
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
"Rakefile",
|
19
19
|
"VERSION",
|
20
20
|
"assets/distil.js",
|
21
|
+
"assets/mime.types",
|
21
22
|
"bin/distil",
|
22
23
|
"bin/jsl",
|
23
24
|
"distil.gemspec",
|
@@ -758,17 +759,20 @@ Gem::Specification.new do |s|
|
|
758
759
|
|
759
760
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
760
761
|
s.add_runtime_dependency(%q<json>, [">= 1.4.3"])
|
762
|
+
s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
|
761
763
|
s.add_runtime_dependency(%q<rubyzip>, [">= 0.9.4"])
|
762
764
|
s.add_runtime_dependency(%q<treetop>, [">= 1.4.8"])
|
763
765
|
s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
|
764
766
|
else
|
765
767
|
s.add_dependency(%q<json>, [">= 1.4.3"])
|
768
|
+
s.add_dependency(%q<mime-types>, [">= 1.16"])
|
766
769
|
s.add_dependency(%q<rubyzip>, [">= 0.9.4"])
|
767
770
|
s.add_dependency(%q<treetop>, [">= 1.4.8"])
|
768
771
|
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
|
769
772
|
end
|
770
773
|
else
|
771
774
|
s.add_dependency(%q<json>, [">= 1.4.3"])
|
775
|
+
s.add_dependency(%q<mime-types>, [">= 1.16"])
|
772
776
|
s.add_dependency(%q<rubyzip>, [">= 0.9.4"])
|
773
777
|
s.add_dependency(%q<treetop>, [">= 1.4.8"])
|
774
778
|
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
|
@@ -14,7 +14,7 @@ module Distil
|
|
14
14
|
}.gsub(/^\s*/, '')
|
15
15
|
|
16
16
|
def can_embed_as_content(file)
|
17
|
-
["css", "html", "json"].include?(file.extension)
|
17
|
+
["css", "html", "json", "sql"].include?(file.extension)
|
18
18
|
end
|
19
19
|
|
20
20
|
def escape_embeded_content(file)
|
@@ -72,6 +72,9 @@ module Distil
|
|
72
72
|
|
73
73
|
if (APPLICATION_TYPE==project.project_type)
|
74
74
|
output.puts File.read(BOOTSTRAP_SCRIPT)
|
75
|
+
if (project.synchronise_assets)
|
76
|
+
output.puts "\n\ndistil.sync= true;\n\n"
|
77
|
+
end
|
75
78
|
output.puts FILE_SEPARATOR
|
76
79
|
end
|
77
80
|
|
@@ -85,7 +88,8 @@ module Distil
|
|
85
88
|
content= f.rewrite_content_relative_to_path(nil)
|
86
89
|
next if !content || content.empty?
|
87
90
|
|
88
|
-
output.puts content
|
91
|
+
output.puts content.strip
|
92
|
+
output.puts "\n"
|
89
93
|
output.puts FILE_SEPARATOR
|
90
94
|
}
|
91
95
|
|
@@ -99,8 +103,8 @@ module Distil
|
|
99
103
|
|
100
104
|
next if !content || content.empty?
|
101
105
|
|
102
|
-
output.puts content
|
103
|
-
output.puts ""
|
106
|
+
output.puts content.strip
|
107
|
+
output.puts "\n"
|
104
108
|
output.puts FILE_SEPARATOR
|
105
109
|
}
|
106
110
|
|
@@ -120,6 +124,9 @@ module Distil
|
|
120
124
|
|
121
125
|
if (APPLICATION_TYPE==project.project_type)
|
122
126
|
output.puts File.read(BOOTSTRAP_SCRIPT)
|
127
|
+
if (project.synchronise_assets)
|
128
|
+
output.puts "\n\ndistil.sync= true;\n\n"
|
129
|
+
end
|
123
130
|
end
|
124
131
|
|
125
132
|
if project.global_export
|
data/lib/distil/project.rb
CHANGED
@@ -26,9 +26,12 @@ module Distil
|
|
26
26
|
attr_reader :dependency_aliases
|
27
27
|
attr_reader :doc_src_path
|
28
28
|
attr_reader :doc_output_path
|
29
|
+
attr_reader :synchronise_assets
|
29
30
|
|
30
31
|
alias_config_key :project_type, :type
|
31
|
-
|
32
|
+
alias_config_key :synchronise_assets, :synchronize_assets
|
33
|
+
alias_config_key :synchronise_assets, :sync
|
34
|
+
|
32
35
|
def self.find(dir=nil)
|
33
36
|
cwd= Dir.pwd
|
34
37
|
dir ||= Dir.pwd
|
@@ -80,6 +83,8 @@ module Distil
|
|
80
83
|
@languages= []
|
81
84
|
@additional_globals= []
|
82
85
|
@name= File.basename(@folder, ".*")
|
86
|
+
@raw_sources = []
|
87
|
+
@synchronise_assets = false
|
83
88
|
|
84
89
|
ignore_warnings= false
|
85
90
|
|
@@ -195,16 +200,29 @@ module Distil
|
|
195
200
|
end
|
196
201
|
|
197
202
|
def build
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
203
|
+
FileUtils.mkdir_p(output_path)
|
204
|
+
|
205
|
+
if @parent.nil?
|
206
|
+
libraries.each { |lib|
|
207
|
+
lib.build
|
208
|
+
}
|
209
|
+
end
|
210
|
+
|
202
211
|
puts "\n#{name}:\n\n" unless @parent
|
212
|
+
|
213
|
+
failed = false
|
203
214
|
|
204
|
-
subprojects.each { |subproject|
|
205
|
-
|
215
|
+
@subprojects.each { |subproject|
|
216
|
+
begin
|
217
|
+
subproject.build
|
218
|
+
rescue BuildFailure
|
219
|
+
failed = true
|
220
|
+
end
|
206
221
|
}
|
207
222
|
|
223
|
+
# Don't keep going if one of the sub-projects failed.
|
224
|
+
raise BuildFailure if failed
|
225
|
+
|
208
226
|
compute_source_files
|
209
227
|
return if up_to_date?
|
210
228
|
|
@@ -3,6 +3,7 @@ module Distil
|
|
3
3
|
JSL_IMPORT_REGEX= /\/\*jsl:import\s+([^\*]*)\*\//
|
4
4
|
NIB_ASSET_REGEX= /(NIB\.asset(?:Url)?)\(['"]([^)]+)['"]\)/
|
5
5
|
NIB_DECLARATION_REGEX= /NIB\(\s*(["'])(\w(?:\w|-)*)\1\s*,/
|
6
|
+
DISTIL_ASSET_REGEX= /(distil.asset(?:Url)?)\(['"]([^)]+)['"]\)/
|
6
7
|
|
7
8
|
class JavascriptFile < SourceFile
|
8
9
|
include YuiMinifiableFile
|
@@ -31,7 +32,15 @@ module Distil
|
|
31
32
|
|
32
33
|
def rewrite_content_relative_to_path(path)
|
33
34
|
text= content.gsub(JSL_IMPORT_REGEX, '')
|
34
|
-
text.gsub(NIB_ASSET_REGEX) do |match|
|
35
|
+
text= text.gsub(NIB_ASSET_REGEX) do |match|
|
36
|
+
asset= project.file_from_path(File.join(dirname, $2))
|
37
|
+
if asset
|
38
|
+
"#{$1}(\"#{asset.relative_path}\")"
|
39
|
+
else
|
40
|
+
match
|
41
|
+
end
|
42
|
+
end
|
43
|
+
text= text.gsub(DISTIL_ASSET_REGEX) do |match|
|
35
44
|
asset= project.file_from_path(File.join(dirname, $2))
|
36
45
|
if asset
|
37
46
|
"#{$1}(\"#{asset.relative_path}\")"
|
@@ -72,14 +81,23 @@ module Distil
|
|
72
81
|
end
|
73
82
|
end
|
74
83
|
|
75
|
-
line.scan(
|
76
|
-
asset= project.file_from_path(File.join(dirname, $
|
84
|
+
line.scan(DISTIL_ASSET_REGEX) do |match|
|
85
|
+
asset= project.file_from_path(File.join(dirname, $2))
|
77
86
|
if asset
|
78
87
|
add_asset(asset)
|
79
88
|
else
|
80
89
|
error "Missing asset file: #{$1}", line_num
|
81
90
|
end
|
82
91
|
end
|
92
|
+
|
93
|
+
line.scan(NIB_ASSET_REGEX) do |match|
|
94
|
+
asset= project.file_from_path(File.join(dirname, $2))
|
95
|
+
if asset
|
96
|
+
add_asset(asset)
|
97
|
+
else
|
98
|
+
error "Missing asset file: #{$2}", line_num
|
99
|
+
end
|
100
|
+
end
|
83
101
|
end
|
84
102
|
|
85
103
|
if is_nib_file
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 39
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 14
|
9
9
|
- 0
|
10
|
-
|
11
|
-
version: 0.14.0.i
|
10
|
+
version: 0.14.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Jeff Watkins
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-17 00:00:00 -07:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -36,9 +35,24 @@ dependencies:
|
|
36
35
|
type: :runtime
|
37
36
|
version_requirements: *id001
|
38
37
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
38
|
+
name: mime-types
|
40
39
|
prerelease: false
|
41
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 47
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 16
|
49
|
+
version: "1.16"
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rubyzip
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
56
|
none: false
|
43
57
|
requirements:
|
44
58
|
- - ">="
|
@@ -50,11 +64,11 @@ dependencies:
|
|
50
64
|
- 4
|
51
65
|
version: 0.9.4
|
52
66
|
type: :runtime
|
53
|
-
version_requirements: *
|
67
|
+
version_requirements: *id003
|
54
68
|
- !ruby/object:Gem::Dependency
|
55
69
|
name: treetop
|
56
70
|
prerelease: false
|
57
|
-
requirement: &
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
58
72
|
none: false
|
59
73
|
requirements:
|
60
74
|
- - ">="
|
@@ -66,11 +80,11 @@ dependencies:
|
|
66
80
|
- 8
|
67
81
|
version: 1.4.8
|
68
82
|
type: :runtime
|
69
|
-
version_requirements: *
|
83
|
+
version_requirements: *id004
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: directory_watcher
|
72
86
|
prerelease: false
|
73
|
-
requirement: &
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
74
88
|
none: false
|
75
89
|
requirements:
|
76
90
|
- - ">="
|
@@ -82,7 +96,7 @@ dependencies:
|
|
82
96
|
- 1
|
83
97
|
version: 1.1.1
|
84
98
|
type: :runtime
|
85
|
-
version_requirements: *
|
99
|
+
version_requirements: *id005
|
86
100
|
description: A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit
|
87
101
|
email:
|
88
102
|
executables:
|
@@ -97,6 +111,7 @@ files:
|
|
97
111
|
- Rakefile
|
98
112
|
- VERSION
|
99
113
|
- assets/distil.js
|
114
|
+
- assets/mime.types
|
100
115
|
- bin/distil
|
101
116
|
- bin/jsl
|
102
117
|
- distil.gemspec
|
@@ -846,14 +861,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
846
861
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
847
862
|
none: false
|
848
863
|
requirements:
|
849
|
-
- - "
|
864
|
+
- - ">="
|
850
865
|
- !ruby/object:Gem::Version
|
851
|
-
hash:
|
866
|
+
hash: 3
|
852
867
|
segments:
|
853
|
-
-
|
854
|
-
|
855
|
-
- 1
|
856
|
-
version: 1.3.1
|
868
|
+
- 0
|
869
|
+
version: "0"
|
857
870
|
requirements: []
|
858
871
|
|
859
872
|
rubyforge_project:
|