sprockets_better_errors 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82e5beaa51f3638f3705da3d09d0e17a3c87cab0
4
- data.tar.gz: a6cb373b070b9bde834a36037997bb69617c07b4
3
+ metadata.gz: d41a6ace0ae7ca72a5dee2e473ccf1b9a375b6ec
4
+ data.tar.gz: bc78b2ca3ce506b8834d63ee9074c4222efa0992
5
5
  SHA512:
6
- metadata.gz: 9611d176a7f7b08ab072a0fb3ea7bae5bedc5b618b7849bd6474d5a7abff3c87f9f5a583c30816aca6336e3ac1c1ea988b586d578a30523b4381a1195f288f1b
7
- data.tar.gz: 9d5f8ac38de36a23efd8c31e0db3fa1dcc3dc2dce90cf54d6b608946ef2d680e29a2edc8cd3a3102f2b72d7dcdedd8cd99525566ec484e956ab797b2525ce0ec
6
+ metadata.gz: 74c60c85a5ffb0c931007acc08ccebf6adc538d755b502476368bf6197725087b58139cbd7e2482b41e875b32696943f7df830f80209962e7fcecbedec8f0d22
7
+ data.tar.gz: 5bcfd12df8306422b41d31114f46cd87480857efb8bb672fb5de2a7a10acf4e5b7fa4a61eacef14b058e8c237bed2ea04ba1e5dbae5f58d5a4ac58faba6e2e27
data/README.md CHANGED
@@ -36,6 +36,12 @@ Then run:
36
36
  $ bundle install
37
37
  ```
38
38
 
39
+ And add this line to your `config/environments/development.rb`:
40
+
41
+ ```
42
+ config.assets.raise_production_errors = true
43
+ ```
44
+
39
45
  Now develop with some sprockets super powers!
40
46
 
41
47
 
@@ -85,6 +91,15 @@ Why not add this code upstream? I allready tried, there are several PR awaiting
85
91
  - [Raise on improper dependency use](https://github.com/rails/sprockets-rails/pull/96)
86
92
  - Bonus, not mine: [Raise if ERB ](https://github.com/sstephenson/sprockets/pull/426)
87
93
 
94
+
95
+ ## Tests
96
+
97
+ Here's a one liner to running tests
98
+
99
+ ```
100
+ $ export RAILS_VERSION=4.0.0; bundle update; bundle exec rake test
101
+ ```
102
+
88
103
  ## License
89
104
 
90
105
  MIT
@@ -1,7 +1,7 @@
1
1
  module Sprockets::Rails::Helper
2
2
 
3
3
  # == BEGIN Hacks for checking if dependencies are listed correctly
4
- class DependencyError <StandardError
4
+ class DependencyError < StandardError
5
5
  def initialize(path, dep)
6
6
  msg = "Asset depends on '#{dep}' to generate properly but has not declared the dependency\n"
7
7
  msg << "Please add: `//= depend_on_asset \"#{dep}\"` to '#{path}'"
@@ -11,6 +11,7 @@ module Sprockets::Rails::Helper
11
11
 
12
12
 
13
13
  def check_dependencies!(dep)
14
+ return unless Sprockets::Rails::Helper.raise_asset_errors
14
15
  return unless @_dependency_assets
15
16
  return if @_dependency_assets.detect { |asset| asset.include?(dep) }
16
17
  raise DependencyError.new(self.pathname, dep)
@@ -1,9 +1,9 @@
1
1
  module Sprockets
2
2
  class Railtie < ::Rails::Railtie
3
3
  config.after_initialize do |app|
4
- Sprockets::Rails::Helper.precompile ||= app.config.assets.precompile
5
- Sprockets::Rails::Helper.assets ||= app.assets
6
- Sprockets::Rails::Helper.raise_asset_errors = ::Rails.env.development?
4
+ Sprockets::Rails::Helper.precompile = app.config.assets.precompile
5
+ Sprockets::Rails::Helper.assets = app.assets
6
+ Sprockets::Rails::Helper.raise_asset_errors = app.config.assets.raise_production_errors
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module SprocketsBetterErrors
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -18,6 +18,15 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
+ msg = <<-MSG
22
+
23
+ To enable sprockets_better_errors
24
+ add this line to your `config/environments/development.rb:
25
+ config.assets.raise_production_errors = true
26
+
27
+ MSG
28
+
29
+ gem.post_install_message = msg
21
30
 
22
31
  gem.add_dependency 'sprockets-rails', ">= 1.0.0"
23
32
  gem.add_development_dependency "capybara", ">= 0.4.0"
@@ -0,0 +1,3 @@
1
+ //= depend_on_asset "application.css"
2
+
3
+ var foo = '<%= asset_path("application.css") %>';
@@ -1 +1 @@
1
- <%= asset_path('no_erb_tag_error.js') %>
1
+ <%= asset_path("no_erb_tag_error.js") %>
@@ -0,0 +1 @@
1
+ <%= asset_path("no_errors.js") %>
@@ -1 +1 @@
1
- <%= asset_path('no_reference_error.js') %>
1
+ <%= asset_path("no_reference_error.js") %>
@@ -33,7 +33,9 @@ module Dummy
33
33
  # JavaScript files you want as :defaults (application.js is always included).
34
34
  # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
35
35
 
36
- config.assets.precompile += %w( no_reference_error.js no_erb_tag_error.js )
36
+ config.assets.precompile += %w( no_reference_error.js
37
+ no_errors.js
38
+ no_erb_tag_error.js )
37
39
 
38
40
  # Configure the default encoding used in templates for Ruby 1.9.
39
41
  config.encoding = "utf-8"
@@ -42,5 +44,7 @@ module Dummy
42
44
  config.filter_parameters += [:password]
43
45
 
44
46
  config.assets.enabled = true
47
+
48
+ config.assets.raise_production_errors = true
45
49
  end
46
50
  end
@@ -16,10 +16,7 @@ class InheritNavigationTest < ActiveSupport::IntegrationCase
16
16
  assert_match "depends on 'application.css'", error.message
17
17
  end
18
18
 
19
- # test 'erb' do
20
- # error = assert_raise(ActionView::Template::Error) do
21
- # visit('/foo/no_erb_tag_error')
22
- # end
23
- # end
24
-
19
+ test 'no failure' do
20
+ visit('/foo/no_errors')
21
+ end
25
22
  end
@@ -8,9 +8,6 @@ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
8
8
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
9
9
  require "rails/test_help"
10
10
 
11
-
12
-
13
-
14
11
  ActionMailer::Base.delivery_method = :test
15
12
  ActionMailer::Base.perform_deliveries = true
16
13
  ActionMailer::Base.default_url_options[:host] = "test.com"
@@ -23,10 +20,16 @@ require 'capybara/poltergeist'
23
20
  Capybara.javascript_driver = :poltergeist
24
21
  Capybara.default_selector = :css
25
22
 
26
-
27
-
28
23
  # Run any available migration
29
24
  ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
30
25
 
31
26
  # Load support files
32
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
27
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
28
+
29
+
30
+ clear_assets = Proc.new do
31
+ `bundle exec rake -f ./test/dummy/Rakefile assets:clobber`
32
+ raise "could not clear assets" unless $?.success?
33
+ end
34
+
35
+ clear_assets.call
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets_better_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets-rails
@@ -101,6 +101,7 @@ files:
101
101
  - test/dummy/app/assets/images/.keep
102
102
  - test/dummy/app/assets/javascripts/application.js
103
103
  - test/dummy/app/assets/javascripts/no_erb_tag_error.js
104
+ - test/dummy/app/assets/javascripts/no_errors.js
104
105
  - test/dummy/app/assets/javascripts/no_reference_error.js.erb
105
106
  - test/dummy/app/assets/javascripts/not_precompiled.js
106
107
  - test/dummy/app/assets/javascripts/welcome.js.coffee
@@ -110,6 +111,7 @@ files:
110
111
  - test/dummy/app/helpers/application_helper.rb
111
112
  - test/dummy/app/views/foo/index.html
112
113
  - test/dummy/app/views/foo/no_erb_tag_error.html.erb
114
+ - test/dummy/app/views/foo/no_errors.html.erb
113
115
  - test/dummy/app/views/foo/no_reference_error.html.erb
114
116
  - test/dummy/app/views/foo/precompile_error.html.erb
115
117
  - test/dummy/app/views/layouts/application.html.erb
@@ -164,7 +166,12 @@ homepage: https://github.com/schneems/sprockets_better_errors
164
166
  licenses:
165
167
  - MIT
166
168
  metadata: {}
167
- post_install_message:
169
+ post_install_message: |2+
170
+
171
+ To enable sprockets_better_errors
172
+ add this line to your `config/environments/development.rb:
173
+ config.assets.raise_production_errors = true
174
+
168
175
  rdoc_options: []
169
176
  require_paths:
170
177
  - lib
@@ -190,6 +197,7 @@ test_files:
190
197
  - test/dummy/app/assets/images/.keep
191
198
  - test/dummy/app/assets/javascripts/application.js
192
199
  - test/dummy/app/assets/javascripts/no_erb_tag_error.js
200
+ - test/dummy/app/assets/javascripts/no_errors.js
193
201
  - test/dummy/app/assets/javascripts/no_reference_error.js.erb
194
202
  - test/dummy/app/assets/javascripts/not_precompiled.js
195
203
  - test/dummy/app/assets/javascripts/welcome.js.coffee
@@ -199,6 +207,7 @@ test_files:
199
207
  - test/dummy/app/helpers/application_helper.rb
200
208
  - test/dummy/app/views/foo/index.html
201
209
  - test/dummy/app/views/foo/no_erb_tag_error.html.erb
210
+ - test/dummy/app/views/foo/no_errors.html.erb
202
211
  - test/dummy/app/views/foo/no_reference_error.html.erb
203
212
  - test/dummy/app/views/foo/precompile_error.html.erb
204
213
  - test/dummy/app/views/layouts/application.html.erb
@@ -249,3 +258,4 @@ test_files:
249
258
  - test/route_inspector_test.rb
250
259
  - test/support/integration_case.rb
251
260
  - test/test_helper.rb
261
+ has_rdoc: