middleman-cli 4.1.2 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/middleman +43 -0
- data/lib/middleman-cli.rb +0 -11
- data/lib/middleman-cli/build.rb +15 -4
- data/lib/middleman-cli/config.rb +2 -0
- data/lib/middleman-cli/server.rb +7 -40
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12273d205f2bf08d0212180889ac23701ac1fe96
|
4
|
+
data.tar.gz: 2b8a404ea8856f2bc7a35f15c291d8281374d034
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e4f85045bb88f0c4db58527cbd0a39db84bfb725477a398c9cdc2e4cb8e12cb9e3e9ce336033a91d89a4f9bb5da5220336d6976576569847cf67e486edfa46f
|
7
|
+
data.tar.gz: 40de4da70b54e10eae959a86a5ef75faee7edd4fbe73544a1cb16c2b48e64885aaab042aa99db15772fe21e98eef41a1624a445337bc04ad166e2ee8731d9cce
|
data/bin/middleman
CHANGED
@@ -9,6 +9,31 @@ end
|
|
9
9
|
require "middleman-core/load_paths"
|
10
10
|
Middleman.setup_load_paths
|
11
11
|
|
12
|
+
require 'middleman-core'
|
13
|
+
require 'middleman-core/logger'
|
14
|
+
|
15
|
+
module Middleman::Cli
|
16
|
+
class << self
|
17
|
+
attr_accessor :config
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.import_config(base)
|
21
|
+
::Middleman::Cli.config.all_settings.each do |setting|
|
22
|
+
if setting.default.is_a?(String) || setting.default.is_a?(NilClass)
|
23
|
+
base.class_option setting.key,
|
24
|
+
type: :string,
|
25
|
+
default: setting.default,
|
26
|
+
desc: setting.description
|
27
|
+
elsif setting.default.is_a?(TrueClass) || setting.default.is_a?(FalseClass)
|
28
|
+
base.class_option setting.key,
|
29
|
+
type: :boolean,
|
30
|
+
default: setting.default,
|
31
|
+
desc: setting.description
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
12
37
|
require "middleman-cli"
|
13
38
|
|
14
39
|
# Change directory to the root
|
@@ -19,5 +44,23 @@ if ARGV[0] != 'help' && (ARGV.length < 1 || ARGV.first.include?('-'))
|
|
19
44
|
ARGV.unshift('server')
|
20
45
|
end
|
21
46
|
|
47
|
+
::Middleman::Logger.singleton(3)
|
48
|
+
::Middleman::Cli.config = ::Middleman::Application.new do
|
49
|
+
config[:exit_before_ready] = true
|
50
|
+
config[:watcher_disable] = true
|
51
|
+
config[:disable_sitemap] = true
|
52
|
+
end.config
|
53
|
+
|
54
|
+
# Require the Middleman version
|
55
|
+
require 'middleman-core/version'
|
56
|
+
|
57
|
+
# Include the core CLI items
|
58
|
+
require 'middleman-cli/init'
|
59
|
+
require 'middleman-cli/extension'
|
60
|
+
require 'middleman-cli/server'
|
61
|
+
require 'middleman-cli/build'
|
62
|
+
require 'middleman-cli/console'
|
63
|
+
require 'middleman-cli/config'
|
64
|
+
|
22
65
|
# Start the CLI
|
23
66
|
Middleman::Cli::Base.start(ARGV)
|
data/lib/middleman-cli.rb
CHANGED
@@ -21,14 +21,3 @@ module Middleman::Cli
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
# Require the Middleman version
|
26
|
-
require 'middleman-core/version'
|
27
|
-
|
28
|
-
# Include the core CLI items
|
29
|
-
require 'middleman-cli/init'
|
30
|
-
require 'middleman-cli/extension'
|
31
|
-
require 'middleman-cli/server'
|
32
|
-
require 'middleman-cli/build'
|
33
|
-
require 'middleman-cli/console'
|
34
|
-
require 'middleman-cli/config'
|
data/lib/middleman-cli/build.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'middleman-core/application'
|
2
|
+
|
1
3
|
# CLI Module
|
2
4
|
module Middleman::Cli
|
3
5
|
# The CLI Build class
|
@@ -8,8 +10,7 @@ module Middleman::Cli
|
|
8
10
|
|
9
11
|
class_option :environment,
|
10
12
|
aliases: '-e',
|
11
|
-
default:
|
12
|
-
desc: 'The environment Middleman will run under'
|
13
|
+
default: :production
|
13
14
|
class_option :clean,
|
14
15
|
type: :boolean,
|
15
16
|
default: true,
|
@@ -36,6 +37,8 @@ module Middleman::Cli
|
|
36
37
|
default: false,
|
37
38
|
desc: 'Generate profiling report for the build'
|
38
39
|
|
40
|
+
Middleman::Cli.import_config(self)
|
41
|
+
|
39
42
|
# Core build Thor command
|
40
43
|
# @return [void]
|
41
44
|
def build
|
@@ -48,19 +51,27 @@ module Middleman::Cli
|
|
48
51
|
require 'middleman-core/builder'
|
49
52
|
require 'fileutils'
|
50
53
|
|
51
|
-
env = options['environment'].to_sym
|
52
54
|
verbose = options['verbose'] ? 0 : 1
|
53
55
|
instrument = options['instrument']
|
54
56
|
|
55
57
|
builder = nil
|
58
|
+
cli_options = options
|
56
59
|
|
57
60
|
::Middleman::Logger.singleton(verbose, instrument)
|
58
61
|
|
59
62
|
::Middleman::Util.instrument 'builder.setup' do
|
60
63
|
@app = ::Middleman::Application.new do
|
61
64
|
config[:mode] = :build
|
62
|
-
config[:environment] = env
|
63
65
|
config[:show_exceptions] = false
|
66
|
+
|
67
|
+
cli_options.each do |k, v|
|
68
|
+
setting = config.setting(k.to_sym)
|
69
|
+
next unless setting
|
70
|
+
|
71
|
+
v = setting.options[:import].call(v) if setting.options[:import]
|
72
|
+
|
73
|
+
config[k.to_sym] = v
|
74
|
+
end
|
64
75
|
end
|
65
76
|
|
66
77
|
builder = Middleman::Builder.new(@app,
|
data/lib/middleman-cli/config.rb
CHANGED
@@ -23,6 +23,8 @@ module Middleman::Cli
|
|
23
23
|
::Middleman::Logger.singleton(2, false)
|
24
24
|
|
25
25
|
app = ::Middleman::Application.new do
|
26
|
+
config[:disable_sitemap] = true
|
27
|
+
config[:watcher_disable] = true
|
26
28
|
config[:exit_before_ready] = true
|
27
29
|
config[:environment] = opts[:environment].to_sym if opts[:environment]
|
28
30
|
end
|
data/lib/middleman-cli/server.rb
CHANGED
@@ -5,25 +5,13 @@ module Middleman::Cli
|
|
5
5
|
check_unknown_options!
|
6
6
|
|
7
7
|
class_option :environment,
|
8
|
-
aliases: '-e'
|
9
|
-
default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development',
|
10
|
-
desc: 'The environment Middleman will run under'
|
8
|
+
aliases: '-e'
|
11
9
|
class_option :port,
|
12
|
-
aliases: '-p'
|
13
|
-
desc: 'The port Middleman will listen on'
|
10
|
+
aliases: '-p'
|
14
11
|
class_option :server_name,
|
15
|
-
aliases: '-s'
|
16
|
-
desc: 'The server name Middleman will use'
|
12
|
+
aliases: '-s'
|
17
13
|
class_option :bind_address,
|
18
|
-
aliases: '-b'
|
19
|
-
desc: 'The bind address Middleman will listen on'
|
20
|
-
class_option :https,
|
21
|
-
type: :boolean,
|
22
|
-
desc: 'Serve the preview server over SSL/TLS'
|
23
|
-
class_option :ssl_certificate,
|
24
|
-
desc: 'Path to an X.509 certificate to use for the preview server'
|
25
|
-
class_option :ssl_private_key,
|
26
|
-
desc: "Path to an RSA private key for the preview server's certificate"
|
14
|
+
aliases: '-b'
|
27
15
|
class_option :verbose,
|
28
16
|
type: :boolean,
|
29
17
|
default: false,
|
@@ -32,29 +20,18 @@ module Middleman::Cli
|
|
32
20
|
type: :string,
|
33
21
|
default: false,
|
34
22
|
desc: 'Print instrument messages'
|
35
|
-
class_option :disable_watcher,
|
36
|
-
type: :boolean,
|
37
|
-
default: false,
|
38
|
-
desc: 'Disable the file change and delete watcher process'
|
39
23
|
class_option :profile,
|
40
24
|
type: :boolean,
|
41
25
|
default: false,
|
42
26
|
desc: 'Generate profiling report for server startup'
|
43
|
-
class_option :force_polling,
|
44
|
-
type: :boolean,
|
45
|
-
default: false,
|
46
|
-
desc: 'Force file watcher into polling mode'
|
47
|
-
class_option :latency,
|
48
|
-
type: :numeric,
|
49
|
-
aliases: '-l',
|
50
|
-
default: 0.5,
|
51
|
-
desc: 'Set file watcher latency, in seconds'
|
52
27
|
class_option :daemon,
|
53
28
|
type: :boolean,
|
54
29
|
aliases: '-d',
|
55
30
|
default: false,
|
56
31
|
desc: 'Daemonize preview server'
|
57
32
|
|
33
|
+
Middleman::Cli.import_config(self)
|
34
|
+
|
58
35
|
# Start the server
|
59
36
|
def server
|
60
37
|
require 'middleman-core'
|
@@ -66,24 +43,14 @@ module Middleman::Cli
|
|
66
43
|
end
|
67
44
|
|
68
45
|
params = {
|
69
|
-
port: options['port'],
|
70
|
-
bind_address: options['bind_address'],
|
71
|
-
https: options['https'],
|
72
|
-
server_name: options['server_name'],
|
73
|
-
ssl_certificate: options['ssl_certificate'],
|
74
|
-
ssl_private_key: options['ssl_private_key'],
|
75
|
-
environment: options['environment'],
|
76
46
|
debug: options['verbose'],
|
77
47
|
instrumenting: options['instrument'],
|
78
|
-
disable_watcher: options['disable_watcher'],
|
79
48
|
reload_paths: options['reload_paths'],
|
80
|
-
force_polling: options['force_polling'],
|
81
|
-
latency: options['latency'],
|
82
49
|
daemon: options['daemon']
|
83
50
|
}
|
84
51
|
|
85
52
|
puts '== The Middleman is loading'
|
86
|
-
::Middleman::PreviewServer.start(params)
|
53
|
+
::Middleman::PreviewServer.start(params, options)
|
87
54
|
end
|
88
55
|
|
89
56
|
# Add to CLI
|
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.1.
|
4
|
+
version: 4.1.3
|
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: 2016-
|
12
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|