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?("#{RAILS_ROOT}/config/asset_packages.yml") ? YAML.load_file("#{RAILS_ROOT}/config/asset_packages.yml") : nil)
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?("#{RAILS_ROOT}/config/asset_packages.yml")
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("#{RAILS_ROOT}/public/javascripts", "js")}]
78
- asset_yml['stylesheets'] = [{"base" => build_file_list("#{RAILS_ROOT}/public/stylesheets", "css")}]
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("#{RAILS_ROOT}/config/asset_packages.yml", "w") do |out|
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 = "#{RAILS_ROOT}/vendor/plugins/asset_packager/lib"
159
- tmp_path = "#{RAILS_ROOT}/tmp/#{@target}_packaged"
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?("#{RAILS_ROOT}/public/javascripts/application.js") ? ['application'] : []) +
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
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dieinzige