rails2_asset_pipeline 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails2_asset_pipeline (0.1.13)
4
+ rails2_asset_pipeline (0.1.14)
5
5
  sprockets
6
6
 
7
7
  GEM
@@ -9,7 +9,7 @@ GEM
9
9
  specs:
10
10
  diff-lcs (1.1.3)
11
11
  hike (1.2.1)
12
- multi_json (1.3.5)
12
+ multi_json (1.3.6)
13
13
  rack (1.4.1)
14
14
  rake (0.9.2)
15
15
  rspec (2.6.0)
@@ -36,4 +36,19 @@ module Rails2AssetPipeline
36
36
  def self.static?
37
37
  not Rails2AssetPipeline.dynamic_assets_available or Rails2AssetPipeline::STATIC_ENVIRONMENTS.include?(Rails.env)
38
38
  end
39
+
40
+ def self.manifest
41
+ "#{Rails.root}/public/assets/manifest.json"
42
+ end
43
+
44
+ def self.warn_user_about_misconfiguration!
45
+ return unless Rails2AssetPipeline.static? and not File.exist?(manifest)
46
+
47
+ config = "config.ru.example"
48
+ if File.exist?(config) and File.read(config).include?("Rails2AssetPipeline.config_ru")
49
+ raise "No dynamic assets available and no #{manifest} found, run `rake assets:precompile` for static assets or `cp #{config} config.ru` for dynamic assets"
50
+ else
51
+ raise "No dynamic assets available and no #{manifest} found, run `rake assets:precompile` for static assets or read https://github.com/grosser/rails2_asset_pipeline#dynamic-assets-for-development for instructions on dynamic assets"
52
+ end
53
+ end
39
54
  end
@@ -1,3 +1,3 @@
1
1
  module Rails2AssetPipeline
2
- VERSION = '0.1.13'
2
+ VERSION = '0.1.14'
3
3
  end
@@ -32,10 +32,10 @@ module Rails2AssetPipeline
32
32
  end
33
33
 
34
34
  def asset_path(asset)
35
+ Rails2AssetPipeline.warn_user_about_misconfiguration!
36
+
35
37
  asset_with_id = if Rails2AssetPipeline.static?
36
- manifest = "#{Rails.root}/public/assets/manifest.json"
37
- raise "No dynamic assets available and no manifest found, run rake assets:precompile" unless File.exist?(manifest)
38
- @sprockets_manifest ||= Sprockets::Manifest.new(Rails2AssetPipeline.env, manifest)
38
+ @sprockets_manifest ||= Sprockets::Manifest.new(Rails2AssetPipeline.env, Rails2AssetPipeline.manifest)
39
39
  @sprockets_manifest.assets[asset] || "NOT_FOUND_IN_MANIFEST"
40
40
  else
41
41
  data = Rails2AssetPipeline.env[asset]
@@ -26,6 +26,7 @@ describe Rails2AssetPipeline::ViewHelpers do
26
26
  Rails2AssetPipeline.stub(:env).and_return env
27
27
  Rails2AssetPipeline.dynamic_assets_available = true
28
28
  env["xxx.js"] = mock(:digest => "abc", :mtime => Time.at(123456))
29
+
29
30
  end
30
31
 
31
32
  describe "#asset_path" do
@@ -87,13 +88,30 @@ describe Rails2AssetPipeline::ViewHelpers do
87
88
  env["yyy.js"] = env["xxx.js"]
88
89
  asset_path("yyy.js").should == "/assets/NOT_FOUND_IN_MANIFEST"
89
90
  end
91
+ end
90
92
 
91
- it "fails if there is no manifest" do
93
+ context "with no way of resolving assets" do
94
+ before do
95
+ Rails.env = "production"
92
96
  run "rm #{manifest}"
97
+ end
98
+
99
+ after do
100
+ run "rm -f config.ru.example"
101
+ end
102
+
103
+ it "fails" do
93
104
  expect{
94
105
  asset_path("yyy.js")
95
106
  }.to raise_error
96
107
  end
108
+
109
+ it "tells me to copy config.ru.example if it is helpful" do
110
+ write "config.ru.example", "Rails2AssetPipeline.config_ru"
111
+ expect{
112
+ asset_path("yyy.js")
113
+ }.to raise_error(/cp config.ru.example config.ru/)
114
+ end
97
115
  end
98
116
  end
99
117
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails2_asset_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-25 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
@@ -67,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  segments:
69
69
  - 0
70
- hash: -2499949293309194968
70
+ hash: -4347355398873400034
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  segments:
78
78
  - 0
79
- hash: -2499949293309194968
79
+ hash: -4347355398873400034
80
80
  requirements: []
81
81
  rubyforge_project:
82
82
  rubygems_version: 1.8.24