middleman-sprockets 3.0.6 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - 2.0.0
5
6
  - jruby-18mode
6
7
  - jruby-19mode
7
8
 
@@ -11,5 +12,6 @@ env: TEST=true
11
12
 
12
13
  matrix:
13
14
  allow_failures:
15
+ - rvm: 2.0.0
14
16
  - rvm: jruby-18mode
15
17
  - rvm: jruby-19mode
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  git "git://github.com/middleman/middleman.git", :branch => "3.0-stable" do
4
4
  gem "middleman"
@@ -9,24 +9,18 @@ end
9
9
  # Specify your gem's dependencies in middleman-blog.gemspec
10
10
  gemspec
11
11
 
12
- group :development do
13
- gem "rake", "~> 0.9.2"
14
- gem "rdoc", "~> 3.9"
15
- gem "yard", "~> 0.8.0"
16
- gem "pry"
17
- gem "pry-debugger"
18
- end
12
+ # Build and doc tools
13
+ gem "rake", "~> 10.0.3"
14
+ gem "yard", "~> 0.8.0"
19
15
 
20
- group :test do
21
- gem "cucumber", "~> 1.2.0"
22
- gem "fivemat"
23
- gem "aruba", "~> 0.4.11"
24
- gem "rspec", "~> 2.7"
16
+ # Test tools
17
+ gem "cucumber", "~> 1.2.1"
18
+ gem "fivemat", "~> 1.1.0"
19
+ gem "aruba", "~> 0.5.1"
20
+ gem "rspec", "~> 2.12"
25
21
 
26
- # For actual tests
27
- gem "jquery-rails", "~> 2.0.1"
28
- # gem "bootstrap-rails", "0.0.5"
29
- # gem "zurb-foundation"
30
- gem "ejs"
31
- gem "eco"
32
- end
22
+ # For actual tests
23
+ gem "jquery-rails", "2.0.1"
24
+ gem "ejs", "~> 1.1.1"
25
+ gem "eco", "~> 1.0.0"
26
+ gem "erubis", "~> 2.7.0"
@@ -7,7 +7,7 @@ Feature: Assets get a file hash appended to their and references to them are upd
7
7
  | images/100px-1242c368.png |
8
8
  | images/100px-5fd6fb90.jpg |
9
9
  | images/100px-5fd6fb90.gif |
10
- | javascripts/application-1d8d5276.js |
10
+ | javascripts/application-df677242.js |
11
11
  | stylesheets/site-50eaa978.css |
12
12
  | index.html |
13
13
  | subdir/index.html |
@@ -19,33 +19,33 @@ Feature: Assets get a file hash appended to their and references to them are upd
19
19
  | javascripts/application.js |
20
20
  | stylesheets/site.css |
21
21
 
22
- And the file "javascripts/application-1d8d5276.js" should contain "img.src = '/images/100px-5fd6fb90.jpg'"
22
+ And the file "javascripts/application-df677242.js" should contain "img.src = '/images/100px-5fd6fb90.jpg'"
23
23
  And the file "stylesheets/site-50eaa978.css" should contain "background-image: url('../images/100px-5fd6fb90.jpg')"
24
24
  And the file "index.html" should contain 'href="stylesheets/site-50eaa978.css"'
25
- And the file "index.html" should contain 'src="javascripts/application-1d8d5276.js"'
25
+ And the file "index.html" should contain 'src="javascripts/application-df677242.js"'
26
26
  And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"'
27
27
  And the file "subdir/index.html" should contain 'href="../stylesheets/site-50eaa978.css"'
28
- And the file "subdir/index.html" should contain 'src="../javascripts/application-1d8d5276.js"'
28
+ And the file "subdir/index.html" should contain 'src="../javascripts/application-df677242.js"'
29
29
  And the file "subdir/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"'
30
30
  And the file "other/index.html" should contain 'href="../stylesheets/site-50eaa978.css"'
31
- And the file "other/index.html" should contain 'src="../javascripts/application-1d8d5276.js"'
31
+ And the file "other/index.html" should contain 'src="../javascripts/application-df677242.js"'
32
32
  And the file "other/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"'
33
33
 
34
34
  Scenario: Hashed assets work in preview server
35
35
  Given the Server is running at "asset-hash-app"
36
36
  When I go to "/"
37
37
  Then I should see 'href="stylesheets/site-50eaa978.css"'
38
- And I should see 'src="javascripts/application-1d8d5276.js"'
38
+ And I should see 'src="javascripts/application-df677242.js"'
39
39
  And I should see 'src="images/100px-5fd6fb90.jpg"'
40
40
  When I go to "/subdir/"
41
41
  Then I should see 'href="../stylesheets/site-50eaa978.css"'
42
- And I should see 'src="../javascripts/application-1d8d5276.js"'
42
+ And I should see 'src="../javascripts/application-df677242.js"'
43
43
  And I should see 'src="../images/100px-5fd6fb90.jpg"'
44
44
  When I go to "/other/"
45
45
  Then I should see 'href="../stylesheets/site-50eaa978.css"'
46
- And I should see 'src="../javascripts/application-1d8d5276.js"'
46
+ And I should see 'src="../javascripts/application-df677242.js"'
47
47
  And I should see 'src="../images/100px-5fd6fb90.jpg"'
48
- When I go to "/javascripts/application-1d8d5276.js"
48
+ When I go to "/javascripts/application-df677242.js"
49
49
  Then I should see "img.src = '/images/100px-5fd6fb90.jpg'"
50
50
  When I go to "/stylesheets/site-50eaa978.css"
51
51
  Then I should see "background-image: url('../images/100px-5fd6fb90.jpg')"
@@ -89,14 +89,14 @@ Feature: Assets get a file hash appended to their and references to them are upd
89
89
  function sprockets_sub_function() { }
90
90
  """
91
91
  When I go to "/partials/"
92
- Then I should see 'src="../javascripts/sprockets_base-095c3f3f.js'
93
- When I go to "/javascripts/sprockets_base-095c3f3f.js"
92
+ Then I should see 'src="../javascripts/sprockets_base-0252a861.js'
93
+ When I go to "/javascripts/sprockets_base-0252a861.js"
94
94
  Then I should see "sprockets_sub_function"
95
95
  And the file "source/javascripts/sprockets_sub.js" has the contents
96
96
  """
97
97
  function sprockets_sub2_function() { }
98
98
  """
99
99
  When I go to "/partials/"
100
- Then I should see 'src="../javascripts/sprockets_base-095c3f3f.js'
101
- When I go to "/javascripts/sprockets_base-095c3f3f.js"
100
+ Then I should see 'src="../javascripts/sprockets_base-5121d891.js'
101
+ When I go to "/javascripts/sprockets_base-5121d891.js"
102
102
  Then I should see "sprockets_sub2_function"
@@ -1,6 +1,5 @@
1
- require 'pry'
2
-
3
1
  PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
4
2
  require "middleman-core"
5
3
  require "middleman-core/step_definitions"
6
- require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-sprockets')
4
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-sprockets')
5
+ require "erubis"
@@ -76,10 +76,20 @@ module Middleman::Sprockets
76
76
 
77
77
  # Make the app context available to Sprockets
78
78
  context_class.send(:define_method, :app) { app }
79
+
79
80
  context_class.class_eval do
81
+ # Find the Middleman-compatible version of this file's path
82
+ def mm_path
83
+ @mm_path ||= app.sitemap.file_to_path(pathname.to_s)
84
+ end
85
+
80
86
  def method_missing(*args)
81
87
  name = args.first
82
88
  if app.respond_to?(name)
89
+ # Set the middleman application current path, since it won't
90
+ # be set if the request came in through Sprockets and helpers
91
+ # won't work without it.
92
+ app.current_path = mm_path unless app.current_path
83
93
  app.send(*args)
84
94
  else
85
95
  super
@@ -102,7 +112,10 @@ module Middleman::Sprockets
102
112
  end if app.respond_to?(:js_assets_paths)
103
113
 
104
114
  # Stylus support
105
- ::Stylus.setup(self, app.styl) if defined?(::Stylus)
115
+ if defined?(::Stylus)
116
+ require 'stylus/sprockets'
117
+ ::Stylus.setup(self, app.styl)
118
+ end
106
119
  end
107
120
 
108
121
  # Override Sprockets' default digest function to *not*
@@ -137,7 +150,7 @@ module Middleman::Sprockets
137
150
  # splits up script dependencies in individual files when
138
151
  # configuration variable :debug_assets is set to true
139
152
  def javascript_include_tag(*sources)
140
- if respond_to?(:debug_assets) && debug_assets
153
+ if respond_to?(:debug_assets) && debug_assets && !build?
141
154
  options = sources.extract_options!.symbolize_keys
142
155
 
143
156
  # loop through all sources and the dependencies and
@@ -150,7 +163,7 @@ module Middleman::Sprockets
150
163
  end
151
164
 
152
165
  super(dependencies_paths, options)
153
- end.join("")
166
+ end.join("").gsub("body=1.js", "body=1")
154
167
  else
155
168
  super
156
169
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Sprockets
3
- VERSION = "3.0.6"
3
+ VERSION = "3.0.8"
4
4
  end
5
5
  end
@@ -1,7 +1,20 @@
1
1
  require "middleman-core"
2
2
  require "middleman-more"
3
3
 
4
+ module Rails
5
+ def self.env
6
+ Class.new do
7
+ def test?
8
+ false
9
+ end
10
+ end.new
11
+ end
12
+
13
+ class Engine
14
+ end
15
+ end unless defined? Rails
16
+
4
17
  Middleman::Extensions.register(:sprockets) do
5
18
  require "middleman-sprockets/extension"
6
19
  Middleman::Sprockets
7
- end
20
+ end
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency("middleman-more", [">= 3.0.1"])
21
+ s.add_dependency("middleman-more", [">= 3.0.11"])
22
22
  s.add_dependency("sprockets", ["~> 2.1", "< 2.5"])
23
- s.add_dependency("sprockets-sass", ["~> 0.9.0"])
23
+ s.add_dependency("sprockets-sass", ["~> 0.9.1"])
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.8
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-12-27 00:00:00.000000000 Z
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-more
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 3.0.1
21
+ version: 3.0.11
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 3.0.1
29
+ version: 3.0.11
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: sprockets
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - ~>
58
58
  - !ruby/object:Gem::Version
59
- version: 0.9.0
59
+ version: 0.9.1
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - ~>
66
66
  - !ruby/object:Gem::Version
67
- version: 0.9.0
67
+ version: 0.9.1
68
68
  description: Sprockets support for Middleman
69
69
  email:
70
70
  - me@tdreyno.com
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  segments:
183
183
  - 0
184
- hash: 2105704701769058929
184
+ hash: -2287386190982778371
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  none: false
187
187
  requirements:
@@ -190,10 +190,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  segments:
192
192
  - 0
193
- hash: 2105704701769058929
193
+ hash: -2287386190982778371
194
194
  requirements: []
195
195
  rubyforge_project: middleman-sprockets
196
- rubygems_version: 1.8.24
196
+ rubygems_version: 1.8.23
197
197
  signing_key:
198
198
  specification_version: 3
199
199
  summary: Sprockets support for Middleman