middleman-core 3.0.0.rc.2 → 3.0.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ Feature: Map special characters to automatically put files in a directory
2
+
3
+ Scenario: Building files with special character escape
4
+ Given a successfully built app at "automatic-directory-matcher-app"
5
+ When I cd to "build"
6
+ Then the following files should exist:
7
+ | root.html |
8
+ | root-plain.html |
9
+ | sub/sub.html |
10
+ | sub/sub-plain.html |
11
+ | sub/sub/sub.html |
12
+ | sub/sub/sub-plain.html |
13
+ Then the following files should not exist:
14
+ | sub--sub.html |
15
+ | sub--sub-plain.html |
16
+ | sub--sub--sub.html |
17
+ | sub--sub--sub-plain.html |
18
+
19
+ Scenario: Previewing files with special character escape
20
+ Given the Server is running at "automatic-directory-matcher-app"
21
+ When I go to "/root.html"
22
+ Then I should see "Root Erb"
23
+ When I go to "/root-plain.html"
24
+ Then I should see "Root Plain"
25
+ When I go to "/sub/sub.html"
26
+ Then I should see "Sub1 Erb"
27
+ When I go to "/sub/sub-plain.html"
28
+ Then I should see "Sub1 Plain"
29
+ When I go to "/sub/sub/sub.html"
30
+ Then I should see "Sub2 Erb"
31
+ When I go to "/sub/sub/sub-plain.html"
32
+ Then I should see "Sub2 Plain"
@@ -1,14 +1,36 @@
1
+ @encoding @travishatesme @wip
2
+
1
3
  Feature: Unicode filenames
2
4
  In order to support non-ASCII characters in filenames
3
5
 
4
- #Scenario: Build with files containing unicode characters in their name
5
- # Given a successfully built app at "unicode-filenames-app"
6
- # When I cd to "build"
7
- # Then the file "snowmen-rule-☃.html" should contain "☃"
6
+ Scenario: Build with files containing unicode characters in their name
7
+ Given a fixture app "empty-app"
8
+ And a file named "config.rb" with:
9
+ """
10
+ """
11
+ And a file named "source/snowmen-rule-☃.html" with:
12
+ """
13
+ Snowman!
14
+ <div style="text-align:center; font-size:4000%;">
15
+
16
+ </div>
17
+ """
18
+ And a successfully built app at "empty-app"
19
+ When I cd to "build"
20
+ Then the file "snowmen-rule-☃.html" should contain "☃"
8
21
 
9
22
  Scenario: Preview with files containing unicode characters in their name
10
- Given the Server is running at "unicode-filenames-app"
23
+ Given a fixture app "empty-app"
24
+ And a file named "config.rb" with:
25
+ """
26
+ """
27
+ And a file named "source/snowmen-rule-☃.html" with:
28
+ """
29
+ Snowman!
30
+ <div style="text-align:center; font-size:4000%;">
31
+
32
+ </div>
33
+ """
34
+ And the Server is running
11
35
  When I go to "/snowmen-rule-☃.html"
12
- # There seem to be encoding issues w/ the test framework so we can't check the content
13
- Then I should see "Snowman!"
14
-
36
+ Then I should see "Snowman!"
@@ -0,0 +1 @@
1
+ set :automatic_directory_matcher, "--"
@@ -42,7 +42,7 @@ module Middleman::Cli
42
42
 
43
43
  require 'find'
44
44
 
45
- @debugging = Middleman::Cli::Base.debugging
45
+ @debugging = Middleman::Cli::Base.respond_to?(:debugging) && Middleman::Cli::Base.debugging
46
46
  @had_errors = false
47
47
 
48
48
  self.class.shared_instance(options["verbose"])
@@ -56,7 +56,7 @@ module Middleman::Cli
56
56
  action GlobAction.new(self, opts)
57
57
 
58
58
  if @had_errors && !@debugging
59
- self.shell.say "There were errors during this build, re-run with --debug to see the full exception."
59
+ self.shell.say "There were errors during this build, re-run with --verbose to see the full exception."
60
60
  end
61
61
 
62
62
  exit(1) if @had_errors
@@ -268,7 +268,7 @@ class ::Thor::Actions::CreateFile
268
268
  if identical?
269
269
  say_status :identical, :blue
270
270
  else
271
- say_status :create, :green
271
+ say_status :update, :yellow
272
272
  block.call unless pretend?
273
273
  end
274
274
  end
@@ -22,12 +22,14 @@ module Middleman
22
22
  set :logging, true
23
23
  end
24
24
  end
25
+
26
+ port = options[:port] || DEFAULT_PORT
25
27
 
26
- puts "== The Middleman is standing watch on port #{options[:port]||4567}"
28
+ puts "== The Middleman is standing watch on port #{port}"
27
29
 
28
30
  @webrick ||= setup_webrick(
29
31
  options[:host] || "0.0.0.0",
30
- options[:port] || DEFAULT_PORT,
32
+ port,
31
33
  options[:debug] || false
32
34
  )
33
35
 
@@ -53,6 +55,10 @@ module Middleman
53
55
  # @return [void]
54
56
  def stop
55
57
  puts "== The Middleman is shutting down"
58
+ if @listener
59
+ @listener.stop
60
+ @listener = nil
61
+ end
56
62
  unmount_instance
57
63
  end
58
64
 
@@ -76,16 +82,18 @@ module Middleman
76
82
  # Watcher Library
77
83
  require "listen"
78
84
 
79
- listener = Listen.to(Dir.pwd, :relative_paths => true)
85
+ return if @listener
86
+
87
+ @listener = Listen.to(Dir.pwd, :relative_paths => true)
80
88
 
81
- listener.change do |modified, added, removed|
89
+ @listener.change do |modified, added, removed|
82
90
  added_and_modified = (modified + added)
83
91
 
84
- if added_and_modified.length > 0
92
+ unless added_and_modified.empty?
85
93
  # See if the changed file is config.rb or lib/*.rb
86
94
  if needs_to_reload?(added_and_modified)
87
95
  reload
88
- return listener.stop
96
+ return
89
97
  end
90
98
 
91
99
  # Otherwise forward to Middleman
@@ -94,11 +102,11 @@ module Middleman
94
102
  end
95
103
  end
96
104
 
97
- if removed.length > 0
105
+ unless removed.empty?
98
106
  # See if the changed file is config.rb or lib/*.rb
99
107
  if needs_to_reload?(removed)
100
108
  reload
101
- return listener.stop
109
+ return
102
110
  end
103
111
 
104
112
  # Otherwise forward to Middleman
@@ -109,7 +117,7 @@ module Middleman
109
117
  end
110
118
 
111
119
  # Don't block this thread
112
- listener.start(false)
120
+ @listener.start(false)
113
121
  end
114
122
 
115
123
  # Trap the interupt signal and shut down smoothly
@@ -19,6 +19,9 @@ module Middleman
19
19
  app.register Middleman::Sitemap::Extensions::Proxies
20
20
  app.register Middleman::Sitemap::Extensions::Ignores
21
21
 
22
+ # Set to automatically convert some characters into a directory
23
+ app.set :automatic_directory_matcher, nil
24
+
22
25
  # Setup callbacks which can exclude paths from the sitemap
23
26
  app.set :ignored_sitemap_matchers, {
24
27
  # dotfiles and folders in the root
@@ -144,7 +144,8 @@ module Middleman
144
144
  # just foo. Best for linking.
145
145
  # @return [String]
146
146
  def url
147
- ('/' + destination_path).sub(/\/#{Regexp.escape(app.index_file)}$/, '/')
147
+ File.join(app.respond_to?(:http_prefix) ? app.http_prefix : '/',
148
+ destination_path.sub(/\/#{Regexp.escape(app.index_file)}$/, '/'))
148
149
  end
149
150
  end
150
151
  end
@@ -174,6 +174,12 @@ module Middleman
174
174
  return false unless file.include?(prefix)
175
175
 
176
176
  path = file.sub(prefix, "")
177
+
178
+ # Replace a file name containing automatic_directory_matcher with a folder
179
+ unless @app.automatic_directory_matcher.nil?
180
+ path = path.gsub(@app.automatic_directory_matcher, "/")
181
+ end
182
+
177
183
  extensionless_path(path)
178
184
  end
179
185
 
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.0.0.rc.2' unless const_defined?(:VERSION)
4
+ VERSION = '3.0.0.rc.3' unless const_defined?(:VERSION)
5
5
  end
@@ -20,19 +20,19 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # Core
22
22
  s.add_dependency("bundler", ["~> 1.1"])
23
- s.add_dependency("rack", ["~> 1.4.0"])
23
+ s.add_dependency("rack", ["~> 1.4.1"])
24
24
  s.add_dependency("tilt", ["~> 1.3.1"])
25
25
 
26
26
  # Builder
27
27
  s.add_dependency("rack-test", ["~> 0.6.1"])
28
28
 
29
29
  # CLI
30
- s.add_dependency("thor", ["~> 0.14.3"])
30
+ s.add_dependency("thor", ["~> 0.15.4"])
31
31
 
32
32
  # Helpers
33
33
  s.add_dependency("activesupport", ["~> 3.2.6"])
34
34
 
35
35
  # Watcher
36
- s.add_dependency("listen", ["~> 0.4.5"])
36
+ s.add_dependency("listen", ["~> 0.4.7"])
37
37
  end
38
38
 
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.0.0.rc.2
4
+ version: 3.0.0.rc.3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-17 00:00:00.000000000 Z
13
+ date: 2012-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: 1.4.0
38
+ version: 1.4.1
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: 1.4.0
46
+ version: 1.4.1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: tilt
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +83,7 @@ dependencies:
83
83
  requirements:
84
84
  - - ~>
85
85
  - !ruby/object:Gem::Version
86
- version: 0.14.3
86
+ version: 0.15.4
87
87
  type: :runtime
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,7 +91,7 @@ dependencies:
91
91
  requirements:
92
92
  - - ~>
93
93
  - !ruby/object:Gem::Version
94
- version: 0.14.3
94
+ version: 0.15.4
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: activesupport
97
97
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +115,7 @@ dependencies:
115
115
  requirements:
116
116
  - - ~>
117
117
  - !ruby/object:Gem::Version
118
- version: 0.4.5
118
+ version: 0.4.7
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,7 +123,7 @@ dependencies:
123
123
  requirements:
124
124
  - - ~>
125
125
  - !ruby/object:Gem::Version
126
- version: 0.4.5
126
+ version: 0.4.7
127
127
  description: A static site generator. Provides dozens of templating languages (Haml,
128
128
  Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache
129
129
  busting, Yaml data (and more) an easy part of your development cycle.
@@ -140,6 +140,7 @@ files:
140
140
  - bin/middleman
141
141
  - features/3rd_party_cli.feature
142
142
  - features/auto_layout.feature
143
+ - features/automatic_directory_matcher.feature
143
144
  - features/builder.feature
144
145
  - features/chained_templates.feature
145
146
  - features/clean_build.feature
@@ -166,6 +167,13 @@ files:
166
167
  - features/support/env.rb
167
168
  - features/unicode_filenames.feature
168
169
  - features/wildcard_page_helper.feature
170
+ - fixtures/automatic-directory-matcher-app/config.rb
171
+ - fixtures/automatic-directory-matcher-app/source/root-plain.html
172
+ - fixtures/automatic-directory-matcher-app/source/root.html.erb
173
+ - fixtures/automatic-directory-matcher-app/source/sub--sub--sub-plain.html
174
+ - fixtures/automatic-directory-matcher-app/source/sub--sub--sub.html.erb
175
+ - fixtures/automatic-directory-matcher-app/source/sub--sub-plain.html
176
+ - fixtures/automatic-directory-matcher-app/source/sub--sub.html.erb
169
177
  - fixtures/basic-data-app/config.rb
170
178
  - fixtures/basic-data-app/data/test.yml
171
179
  - fixtures/basic-data-app/data/test2.json
@@ -335,8 +343,6 @@ files:
335
343
  - fixtures/traversal-app/source/sub/sibling2.html.erb
336
344
  - fixtures/traversal-app/source/sub/sub2/index.html.erb
337
345
  - fixtures/traversal-app/source/sub/sub3/deep.html.erb
338
- - fixtures/unicode-filenames-app/config.rb
339
- - fixtures/unicode-filenames-app/source/snowmen-rule-☃.html
340
346
  - fixtures/wildcard-app/config.rb
341
347
  - fixtures/wildcard-app/source/admin/index.html.erb
342
348
  - fixtures/wildcard-app/source/admin/page.html.erb
@@ -524,7 +530,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
524
530
  version: '0'
525
531
  segments:
526
532
  - 0
527
- hash: 1155091797610046415
533
+ hash: 4571590905911767496
528
534
  required_rubygems_version: !ruby/object:Gem::Requirement
529
535
  none: false
530
536
  requirements:
@@ -540,6 +546,7 @@ summary: Hand-crafted frontend development
540
546
  test_files:
541
547
  - features/3rd_party_cli.feature
542
548
  - features/auto_layout.feature
549
+ - features/automatic_directory_matcher.feature
543
550
  - features/builder.feature
544
551
  - features/chained_templates.feature
545
552
  - features/clean_build.feature
@@ -566,6 +573,13 @@ test_files:
566
573
  - features/support/env.rb
567
574
  - features/unicode_filenames.feature
568
575
  - features/wildcard_page_helper.feature
576
+ - fixtures/automatic-directory-matcher-app/config.rb
577
+ - fixtures/automatic-directory-matcher-app/source/root-plain.html
578
+ - fixtures/automatic-directory-matcher-app/source/root.html.erb
579
+ - fixtures/automatic-directory-matcher-app/source/sub--sub--sub-plain.html
580
+ - fixtures/automatic-directory-matcher-app/source/sub--sub--sub.html.erb
581
+ - fixtures/automatic-directory-matcher-app/source/sub--sub-plain.html
582
+ - fixtures/automatic-directory-matcher-app/source/sub--sub.html.erb
569
583
  - fixtures/basic-data-app/config.rb
570
584
  - fixtures/basic-data-app/data/test.yml
571
585
  - fixtures/basic-data-app/data/test2.json
@@ -735,8 +749,6 @@ test_files:
735
749
  - fixtures/traversal-app/source/sub/sibling2.html.erb
736
750
  - fixtures/traversal-app/source/sub/sub2/index.html.erb
737
751
  - fixtures/traversal-app/source/sub/sub3/deep.html.erb
738
- - fixtures/unicode-filenames-app/config.rb
739
- - fixtures/unicode-filenames-app/source/snowmen-rule-☃.html
740
752
  - fixtures/wildcard-app/config.rb
741
753
  - fixtures/wildcard-app/source/admin/index.html.erb
742
754
  - fixtures/wildcard-app/source/admin/page.html.erb
@@ -1 +0,0 @@
1
-
@@ -1,4 +0,0 @@
1
- Snowman!
2
- <div style="text-align:center; font-size:4000%;">
3
-
4
- </div>