starter 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,20 +47,19 @@ task "gem:push" do
47
47
  end
48
48
  end
49
49
 
50
- task "gem:dependencies" => "gemspec" do
50
+ task "gem:deps" => "read_gemspec" do
51
51
  gemspec = $STARTER[:gemspec]
52
- require "pp"
53
- pp gemspec.dependencies.first
54
- # install dependencies from gemspec
55
-
56
- #require 'rubygems/dependency_installer'
57
- #gems = Gem::SourceIndex.from_installed_gems
58
- #installer = Gem::DependencyInstaller.new
59
- #spec.dependencies.each do |dep|
60
- #if gems.find_name(dep.name, dep.requirement).empty?
61
- #installer.install(dep.name, dep.requirement)
62
- #end
63
- #end
52
+
53
+ require 'rubygems/dependency_installer'
54
+ installer = Gem::DependencyInstaller.new
55
+ gemspec.dependencies.each do |dep|
56
+ begin
57
+ Gem::Specification.find_by_name(dep.name, dep.requirement)
58
+ rescue LoadError
59
+ puts "Installing dependency: #{dep.name} #{dep.requirement}"
60
+ installer.install(dep.name, dep.requirement)
61
+ end
62
+ end
64
63
  end
65
64
 
66
65
  task "version" => "read_gemspec" do
@@ -22,7 +22,7 @@ task ".starter" do
22
22
  end
23
23
 
24
24
  task "determine_author" => %w[ read_git_config ] do
25
- if author = $STARTER[:git].config["user.name"]
25
+ if (git = $STARTER[:git]) && (author = git.config["user.name"])
26
26
  $STARTER[:author] = author
27
27
  else
28
28
  $STARTER[:author] = Starter::Prompt.prompt("Project author?")
@@ -30,8 +30,10 @@ task "determine_author" => %w[ read_git_config ] do
30
30
  end
31
31
 
32
32
  task "read_git_config" do
33
- g = Git.open(Dir.pwd)
34
- $STARTER[:git] = g
33
+ if File.exist?(".git")
34
+ g = Git.open(Dir.pwd)
35
+ $STARTER[:git] = g
36
+ end
35
37
  end
36
38
 
37
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-28 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: git
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 1.8.24
90
+ rubygems_version: 1.8.23
91
91
  signing_key:
92
92
  specification_version: 3
93
93
  summary: Generally useful and reusable things