middleman-core 3.3.2 → 3.3.3

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/features/helpers_select_tag.feature +6 -8
  3. data/lib/middleman-core.rb +1 -2
  4. data/lib/middleman-core/application.rb +10 -9
  5. data/lib/middleman-core/cli.rb +9 -13
  6. data/lib/middleman-core/cli/build.rb +26 -27
  7. data/lib/middleman-core/cli/bundler.rb +6 -7
  8. data/lib/middleman-core/cli/console.rb +10 -13
  9. data/lib/middleman-core/cli/extension.rb +2 -4
  10. data/lib/middleman-core/cli/init.rb +27 -28
  11. data/lib/middleman-core/cli/server.rb +43 -44
  12. data/lib/middleman-core/configuration.rb +13 -11
  13. data/lib/middleman-core/core_extensions/data.rb +21 -29
  14. data/lib/middleman-core/core_extensions/extensions.rb +8 -8
  15. data/lib/middleman-core/core_extensions/external_helpers.rb +3 -5
  16. data/lib/middleman-core/core_extensions/file_watcher.rb +7 -11
  17. data/lib/middleman-core/core_extensions/front_matter.rb +5 -6
  18. data/lib/middleman-core/core_extensions/rendering.rb +40 -30
  19. data/lib/middleman-core/core_extensions/request.rb +16 -19
  20. data/lib/middleman-core/core_extensions/routing.rb +37 -36
  21. data/lib/middleman-core/core_extensions/show_exceptions.rb +1 -5
  22. data/lib/middleman-core/extension.rb +14 -16
  23. data/lib/middleman-core/extensions.rb +4 -6
  24. data/lib/middleman-core/load_paths.rb +3 -6
  25. data/lib/middleman-core/logger.rb +1 -3
  26. data/lib/middleman-core/meta_pages.rb +11 -11
  27. data/lib/middleman-core/meta_pages/config_setting.rb +4 -4
  28. data/lib/middleman-core/meta_pages/sitemap_resource.rb +2 -2
  29. data/lib/middleman-core/meta_pages/sitemap_tree.rb +4 -4
  30. data/lib/middleman-core/preview_server.rb +12 -11
  31. data/lib/middleman-core/profiling.rb +6 -8
  32. data/lib/middleman-core/renderers/asciidoc.rb +12 -13
  33. data/lib/middleman-core/renderers/coffee_script.rb +2 -4
  34. data/lib/middleman-core/renderers/erb.rb +3 -4
  35. data/lib/middleman-core/renderers/haml.rb +2 -4
  36. data/lib/middleman-core/renderers/kramdown.rb +3 -4
  37. data/lib/middleman-core/renderers/less.rb +3 -9
  38. data/lib/middleman-core/renderers/liquid.rb +4 -8
  39. data/lib/middleman-core/renderers/markdown.rb +7 -11
  40. data/lib/middleman-core/renderers/redcarpet.rb +14 -16
  41. data/lib/middleman-core/renderers/sass.rb +36 -15
  42. data/lib/middleman-core/renderers/slim.rb +7 -10
  43. data/lib/middleman-core/renderers/stylus.rb +2 -6
  44. data/lib/middleman-core/sitemap.rb +6 -13
  45. data/lib/middleman-core/sitemap/extensions/ignores.rb +4 -10
  46. data/lib/middleman-core/sitemap/extensions/on_disk.rb +3 -7
  47. data/lib/middleman-core/sitemap/extensions/proxies.rb +7 -12
  48. data/lib/middleman-core/sitemap/extensions/redirects.rb +7 -15
  49. data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +7 -15
  50. data/lib/middleman-core/sitemap/extensions/traversal.rb +4 -7
  51. data/lib/middleman-core/sitemap/queryable.rb +22 -27
  52. data/lib/middleman-core/sitemap/resource.rb +13 -25
  53. data/lib/middleman-core/sitemap/store.rb +11 -15
  54. data/lib/middleman-core/templates.rb +9 -12
  55. data/lib/middleman-core/templates/default.rb +6 -7
  56. data/lib/middleman-core/templates/empty.rb +0 -1
  57. data/lib/middleman-core/templates/extension/Gemfile +1 -1
  58. data/lib/middleman-core/templates/extension/Rakefile +2 -2
  59. data/lib/middleman-core/templates/extension/lib/lib.rb +0 -1
  60. data/lib/middleman-core/templates/html5.rb +6 -7
  61. data/lib/middleman-core/templates/local.rb +1 -2
  62. data/lib/middleman-core/templates/mobile.rb +3 -4
  63. data/lib/middleman-core/templates/shared/config.ru +1 -1
  64. data/lib/middleman-core/util.rb +5 -6
  65. data/lib/middleman-core/version.rb +1 -1
  66. data/lib/middleman-more/core_extensions/compass.rb +0 -1
  67. data/lib/middleman-more/core_extensions/default_helpers.rb +25 -16
  68. data/lib/middleman-more/core_extensions/i18n.rb +24 -23
  69. data/lib/middleman-more/extensions/asset_hash.rb +4 -6
  70. data/lib/middleman-more/extensions/asset_host.rb +1 -1
  71. data/lib/middleman-more/extensions/automatic_alt_tags.rb +2 -3
  72. data/lib/middleman-more/extensions/automatic_image_sizes.rb +4 -5
  73. data/lib/middleman-more/extensions/cache_buster.rb +0 -1
  74. data/lib/middleman-more/extensions/gzip.rb +1 -1
  75. data/lib/middleman-more/extensions/lorem.rb +8 -8
  76. data/lib/middleman-more/extensions/minify_css.rb +9 -8
  77. data/lib/middleman-more/extensions/minify_javascript.rb +5 -6
  78. data/lib/middleman-more/extensions/relative_assets.rb +0 -1
  79. data/lib/middleman-more/templates/smacss.rb +6 -7
  80. data/middleman-core.gemspec +1 -1
  81. metadata +5 -5
@@ -1,6 +1,5 @@
1
1
  # The Cache Buster extension
2
2
  class Middleman::Extensions::CacheBuster < ::Middleman::Extension
3
-
4
3
  def initialize(app, options_hash={}, &block)
5
4
  super
6
5
 
@@ -35,7 +35,7 @@ class Middleman::Extensions::Gzip < ::Middleman::Extension
35
35
 
36
36
  # Farm out gzip tasks to threads and put the results in in_queue
37
37
  out_queue = Queue.new
38
- threads = num_threads.times.map do
38
+ num_threads.times.each do
39
39
  Thread.new do
40
40
  while path = in_queue.pop
41
41
  out_queue << gzip_file(path.to_s)
@@ -94,11 +94,11 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension
94
94
  # Get a placeholder date
95
95
  # @param [String] fmt
96
96
  # @return [String]
97
- def date(fmt = '%a %b %d, %Y')
97
+ def date(fmt='%a %b %d, %Y')
98
98
  y = rand(20) + 1990
99
99
  m = rand(12) + 1
100
100
  d = rand(31) + 1
101
- Time.local(y,m,d).strftime(fmt)
101
+ Time.local(y, m, d).strftime(fmt)
102
102
  end
103
103
 
104
104
  # Get a placeholder name
@@ -125,16 +125,16 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension
125
125
  # Via http://www.kevadamson.com/talking-of-design/article/140-alternative-characters-to-lorem-ipsum
126
126
  # @return [String]
127
127
  def tweet
128
- tweets = [ 'Far away, in a forest next to a river beneath the mountains, there lived a small purple otter called Philip. Philip likes sausages. The End.',
129
- 'He liked the quality sausages from Marks & Spencer but due to the recession he had been forced to shop in a less desirable supermarket. End.',
130
- 'He awoke one day to find his pile of sausages missing. Roger the greedy boar with human eyes, had skateboarded into the forest & eaten them!']
128
+ tweets = ['Far away, in a forest next to a river beneath the mountains, there lived a small purple otter called Philip. Philip likes sausages. The End.',
129
+ 'He liked the quality sausages from Marks & Spencer but due to the recession he had been forced to shop in a less desirable supermarket. End.',
130
+ 'He awoke one day to find his pile of sausages missing. Roger the greedy boar with human eyes, had skateboarded into the forest & eaten them!']
131
131
  tweets[rand(tweets.size)]
132
132
  end
133
133
 
134
134
  # Get a placeholder email address
135
135
  # @return [String]
136
136
  def email
137
- delimiters = [ '_', '-', '' ]
137
+ delimiters = ['_', '-', '']
138
138
  domains = %w(gmail.com yahoo.com hotmail.com email.com live.com me.com mac.com aol.com fastmail.com mail.com)
139
139
  username = name.gsub(/[^\w]/, delimiters[rand(delimiters.size)])
140
140
  "#{username}@#{domains[rand(domains.size)]}".downcase
@@ -147,7 +147,7 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension
147
147
  def image(size, options={})
148
148
  domain = options[:domain] || 'http://placehold.it'
149
149
  src = "#{domain}/#{size}"
150
- hex = %w[a b c d e f 0 1 2 3 4 5 6 7 8 9]
150
+ hex = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)
151
151
  background_color = options[:background_color]
152
152
  color = options[:color]
153
153
 
@@ -159,7 +159,7 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension
159
159
  src << "/#{background_color.sub(/^#/, '')}" if background_color
160
160
  src << '/ccc' if background_color.nil? && color
161
161
  src << "/#{color.sub(/^#/, '')}" if color
162
- src << "&text=#{Rack::Utils::escape(options[:text])}" if options[:text]
162
+ src << "&text=#{Rack::Utils.escape(options[:text])}" if options[:text]
163
163
 
164
164
  src
165
165
  end
@@ -14,15 +14,15 @@ class Middleman::Extensions::MinifyCss < ::Middleman::Extension
14
14
  chosen_compressor = app.config[:css_compressor] || options[:compressor] || SassCompressor
15
15
 
16
16
  # Setup Rack middleware to minify CSS
17
- app.use Rack, :compressor => chosen_compressor,
18
- :ignore => Array(options[:ignore]) + [/\.min\./],
19
- :inline => options[:inline]
17
+ app.use Rack, compressor: chosen_compressor,
18
+ ignore: Array(options[:ignore]) + [/\.min\./],
19
+ inline: options[:inline]
20
20
  end
21
21
 
22
22
  class SassCompressor
23
- def self.compress(style, options = {})
23
+ def self.compress(style, options={})
24
24
  root_node = ::Sass::SCSS::CssParser.new(style, 'middleman-css-input', 1).parse
25
- root_node.options = { :style => :compressed }
25
+ root_node.options = options.merge(style: :compressed)
26
26
  root_node.render.strip
27
27
  end
28
28
  end
@@ -49,7 +49,7 @@ class Middleman::Extensions::MinifyCss < ::Middleman::Extension
49
49
 
50
50
  if inline_html_content?(env['PATH_INFO'])
51
51
  minified = ::Middleman::Util.extract_response_text(response)
52
- minified.gsub!(INLINE_CSS_REGEX) do |match|
52
+ minified.gsub!(INLINE_CSS_REGEX) do
53
53
  $1 << @compressor.compress($2) << $3
54
54
  end
55
55
 
@@ -65,13 +65,14 @@ class Middleman::Extensions::MinifyCss < ::Middleman::Extension
65
65
  [status, headers, response]
66
66
  end
67
67
 
68
- private
68
+ private
69
+
69
70
  def inline_html_content?(path)
70
71
  (path.end_with?('.html') || path.end_with?('.php')) && @inline
71
72
  end
72
73
 
73
74
  def standalone_css_content?(path)
74
- path.end_with?('.css') && @ignore.none? {|ignore| Middleman::Util.path_match(ignore, path) }
75
+ path.end_with?('.css') && @ignore.none? { |ignore| Middleman::Util.path_match(ignore, path) }
75
76
  end
76
77
  end
77
78
  end
@@ -17,14 +17,13 @@ class Middleman::Extensions::MinifyJavascript < ::Middleman::Extension
17
17
  end
18
18
 
19
19
  # Setup Rack middleware to minify CSS
20
- app.use Rack, :compressor => chosen_compressor,
21
- :ignore => Array(options[:ignore]) + [/\.min\./],
22
- :inline => options[:inline]
20
+ app.use Rack, compressor: chosen_compressor,
21
+ ignore: Array(options[:ignore]) + [/\.min\./],
22
+ inline: options[:inline]
23
23
  end
24
24
 
25
25
  # Rack middleware to look for JS and compress it
26
26
  class Rack
27
-
28
27
  # Init
29
28
  # @param [Class] app
30
29
  # @param [Hash] options
@@ -51,7 +50,7 @@ class Middleman::Extensions::MinifyJavascript < ::Middleman::Extension
51
50
 
52
51
  headers['Content-Length'] = ::Rack::Utils.bytesize(minified).to_s
53
52
  response = [minified]
54
- elsif path.end_with?('.js') && @ignore.none? {|ignore| Middleman::Util.path_match(ignore, path) }
53
+ elsif path.end_with?('.js') && @ignore.none? { |ignore| Middleman::Util.path_match(ignore, path) }
55
54
  uncompressed_source = ::Middleman::Util.extract_response_text(response)
56
55
  minified = @compressor.compress(uncompressed_source)
57
56
 
@@ -65,7 +64,7 @@ class Middleman::Extensions::MinifyJavascript < ::Middleman::Extension
65
64
  [status, headers, response]
66
65
  end
67
66
 
68
- private
67
+ private
69
68
 
70
69
  def minify_inline_content(uncompressed_source)
71
70
  uncompressed_source.gsub(/(<script[^>]*>\s*(?:\/\/(?:(?:<!--)|(?:<!\[CDATA\[))\n)?)(.*?)((?:(?:\n\s*)?\/\/(?:(?:-->)|(?:\]\]>)))?\s*<\/script>)/m) do |match|
@@ -1,6 +1,5 @@
1
1
  # Relative Assets extension
2
2
  class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
3
-
4
3
  def initialize(app, options_hash={}, &block)
5
4
  super
6
5
 
@@ -1,15 +1,14 @@
1
1
  # SMACSS
2
2
  class Middleman::Templates::Smacss < Middleman::Templates::Base
3
-
4
3
  class_option 'css_dir',
5
- :default => 'stylesheets',
6
- :desc => 'The path to the css files'
4
+ default: 'stylesheets',
5
+ desc: 'The path to the css files'
7
6
  class_option 'js_dir',
8
- :default => 'javascripts',
9
- :desc => 'The path to the javascript files'
7
+ default: 'javascripts',
8
+ desc: 'The path to the javascript files'
10
9
  class_option 'images_dir',
11
- :default => 'images',
12
- :desc => 'The path to the image files'
10
+ default: 'images',
11
+ desc: 'The path to the image files'
13
12
 
14
13
  # Template files are relative to this file
15
14
  # @return [String]
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency("thor", [">= 0.15.2", "< 2.0"])
33
33
 
34
34
  # Helpers
35
- s.add_dependency("activesupport", ["~> 4.0.1"])
35
+ s.add_dependency("activesupport", ["~> 4.1.0"])
36
36
  s.add_dependency("padrino-helpers", ["~> 0.12.1"])
37
37
 
38
38
  # Watcher
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.2
4
+ version: 3.3.3
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: 2014-04-07 00:00:00.000000000 Z
13
+ date: 2014-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - ~>
136
136
  - !ruby/object:Gem::Version
137
- version: 4.0.1
137
+ version: 4.1.0
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ~>
143
143
  - !ruby/object:Gem::Version
144
- version: 4.0.1
144
+ version: 4.1.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: padrino-helpers
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -1234,7 +1234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1234
1234
  version: '0'
1235
1235
  requirements: []
1236
1236
  rubyforge_project:
1237
- rubygems_version: 2.1.11
1237
+ rubygems_version: 2.2.2
1238
1238
  signing_key:
1239
1239
  specification_version: 4
1240
1240
  summary: Hand-crafted frontend development