middleman 2.0.0.rc96 → 2.0.0.rc97
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/middleman +68 -3
- data/lib/middleman/cli.rb +3 -11
- data/lib/middleman/version.rb +1 -1
- data/middleman.gemspec +1 -1
- metadata +7 -7
data/bin/middleman
CHANGED
@@ -1,8 +1,73 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "rubygems"
|
3
2
|
|
4
3
|
libdir = File.join(File.dirname(File.dirname(__FILE__)), "lib")
|
5
4
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
6
5
|
|
7
|
-
require '
|
8
|
-
|
6
|
+
require 'pathname'
|
7
|
+
require 'rubygems'
|
8
|
+
|
9
|
+
module Middleman
|
10
|
+
module ProjectLocator
|
11
|
+
def self.locate_middleman_root!(args)
|
12
|
+
cwd = Dir.pwd
|
13
|
+
|
14
|
+
if !in_middleman_project? && !in_middleman_project_subdirectory?
|
15
|
+
$stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
if in_middleman_project?
|
20
|
+
did_locate_middleman_project(cwd, args)
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
24
|
+
Dir.chdir("..") do
|
25
|
+
# Recurse in a chdir block: if the search fails we want to be sure
|
26
|
+
# the application is generated in the original working directory.
|
27
|
+
locate_middleman_root!(args) unless cwd == Dir.pwd
|
28
|
+
end
|
29
|
+
rescue SystemCallError
|
30
|
+
# could not chdir, no problem just return
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.in_middleman_project?
|
34
|
+
File.exists?('config.rb')
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.in_middleman_project_subdirectory?(path = Pathname.new(Dir.pwd))
|
38
|
+
File.exists?(File.join(path, 'config.rb')) || !path.root? && in_middleman_project_subdirectory?(path.parent)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.did_locate_middleman_project(path, args)
|
42
|
+
# Set up gems listed in the Gemfile.
|
43
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', path)
|
44
|
+
|
45
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
46
|
+
|
47
|
+
start_cli!(args)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.start_cli!(args)
|
51
|
+
require 'middleman'
|
52
|
+
Middleman::CLI.start(args)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
args = ARGV.dup
|
58
|
+
|
59
|
+
ARG_ALIASES = {
|
60
|
+
"s" => "server",
|
61
|
+
"b" => "build",
|
62
|
+
"i" => "init"
|
63
|
+
}
|
64
|
+
|
65
|
+
if ARG_ALIASES.has_key?(args[0])
|
66
|
+
args[0] = ARG_ALIASES[args[0]]
|
67
|
+
end
|
68
|
+
|
69
|
+
if args.length < 1 || %w(server build migrate).include?(args.first)
|
70
|
+
Middleman::ProjectLocator.locate_middleman_root!(args)
|
71
|
+
else
|
72
|
+
Middleman::ProjectLocator.start_cli!(args)
|
73
|
+
end
|
data/lib/middleman/cli.rb
CHANGED
@@ -34,7 +34,7 @@ module Middleman
|
|
34
34
|
method_option "livereload", :default => false, :type => :boolean, :desc => "Whether to enable Livereload or not"
|
35
35
|
method_option "livereload-port", :default => "35729", :desc => "The port Livereload will listen on"
|
36
36
|
def server
|
37
|
-
|
37
|
+
v1_check
|
38
38
|
if options["livereload"]
|
39
39
|
livereload_options = {:port => options["livereload-port"]}
|
40
40
|
end
|
@@ -48,13 +48,12 @@ module Middleman
|
|
48
48
|
desc "build", "Builds the static site for deployment"
|
49
49
|
method_option "relative", :type => :boolean, :aliases => "-r", :default => false, :desc => 'Override the config.rb file and force relative urls'
|
50
50
|
def build
|
51
|
-
|
51
|
+
v1_check
|
52
52
|
thor_group = Middleman::Builder.new([], options).invoke_all
|
53
53
|
end
|
54
54
|
|
55
55
|
desc "migrate", "Migrates an older Middleman project to the 2.0 structure"
|
56
56
|
def migrate
|
57
|
-
config_check
|
58
57
|
return if File.exists?("source")
|
59
58
|
`mv public source`
|
60
59
|
`cp -R views/* source/`
|
@@ -68,17 +67,10 @@ module Middleman
|
|
68
67
|
end
|
69
68
|
|
70
69
|
private
|
71
|
-
|
72
|
-
def config_check
|
73
|
-
if !File.exists?("config.rb")
|
74
|
-
$stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
|
75
|
-
exit 1
|
76
|
-
end
|
77
|
-
end
|
78
70
|
|
79
71
|
def v1_check
|
80
72
|
if File.exists?("views") || File.exists?("public")
|
81
|
-
$stderr.puts "== Error: The views and public folders are have been combined.
|
73
|
+
$stderr.puts "== Error: The views and public folders are have been combined. Use the 'middleman migrate' command to merge your folders automatically."
|
82
74
|
exit 1
|
83
75
|
end
|
84
76
|
end
|
data/lib/middleman/version.rb
CHANGED
data/middleman.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_runtime_dependency("compass", ["~> 0.11.3"])
|
34
34
|
s.add_runtime_dependency("coffee-script", ["~> 2.2.0"])
|
35
35
|
s.add_runtime_dependency("sprockets", ["2.0.0.beta.12"])
|
36
|
-
s.add_runtime_dependency("httparty", ["~> 0.7.
|
36
|
+
s.add_runtime_dependency("httparty", ["~> 0.7.8"])
|
37
37
|
s.add_runtime_dependency("guard", ["~> 0.5.1"])
|
38
38
|
s.add_runtime_dependency("guard-livereload", ["~> 0.2.1"])
|
39
39
|
s.add_development_dependency("coffee-filter", ["~> 0.1.1"])
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424151
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 2.0.0.
|
11
|
+
- 97
|
12
|
+
version: 2.0.0.rc97
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Thomas Reynolds
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-08-
|
20
|
+
date: 2011-08-04 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rack
|
@@ -309,12 +309,12 @@ dependencies:
|
|
309
309
|
requirements:
|
310
310
|
- - ~>
|
311
311
|
- !ruby/object:Gem::Version
|
312
|
-
hash:
|
312
|
+
hash: 19
|
313
313
|
segments:
|
314
314
|
- 0
|
315
315
|
- 7
|
316
|
-
-
|
317
|
-
version: 0.7.
|
316
|
+
- 8
|
317
|
+
version: 0.7.8
|
318
318
|
type: :runtime
|
319
319
|
version_requirements: *id018
|
320
320
|
- !ruby/object:Gem::Dependency
|