gill 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gill +0 -1
- data/gill.gemspec +7 -4
- data/lib/gill/exceptions/category_missing.rb +5 -0
- data/lib/gill/exceptions/repository_missing.rb +5 -0
- data/lib/gill/exceptions/syntax_error.rb +5 -0
- data/lib/gill/exceptions.rb +3 -0
- data/lib/gill/gill.rb +7 -6
- data/lib/gill/git.rb +11 -4
- data/lib/gill/remove.rb +3 -0
- data/lib/gill/version.rb +1 -1
- data/lib/gill.rb +1 -0
- metadata +12 -4
data/bin/gill
CHANGED
data/gill.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gill}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dustin Willis Webber"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-14}
|
13
13
|
s.default_executable = %q{gill}
|
14
14
|
s.description = %q{Gill is a simple Ruby app to help keep your git clones clean and organized.}
|
15
15
|
s.email = %q{dustin.webber@gmail.com}
|
@@ -34,9 +34,12 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/gill/config/setup.rb",
|
35
35
|
"lib/gill/exceptions.rb",
|
36
36
|
"lib/gill/exceptions/argument_error.rb",
|
37
|
+
"lib/gill/exceptions/category_missing.rb",
|
37
38
|
"lib/gill/exceptions/directory_error.rb",
|
38
39
|
"lib/gill/exceptions/error.rb",
|
39
40
|
"lib/gill/exceptions/repository_error.rb",
|
41
|
+
"lib/gill/exceptions/repository_missing.rb",
|
42
|
+
"lib/gill/exceptions/syntax_error.rb",
|
40
43
|
"lib/gill/gill.rb",
|
41
44
|
"lib/gill/git.rb",
|
42
45
|
"lib/gill/helper.rb",
|
@@ -53,7 +56,7 @@ Gem::Specification.new do |s|
|
|
53
56
|
s.licenses = ["MIT"]
|
54
57
|
s.rdoc_options = ["--charset=UTF-8"]
|
55
58
|
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = %q{1.3.
|
59
|
+
s.rubygems_version = %q{1.3.7}
|
57
60
|
s.summary = %q{Gill- Git, Clone, Cleanliness.}
|
58
61
|
s.test_files = [
|
59
62
|
"spec/gill_spec.rb",
|
@@ -65,7 +68,7 @@ Gem::Specification.new do |s|
|
|
65
68
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
66
69
|
s.specification_version = 3
|
67
70
|
|
68
|
-
if Gem::Version.new(Gem::
|
71
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
69
72
|
else
|
70
73
|
end
|
71
74
|
else
|
data/lib/gill/exceptions.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'gill/exceptions/error'
|
2
|
+
require 'gill/exceptions/category_missing'
|
3
|
+
require 'gill/exceptions/repository_missing'
|
4
|
+
require 'gill/exceptions/syntax_error'
|
2
5
|
require 'gill/exceptions/argument_error'
|
3
6
|
require 'gill/exceptions/repository_error'
|
4
7
|
require 'gill/exceptions/directory_error'
|
data/lib/gill/gill.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'optparse'
|
3
|
+
require 'yaml'
|
4
|
+
|
1
5
|
require 'gill/config'
|
2
6
|
require 'gill/helper'
|
3
7
|
require 'gill/git'
|
4
8
|
require 'gill/remove'
|
5
9
|
require 'gill/parse'
|
6
|
-
require 'gill/version'
|
7
10
|
require 'gill/exceptions'
|
8
11
|
|
9
|
-
require 'fileutils'
|
10
|
-
require 'optparse'
|
11
|
-
require 'yaml'
|
12
|
-
|
13
12
|
module Gill
|
14
13
|
|
15
14
|
# Module method for the gill configuration.
|
@@ -88,8 +87,9 @@ module Gill
|
|
88
87
|
# Update a gill repository.
|
89
88
|
def Gill.update
|
90
89
|
begin
|
90
|
+
raise(SyntaxError, "Invalid Syntax. Arguments must be separated by `#`. Example: gill -u category#title") unless @options[:update] =~ /\#/
|
91
91
|
args = @options[:update].split(/\#/)
|
92
|
-
raise(ArgumentError, "Requires
|
92
|
+
raise(ArgumentError, "Requires argument. category#title") if args.length != 2
|
93
93
|
category, folder, branch = args
|
94
94
|
git = Git.new(category, folder, false)
|
95
95
|
if branch
|
@@ -125,6 +125,7 @@ module Gill
|
|
125
125
|
# Remove a gill cloned repository.
|
126
126
|
def Gill.remove
|
127
127
|
begin
|
128
|
+
raise(SyntaxError, "Invalid Syntax. Arguments must be separated by `#`. Example: gill -r category#title") unless @options[:remove] =~ /\#/
|
128
129
|
Remove.new(@options[:remove]).remove_repo
|
129
130
|
rescue Gill::DirectoryError => e
|
130
131
|
STDERR.puts "Error: #{e}"
|
data/lib/gill/git.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'tempfile'
|
1
2
|
module Gill
|
2
3
|
|
3
4
|
class Git
|
4
5
|
# Include the gill cache convenience methods.
|
5
6
|
include Config::Cache
|
7
|
+
include Gill::Helper
|
6
8
|
|
7
9
|
# Initialize a new gill git instance.
|
8
10
|
#
|
@@ -34,6 +36,8 @@ module Gill
|
|
34
36
|
# The branch to git pull
|
35
37
|
#
|
36
38
|
def update(branch='master')
|
39
|
+
raise(CategoryMissing, "Unknown Category: `#{@folder}`") unless File.directory?(@category_path)
|
40
|
+
raise(RepositoryMissing, "Unknown Repository: `#{@folder}`") unless File.directory?(@folder_path)
|
37
41
|
Dir.chdir(@folder_path)
|
38
42
|
STDOUT.puts "Updating #{@folder} repository."
|
39
43
|
if system('git', 'pull', 'origin', branch)
|
@@ -77,13 +81,15 @@ module Gill
|
|
77
81
|
end
|
78
82
|
end
|
79
83
|
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
84
|
+
# Clone
|
83
85
|
def clone
|
86
|
+
|
84
87
|
if File.directory?(@folder_path) && @folder
|
88
|
+
|
85
89
|
raise(DirectoryError, "destination path '#{@folder_path}' already exists and is not an empty directory.")
|
90
|
+
|
86
91
|
else
|
92
|
+
|
87
93
|
if @folder
|
88
94
|
build_type_folder
|
89
95
|
build_cache if system('git', 'clone', @repo, @folder_path)
|
@@ -92,9 +98,10 @@ module Gill
|
|
92
98
|
Dir.chdir(@folder_path)
|
93
99
|
build_cache if system('git', 'clone', @repo)
|
94
100
|
end
|
101
|
+
|
95
102
|
end
|
96
103
|
end
|
97
|
-
|
104
|
+
|
98
105
|
end
|
99
106
|
|
100
107
|
end
|
data/lib/gill/remove.rb
CHANGED
@@ -38,6 +38,9 @@ module Gill
|
|
38
38
|
type_folder = "#{@source}/#{@category}"
|
39
39
|
folder = "#{@source}/#{@category}/#{@folder}"
|
40
40
|
|
41
|
+
raise(CategoryMissing, "Unknown Category: `#{@folder}`") unless File.directory?(type_folder)
|
42
|
+
raise(RepositoryMissing, "Unknown Repository: `#{@folder}`") unless File.directory?(folder)
|
43
|
+
|
41
44
|
if File.directory?(type_folder) && File.directory?(folder) && !Gill.config.cache.empty?
|
42
45
|
|
43
46
|
if Gill.config.cache[:"#{@category}"][:"#{@folder}"]
|
data/lib/gill/version.rb
CHANGED
data/lib/gill.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Dustin Willis Webber
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-14 00:00:00 -04:00
|
18
19
|
default_executable: gill
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -43,9 +44,12 @@ files:
|
|
43
44
|
- lib/gill/config/setup.rb
|
44
45
|
- lib/gill/exceptions.rb
|
45
46
|
- lib/gill/exceptions/argument_error.rb
|
47
|
+
- lib/gill/exceptions/category_missing.rb
|
46
48
|
- lib/gill/exceptions/directory_error.rb
|
47
49
|
- lib/gill/exceptions/error.rb
|
48
50
|
- lib/gill/exceptions/repository_error.rb
|
51
|
+
- lib/gill/exceptions/repository_missing.rb
|
52
|
+
- lib/gill/exceptions/syntax_error.rb
|
49
53
|
- lib/gill/gill.rb
|
50
54
|
- lib/gill/git.rb
|
51
55
|
- lib/gill/helper.rb
|
@@ -66,23 +70,27 @@ rdoc_options:
|
|
66
70
|
require_paths:
|
67
71
|
- lib
|
68
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
69
74
|
requirements:
|
70
75
|
- - ">="
|
71
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
72
78
|
segments:
|
73
79
|
- 0
|
74
80
|
version: "0"
|
75
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
76
83
|
requirements:
|
77
84
|
- - ">="
|
78
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
79
87
|
segments:
|
80
88
|
- 0
|
81
89
|
version: "0"
|
82
90
|
requirements: []
|
83
91
|
|
84
92
|
rubyforge_project:
|
85
|
-
rubygems_version: 1.3.
|
93
|
+
rubygems_version: 1.3.7
|
86
94
|
signing_key:
|
87
95
|
specification_version: 3
|
88
96
|
summary: Gill- Git, Clone, Cleanliness.
|