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 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
- necktie ARGV
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
- handle_options
16
- Dir.chdir clone_repo do
17
- collect_tasks
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
- top_level
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("../necktie.gemspec", File.dirname(__FILE__)))
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
@@ -3,7 +3,3 @@ require "necktie/files"
3
3
  require "necktie/gems"
4
4
  require "necktie/services"
5
5
  require "necktie/rush"
6
-
7
-
8
- Rake.application = Necktie::Application.new
9
- Rake.application.run
data/necktie.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "necktie"
3
- spec.version = "0.3.0"
3
+ spec.version = "0.3.1"
4
4
  spec.author = "Assaf Arkin"
5
5
  spec.email = "assaf@labnotes.org"
6
6
  spec.homepage = ""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: necktie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Assaf Arkin