gill 1.0.0.rc.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -1
- data/Gemfile.lock +26 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.rdoc +10 -10
- data/bin/gill +1 -1
- data/lib/gill/cli.rb +138 -0
- data/lib/gill/config.rb +168 -25
- data/lib/gill/gill.rb +13 -156
- data/lib/gill/git.rb +42 -59
- data/lib/gill/helper.rb +28 -5
- data/lib/gill/import.rb +11 -9
- data/lib/gill/remove.rb +51 -88
- data/lib/gill/version.rb +1 -2
- data/spec/config_spec.rb +47 -0
- data/spec/gill_spec.rb +4 -2
- data/spec/git_spec.rb +47 -0
- data/spec/spec_helper.rb +15 -2
- metadata +15 -18
- data/gill.gemspec +0 -79
- data/lib/gill/config/cache.rb +0 -75
- data/lib/gill/config/setup.rb +0 -77
- data/spec/parse_spec.rb +0 -37
data/spec/gill_spec.rb
CHANGED
data/spec/git_spec.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "gill/gill"
|
3
|
+
|
4
|
+
describe Git do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
Gill.config = Settings::Config.new('/tmp')
|
8
|
+
@uri = Parse.new('git://github.com/mephux/gill.git')
|
9
|
+
@git = Git.new(@uri.category, @uri.folder, @uri.repo)
|
10
|
+
#@git.clone
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:all) do
|
14
|
+
FileUtils.rm_rf('/tmp/source')
|
15
|
+
FileUtils.rm_rf('/tmp/.gillrc')
|
16
|
+
FileUtils.rm_rf('/tmp/.gillcache')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should parse the empty category name as false" do
|
20
|
+
@uri.category.should == false
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should parse the folder name as gill" do
|
24
|
+
@uri.folder.should == 'gill'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should parse the repo as git://github.com/mephux/gill.git" do
|
28
|
+
@uri.repo.should == 'git://github.com/mephux/gill.git'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have a category of misc" do
|
32
|
+
@git.category.should == 'misc'
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have a category path of /tmp/source/misc" do
|
36
|
+
@git.category_path.should == '/tmp/source/misc'
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have a repo name of gill" do
|
40
|
+
@git.repo_name.should == 'gill'
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have a repo path of /tmp/source/misc/gill" do
|
44
|
+
@git.repo_path.should == '/tmp/source/misc/gill'
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,20 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
STDERR.puts e.message
|
8
|
+
STDERR.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
3
12
|
require 'spec'
|
13
|
+
require "gill/helper"
|
14
|
+
require "gill/config"
|
15
|
+
require "gill/parse"
|
16
|
+
require "gill/git"
|
4
17
|
|
5
18
|
require 'gill/version'
|
6
19
|
|
7
|
-
include Gill
|
20
|
+
include Gill
|
metadata
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
|
10
|
-
- 4
|
11
|
-
version: 1.0.0.rc.4
|
9
|
+
version: 1.0.0
|
12
10
|
platform: ruby
|
13
11
|
authors:
|
14
12
|
- Dustin Willis Webber
|
@@ -16,7 +14,7 @@ autorequire:
|
|
16
14
|
bindir: bin
|
17
15
|
cert_chain: []
|
18
16
|
|
19
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-09 00:00:00 -04:00
|
20
18
|
default_executable: gill
|
21
19
|
dependencies: []
|
22
20
|
|
@@ -27,22 +25,21 @@ executables:
|
|
27
25
|
extensions: []
|
28
26
|
|
29
27
|
extra_rdoc_files:
|
30
|
-
- LICENSE
|
28
|
+
- LICENSE
|
31
29
|
- README.rdoc
|
32
30
|
files:
|
33
31
|
- .gitignore
|
34
32
|
- .specopts
|
35
33
|
- .yardopts
|
36
34
|
- Gemfile
|
37
|
-
-
|
35
|
+
- Gemfile.lock
|
36
|
+
- LICENSE
|
38
37
|
- README.rdoc
|
39
38
|
- Rakefile
|
40
39
|
- bin/gill
|
41
|
-
- gill.gemspec
|
42
40
|
- lib/gill.rb
|
41
|
+
- lib/gill/cli.rb
|
43
42
|
- lib/gill/config.rb
|
44
|
-
- lib/gill/config/cache.rb
|
45
|
-
- lib/gill/config/setup.rb
|
46
43
|
- lib/gill/exceptions.rb
|
47
44
|
- lib/gill/exceptions/argument_error.rb
|
48
45
|
- lib/gill/exceptions/cache_error.rb
|
@@ -59,8 +56,9 @@ files:
|
|
59
56
|
- lib/gill/parse.rb
|
60
57
|
- lib/gill/remove.rb
|
61
58
|
- lib/gill/version.rb
|
59
|
+
- spec/config_spec.rb
|
62
60
|
- spec/gill_spec.rb
|
63
|
-
- spec/
|
61
|
+
- spec/git_spec.rb
|
64
62
|
- spec/spec.opts
|
65
63
|
- spec/spec_helper.rb
|
66
64
|
has_rdoc: yard
|
@@ -77,20 +75,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
75
|
requirements:
|
78
76
|
- - ">="
|
79
77
|
- !ruby/object:Gem::Version
|
80
|
-
hash: -
|
78
|
+
hash: -3202130277375719218
|
81
79
|
segments:
|
82
80
|
- 0
|
83
81
|
version: "0"
|
84
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
84
|
requirements:
|
87
|
-
- - "
|
85
|
+
- - ">="
|
88
86
|
- !ruby/object:Gem::Version
|
89
87
|
segments:
|
90
|
-
-
|
91
|
-
|
92
|
-
- 1
|
93
|
-
version: 1.3.1
|
88
|
+
- 0
|
89
|
+
version: "0"
|
94
90
|
requirements: []
|
95
91
|
|
96
92
|
rubyforge_project:
|
@@ -99,6 +95,7 @@ signing_key:
|
|
99
95
|
specification_version: 3
|
100
96
|
summary: Gill- Git, Clone, Cleanliness.
|
101
97
|
test_files:
|
98
|
+
- spec/config_spec.rb
|
102
99
|
- spec/gill_spec.rb
|
103
|
-
- spec/
|
100
|
+
- spec/git_spec.rb
|
104
101
|
- spec/spec_helper.rb
|
data/gill.gemspec
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{gill}
|
8
|
-
s.version = "1.0.0.rc.4"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Dustin Willis Webber"]
|
12
|
-
s.date = %q{2010-08-03}
|
13
|
-
s.default_executable = %q{gill}
|
14
|
-
s.description = %q{Gill is a simple Ruby app to help keep your git clones clean and organized.}
|
15
|
-
s.email = %q{dustin.webber@gmail.com}
|
16
|
-
s.executables = ["gill"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".gitignore",
|
23
|
-
".specopts",
|
24
|
-
".yardopts",
|
25
|
-
"Gemfile",
|
26
|
-
"LICENSE.txt",
|
27
|
-
"README.rdoc",
|
28
|
-
"Rakefile",
|
29
|
-
"bin/gill",
|
30
|
-
"gill.gemspec",
|
31
|
-
"lib/gill.rb",
|
32
|
-
"lib/gill/config.rb",
|
33
|
-
"lib/gill/config/cache.rb",
|
34
|
-
"lib/gill/config/setup.rb",
|
35
|
-
"lib/gill/exceptions.rb",
|
36
|
-
"lib/gill/exceptions/argument_error.rb",
|
37
|
-
"lib/gill/exceptions/cache_error.rb",
|
38
|
-
"lib/gill/exceptions/category_missing.rb",
|
39
|
-
"lib/gill/exceptions/directory_error.rb",
|
40
|
-
"lib/gill/exceptions/error.rb",
|
41
|
-
"lib/gill/exceptions/repository_error.rb",
|
42
|
-
"lib/gill/exceptions/repository_missing.rb",
|
43
|
-
"lib/gill/exceptions/syntax_error.rb",
|
44
|
-
"lib/gill/gill.rb",
|
45
|
-
"lib/gill/git.rb",
|
46
|
-
"lib/gill/helper.rb",
|
47
|
-
"lib/gill/import.rb",
|
48
|
-
"lib/gill/parse.rb",
|
49
|
-
"lib/gill/remove.rb",
|
50
|
-
"lib/gill/version.rb",
|
51
|
-
"spec/gill_spec.rb",
|
52
|
-
"spec/parse_spec.rb",
|
53
|
-
"spec/spec.opts",
|
54
|
-
"spec/spec_helper.rb"
|
55
|
-
]
|
56
|
-
s.has_rdoc = %q{yard}
|
57
|
-
s.homepage = %q{http://github.com/mephux/gill}
|
58
|
-
s.licenses = ["MIT"]
|
59
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
60
|
-
s.require_paths = ["lib"]
|
61
|
-
s.rubygems_version = %q{1.3.7}
|
62
|
-
s.summary = %q{Gill- Git, Clone, Cleanliness.}
|
63
|
-
s.test_files = [
|
64
|
-
"spec/gill_spec.rb",
|
65
|
-
"spec/parse_spec.rb",
|
66
|
-
"spec/spec_helper.rb"
|
67
|
-
]
|
68
|
-
|
69
|
-
if s.respond_to? :specification_version then
|
70
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
71
|
-
s.specification_version = 3
|
72
|
-
|
73
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
74
|
-
else
|
75
|
-
end
|
76
|
-
else
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
data/lib/gill/config/cache.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
module Gill
|
2
|
-
class Config
|
3
|
-
|
4
|
-
module Cache
|
5
|
-
|
6
|
-
# Returns the gill cache yaml file.
|
7
|
-
# @return [Hash] the gill cache
|
8
|
-
def cache
|
9
|
-
@cache ||= find_or_create_cache
|
10
|
-
end
|
11
|
-
|
12
|
-
# Returns the path of the .gillcache file.
|
13
|
-
# @return [String] path to the gill cache file.
|
14
|
-
def cache_path
|
15
|
-
@cache_path
|
16
|
-
end
|
17
|
-
|
18
|
-
# Find or created the gill cache file.
|
19
|
-
def find_or_create_cache
|
20
|
-
if File.exists?("#{@cache_path}")
|
21
|
-
@cache = YAML.load_file(@cache_path)
|
22
|
-
else
|
23
|
-
build_cache
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Build the inital .gillache file in the user home directory.
|
28
|
-
# @return [Hash] the gill cache
|
29
|
-
def build_cache
|
30
|
-
new_cache = Hash.new
|
31
|
-
File.open(@cache_path, 'w') do |out|
|
32
|
-
YAML.dump(new_cache, out)
|
33
|
-
end
|
34
|
-
YAML.load_file(@cache_path)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Rebuild cache writes updated entries to the .gillache file in the user home directory.
|
38
|
-
# @param [String] path to the gill cache file
|
39
|
-
# @param [String] override the default cache path in the gill configuration file.
|
40
|
-
def rebuild_cache(cache, path=false)
|
41
|
-
@cache_path = path if path
|
42
|
-
File.open("#{@cache_path}", 'w+') do |out|
|
43
|
-
YAML.dump(cache, out)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# Checks the current gill cache file for missing entries and removes them accordingly.
|
48
|
-
def cache_check!
|
49
|
-
|
50
|
-
updated_cache = @cache
|
51
|
-
return if updated_cache.nil?
|
52
|
-
|
53
|
-
updated_cache.each do |key,value|
|
54
|
-
|
55
|
-
if File.directory?("#{source_path}/#{key}")
|
56
|
-
unless value.nil?
|
57
|
-
value.each do |skey,svalue|
|
58
|
-
|
59
|
-
unless File.directory?("#{svalue[:path]}")
|
60
|
-
updated_cache[:"#{key}"].delete(:"#{skey}")
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
65
|
-
updated_cache.delete(:"#{key}") if updated_cache[:"#{key}"].values.empty?
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
rebuild_cache(updated_cache)
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
data/lib/gill/config/setup.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
module Gill
|
2
|
-
class Config
|
3
|
-
|
4
|
-
module Setup
|
5
|
-
|
6
|
-
# Returns the gill configuration.
|
7
|
-
# @return [Hash] the gill configuration
|
8
|
-
def config
|
9
|
-
@config
|
10
|
-
end
|
11
|
-
|
12
|
-
# Finds or created the gill configuration file.
|
13
|
-
# @return [Hash] the gill configuration file
|
14
|
-
def find_or_create_config
|
15
|
-
|
16
|
-
if File.exists?("#{@config_path}")
|
17
|
-
find_or_create_cache
|
18
|
-
@config = YAML.load_file(@config_path)
|
19
|
-
|
20
|
-
unless File.exists?(@config[:default]) && File.directory?(@config[:default])
|
21
|
-
Dir.mkdir(@config[:default])
|
22
|
-
end
|
23
|
-
|
24
|
-
build_source_folder
|
25
|
-
else
|
26
|
-
build_config && find_or_create_cache
|
27
|
-
@config = YAML.load_file(@config_path)
|
28
|
-
build_source_folder
|
29
|
-
end
|
30
|
-
|
31
|
-
YAML.load_file(@config_path)
|
32
|
-
end
|
33
|
-
|
34
|
-
# The gill configuration path.
|
35
|
-
# @return [String] the gill configuration path
|
36
|
-
def config_path
|
37
|
-
@config_path
|
38
|
-
end
|
39
|
-
|
40
|
-
# The source folder path set in the gill configuration file.
|
41
|
-
# @return [String] the gill source folder path.
|
42
|
-
def source_path
|
43
|
-
@config[:source]
|
44
|
-
end
|
45
|
-
|
46
|
-
def default_path
|
47
|
-
@config[:default]
|
48
|
-
end
|
49
|
-
|
50
|
-
# Build the initial .gillrc configuration file.
|
51
|
-
def build_config
|
52
|
-
|
53
|
-
config = { :home => @home, :config => @config_path, :source => "#{@home}/source", :default => "#{@home}/source/misc", :cache => @cache_path }
|
54
|
-
|
55
|
-
File.open(@config_path, 'w') do |out|
|
56
|
-
YAML.dump(config, out)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
# Build the initial source directory configured in the .gillrc file.
|
62
|
-
# The initial source directory is only created if it does not exist.
|
63
|
-
def build_source_folder
|
64
|
-
|
65
|
-
unless File.directory?(@config[:source])
|
66
|
-
|
67
|
-
STDERR.puts "Creating Source Directory: " + "#{@config[:source]}"
|
68
|
-
Dir.mkdir(@config[:source])
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
data/spec/parse_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'gill/parse'
|
2
|
-
|
3
|
-
describe Parse do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@p = Parse.new("https://mephux@github.com/mephux/gill.git#ruby")
|
7
|
-
@p1 = Parse.new("http://mephux@github.com:gill.git#ruby#gill-dev")
|
8
|
-
@p2 = Parse.new("git://mephux@github.com/3/3/3/mephux/gill.git#dev")
|
9
|
-
@p3 = Parse.new("mephux@github.com/gill.git#test-123")
|
10
|
-
@p4 = Parse.new("mephux@127.0.0.1:gill.git#ruby/w0ot/w0ot/test#hello")
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should grab the repository name correctly" do
|
14
|
-
@p.folder.should == 'gill'
|
15
|
-
@p1.folder.should == 'gill-dev'
|
16
|
-
@p2.folder.should == 'gill'
|
17
|
-
@p3.folder.should == 'gill'
|
18
|
-
@p4.folder.should == 'hello'
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should grab the repository uri correctly" do
|
22
|
-
@p.repo.should == 'https://mephux@github.com/mephux/gill.git'
|
23
|
-
@p1.repo.should == 'http://mephux@github.com:gill.git'
|
24
|
-
@p2.repo.should == 'git://mephux@github.com/3/3/3/mephux/gill.git'
|
25
|
-
@p3.repo.should == 'mephux@github.com/gill.git'
|
26
|
-
@p4.repo.should == 'mephux@127.0.0.1:gill.git'
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should grab the repository category name correctly" do
|
30
|
-
@p.category.should == 'ruby'
|
31
|
-
@p1.category.should == 'ruby'
|
32
|
-
@p2.category.should == 'dev'
|
33
|
-
@p3.category.should == 'test-123'
|
34
|
-
@p4.category.should == 'ruby/w0ot/w0ot/test'
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|