necktie 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/necktie +3 -1
- data/lib/necktie/rake.rb +22 -18
- data/lib/necktie.rb +0 -4
- data/necktie.gemspec +1 -1
- metadata +1 -1
data/bin/necktie
CHANGED
@@ -3,4 +3,6 @@ $LOAD_PATH.unshift File.expand_path("../lib", File.dirname(__FILE__)),
|
|
3
3
|
File.expand_path("../vendor/rake/lib", File.dirname(__FILE__)), File.expand_path("../vendor/rush/lib", File.dirname(__FILE__)),
|
4
4
|
File.expand_path("../vendor/session/lib", File.dirname(__FILE__))
|
5
5
|
require "necktie"
|
6
|
-
|
6
|
+
|
7
|
+
Rake.application = Necktie::Application.new
|
8
|
+
Rake.application.run
|
data/lib/necktie/rake.rb
CHANGED
@@ -12,28 +12,32 @@ module Necktie
|
|
12
12
|
|
13
13
|
def run
|
14
14
|
standard_exception_handling do
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
init
|
16
|
+
repo = File.expand_path(".necktie")
|
17
|
+
unless File.exist?(repo)
|
18
|
+
git_url = ENV["GIT_URL"] or fail "Need GIT_URL variable to point to Git repository, can't clone without it"
|
19
|
+
puts "Cloning #{git_url} to #{repo}"
|
20
|
+
sh "git clone #{git_url} #{repo.inspect}"
|
21
|
+
cloned = true
|
22
|
+
end
|
23
|
+
|
24
|
+
Dir.chdir repo do
|
18
25
|
load_rakefile
|
19
|
-
|
26
|
+
if options.show_tasks
|
27
|
+
display_tasks_and_comments
|
28
|
+
elsif options.show_prereqs
|
29
|
+
display_prerequisites
|
30
|
+
else
|
31
|
+
unless cloned
|
32
|
+
puts "Pulling latest updates to #{repo}"
|
33
|
+
sh "git pull origin #{ENV["BRANCH"] || "master"}"
|
34
|
+
end
|
35
|
+
top_level_tasks.each { |task_name| invoke_task(task_name) }
|
36
|
+
end
|
20
37
|
end
|
21
38
|
end
|
22
39
|
end
|
23
40
|
|
24
|
-
def clone_repo
|
25
|
-
@git_url = ARGV.shift or fail "expecting first argument to be a Git repository URL"
|
26
|
-
repo = File.expand_path(".necktie")
|
27
|
-
if File.exist?(repo)
|
28
|
-
puts "Pulling latest updates to #{repo}"
|
29
|
-
system "cd #{repo.inspect} && git pull origin #{ENV["BRANCH"] || "master"}" or fail
|
30
|
-
else
|
31
|
-
puts "Cloning #{@git_url} to #{repo}"
|
32
|
-
system "git clone #{@git_url} #{repo.inspect}" or fail
|
33
|
-
end
|
34
|
-
repo
|
35
|
-
end
|
36
|
-
|
37
41
|
def necktie_options
|
38
42
|
[
|
39
43
|
['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
|
@@ -74,7 +78,7 @@ module Necktie
|
|
74
78
|
],
|
75
79
|
['--version', '-V', "Display the program version.",
|
76
80
|
lambda { |value|
|
77
|
-
spec = Gem::Specification.load(File.expand_path("
|
81
|
+
spec = Gem::Specification.load(File.expand_path("../../necktie.gemspec", File.dirname(__FILE__)))
|
78
82
|
puts "Necktie, version #{spec.version}"
|
79
83
|
exit
|
80
84
|
}
|
data/lib/necktie.rb
CHANGED
data/necktie.gemspec
CHANGED