middleman-core 3.3.10 → 3.3.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51f7c09a1eedee6dc4c8d2713418134b37911600
4
- data.tar.gz: a364a4e6a03a63a4b087606f844d551a987c7aa2
3
+ metadata.gz: 4bdee941102d480e0efde57121a8f4158b053579
4
+ data.tar.gz: 4d51251656f7a673ebe12fa3c3a43ab97a885f1b
5
5
  SHA512:
6
- metadata.gz: 6da1d3c7f92ea229de1baba5fdf12c4fe272c61549ad6f89cc52c0007cfd4ad2ff7926ce8cbd254c08b40082b1cc9106aaf22f9c6669136dad50f0a25641e166
7
- data.tar.gz: 16a4cc624110b0b6eb0efb61f4b282e2827fc36e4d85e10198b3dc4c0d0a7ef57d50709acbccc83eefea39c2eef63bc6879aa389d577dd286bd6a62c889fb979
6
+ metadata.gz: 3645d04948555d0cc894ab7ce41b05c854a1b2e2b9c140fc087aca9d159004743a25ed4e684281cc5b99026eab36c6cf643bea374216e1b79c4392dbd657bb51
7
+ data.tar.gz: 7568e90823fbfa99c5baf7aaf0ee51beb6191c0e0921ac998e5d1ff021a577fd2594e40daccd18ed8e6722cb1856358cff1046e337329bddda4cd3bdc6096bd6
@@ -0,0 +1,10 @@
1
+ Feature: Console
2
+
3
+ Scenario: Enter and exit the console
4
+ Given I run `middleman console` interactively
5
+ When I type "puts 'Hello from the console.'"
6
+ And I type "exit"
7
+ Then it should pass with:
8
+ """
9
+ Hello from the console.
10
+ """
@@ -5,6 +5,24 @@ Feature: link_to helper
5
5
  When I go to "/link_to_erb.html"
6
6
  Then I should see "erb <s>with html tags</s>"
7
7
 
8
+ Scenario: link_to works with absolute URLs (where the relative part matches a local path)
9
+ Given a fixture app "link-to-app"
10
+ And a file named "config.rb" with:
11
+ """
12
+ set :relative_links, true
13
+ """
14
+ And a file named "source/test.html.erb" with:
15
+ """
16
+ Hello
17
+ """
18
+ And a file named "source/link_to_absolute.html.erb" with:
19
+ """
20
+ <%= link_to "test", "http://google.com/test.html" %>
21
+ """
22
+ And the Server is running at "link-to-app"
23
+ When I go to "/link_to_absolute.html"
24
+ Then I should see '<a href="http://google.com/test.html">test</a>'
25
+
8
26
  Scenario: link_to works with blocks (slim)
9
27
  Given the Server is running at "link-to-app"
10
28
  When I go to "/link_to_slim.html"
@@ -0,0 +1,7 @@
1
+ Feature: Support srcset property as params for image_tag helper
2
+ This lets you specify responsive image sizes
3
+
4
+ Scenario: Rendering an image with the feature enabled
5
+ Given the Server is running at "image-srcset-paths-app"
6
+ When I go to "/image-srcset-paths.html"
7
+ Then I should see '//example.com/remote-image.jpg 2x, /images/blank_3x.jpg 3x'
@@ -33,9 +33,10 @@ Feature: Markdown support in Haml (Kramdown)
33
33
  :markdown
34
34
  [A link](/link_target.html)
35
35
 
36
- ![image](blank.gif)
36
+ ![image](blank.gif){: srcset="image_2x.jpg 2x"}
37
37
  """
38
38
  Given the Server is running at "markdown-in-haml-app"
39
39
  When I go to "/link_and_image/"
40
40
  Then I should see "/link_target/"
41
+ Then I should see "/images/image_2x.jpg 2x"
41
42
  Then I should see 'src="/images/blank.gif"'
@@ -0,0 +1 @@
1
+ <%= image_tag 'blank.jpg', srcset: '//example.com/remote-image.jpg 2x, blank_3x.jpg 3x, http://example.com/remoteimage.jpg 4x' %>
@@ -1,3 +1,5 @@
1
1
  with_layout false do
2
2
  page "/spaces in file.html"
3
3
  end
4
+
5
+ config[:port] = 5555
File without changes
@@ -67,6 +67,14 @@ module Middleman
67
67
  end
68
68
  delegate :root_path, to: :"self.class"
69
69
 
70
+ # Which host preview should start on.
71
+ # @return [Fixnum]
72
+ config.define_setting :host, '0.0.0.0', 'The preview server host'
73
+
74
+ # Which port preview should start on.
75
+ # @return [Fixnum]
76
+ config.define_setting :port, 4567, 'The preview server port'
77
+
70
78
  # Name of the source directory
71
79
  # @return [String]
72
80
  config.define_setting :source, 'source', 'Name of the source directory'
@@ -178,7 +178,7 @@ module Middleman::Cli
178
178
  # @return [void]
179
179
  def execute!
180
180
  # Sort order, images, fonts, js/css and finally everything else.
181
- sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .webp .woff .otf .ttf .eot .js .css)
181
+ sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .webp .woff .woff2 .otf .ttf .eot .js .css)
182
182
 
183
183
  # Pre-request CSS to give Compass a chance to build sprites
184
184
  logger.debug '== Prerendering CSS'
@@ -34,10 +34,19 @@ module Middleman::Cli
34
34
 
35
35
  # TODO: get file watcher / reload! working in console
36
36
 
37
+ interact_with @app
38
+ end
39
+
40
+ private
41
+
42
+ # Start an interactive console in the context of the provided object.
43
+ # @param [Object] context
44
+ # @return [void]
45
+ def interact_with(context)
37
46
  IRB.setup nil
38
47
  IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
39
48
  require 'irb/ext/multi-irb'
40
- IRB.irb nil, @app
49
+ IRB.irb nil, context
41
50
  end
42
51
  end
43
52
  end
@@ -14,11 +14,9 @@ module Middleman::Cli
14
14
  method_option :host,
15
15
  type: :string,
16
16
  aliases: '-h',
17
- default: '0.0.0.0',
18
17
  desc: 'Bind to HOST address'
19
18
  method_option :port,
20
19
  aliases: '-p',
21
- default: '4567',
22
20
  desc: 'The port Middleman will listen on'
23
21
  method_option :verbose,
24
22
  type: :boolean,
@@ -4,6 +4,7 @@ require 'rack/file'
4
4
  require 'rack/lint'
5
5
  require 'rack/head'
6
6
 
7
+ require 'middleman-core/application'
7
8
  require 'middleman-core/util'
8
9
 
9
10
  module Middleman
@@ -5,8 +5,6 @@ require 'middleman-core/logger'
5
5
  # rubocop:disable GlobalVars
6
6
  module Middleman
7
7
  module PreviewServer
8
- DEFAULT_PORT = 4567
9
-
10
8
  class << self
11
9
  attr_reader :app, :host, :port
12
10
  delegate :logger, to: :app
@@ -15,8 +13,6 @@ module Middleman
15
13
  # @return [void]
16
14
  def start(opts={})
17
15
  @options = opts
18
- @host = @options[:host] || '0.0.0.0'
19
- @port = @options[:port] || DEFAULT_PORT
20
16
 
21
17
  mount_instance(new_app)
22
18
  logger.info "== The Middleman is standing watch at http://#{host}:#{port}"
@@ -92,6 +88,7 @@ module Middleman
92
88
 
93
89
  def new_app
94
90
  opts = @options.dup
91
+
95
92
  server = ::Middleman::Application.server
96
93
 
97
94
  # Add in the meta pages application
@@ -107,7 +104,14 @@ module Middleman
107
104
  )
108
105
 
109
106
  config[:environment] = opts[:environment].to_sym if opts[:environment]
107
+ config[:host] = opts[:host] if opts[:host]
108
+ config[:port] = opts[:port] if opts[:port]
110
109
  end
110
+
111
+ @host = @app.config[:host]
112
+ @port = @app.config[:port]
113
+
114
+ @app
111
115
  end
112
116
 
113
117
  def start_file_watcher
@@ -9,7 +9,9 @@ module Middleman
9
9
  tail = parts.pop
10
10
  is_index = (tail == app.index_file)
11
11
 
12
- return nil if is_index && parts.length < 1
12
+ if parts.empty?
13
+ return is_index ? nil : store.find_resource_by_path(app.index_file)
14
+ end
13
15
 
14
16
  test_expr = parts.join('\\/')
15
17
  # A makeshift for eponymous reverse-lookup
@@ -21,7 +21,7 @@
21
21
  <IfModule mod_headers.c>
22
22
  Header set X-UA-Compatible "IE=Edge,chrome=1"
23
23
  # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
24
- <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
24
+ <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|woff2|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
25
25
  Header unset X-UA-Compatible
26
26
  </FilesMatch>
27
27
  </IfModule>
@@ -70,7 +70,7 @@
70
70
  # subdomains like "subdomain.example.com".
71
71
 
72
72
  <IfModule mod_headers.c>
73
- <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
73
+ <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css)$">
74
74
  Header set Access-Control-Allow-Origin "*"
75
75
  </FilesMatch>
76
76
  </IfModule>
@@ -107,6 +107,7 @@ AddType application/vnd.ms-fontobject eot
107
107
  AddType application/x-font-ttf ttf ttc
108
108
  AddType font/opentype otf
109
109
  AddType application/x-font-woff woff
110
+ AddType application/font-woff2 woff2
110
111
 
111
112
  # Assorted types
112
113
  AddType image/x-icon ico
@@ -238,6 +239,7 @@ AddType text/vtt vtt
238
239
  ExpiresByType application/x-font-ttf "access plus 1 month"
239
240
  ExpiresByType font/opentype "access plus 1 month"
240
241
  ExpiresByType application/x-font-woff "access plus 1 month"
242
+ ExpiresByType application/font-woff2 "access plus 1 month"
241
243
  ExpiresByType image/svg+xml "access plus 1 month"
242
244
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
243
245
 
@@ -11,4 +11,4 @@ gem "middleman-livereload", "~> 3.1.0"
11
11
  gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
12
12
 
13
13
  # Windows does not come with time zone data
14
- gem "tzinfo-data", platforms: [:mswin, :mingw]
14
+ gem "tzinfo-data", platforms: [:mswin, :mingw, :jruby]
@@ -169,14 +169,14 @@ module Middleman
169
169
  if path_or_resource.is_a?(::Middleman::Sitemap::Resource)
170
170
  resource = path_or_resource
171
171
  resource_url = url
172
- elsif this_resource && uri.path
172
+ elsif this_resource && uri.path && !uri.host
173
173
  # Handle relative urls
174
174
  url_path = Pathname(uri.path)
175
175
  current_source_dir = Pathname('/' + this_resource.path).dirname
176
176
  url_path = current_source_dir.join(url_path) if url_path.relative?
177
177
  resource = app.sitemap.find_resource_by_path(url_path.to_s)
178
178
  resource_url = resource.url if resource
179
- elsif options[:find_resource] && uri.path
179
+ elsif options[:find_resource] && uri.path && !uri.host
180
180
  resource = app.sitemap.find_resource_by_path(uri.path)
181
181
  resource_url = resource.url if resource
182
182
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.3.10' unless const_defined?(:VERSION)
4
+ VERSION = '3.3.11' unless const_defined?(:VERSION)
5
5
  end
@@ -255,5 +255,18 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
255
255
  url = url_for(url, options)
256
256
  super
257
257
  end
258
+
259
+ # Modified Padrino image_tag so that it finds the paths for srcset
260
+ # using asset_path for the images listed in the srcset param
261
+ def image_tag(path, params={})
262
+ params.symbolize_keys!
263
+
264
+ if params.key?(:srcset)
265
+ images = params[:srcset].split(',').map {|size| (size.include?('//') ? size : asset_url("images/#{size.strip}")) }
266
+ params[:srcset] = images.join(', ')
267
+ end
268
+
269
+ super(path, params)
270
+ end
258
271
  end
259
272
  end
@@ -1,7 +1,7 @@
1
1
  require 'middleman-core/util'
2
2
 
3
3
  class Middleman::Extensions::AssetHash < ::Middleman::Extension
4
- option :exts, %w(.jpg .jpeg .png .gif .webp .js .css .otf .woff .eot .ttf .svg .svgz), 'List of extensions that get asset hashes appended to them.'
4
+ option :exts, %w(.jpg .jpeg .png .gif .webp .js .css .otf .woff .woff2 .eot .ttf .svg .svgz), 'List of extensions that get asset hashes appended to them.'
5
5
  option :ignore, [], 'Patterns to avoid adding asset hashes to'
6
6
 
7
7
  def initialize(app, options_hash={}, &block)
@@ -2,3 +2,4 @@ require 'middleman-core/load_paths'
2
2
  ::Middleman.setup_load_paths
3
3
 
4
4
  require 'middleman-core'
5
+ require 'middleman-core/application'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.10
4
+ version: 3.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-23 00:00:00.000000000 Z
13
+ date: 2015-04-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -224,6 +224,7 @@ files:
224
224
  - features/cli_init.feature
225
225
  - features/coffee-script.feature
226
226
  - features/compass-sprites.feature
227
+ - features/console.feature
227
228
  - features/content_for.feature
228
229
  - features/content_type.feature
229
230
  - features/current_page_request_path_backwards.feature
@@ -257,6 +258,7 @@ files:
257
258
  - features/i18n_preview.feature
258
259
  - features/ignore.feature
259
260
  - features/ignore_already_minified.feature
261
+ - features/image_srcset_paths.feature
260
262
  - features/implied_extensions.feature
261
263
  - features/instance_vars.feature
262
264
  - features/layouts_dir.feature
@@ -624,6 +626,8 @@ files:
624
626
  - fixtures/ignore-app/source/plain.html
625
627
  - fixtures/ignore-app/source/reports/another.html
626
628
  - fixtures/ignore-app/source/reports/index.html
629
+ - fixtures/image-srcset-paths-app/image-srcset-paths.html.erb
630
+ - fixtures/image-srcset-paths-app/images/blank.gif
627
631
  - fixtures/implied-extensions-app/config.rb
628
632
  - fixtures/implied-extensions-app/source/index.erb
629
633
  - fixtures/indexable-app/config.rb
@@ -917,6 +921,7 @@ files:
917
921
  - fixtures/stylus-preview-app/source/stylesheets/main2.css.styl
918
922
  - fixtures/stylus-preview-app/source/stylesheets/plain.css.styl
919
923
  - fixtures/traversal-app/config.rb
924
+ - fixtures/traversal-app/source/.htaccess
920
925
  - fixtures/traversal-app/source/directory-indexed.html.erb
921
926
  - fixtures/traversal-app/source/directory-indexed/sibling.html.erb
922
927
  - fixtures/traversal-app/source/directory-indexed/sibling2.html.erb
@@ -1273,7 +1278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1273
1278
  version: '0'
1274
1279
  requirements: []
1275
1280
  rubyforge_project:
1276
- rubygems_version: 2.4.3
1281
+ rubygems_version: 2.4.6
1277
1282
  signing_key:
1278
1283
  specification_version: 4
1279
1284
  summary: Hand-crafted frontend development
@@ -1295,6 +1300,7 @@ test_files:
1295
1300
  - features/cli_init.feature
1296
1301
  - features/coffee-script.feature
1297
1302
  - features/compass-sprites.feature
1303
+ - features/console.feature
1298
1304
  - features/content_for.feature
1299
1305
  - features/content_type.feature
1300
1306
  - features/current_page_request_path_backwards.feature
@@ -1328,6 +1334,7 @@ test_files:
1328
1334
  - features/i18n_preview.feature
1329
1335
  - features/ignore.feature
1330
1336
  - features/ignore_already_minified.feature
1337
+ - features/image_srcset_paths.feature
1331
1338
  - features/implied_extensions.feature
1332
1339
  - features/instance_vars.feature
1333
1340
  - features/layouts_dir.feature
@@ -1695,6 +1702,8 @@ test_files:
1695
1702
  - fixtures/ignore-app/source/plain.html
1696
1703
  - fixtures/ignore-app/source/reports/another.html
1697
1704
  - fixtures/ignore-app/source/reports/index.html
1705
+ - fixtures/image-srcset-paths-app/image-srcset-paths.html.erb
1706
+ - fixtures/image-srcset-paths-app/images/blank.gif
1698
1707
  - fixtures/implied-extensions-app/config.rb
1699
1708
  - fixtures/implied-extensions-app/source/index.erb
1700
1709
  - fixtures/indexable-app/config.rb
@@ -1988,6 +1997,7 @@ test_files:
1988
1997
  - fixtures/stylus-preview-app/source/stylesheets/main2.css.styl
1989
1998
  - fixtures/stylus-preview-app/source/stylesheets/plain.css.styl
1990
1999
  - fixtures/traversal-app/config.rb
2000
+ - fixtures/traversal-app/source/.htaccess
1991
2001
  - fixtures/traversal-app/source/directory-indexed.html.erb
1992
2002
  - fixtures/traversal-app/source/directory-indexed/sibling.html.erb
1993
2003
  - fixtures/traversal-app/source/directory-indexed/sibling2.html.erb