middleman-cli 4.3.0.rc.4 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a015cd8e53b2704ba320851f560dbebe67402b1ea1771b56f6efc1d9558b34b5
4
- data.tar.gz: 781202b9739198f2eeebe08807189d64f771eab6f957e37f1869c6c4f067b839
3
+ metadata.gz: f7c809bca619d378af240d3f39668bb6c066c5af4ef0c970cda6907b56fe9d9b
4
+ data.tar.gz: 9ce8697764f3dfca793c6bfa57973645254fccbc93497306ef92cdc3d59489b3
5
5
  SHA512:
6
- metadata.gz: 21eceda8007615dd7cc4a96bb1dfda09b13851167a0f3982511f141578c409c29c900a75578922797987d5da0a78de24a2ac5fd4b5fc20fa47493b8963a6a33f
7
- data.tar.gz: f4385f04aaa92837c3f04d781999c7f6d4ef33b7e65b07f9c5f1f163e8c8a9daaff5a2fab77c5d094ff098d24edcff8e1ca65957f37d59ffe9d07925d9355c00
6
+ metadata.gz: 7a25198d428b7fff9d548e13fb452f2798a9627030ddb5df0fade810f3b8d07aff682f60e411647ff1d2152fc93624d577ad58eee448efb8cd32d5b50383690b
7
+ data.tar.gz: e5acbbe0573e2cc6e26bc077ef25bb09f33bd25f5ee20e9a263591cc05d377fd99f2973c1b5f7fe2e8c4f5cba0cd87c064767b018599f1e7daac5608fab203a1
data/bin/middleman CHANGED
@@ -6,7 +6,7 @@ if ARGV.include? '--profile'
6
6
  end
7
7
  # Middleman::Profiling.start
8
8
 
9
- require 'middleman-core/load_paths'
9
+ require "middleman-core/load_paths"
10
10
  Middleman.setup_load_paths
11
11
 
12
12
  require 'dotenv'
@@ -35,18 +35,19 @@ module Middleman::Cli
35
35
  end
36
36
  end
37
37
 
38
- require 'middleman-cli'
38
+ require "middleman-cli"
39
39
 
40
40
  # Change directory to the root
41
- Dir.chdir(ENV['MM_ROOT']) if ENV['MM_ROOT']
41
+ Dir.chdir(ENV["MM_ROOT"]) if ENV["MM_ROOT"]
42
42
 
43
43
  # Default command is server
44
- if ARGV[0] != 'help' && (ARGV.empty? || ARGV.first.include?('-'))
44
+ if ARGV[0] != 'help' && (ARGV.length < 1 || ARGV.first.include?('-'))
45
45
  ARGV.unshift('server')
46
46
  end
47
47
 
48
48
  ::Middleman::Logger.singleton(3)
49
49
  ::Middleman::Cli.config = ::Middleman::Application.new do
50
+ #
50
51
  config[:environment] = (ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development').to_sym
51
52
  config[:mode] = :config
52
53
  config[:exit_before_ready] = true
@@ -14,7 +14,7 @@ Feature: Middleman CLI
14
14
  | config.rb |
15
15
  | source/index.html.erb |
16
16
  | source/layouts/layout.erb |
17
- | source/javascripts/site.js |
17
+ | source/javascripts/site.js |
18
18
  | source/stylesheets/site.css.scss |
19
19
 
20
20
  Scenario: Create a new project in the current directory
@@ -9,7 +9,7 @@ Feature: Run the preview server
9
9
  And the default aruba timeout is 30 seconds
10
10
 
11
11
  Scenario: Start the server with defaults
12
- When I run the interactive middleman server
12
+ When I run `middleman server` interactively
13
13
  And I stop middleman if the output contains:
14
14
  """
15
15
  Inspect your site configuration
@@ -139,7 +139,6 @@ Feature: Run the preview server
139
139
  Inspect your site configuration at "http://127.0.0.5:4567/__middleman"
140
140
  """
141
141
 
142
- @wip
143
142
  Scenario: Start the server with bind address ::1
144
143
  Given a file named ".hosts" with:
145
144
  """
@@ -316,7 +315,6 @@ Feature: Run the preview server
316
315
  Inspect your site configuration at "http://[::1]:4567/__middleman"
317
316
  """
318
317
 
319
- @wip
320
318
  Scenario: Start the server with https
321
319
  When I run `middleman server --verbose --https` interactively
322
320
  And I stop middleman if the output contains:
@@ -1,13 +1,15 @@
1
- ENV['TEST'] = 'true'
1
+ ENV["TEST"] = "true"
2
2
 
3
- require 'backports/latest'
4
3
  require 'sassc'
5
4
 
6
5
  require 'simplecov'
7
6
  SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..'))
8
7
 
9
- require 'simplecov'
10
- SimpleCov.start
8
+ require 'coveralls'
9
+ Coveralls.wear!
10
+
11
+ require 'codeclimate-test-reporter'
12
+ CodeClimate::TestReporter.start
11
13
 
12
14
  PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
13
15
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli')
@@ -6,24 +6,25 @@ require 'psych'
6
6
  db_file = ARGV[0]
7
7
  port = ARGV[1] || 5300
8
8
 
9
- db = if File.file? db_file
10
- warn 'Found dns db'
11
- Psych.load_file(db_file)
12
- else
13
- warn 'Found no dns db. Use default db.'
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
14
 
15
- {
16
- /www\.example\.org/ => '1.1.1.1'
17
- }
18
- end
15
+ {
16
+ /www\.example\.org/ => '1.1.1.1'
17
+ }
18
+ end
19
19
 
20
20
  interfaces = [
21
- [:udp, '127.0.0.1', port],
22
- [:tcp, '127.0.0.1', port]
21
+ [:udp, "127.0.0.1", port],
22
+ [:tcp, "127.0.0.1", port]
23
23
  ]
24
24
 
25
+
25
26
  # Start the RubyDNS server
26
- RubyDNS.run_server(listen: interfaces) do
27
+ RubyDNS::run_server(listen: interfaces) do
27
28
  db.each do |matcher, result|
28
29
  match(matcher, Resolv::DNS::Resource::IN::A) do |transaction|
29
30
  transaction.respond!(result)
@@ -9,7 +9,7 @@ class MyFeature < Middleman::Extension
9
9
  puts "/// #{server_information.port} ///"
10
10
  puts "/// #{server_information.server_name} ///"
11
11
  puts "/// #{server_information.site_addresses.first} ///"
12
- puts '/// ### END ### ///'
12
+ puts "/// ### END ### ///"
13
13
  end
14
14
  end
15
15
  end
data/lib/middleman-cli.rb CHANGED
@@ -1,5 +1,7 @@
1
+ # rubocop:disable FileName
2
+
1
3
  # Setup our load paths
2
- libdir = __dir__
4
+ libdir = File.expand_path(File.dirname(__FILE__))
3
5
  $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
4
6
 
5
7
  # Require Thor since that's what the whole CLI is built around
@@ -42,9 +42,7 @@ module Middleman::Cli
42
42
  # Core build Thor command
43
43
  # @return [void]
44
44
  def build
45
- root = ENV['MM_ROOT'] || Dir.pwd
46
-
47
- unless File.exist?(File.join(root, 'config.rb'))
45
+ unless ENV['MM_ROOT']
48
46
  raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?'
49
47
  end
50
48
 
@@ -81,7 +79,7 @@ module Middleman::Cli
81
79
  ::Middleman::Util.instrument 'builder.run' do
82
80
  if builder.run!
83
81
  clean_directories! if options['clean']
84
- puts 'Project built successfully.'
82
+ shell.say 'Project built successfully.'
85
83
  else
86
84
  msg = 'There were errors during this build'
87
85
  unless options['verbose']
@@ -101,7 +99,7 @@ module Middleman::Cli
101
99
  # @param [String] contents The event contents.
102
100
  # @param [String] extra The extra information.
103
101
  # @return [void]
104
- def on_event(event_type, target, extra = nil)
102
+ def on_event(event_type, target, extra=nil)
105
103
  case event_type
106
104
  when :error
107
105
  say_status :error, target, :red
@@ -22,10 +22,6 @@ 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
-
29
25
  # The init task
30
26
  def init
31
27
  require 'fileutils'
@@ -39,29 +35,38 @@ module Middleman::Cli
39
35
  end
40
36
 
41
37
  repo_path, repo_branch = if shortname?(options[:template])
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
38
+ require 'open-uri'
39
+ require 'json'
40
+
41
+ api = 'https://directory.middlemanapp.com/api'
42
+ uri = ::URI.parse("#{api}/#{options[:template]}.json")
43
+
44
+ begin
45
+ data = ::JSON.parse(uri.read)
46
+ data['links']['github']
47
+ data['links']['github'].split('#')
48
+ rescue ::OpenURI::HTTPError
49
+ say "Template `#{options[:template]}` not found in Middleman Directory."
50
+ say 'Did you mean to use a full `user/repo` path?'
51
+ exit 1
52
+ end
53
+ else
54
+ repo_name, repo_branch = options[:template].split('#')
55
+ [repository_path(repo_name), repo_branch]
56
+ end
57
+
58
+ dir = Dir.mktmpdir
62
59
 
63
60
  begin
64
- dir = is_local_dir ? repo_path : clone_repository(repo_path, repo_branch)
61
+ branch_cmd = repo_branch ? "-b #{repo_branch} " : ''
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
65
70
 
66
71
  inside(target) do
67
72
  thorfile = File.join(dir, 'Thorfile')
@@ -75,11 +80,10 @@ module Middleman::Cli
75
80
  directory dir, '.', exclude_pattern: /\.git\/|\.gitignore$/
76
81
  end
77
82
 
78
- bundle_args = options[:'bundle-path'] ? " --path=#{options[:'bundle-path']}" : ''
79
- run("bundle install#{bundle_args}") unless ENV['TEST'] || options[:'skip-bundle']
83
+ run('bundle install') unless ENV['TEST'] || options[:'skip-bundle']
80
84
  end
81
85
  ensure
82
- FileUtils.remove_entry(dir) if !is_local_dir && File.directory?(dir)
86
+ FileUtils.remove_entry(dir) if File.directory?(dir)
83
87
  end
84
88
  end
85
89
 
@@ -88,7 +92,6 @@ module Middleman::Cli
88
92
  # Copied from Bundler
89
93
  def git_present?
90
94
  return @git_present if defined?(@git_present)
91
-
92
95
  @git_present = which(GIT_CMD) || which('git.exe')
93
96
  end
94
97
 
@@ -109,30 +112,8 @@ module Middleman::Cli
109
112
  repo.split('/').length == 1
110
113
  end
111
114
 
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
115
+ def repository_path(repo)
116
+ repo.include?('://') || repo.include?('git@') ? repo : "https://github.com/#{repo}.git"
136
117
  end
137
118
 
138
119
  # Add to CLI
@@ -12,7 +12,7 @@ group :development do
12
12
  end
13
13
 
14
14
  group :test do
15
- gem 'aruba'
16
15
  gem 'cucumber'
16
+ gem 'aruba'
17
17
  gem 'rspec'
18
18
  end
@@ -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 = '--fail-fast --color --tags "not @wip" --strict'
7
+ t.cucumber_opts = '--color --tags ~@wip --strict'
8
8
  end
9
9
 
10
10
  require 'rake/clean'
@@ -1,6 +1,6 @@
1
1
  require "middleman-core"
2
2
 
3
3
  Middleman::Extensions.register :<%= name %> do
4
- require "<%= name %>/extension"
4
+ require "my-extension/extension"
5
5
  MyExtension
6
6
  end
@@ -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, options_hash = {}, &block)
8
+ def initialize(app, options_hash={}, &block)
9
9
  # Call super to build options from the options_hash
10
10
  super
11
11
 
@@ -11,13 +11,13 @@ 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, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle.'
14
+ s.description = 'A static site generator. Provides dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle.'
15
15
 
16
16
  s.files = `git ls-files -z`.split("\0")
17
17
  s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
18
18
  s.executable = 'middleman'
19
19
  s.require_path = 'lib'
20
- s.required_ruby_version = '>= 2.3.0'
20
+ s.required_ruby_version = '>= 2.2.0'
21
21
 
22
22
  # CLI
23
23
  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.3.0.rc.4
4
+ version: 4.3.0
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: 2018-11-07 00:00:00.000000000 Z
12
+ date: 2019-01-11 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, Slim, CoffeeScript, and more). Makes minification, compression, cache busting,
36
- Yaml data (and more) an easy part of your development cycle.
35
+ Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache
36
+ busting, Yaml data (and more) an easy part of your development cycle.
37
37
  email:
38
38
  - me@tdreyno.com
39
39
  - ben@benhollis.net
@@ -95,15 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: 2.3.0
98
+ version: 2.2.0
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3.1
103
+ version: '0'
104
104
  requirements: []
105
- rubyforge_project:
106
- rubygems_version: 2.7.7
105
+ rubygems_version: 3.0.2
107
106
  signing_key:
108
107
  specification_version: 4
109
108
  summary: Hand-crafted frontend development