francois-gip 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,8 +5,8 @@ Feature: Importing a repository
5
5
 
6
6
  Scenario: Importing into an existing repository
7
7
  Given a project
8
- And a vendor project named 'libcalc'
9
- When I run 'gip import __libcalc__ vendor/libcalc'
8
+ And a vendor project named "libcalc"
9
+ When I run "gip import __libcalc__ vendor/libcalc"
10
10
  Then I should see "Imported __libcalc__ into vendor/libcalc"
11
- And the file '.gipinfo' should contain 'vendor/libcalc,__libcalc__'
11
+ And the file ".gipinfo" should contain "vendor/libcalc,__libcalc__"
12
12
  And the working copy should be clean
@@ -1,12 +1,42 @@
1
1
  Given /^a project$/ do
2
- @project_dir = Pathname.new(Dir.tmpdir) + "gip/#{Process.pid}/project-dir"
3
- FileUtils::Verbose.rm_rf(@project_dir)
4
- @project_dir.mkpath
5
- Dir.chdir(@project_dir) do
6
- sh "touch README", :verbose => true
2
+ Dir.chdir(project_dir) do
3
+ sh "cd #{project_dir}"
4
+ sh "touch README"
5
+ sh "git init"
6
+ sh "git add --all"
7
+ sh "git commit --message 'Initial commit'"
8
+ sh "ls -A"
9
+ end
10
+ end
11
+
12
+ Given /^a vendor project named "([^"]+)"$/ do |name|
13
+ vendor(name) do |path|
14
+ sh "cd #{path}"
15
+ sh "touch README"
16
+ sh "mkdir lib"
17
+ sh "touch lib/#{name}.rb"
7
18
  sh "git init", :verbose => true
8
19
  sh "git add --all", :verbose => true
9
20
  sh "git commit --message 'Initial commit'", :verbose => true
10
- sh "ls -A", :verbose => true
21
+ sh "ls -lA", :verbose => true
22
+ end
23
+ end
24
+
25
+ When /^I run "gip import __([^_]+)__ ([^"]+)"$/ do |vendor, target|
26
+ Dir.chdir(project_dir) do
27
+ sh "gip import #{vendor_dirs[vendor]}/.git #{target}", :verbose => true
11
28
  end
29
+ pending
30
+ end
31
+
32
+ Then /^I should see "([^\"]*)"$/ do |arg1|
33
+ pending
34
+ end
35
+
36
+ Then /^the file '\.gipinfo' should contain 'vendor\/libcalc,__libcalc__'$/ do
37
+ pending
38
+ end
39
+
40
+ Then /^the working copy should be clean$/ do
41
+ pending
12
42
  end
@@ -5,4 +5,32 @@ require "fileutils"
5
5
 
6
6
  require "test/unit/assertions"
7
7
 
8
+ module GipHelpers
9
+ def project_dir
10
+ @project_dir ||= begin
11
+ path = Pathname.new(Dir.tmpdir) + "gip/#{Process.pid}/project-dir"
12
+ path.mkpath
13
+ path
14
+ end
15
+ end
16
+
17
+ def reset_vendors!
18
+ @vendor_dirs.values.each {|dir| dir.rmtree }
19
+ @vendor_dirs = Hash.new
20
+ end
21
+
22
+ def vendor_dirs
23
+ @vendor_dirs
24
+ end
25
+
26
+ def vendor(basename)
27
+ Pathname.new(Dir.tmpdir) / "gip" / Process.pid.to_s / basename
28
+ end
29
+ end
30
+
31
+ World(GipHelpers)
8
32
  World(Test::Unit::Assertions)
33
+
34
+ Before do
35
+ reset_vendors!
36
+ end
data/gip.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gip}
5
- s.version = "0.1.0"
5
+ s.version = "0.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Fran\303\247ois Beausoleil"]
9
- s.date = %q{2009-06-26}
9
+ s.date = %q{2009-07-13}
10
10
  s.default_executable = %q{gip}
11
11
  s.email = %q{francois@teksol.info}
12
12
  s.executables = ["gip"]
data/lib/gip.rb CHANGED
@@ -21,7 +21,11 @@ In all cases, a .gipinfo file will be created/updated with the correct remotes s
21
21
  DESC
22
22
  method_options :commit => :optional, :remote => :optional, :verbose => 0
23
23
  def import(repository_url, path=nil)
24
- uri = URI.parse(repository_url)
24
+ uri = begin
25
+ URI.parse(repository_url)
26
+ rescue URI::InvalidURIError
27
+ URI.parse("git://" + repository_url.split("@", 2).last)
28
+ end
25
29
  path = File.basename(uri.path).sub(File.extname(uri.path), "") unless path
26
30
  name = options[:remote]
27
31
  name = File.basename(uri.path).sub(File.extname(uri.path), "") unless name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: francois-gip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-26 00:00:00 -07:00
12
+ date: 2009-07-13 00:00:00 -07:00
13
13
  default_executable: gip
14
14
  dependencies: []
15
15