asset_packager 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ module Synthesis
|
|
3
3
|
|
4
4
|
# class variables
|
5
5
|
@@asset_packages_yml = $asset_packages_yml ||
|
6
|
-
(File.exists?("#{
|
6
|
+
(File.exists?("#{config.root}/config/asset_packages.yml") ? YAML.load_file("#{config.root}/config/asset_packages.yml") : nil)
|
7
7
|
|
8
8
|
# singleton methods
|
9
9
|
class << self
|
@@ -71,13 +71,13 @@ module Synthesis
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def create_yml
|
74
|
-
unless File.exists?("#{
|
74
|
+
unless File.exists?("#{config.root}/config/asset_packages.yml")
|
75
75
|
asset_yml = Hash.new
|
76
76
|
|
77
|
-
asset_yml['javascripts'] = [{"base" => build_file_list("#{
|
78
|
-
asset_yml['stylesheets'] = [{"base" => build_file_list("#{
|
77
|
+
asset_yml['javascripts'] = [{"base" => build_file_list("#{config.root}/public/javascripts", "js")}]
|
78
|
+
asset_yml['stylesheets'] = [{"base" => build_file_list("#{config.root}/public/stylesheets", "css")}]
|
79
79
|
|
80
|
-
File.open("#{
|
80
|
+
File.open("#{config.root}/config/asset_packages.yml", "w") do |out|
|
81
81
|
YAML.dump(asset_yml, out)
|
82
82
|
end
|
83
83
|
|
@@ -155,8 +155,8 @@ module Synthesis
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def compress_js(source)
|
158
|
-
jsmin_path = "
|
159
|
-
tmp_path = "#{
|
158
|
+
jsmin_path = File.dirname(__FILE__) + "../"
|
159
|
+
tmp_path = "#{config.root}/tmp/#{@target}_packaged"
|
160
160
|
|
161
161
|
# write out to a temp file
|
162
162
|
File.open("#{tmp_path}_uncompressed.js", "w") {|f| f.write(source) }
|
@@ -11,7 +11,7 @@ module Synthesis
|
|
11
11
|
if sources.include?(:defaults)
|
12
12
|
sources = sources[0..(sources.index(:defaults))] +
|
13
13
|
['prototype', 'effects', 'dragdrop', 'controls'] +
|
14
|
-
(File.exists?("#{
|
14
|
+
(File.exists?("#{config.root}/public/javascripts/application.js") ? ['application'] : []) +
|
15
15
|
sources[(sources.index(:defaults) + 1)..sources.length]
|
16
16
|
sources.delete(:defaults)
|
17
17
|
end
|