middleman-cli 4.4.0 → 5.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/middleman +8 -11
- data/lib/middleman-cli.rb +1 -3
- data/lib/middleman-cli/build.rb +45 -10
- data/lib/middleman-cli/extension.rb +0 -1
- data/lib/middleman-cli/init.rb +53 -34
- data/lib/middleman-cli/templates/extension/Gemfile +1 -1
- data/lib/middleman-cli/templates/extension/Rakefile +1 -1
- data/lib/middleman-cli/templates/extension/gemspec +1 -2
- data/lib/middleman-cli/templates/extension/lib/lib.rb +1 -1
- data/lib/middleman-cli/templates/extension/lib/lib/extension.rb +1 -1
- data/middleman-cli.gemspec +3 -4
- metadata +8 -28
- data/features/cli_extension.feature +0 -14
- data/features/cli_init.feature +0 -92
- data/features/preview_server-hook.feature +0 -17
- data/features/preview_server.feature +0 -535
- data/features/support/env.rb +0 -13
- data/fixtures/preview-server-app/bin/dns_server.rb +0 -33
- data/fixtures/preview-server-app/config.rb +0 -0
- data/fixtures/preview-server-app/source/index.html.erb +0 -1
- data/fixtures/preview-server-app/source/layout.erb +0 -9
- data/fixtures/preview-server-app/source/layouts/custom.erb +0 -8
- data/fixtures/preview-server-app/source/real.html +0 -1
- data/fixtures/preview-server-app/source/real/index.html.erb +0 -5
- data/fixtures/preview-server-app/source/should_be_ignored.html +0 -1
- data/fixtures/preview-server-app/source/should_be_ignored2.html +0 -1
- data/fixtures/preview-server-app/source/should_be_ignored3.html +0 -1
- data/fixtures/preview-server-app/source/static.html +0 -1
- data/fixtures/preview-server-hook-app/config.rb +0 -19
- data/fixtures/preview-server-hook-app/source/index.html.erb +0 -9
- data/spec/middleman/.gitkeep +0 -1
- data/spec/spec_helper.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19953457367b99c42c2eabb63a759d447fd652b18baef40c0b1f85b37bca20ca
|
4
|
+
data.tar.gz: 62e4b6c8ab48aa2e560f43441cbd9cfc7c82d020d017628f6f7ecd1a8fd73457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77c8d219e000a0239f8af2ae6447c11e8636e0907116a563a82a36c301a18f7f140e1fa55e494c44a6f004208c3ff300c6feb0e1e01293ff6a9fa5a8cec0a5ec
|
7
|
+
data.tar.gz: d88dcf0a57b1ddb76d5af0735f18b951b52926d61f8d875770b6b4f785deef449ab64eb014eb58c17f85f0b76dd781c4cca85153b50e97c66b956c2548560dc9
|
data/bin/middleman
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'middleman-core/profiling'
|
4
|
-
if ARGV.include? '--profile'
|
5
|
-
Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new
|
6
|
-
end
|
7
|
-
# Middleman::Profiling.start
|
4
|
+
Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new if ARGV.include? '--profile'
|
8
5
|
|
9
|
-
require
|
6
|
+
require 'middleman-core/load_paths'
|
10
7
|
Middleman.setup_load_paths
|
11
8
|
|
12
9
|
require 'dotenv'
|
@@ -35,19 +32,16 @@ module Middleman::Cli
|
|
35
32
|
end
|
36
33
|
end
|
37
34
|
|
38
|
-
require
|
35
|
+
require 'middleman-cli'
|
39
36
|
|
40
37
|
# Change directory to the root
|
41
|
-
Dir.chdir(ENV[
|
38
|
+
Dir.chdir(ENV['MM_ROOT']) if ENV['MM_ROOT']
|
42
39
|
|
43
40
|
# Default command is server
|
44
|
-
if ARGV[0] != 'help' && (ARGV.
|
45
|
-
ARGV.unshift('server')
|
46
|
-
end
|
41
|
+
ARGV.unshift('server') if ARGV[0] != 'help' && (ARGV.empty? || ARGV.first.include?('-'))
|
47
42
|
|
48
43
|
::Middleman::Logger.singleton(3)
|
49
44
|
::Middleman::Cli.config = ::Middleman::Application.new do
|
50
|
-
#
|
51
45
|
config[:environment] = (ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development').to_sym
|
52
46
|
config[:mode] = :config
|
53
47
|
config[:exit_before_ready] = true
|
@@ -66,5 +60,8 @@ require 'middleman-cli/build'
|
|
66
60
|
require 'middleman-cli/console'
|
67
61
|
require 'middleman-cli/config'
|
68
62
|
|
63
|
+
# Support NO_COLOR: https://no-color.org
|
64
|
+
ENV['THOR_SHELL'] = 'Basic' if ENV['NO_COLOR']
|
65
|
+
|
69
66
|
# Start the CLI
|
70
67
|
Middleman::Cli::Base.start(ARGV)
|
data/lib/middleman-cli.rb
CHANGED
data/lib/middleman-cli/build.rb
CHANGED
@@ -40,15 +40,39 @@ module Middleman::Cli
|
|
40
40
|
type: :boolean,
|
41
41
|
default: false,
|
42
42
|
desc: 'Generate profiling report for the build'
|
43
|
+
class_option :dry_run,
|
44
|
+
type: :boolean,
|
45
|
+
default: false,
|
46
|
+
desc: 'Skip writing output files'
|
47
|
+
class_option :track_dependencies,
|
48
|
+
type: :boolean,
|
49
|
+
default: false,
|
50
|
+
desc: 'Track file dependencies'
|
51
|
+
class_option :data_collection_depth,
|
52
|
+
type: :numeric,
|
53
|
+
default: ::Float::INFINITY,
|
54
|
+
desc: 'How deep to recurse into data structures when tracking changes.'
|
55
|
+
class_option :visualize_graph,
|
56
|
+
type: :boolean,
|
57
|
+
default: false,
|
58
|
+
desc: 'Generate a visual of the dependency graph'
|
59
|
+
class_option :only_changed,
|
60
|
+
type: :boolean,
|
61
|
+
default: false,
|
62
|
+
desc: 'Only build changed files'
|
63
|
+
class_option :missing_and_changed,
|
64
|
+
type: :boolean,
|
65
|
+
default: false,
|
66
|
+
desc: 'Only build changed files or files missing from build folder'
|
43
67
|
|
44
68
|
Middleman::Cli.import_config(self)
|
45
69
|
|
46
70
|
# Core build Thor command
|
47
71
|
# @return [void]
|
48
72
|
def build
|
49
|
-
|
50
|
-
|
51
|
-
|
73
|
+
root = ENV['MM_ROOT'] || Dir.pwd
|
74
|
+
|
75
|
+
raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?' unless File.exist?(File.join(root, 'config.rb'))
|
52
76
|
|
53
77
|
require 'middleman-core'
|
54
78
|
require 'middleman-core/logger'
|
@@ -64,18 +88,29 @@ module Middleman::Cli
|
|
64
88
|
::Middleman::Logger.singleton(verbose, instrument)
|
65
89
|
|
66
90
|
::Middleman::Util.instrument 'builder.setup' do
|
91
|
+
missing_and_changed = !options['only_changed'] && options['missing_and_changed']
|
92
|
+
should_track_dependencies = options['only_changed'] || missing_and_changed || options['track_dependencies']
|
93
|
+
data_collection_depth = options['data_collection_depth']
|
94
|
+
|
67
95
|
@app = ::Middleman::Application.new do
|
68
96
|
config[:mode] = :build
|
69
97
|
config[:show_exceptions] = false
|
70
98
|
config[:cli_options] = cli_options.each_with_object({}) do |(k, v), sum|
|
71
99
|
sum[k] = v
|
72
100
|
end
|
101
|
+
config[:track_data_access] = should_track_dependencies
|
102
|
+
config[:data_collection_depth] = data_collection_depth
|
73
103
|
end
|
74
104
|
|
75
105
|
builder = Middleman::Builder.new(@app,
|
76
106
|
glob: options['glob'],
|
107
|
+
dry_run: options['dry_run'],
|
77
108
|
clean: options['clean'],
|
78
|
-
parallel: options['parallel']
|
109
|
+
parallel: options['parallel'],
|
110
|
+
only_changed: options['only_changed'],
|
111
|
+
missing_and_changed: missing_and_changed,
|
112
|
+
track_dependencies: should_track_dependencies,
|
113
|
+
visualize_graph: options['visualize_graph'])
|
79
114
|
builder.thor = self
|
80
115
|
builder.on_build_event(&method(:on_event))
|
81
116
|
end
|
@@ -83,12 +118,10 @@ module Middleman::Cli
|
|
83
118
|
::Middleman::Util.instrument 'builder.run' do
|
84
119
|
if builder.run!
|
85
120
|
clean_directories! if options['clean']
|
86
|
-
|
121
|
+
puts 'Project built successfully.'
|
87
122
|
else
|
88
123
|
msg = 'There were errors during this build'
|
89
|
-
unless options['verbose']
|
90
|
-
msg << ', re-run with `middleman build --verbose` to see the full exception.'
|
91
|
-
end
|
124
|
+
msg << ', re-run with `middleman build --verbose` to see the full exception.' unless options['verbose']
|
92
125
|
shell.say msg, :red
|
93
126
|
|
94
127
|
exit(1)
|
@@ -100,10 +133,10 @@ module Middleman::Cli
|
|
100
133
|
|
101
134
|
# Handles incoming events from the builder.
|
102
135
|
# @param [Symbol] event_type The type of event.
|
103
|
-
# @param [String]
|
136
|
+
# @param [String] target The event contents.
|
104
137
|
# @param [String] extra The extra information.
|
105
138
|
# @return [void]
|
106
|
-
def on_event(event_type, target, extra=nil)
|
139
|
+
def on_event(event_type, target, extra = nil)
|
107
140
|
case event_type
|
108
141
|
when :error
|
109
142
|
say_status :error, target, :red
|
@@ -116,6 +149,8 @@ module Middleman::Cli
|
|
116
149
|
say_status :create, target, :green
|
117
150
|
when :identical
|
118
151
|
say_status :identical, target, :blue
|
152
|
+
when :skipped
|
153
|
+
say_status :skipped, target, :blue
|
119
154
|
when :updated
|
120
155
|
say_status :updated, target, :yellow
|
121
156
|
else
|
@@ -24,7 +24,6 @@ module Middleman::Cli
|
|
24
24
|
class_option :git, type: :boolean, default: true
|
25
25
|
|
26
26
|
# The extension task
|
27
|
-
# @param [String] name
|
28
27
|
def extension
|
29
28
|
copy_file 'extension/gitignore', File.join(name, '.gitignore') unless options[:'skip-git']
|
30
29
|
template 'extension/Rakefile', File.join(name, 'Rakefile')
|
data/lib/middleman-cli/init.rb
CHANGED
@@ -22,6 +22,10 @@ module Middleman::Cli
|
|
22
22
|
default: false,
|
23
23
|
desc: 'Skip bundle install'
|
24
24
|
|
25
|
+
class_option 'bundle-path',
|
26
|
+
type: :string,
|
27
|
+
desc: 'Use specified bundle path'
|
28
|
+
|
25
29
|
# The init task
|
26
30
|
def init
|
27
31
|
require 'fileutils'
|
@@ -35,38 +39,29 @@ module Middleman::Cli
|
|
35
39
|
end
|
36
40
|
|
37
41
|
repo_path, repo_branch = if shortname?(options[:template])
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
dir = Dir.mktmpdir
|
42
|
+
require 'open-uri'
|
43
|
+
require 'json'
|
44
|
+
|
45
|
+
api = 'https://directory.middlemanapp.com/api'
|
46
|
+
uri = ::URI.parse("#{api}/#{options[:template]}.json")
|
47
|
+
|
48
|
+
begin
|
49
|
+
data = ::JSON.parse(uri.read)
|
50
|
+
is_local_dir = false
|
51
|
+
data['links']['github'].split('#')
|
52
|
+
rescue ::OpenURI::HTTPError
|
53
|
+
say "Template `#{options[:template]}` not found in Middleman Directory."
|
54
|
+
say 'Did you mean to use a full `user/repo` path?'
|
55
|
+
exit 1
|
56
|
+
end
|
57
|
+
else
|
58
|
+
repo_name, repo_branch = options[:template].split('#')
|
59
|
+
repo_path, is_local_dir = repository_path(repo_name)
|
60
|
+
[repo_path, repo_branch]
|
61
|
+
end
|
59
62
|
|
60
63
|
begin
|
61
|
-
|
62
|
-
|
63
|
-
git_path = "#{branch_cmd}#{repo_path}"
|
64
|
-
run("#{GIT_CMD} clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
|
65
|
-
|
66
|
-
unless $?.success?
|
67
|
-
say "Git clone command failed. Make sure git repository exists: #{git_path}", :red
|
68
|
-
exit 1
|
69
|
-
end
|
64
|
+
dir = is_local_dir ? repo_path : clone_repository(repo_path, repo_branch)
|
70
65
|
|
71
66
|
inside(target) do
|
72
67
|
thorfile = File.join(dir, 'Thorfile')
|
@@ -80,10 +75,11 @@ module Middleman::Cli
|
|
80
75
|
directory dir, '.', exclude_pattern: /\.git\/|\.gitignore$/
|
81
76
|
end
|
82
77
|
|
83
|
-
|
78
|
+
bundle_args = options[:'bundle-path'] ? " --path=#{options[:'bundle-path']}" : ''
|
79
|
+
run("bundle install#{bundle_args}") unless ENV['TEST'] || options[:'skip-bundle']
|
84
80
|
end
|
85
81
|
ensure
|
86
|
-
FileUtils.remove_entry(dir) if File.directory?(dir)
|
82
|
+
FileUtils.remove_entry(dir) if !is_local_dir && File.directory?(dir)
|
87
83
|
end
|
88
84
|
end
|
89
85
|
|
@@ -92,6 +88,7 @@ module Middleman::Cli
|
|
92
88
|
# Copied from Bundler
|
93
89
|
def git_present?
|
94
90
|
return @git_present if defined?(@git_present)
|
91
|
+
|
95
92
|
@git_present = which(GIT_CMD) || which('git.exe')
|
96
93
|
end
|
97
94
|
|
@@ -112,8 +109,30 @@ module Middleman::Cli
|
|
112
109
|
repo.split('/').length == 1
|
113
110
|
end
|
114
111
|
|
115
|
-
def repository_path(
|
116
|
-
|
112
|
+
def repository_path(repo_name)
|
113
|
+
if repo_name.include?('://') || /^[^@]+@[^:]+:.+/ =~ repo_name
|
114
|
+
repo_name
|
115
|
+
elsif (repo_path = Pathname(repo_name)).directory? && repo_path.absolute?
|
116
|
+
[repo_name, true]
|
117
|
+
else
|
118
|
+
"https://github.com/#{repo_name}.git"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def clone_repository(repo_path, repo_branch)
|
123
|
+
dir = Dir.mktmpdir
|
124
|
+
|
125
|
+
branch_cmd = repo_branch ? "-b #{repo_branch} " : ''
|
126
|
+
|
127
|
+
git_path = "#{branch_cmd}#{repo_path}"
|
128
|
+
run("#{GIT_CMD} clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
|
129
|
+
|
130
|
+
unless $CHILD_STATUS.success?
|
131
|
+
say "Git clone command failed. Make sure git repository exists: #{git_path}", :red
|
132
|
+
exit 1
|
133
|
+
end
|
134
|
+
|
135
|
+
dir
|
117
136
|
end
|
118
137
|
|
119
138
|
# Add to CLI
|
@@ -4,7 +4,7 @@ Bundler::GemHelper.install_tasks
|
|
4
4
|
require 'cucumber/rake/task'
|
5
5
|
|
6
6
|
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
-
t.cucumber_opts = '--color --tags
|
7
|
+
t.cucumber_opts = '--fail-fast --color --tags "not @wip" --strict'
|
8
8
|
end
|
9
9
|
|
10
10
|
require 'rake/clean'
|
@@ -11,8 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
# s.summary = %q{A short summary of your extension}
|
12
12
|
# s.description = %q{A longer description of your extension}
|
13
13
|
|
14
|
-
s.files
|
15
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(fixtures|features|spec)/}) }
|
16
15
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
16
|
s.require_paths = ["lib"]
|
18
17
|
|
@@ -5,7 +5,7 @@ require 'middleman-core'
|
|
5
5
|
class MyExtension < ::Middleman::Extension
|
6
6
|
option :my_option, 'default', 'An example option'
|
7
7
|
|
8
|
-
def initialize(app,
|
8
|
+
def initialize(app, _options_hash = ::Middleman::EMPTY_HASH, &block)
|
9
9
|
# Call super to build options from the options_hash
|
10
10
|
super
|
11
11
|
|
data/middleman-cli.gemspec
CHANGED
@@ -11,13 +11,12 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = ['me@tdreyno.com', 'ben@benhollis.net']
|
12
12
|
s.homepage = 'http://middlemanapp.com'
|
13
13
|
s.summary = 'Hand-crafted frontend development'
|
14
|
-
s.description = 'A static site generator. Provides dozens of templating languages (Haml, Sass,
|
14
|
+
s.description = 'A static site generator. Provides dozens of templating languages (Haml, Sass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle.'
|
15
15
|
|
16
|
-
s.files
|
17
|
-
s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
|
16
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(fixtures|features|spec)/}) }
|
18
17
|
s.executable = 'middleman'
|
19
18
|
s.require_path = 'lib'
|
20
|
-
s.required_ruby_version = '>= 2.
|
19
|
+
s.required_ruby_version = '>= 2.3.0'
|
21
20
|
|
22
21
|
# CLI
|
23
22
|
s.add_dependency('thor', ['>= 0.17.0', '< 2.0'])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -32,8 +32,8 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
description: A static site generator. Provides dozens of templating languages (Haml,
|
35
|
-
Sass,
|
36
|
-
|
35
|
+
Sass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting,
|
36
|
+
Yaml data (and more) an easy part of your development cycle.
|
37
37
|
email:
|
38
38
|
- me@tdreyno.com
|
39
39
|
- ben@benhollis.net
|
@@ -47,24 +47,6 @@ files:
|
|
47
47
|
- ".yardopts"
|
48
48
|
- Rakefile
|
49
49
|
- bin/middleman
|
50
|
-
- features/cli_extension.feature
|
51
|
-
- features/cli_init.feature
|
52
|
-
- features/preview_server-hook.feature
|
53
|
-
- features/preview_server.feature
|
54
|
-
- features/support/env.rb
|
55
|
-
- fixtures/preview-server-app/bin/dns_server.rb
|
56
|
-
- fixtures/preview-server-app/config.rb
|
57
|
-
- fixtures/preview-server-app/source/index.html.erb
|
58
|
-
- fixtures/preview-server-app/source/layout.erb
|
59
|
-
- fixtures/preview-server-app/source/layouts/custom.erb
|
60
|
-
- fixtures/preview-server-app/source/real.html
|
61
|
-
- fixtures/preview-server-app/source/real/index.html.erb
|
62
|
-
- fixtures/preview-server-app/source/should_be_ignored.html
|
63
|
-
- fixtures/preview-server-app/source/should_be_ignored2.html
|
64
|
-
- fixtures/preview-server-app/source/should_be_ignored3.html
|
65
|
-
- fixtures/preview-server-app/source/static.html
|
66
|
-
- fixtures/preview-server-hook-app/config.rb
|
67
|
-
- fixtures/preview-server-hook-app/source/index.html.erb
|
68
50
|
- lib/middleman-cli.rb
|
69
51
|
- lib/middleman-cli/build.rb
|
70
52
|
- lib/middleman-cli/config.rb
|
@@ -81,8 +63,6 @@ files:
|
|
81
63
|
- lib/middleman-cli/templates/extension/lib/lib/extension.rb
|
82
64
|
- lib/middleman-core/cli.rb
|
83
65
|
- middleman-cli.gemspec
|
84
|
-
- spec/middleman/.gitkeep
|
85
|
-
- spec/spec_helper.rb
|
86
66
|
homepage: http://middlemanapp.com
|
87
67
|
licenses:
|
88
68
|
- MIT
|
@@ -95,14 +75,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
75
|
requirements:
|
96
76
|
- - ">="
|
97
77
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.
|
78
|
+
version: 2.3.0
|
99
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
80
|
requirements:
|
101
|
-
- - "
|
81
|
+
- - ">"
|
102
82
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
83
|
+
version: 1.3.1
|
104
84
|
requirements: []
|
105
|
-
rubygems_version: 3.2
|
85
|
+
rubygems_version: 3.0.2
|
106
86
|
signing_key:
|
107
87
|
specification_version: 4
|
108
88
|
summary: Hand-crafted frontend development
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Feature: Middleman New Extension CLI
|
2
|
-
|
3
|
-
Scenario: Create a new extension scaffold
|
4
|
-
Given I run `middleman extension my-extension-library`
|
5
|
-
Then the exit status should be 0
|
6
|
-
When I cd to "my-extension-library"
|
7
|
-
Then the following files should exist:
|
8
|
-
| Gemfile |
|
9
|
-
| Rakefile |
|
10
|
-
| my-extension-library.gemspec |
|
11
|
-
| features/support/env.rb |
|
12
|
-
| lib/my-extension-library/extension.rb |
|
13
|
-
| lib/my-extension-library.rb |
|
14
|
-
| .gitignore |
|
data/features/cli_init.feature
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
Feature: Middleman CLI
|
2
|
-
|
3
|
-
Scenario: Create a new project
|
4
|
-
When I run `middleman init MY_PROJECT` interactively
|
5
|
-
And I type "y"
|
6
|
-
And I type "y"
|
7
|
-
And I type "y"
|
8
|
-
And I type "y"
|
9
|
-
Then the exit status should be 0
|
10
|
-
When I cd to "MY_PROJECT"
|
11
|
-
Then the following files should exist:
|
12
|
-
| Gemfile |
|
13
|
-
| .gitignore |
|
14
|
-
| config.rb |
|
15
|
-
| source/index.html.erb |
|
16
|
-
| source/layouts/layout.erb |
|
17
|
-
| source/javascripts/site.js |
|
18
|
-
| source/stylesheets/site.css.scss |
|
19
|
-
|
20
|
-
Scenario: Create a new project in the current directory
|
21
|
-
Given a directory named "MY_PROJECT"
|
22
|
-
When I cd to "MY_PROJECT"
|
23
|
-
And I run `middleman init` interactively
|
24
|
-
And I type "y"
|
25
|
-
And I type "y"
|
26
|
-
And I type "y"
|
27
|
-
And I type "y"
|
28
|
-
Then the exit status should be 0
|
29
|
-
And the following files should exist:
|
30
|
-
| Gemfile |
|
31
|
-
| config.rb |
|
32
|
-
| source/index.html.erb |
|
33
|
-
|
34
|
-
Scenario: Create a new project (alias i)
|
35
|
-
When I run `middleman i MY_PROJECT` interactively
|
36
|
-
And I type "y"
|
37
|
-
And I type "y"
|
38
|
-
And I type "y"
|
39
|
-
And I type "y"
|
40
|
-
Then a directory named "MY_PROJECT" should exist
|
41
|
-
|
42
|
-
Scenario: Create a new project (alias new)
|
43
|
-
When I run `middleman new MY_PROJECT` interactively
|
44
|
-
And I type "y"
|
45
|
-
And I type "y"
|
46
|
-
And I type "y"
|
47
|
-
And I type "y"
|
48
|
-
Then a directory named "MY_PROJECT" should exist
|
49
|
-
|
50
|
-
Scenario: Create a new project (alias n)
|
51
|
-
When I run `middleman n MY_PROJECT` interactively
|
52
|
-
And I type "y"
|
53
|
-
And I type "y"
|
54
|
-
And I type "y"
|
55
|
-
And I type "y"
|
56
|
-
Then a directory named "MY_PROJECT" should exist
|
57
|
-
|
58
|
-
Scenario: Create a new project using Middleman directory
|
59
|
-
When I run `middleman init MY_PROJECT -T blog`
|
60
|
-
Then a directory named "MY_PROJECT" should exist
|
61
|
-
When I cd to "MY_PROJECT"
|
62
|
-
And the file "Gemfile" should contain "middleman-blog"
|
63
|
-
And the file ".gitignore" should exist
|
64
|
-
|
65
|
-
Scenario: Create an invalid project using Middleman directory
|
66
|
-
When I run `middleman init MY_PROJECT -T does-not-exist-for-reals`
|
67
|
-
Then the exit status should be 1
|
68
|
-
|
69
|
-
Scenario: Create a new project using github(user/repository)
|
70
|
-
When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default` interactively
|
71
|
-
And I type "y"
|
72
|
-
And I type "y"
|
73
|
-
And I type "y"
|
74
|
-
And I type "y"
|
75
|
-
Then a directory named "MY_PROJECT" should exist
|
76
|
-
|
77
|
-
Scenario: Create a new project using github(user/repository#branch)
|
78
|
-
When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default#master` interactively
|
79
|
-
And I type "y"
|
80
|
-
And I type "y"
|
81
|
-
And I type "y"
|
82
|
-
And I type "y"
|
83
|
-
Then a directory named "MY_PROJECT" should exist
|
84
|
-
And the output should contain "-b master"
|
85
|
-
|
86
|
-
Scenario: Create a new project using full path(://)
|
87
|
-
When I run `middleman init MY_PROJECT -T https://github.com/middleman/middleman-templates-default.git` interactively
|
88
|
-
And I type "y"
|
89
|
-
And I type "y"
|
90
|
-
And I type "y"
|
91
|
-
And I type "y"
|
92
|
-
Then a directory named "MY_PROJECT" should exist
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: Run preview server before hook
|
2
|
-
|
3
|
-
Scenario: When run
|
4
|
-
Given a fixture app "preview-server-hook-app"
|
5
|
-
And the default aruba timeout is 30 seconds
|
6
|
-
When I run `middleman server --server-name localhost --bind-address 127.0.0.1` interactively
|
7
|
-
And I stop middleman if the output contains:
|
8
|
-
"""
|
9
|
-
### END ###
|
10
|
-
"""
|
11
|
-
Then the output should contain:
|
12
|
-
"""
|
13
|
-
/// 127.0.0.1:4567 ///
|
14
|
-
/// 4567 ///
|
15
|
-
/// localhost ///
|
16
|
-
/// http://localhost:4567 ///
|
17
|
-
"""
|
@@ -1,535 +0,0 @@
|
|
1
|
-
Feature: Run the preview server
|
2
|
-
|
3
|
-
As a software developer
|
4
|
-
I want to start the preview server
|
5
|
-
In order to view my changes immediately in the browser
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given a fixture app "preview-server-app"
|
9
|
-
And the default aruba timeout is 30 seconds
|
10
|
-
|
11
|
-
Scenario: Start the server with defaults
|
12
|
-
When I run `middleman server` interactively
|
13
|
-
And I stop middleman if the output contains:
|
14
|
-
"""
|
15
|
-
Inspect your site configuration
|
16
|
-
"""
|
17
|
-
And the output should contain:
|
18
|
-
"""
|
19
|
-
View your site at "http://
|
20
|
-
"""
|
21
|
-
And the output should contain:
|
22
|
-
"""
|
23
|
-
Inspect your site configuration at "http://
|
24
|
-
"""
|
25
|
-
|
26
|
-
Scenario: Start the server with defaults in verbose mode
|
27
|
-
When I run `middleman server --verbose` interactively
|
28
|
-
And I stop middleman if the output contains:
|
29
|
-
"""
|
30
|
-
Inspect your site configuration
|
31
|
-
"""
|
32
|
-
Then the output should contain:
|
33
|
-
"""
|
34
|
-
The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
|
35
|
-
"""
|
36
|
-
And the output should contain:
|
37
|
-
"""
|
38
|
-
View your site at "http://
|
39
|
-
"""
|
40
|
-
And the output should contain:
|
41
|
-
"""
|
42
|
-
Inspect your site configuration at "http://
|
43
|
-
"""
|
44
|
-
|
45
|
-
@wip
|
46
|
-
Scenario: Start the server with defaults in verbose mode, when a local mdns server resolves the local hostname
|
47
|
-
Given I start a mdns server for the local hostname
|
48
|
-
When I run `middleman server --verbose` interactively
|
49
|
-
And I stop middleman if the output contains:
|
50
|
-
"""
|
51
|
-
Inspect your site configuration
|
52
|
-
"""
|
53
|
-
Then the output should contain:
|
54
|
-
"""
|
55
|
-
The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
|
56
|
-
"""
|
57
|
-
And the output should contain:
|
58
|
-
"""
|
59
|
-
View your site at "http://
|
60
|
-
"""
|
61
|
-
And the output should contain:
|
62
|
-
"""
|
63
|
-
Inspect your site configuration at "http://
|
64
|
-
"""
|
65
|
-
|
66
|
-
Scenario: Start the server with bind address 127.0.0.1
|
67
|
-
Given I have a local hosts file with:
|
68
|
-
"""
|
69
|
-
# <ip-address> <hostname.domain.org> <hostname>
|
70
|
-
127.0.0.1 localhost.localdomain localhost
|
71
|
-
"""
|
72
|
-
When I run `middleman server --verbose --bind-address 127.0.0.1` interactively
|
73
|
-
And I stop middleman if the output contains:
|
74
|
-
"""
|
75
|
-
Inspect your site configuration
|
76
|
-
"""
|
77
|
-
Then the output should contain:
|
78
|
-
"""
|
79
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
80
|
-
"""
|
81
|
-
And the output should contain:
|
82
|
-
"""
|
83
|
-
View your site at "http://127.0.0.1:4567"
|
84
|
-
"""
|
85
|
-
And the output should contain:
|
86
|
-
"""
|
87
|
-
Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
|
88
|
-
"""
|
89
|
-
|
90
|
-
Scenario: Start the server with bind address 127.0.0.1 configured via config.rb
|
91
|
-
Given I have a local hosts file with:
|
92
|
-
"""
|
93
|
-
# <ip-address> <hostname.domain.org> <hostname>
|
94
|
-
127.0.0.1 localhost.localdomain localhost
|
95
|
-
"""
|
96
|
-
And a file named "config.rb" with:
|
97
|
-
"""
|
98
|
-
set :bind_address, '127.0.0.1'
|
99
|
-
"""
|
100
|
-
When I run `middleman server --verbose` interactively
|
101
|
-
And I stop middleman if the output contains:
|
102
|
-
"""
|
103
|
-
Inspect your site configuration
|
104
|
-
"""
|
105
|
-
Then the output should contain:
|
106
|
-
"""
|
107
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
108
|
-
"""
|
109
|
-
And the output should contain:
|
110
|
-
"""
|
111
|
-
View your site at "http://127.0.0.1:4567"
|
112
|
-
"""
|
113
|
-
And the output should contain:
|
114
|
-
"""
|
115
|
-
Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
|
116
|
-
"""
|
117
|
-
|
118
|
-
@wip
|
119
|
-
Scenario: Start the server with bind address 127.0.0.5
|
120
|
-
|
121
|
-
This will have no hostname attached because the hosts file, the DNS server
|
122
|
-
and the MDNS-server do not know anything about 127.0.0.5
|
123
|
-
|
124
|
-
When I run `middleman server --verbose --bind-address 127.0.0.5` interactively
|
125
|
-
And I stop middleman if the output contains:
|
126
|
-
"""
|
127
|
-
Inspect your site configuration
|
128
|
-
"""
|
129
|
-
Then the output should contain:
|
130
|
-
"""
|
131
|
-
The Middleman preview server is bound to "127.0.0.5:4567"
|
132
|
-
"""
|
133
|
-
And the output should contain:
|
134
|
-
"""
|
135
|
-
View your site at "http://127.0.0.5:4567"
|
136
|
-
"""
|
137
|
-
And the output should contain:
|
138
|
-
"""
|
139
|
-
Inspect your site configuration at "http://127.0.0.5:4567/__middleman"
|
140
|
-
"""
|
141
|
-
|
142
|
-
@wip
|
143
|
-
Scenario: Start the server with bind address ::1
|
144
|
-
Given a file named ".hosts" with:
|
145
|
-
"""
|
146
|
-
# <ip-address> <hostname.domain.org> <hostname>
|
147
|
-
::1 localhost.localdomain localhost
|
148
|
-
"""
|
149
|
-
When I run `middleman server --verbose --bind-address ::1` interactively
|
150
|
-
And I stop middleman if the output contains:
|
151
|
-
"""
|
152
|
-
Inspect your site configuration
|
153
|
-
"""
|
154
|
-
Then the output should contain:
|
155
|
-
"""
|
156
|
-
The Middleman preview server is bound to "::1:4567"
|
157
|
-
"""
|
158
|
-
And the output should contain:
|
159
|
-
"""
|
160
|
-
View your site at "http://[::1]:4567"
|
161
|
-
"""
|
162
|
-
And the output should contain:
|
163
|
-
"""
|
164
|
-
Inspect your site configuration at "http://[::1]:4567/__middleman"
|
165
|
-
"""
|
166
|
-
|
167
|
-
Scenario: Start the server with bind address 0.0.0.0
|
168
|
-
When I run `middleman server --verbose --bind-address 0.0.0.0` interactively
|
169
|
-
And I stop middleman if the output contains:
|
170
|
-
"""
|
171
|
-
Inspect your site configuration
|
172
|
-
"""
|
173
|
-
Then the output should contain:
|
174
|
-
"""
|
175
|
-
The Middleman preview server is bound to "0.0.0.0:4567"
|
176
|
-
"""
|
177
|
-
And the output should contain:
|
178
|
-
"""
|
179
|
-
View your site at "http://
|
180
|
-
"""
|
181
|
-
And the output should contain:
|
182
|
-
"""
|
183
|
-
Inspect your site configuration at "http://
|
184
|
-
"""
|
185
|
-
|
186
|
-
Scenario: Start the server with bind address ::
|
187
|
-
When I run `middleman server --verbose --bind-address ::` interactively
|
188
|
-
And I stop middleman if the output contains:
|
189
|
-
"""
|
190
|
-
Inspect your site configuration
|
191
|
-
"""
|
192
|
-
Then the output should contain:
|
193
|
-
"""
|
194
|
-
The Middleman preview server is bound to ":::4567"
|
195
|
-
"""
|
196
|
-
And the output should contain:
|
197
|
-
"""
|
198
|
-
View your site at "http://
|
199
|
-
"""
|
200
|
-
And the output should contain:
|
201
|
-
"""
|
202
|
-
Inspect your site configuration at "http://
|
203
|
-
"""
|
204
|
-
|
205
|
-
Scenario: Start the server with server name "localhost"
|
206
|
-
Given I have a local hosts file with:
|
207
|
-
"""
|
208
|
-
# <ip-address> <hostname.domain.org> <hostname>
|
209
|
-
127.0.0.1 localhost.localdomain localhost
|
210
|
-
"""
|
211
|
-
When I run `middleman server --verbose --server-name localhost` interactively
|
212
|
-
And I stop middleman if the output contains:
|
213
|
-
"""
|
214
|
-
Inspect your site configuration
|
215
|
-
"""
|
216
|
-
Then the output should contain:
|
217
|
-
"""
|
218
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
219
|
-
"""
|
220
|
-
And the output should contain:
|
221
|
-
"""
|
222
|
-
View your site at "http://localhost:4567", "http://127.0.0.1:4567"
|
223
|
-
"""
|
224
|
-
And the output should contain:
|
225
|
-
"""
|
226
|
-
Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
|
227
|
-
"""
|
228
|
-
|
229
|
-
Scenario: Start the server with server name "localhost" configured via config.rb
|
230
|
-
Given I have a local hosts file with:
|
231
|
-
"""
|
232
|
-
# <ip-address> <hostname.domain.org> <hostname>
|
233
|
-
127.0.0.1 localhost.localdomain localhost
|
234
|
-
"""
|
235
|
-
And a file named "config.rb" with:
|
236
|
-
"""
|
237
|
-
set :server_name, 'localhost'
|
238
|
-
"""
|
239
|
-
When I run `middleman server --verbose` interactively
|
240
|
-
And I stop middleman if the output contains:
|
241
|
-
"""
|
242
|
-
Inspect your site configuration
|
243
|
-
"""
|
244
|
-
Then the output should contain:
|
245
|
-
"""
|
246
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
247
|
-
"""
|
248
|
-
And the output should contain:
|
249
|
-
"""
|
250
|
-
View your site at "http://localhost:4567", "http://127.0.0.1:4567"
|
251
|
-
"""
|
252
|
-
And the output should contain:
|
253
|
-
"""
|
254
|
-
Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
|
255
|
-
"""
|
256
|
-
|
257
|
-
Scenario: Start the server with server name "localhost" and bind address "127.0.0.1"
|
258
|
-
Given I have a local hosts file with:
|
259
|
-
"""
|
260
|
-
# <ip-address> <hostname.domain.org> <hostname>
|
261
|
-
127.0.0.1 localhost.localdomain localhost
|
262
|
-
"""
|
263
|
-
When I run `middleman server --verbose --server-name localhost --bind-address 127.0.0.1` interactively
|
264
|
-
And I stop middleman if the output contains:
|
265
|
-
"""
|
266
|
-
Inspect your site configuration
|
267
|
-
"""
|
268
|
-
Then the output should contain:
|
269
|
-
"""
|
270
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
271
|
-
"""
|
272
|
-
And the output should contain:
|
273
|
-
"""
|
274
|
-
View your site at "http://localhost:4567", "http://127.0.0.1:4567"
|
275
|
-
"""
|
276
|
-
And the output should contain:
|
277
|
-
"""
|
278
|
-
Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
|
279
|
-
"""
|
280
|
-
|
281
|
-
Scenario: Start the server with server name "127.0.0.1"
|
282
|
-
When I run `middleman server --verbose --server-name 127.0.0.1` interactively
|
283
|
-
And I stop middleman if the output contains:
|
284
|
-
"""
|
285
|
-
Inspect your site configuration
|
286
|
-
"""
|
287
|
-
Then the output should contain:
|
288
|
-
"""
|
289
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
290
|
-
"""
|
291
|
-
And the output should contain:
|
292
|
-
"""
|
293
|
-
View your site at "http://127.0.0.1:4567"
|
294
|
-
"""
|
295
|
-
And the output should contain:
|
296
|
-
"""
|
297
|
-
Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
|
298
|
-
"""
|
299
|
-
|
300
|
-
Scenario: Start the server with server name "::1"
|
301
|
-
When I run `middleman server --verbose --server-name ::1` interactively
|
302
|
-
And I stop middleman if the output contains:
|
303
|
-
"""
|
304
|
-
Inspect your site configuration
|
305
|
-
"""
|
306
|
-
Then the output should contain:
|
307
|
-
"""
|
308
|
-
The Middleman preview server is bound to "::1:4567"
|
309
|
-
"""
|
310
|
-
And the output should contain:
|
311
|
-
"""
|
312
|
-
View your site at "http://[::1]:4567"
|
313
|
-
"""
|
314
|
-
And the output should contain:
|
315
|
-
"""
|
316
|
-
Inspect your site configuration at "http://[::1]:4567/__middleman"
|
317
|
-
"""
|
318
|
-
|
319
|
-
Scenario: Start the server with https
|
320
|
-
When I run `middleman server --verbose --https` interactively
|
321
|
-
And I stop middleman if the output contains:
|
322
|
-
"""
|
323
|
-
Inspect your site configuration
|
324
|
-
"""
|
325
|
-
Then the output should contain:
|
326
|
-
"""
|
327
|
-
The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
|
328
|
-
"""
|
329
|
-
And the output should contain:
|
330
|
-
"""
|
331
|
-
View your site at "https://
|
332
|
-
"""
|
333
|
-
And the output should contain:
|
334
|
-
"""
|
335
|
-
Inspect your site configuration at "https://
|
336
|
-
"""
|
337
|
-
|
338
|
-
Scenario: Start the server with port 65432
|
339
|
-
When I run `middleman server --verbose --port 65432` interactively
|
340
|
-
And I stop middleman if the output contains:
|
341
|
-
"""
|
342
|
-
Inspect your site configuration
|
343
|
-
"""
|
344
|
-
Then the output should contain:
|
345
|
-
"""
|
346
|
-
The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
|
347
|
-
"""
|
348
|
-
|
349
|
-
Scenario: Start the server with port 65432 configured via config.rb
|
350
|
-
Given a file named "config.rb" with:
|
351
|
-
"""
|
352
|
-
set :port, 65432
|
353
|
-
"""
|
354
|
-
When I run `middleman server --verbose` interactively
|
355
|
-
And I stop middleman if the output contains:
|
356
|
-
"""
|
357
|
-
Inspect your site configuration
|
358
|
-
"""
|
359
|
-
Then the output should contain:
|
360
|
-
"""
|
361
|
-
The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
|
362
|
-
"""
|
363
|
-
|
364
|
-
@wip
|
365
|
-
Scenario: Start the server when port is blocked by other middleman instance
|
366
|
-
Given `middleman server` is running in background
|
367
|
-
When I run `middleman server --verbose` interactively
|
368
|
-
And I stop all commands if the output of the last command contains:
|
369
|
-
"""
|
370
|
-
Inspect your site configuration
|
371
|
-
"""
|
372
|
-
Then the output should contain:
|
373
|
-
"""
|
374
|
-
The Middleman uses a different port
|
375
|
-
"""
|
376
|
-
|
377
|
-
Scenario: Start the server with bind address 1.1.1.1
|
378
|
-
|
379
|
-
This should fail, because "1.1.1.1" is not an interface available on this computer.
|
380
|
-
|
381
|
-
Given a file named ".hosts" with:
|
382
|
-
"""
|
383
|
-
1.1.1.1 www.example.com www
|
384
|
-
"""
|
385
|
-
When I run `middleman server --verbose --bind-address 1.1.1.1` interactively
|
386
|
-
And I stop middleman if the output contains:
|
387
|
-
"""
|
388
|
-
Running Middleman failed:
|
389
|
-
"""
|
390
|
-
Then the output should contain:
|
391
|
-
"""
|
392
|
-
Bind address "1.1.1.1" is not available on your system
|
393
|
-
"""
|
394
|
-
|
395
|
-
Scenario: Start the server with server name www.example.com and bind address 0.0.0.0
|
396
|
-
|
397
|
-
This should fail, because the user can just use `--server-name`. It does
|
398
|
-
not make sense for `middleman` to only listen on `0.0.0.0` (IPv4 all
|
399
|
-
interfaces), but not on `::` (IPv6 all interfaces). There are other tools
|
400
|
-
like `iptables` (Linux-only) or better some `kernel`-configurations to make
|
401
|
-
this possible.
|
402
|
-
|
403
|
-
When I run `middleman server --verbose --server-name www.example.com --bind-address 0.0.0.0` interactively
|
404
|
-
And I stop middleman if the output contains:
|
405
|
-
"""
|
406
|
-
Running Middleman failed:
|
407
|
-
"""
|
408
|
-
Then the output should contain:
|
409
|
-
"""
|
410
|
-
Undefined combination of options "--server-name" and "--bind-address".
|
411
|
-
"""
|
412
|
-
|
413
|
-
Scenario: Start the server with server name "www.example.com" and bind address "127.0.0.1"
|
414
|
-
|
415
|
-
This should fail because the server name does not resolve to the ip address.
|
416
|
-
|
417
|
-
Given a file named ".hosts" with:
|
418
|
-
"""
|
419
|
-
1.1.1.1 www.example.com www
|
420
|
-
"""
|
421
|
-
When I run `middleman server --verbose --server-name www.example.com --bind-address 127.0.0.1` interactively
|
422
|
-
And I stop middleman if the output contains:
|
423
|
-
"""
|
424
|
-
Running Middleman failed:
|
425
|
-
"""
|
426
|
-
Then the output should contain:
|
427
|
-
"""
|
428
|
-
Server name "www.example.com" does not resolve to bind address "127.0.0.1". Please fix that and try again.
|
429
|
-
"""
|
430
|
-
|
431
|
-
Scenario: Start the server with server name "garbage.example.com"
|
432
|
-
When I run `middleman server --verbose --server-name garbage.example.com` interactively
|
433
|
-
And I stop middleman if the output contains:
|
434
|
-
"""
|
435
|
-
Running Middleman failed:
|
436
|
-
"""
|
437
|
-
Then the output should contain:
|
438
|
-
"""
|
439
|
-
Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again.
|
440
|
-
"""
|
441
|
-
|
442
|
-
Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name
|
443
|
-
Given I have a local hosts file with:
|
444
|
-
"""
|
445
|
-
# empty
|
446
|
-
"""
|
447
|
-
And I start a mdns server with:
|
448
|
-
"""
|
449
|
-
# empty
|
450
|
-
"""
|
451
|
-
And I start a dns server with:
|
452
|
-
"""
|
453
|
-
www.example.com: 127.0.0.1
|
454
|
-
"""
|
455
|
-
When I run `middleman server --verbose --server-name www.example.com` interactively
|
456
|
-
And I stop middleman if the output contains:
|
457
|
-
"""
|
458
|
-
Inspect your site configuration
|
459
|
-
"""
|
460
|
-
Then the output should contain:
|
461
|
-
"""
|
462
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
463
|
-
"""
|
464
|
-
And the output should contain:
|
465
|
-
"""
|
466
|
-
View your site at "http://www.example.com:4567", "http://127.0.0.1:4567"
|
467
|
-
"""
|
468
|
-
And the output should contain:
|
469
|
-
"""
|
470
|
-
Inspect your site configuration at "http://www.example.com:4567/__middleman", "http://127.0.0.1:4567/__middleman"
|
471
|
-
"""
|
472
|
-
|
473
|
-
@wip
|
474
|
-
Scenario: Start the server with server name "host.local" and the link local name server is used to resolve the server name
|
475
|
-
|
476
|
-
To make the mdns resolver resolve a name, it needs to end with ".local".
|
477
|
-
Otherwise the resolver returns [].
|
478
|
-
|
479
|
-
Given I have a local hosts file with:
|
480
|
-
"""
|
481
|
-
# empty
|
482
|
-
"""
|
483
|
-
And I start a mdns server with:
|
484
|
-
"""
|
485
|
-
host.local: 127.0.0.1
|
486
|
-
"""
|
487
|
-
When I run `middleman server --verbose --server-name host.local` interactively
|
488
|
-
And I stop middleman if the output contains:
|
489
|
-
"""
|
490
|
-
Inspect your site configuration
|
491
|
-
"""
|
492
|
-
Then the output should contain:
|
493
|
-
"""
|
494
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
495
|
-
"""
|
496
|
-
And the output should contain:
|
497
|
-
"""
|
498
|
-
View your site at "http://host.local:4567", "http://127.0.0.1:4567"
|
499
|
-
"""
|
500
|
-
And the output should contain:
|
501
|
-
"""
|
502
|
-
Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
|
503
|
-
"""
|
504
|
-
|
505
|
-
@wip
|
506
|
-
Scenario: Start the server with server name "host" and the link local name server is used to resolve the server name
|
507
|
-
|
508
|
-
To make the mdns resolver resolve a name, it needs to end with ".local". If
|
509
|
-
a plain hostname is given `middleman` appends ".local" automatically.
|
510
|
-
|
511
|
-
Given I have a local hosts file with:
|
512
|
-
"""
|
513
|
-
# empty
|
514
|
-
"""
|
515
|
-
And I start a mdns server with:
|
516
|
-
"""
|
517
|
-
host.local: 127.0.0.1
|
518
|
-
"""
|
519
|
-
When I run `middleman server --verbose --server-name host` interactively
|
520
|
-
And I stop middleman if the output contains:
|
521
|
-
"""
|
522
|
-
Inspect your site configuration
|
523
|
-
"""
|
524
|
-
Then the output should contain:
|
525
|
-
"""
|
526
|
-
The Middleman preview server is bound to "127.0.0.1:4567"
|
527
|
-
"""
|
528
|
-
And the output should contain:
|
529
|
-
"""
|
530
|
-
View your site at "http://host.local:4567", "http://127.0.0.1:4567"
|
531
|
-
"""
|
532
|
-
And the output should contain:
|
533
|
-
"""
|
534
|
-
Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
|
535
|
-
"""
|
data/features/support/env.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
ENV["TEST"] = "true"
|
2
|
-
|
3
|
-
require 'sassc'
|
4
|
-
|
5
|
-
require 'simplecov'
|
6
|
-
SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..'))
|
7
|
-
|
8
|
-
require 'coveralls'
|
9
|
-
Coveralls.wear!
|
10
|
-
|
11
|
-
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
12
|
-
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli')
|
13
|
-
require File.join(File.dirname(PROJECT_ROOT_PATH), 'middleman-core', 'lib', 'middleman-core', 'step_definitions')
|
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubydns'
|
4
|
-
require 'psych'
|
5
|
-
|
6
|
-
db_file = ARGV[0]
|
7
|
-
port = ARGV[1] || 5300
|
8
|
-
|
9
|
-
db = if File.file? db_file
|
10
|
-
$stderr.puts 'Found dns db'
|
11
|
-
Psych.load_file(db_file)
|
12
|
-
else
|
13
|
-
$stderr.puts 'Found no dns db. Use default db.'
|
14
|
-
|
15
|
-
{
|
16
|
-
/www\.example\.org/ => '1.1.1.1'
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
interfaces = [
|
21
|
-
[:udp, "127.0.0.1", port],
|
22
|
-
[:tcp, "127.0.0.1", port]
|
23
|
-
]
|
24
|
-
|
25
|
-
|
26
|
-
# Start the RubyDNS server
|
27
|
-
RubyDNS::run_server(listen: interfaces) do
|
28
|
-
db.each do |matcher, result|
|
29
|
-
match(matcher, Resolv::DNS::Resource::IN::A) do |transaction|
|
30
|
-
transaction.respond!(result)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Welcome</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
I am real
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Ignore me!</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Ignore me! 2</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Ignore me! 3</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
Static, no code!
|
@@ -1,19 +0,0 @@
|
|
1
|
-
set :layout, false
|
2
|
-
|
3
|
-
class MyFeature < Middleman::Extension
|
4
|
-
def initialize(app, options_hash = {}, &block)
|
5
|
-
super
|
6
|
-
|
7
|
-
app.before_server do |server_information|
|
8
|
-
puts "/// #{server_information.listeners.first} ///"
|
9
|
-
puts "/// #{server_information.port} ///"
|
10
|
-
puts "/// #{server_information.server_name} ///"
|
11
|
-
puts "/// #{server_information.site_addresses.first} ///"
|
12
|
-
puts "/// ### END ### ///"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
::Middleman::Extensions.register(:my_feature, MyFeature)
|
18
|
-
|
19
|
-
activate :my_feature
|
data/spec/middleman/.gitkeep
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
.gitkeep
|
data/spec/spec_helper.rb
DELETED
File without changes
|