gill 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -9,6 +9,8 @@ Files created by gill:
9
9
  == Install
10
10
 
11
11
  gem install gill
12
+
13
+ * NOTE: if you are using gill <= 0.0.3 please upgrade to version >= 0.0.4.
12
14
 
13
15
  == Example
14
16
 
data/gill.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gill}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
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"]
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  "lib/gill/app.rb",
35
35
  "lib/gill/config.rb",
36
36
  "lib/gill/git.rb",
37
+ "lib/gill/parse.rb",
37
38
  "lib/gill/remove.rb",
38
39
  "lib/gill/version.rb",
39
40
  "spec/gill_spec.rb",
data/lib/gill/app.rb CHANGED
@@ -2,6 +2,7 @@ require 'gill/config'
2
2
  require 'gill/git'
3
3
  require 'fileutils'
4
4
  require 'gill/remove'
5
+ require 'gill/parse'
5
6
  require 'gill/version'
6
7
  require 'rainbow'
7
8
  require 'yaml'
@@ -15,17 +16,17 @@ module Gill
15
16
  def Gill.run
16
17
  Gill.optparse(*ARGV)
17
18
  begin
18
- uri = @options[:uri].split(':', 3)
19
- type = uri[0]
20
- folder = uri[1]
21
- path = uri[2]
22
- if path =~ /\.git/
23
- gillgit = Git.new(type, folder, path)
19
+
20
+ path = Parse.new(@options[:uri])
21
+
22
+ if path.valid?
23
+ gillgit = Git.new(path.type, path.folder, path.repo)
24
24
  gillgit.clone
25
25
  else
26
26
  STDERR.puts "Gill - Version: #{Gill::VERSION}\n"
27
- STDERR.puts "Error: Not a git repository."
27
+ STDERR.puts "Error: Not a valid git repository \"#{path.repo}\" or is currently not supported."
28
28
  end
29
+
29
30
  rescue TypeError
30
31
  STDERR.puts "Gill - Version: #{Gill::VERSION}\n"
31
32
  STDERR.puts "Error: Please make sure to remove all whitespace from types and folder names."
data/lib/gill/git.rb CHANGED
@@ -11,9 +11,6 @@ module Gill
11
11
  @folder_path = File.join(@type_path, @folder)
12
12
  end
13
13
 
14
- def parse_path
15
- end
16
-
17
14
  def build_cache
18
15
  old_cache = YAML.load_file(@cache)
19
16
  if old_cache[:"#{@type}"]
@@ -39,8 +36,7 @@ module Gill
39
36
  STDERR.puts "destination path '#{@folder_path}' already exists and is not an empty directory.\n"
40
37
  else
41
38
  build_type_folder
42
- build_cache
43
- system('git', 'clone', @path, @folder_path)
39
+ build_cache if system('git', 'clone', @path, @folder_path)
44
40
  end
45
41
  end
46
42
 
data/lib/gill/parse.rb ADDED
@@ -0,0 +1,34 @@
1
+ module Gill
2
+
3
+ class Parse
4
+
5
+ def initialize(uri)
6
+ @uri = uri.split(':', 3)
7
+ end
8
+
9
+ def type
10
+ @uri.first
11
+ end
12
+
13
+ def folder
14
+ @uri[1]
15
+ end
16
+
17
+ def repo
18
+ @uri.last
19
+ end
20
+
21
+ def valid?
22
+ if type && folder && repo
23
+ if repo[/^(http\:|https\:|git\:)+/i] && repo[/\.git/]
24
+ return true
25
+ else
26
+ return false
27
+ end
28
+ else
29
+ return false
30
+ end
31
+ end
32
+
33
+ end
34
+ end
data/lib/gill/remove.rb CHANGED
@@ -57,7 +57,7 @@ module Gill
57
57
  end
58
58
 
59
59
  else
60
-
60
+ remove_cache
61
61
  STDERR.puts "The directory #{@source}/#{@type}/#{@folder} does not exist or was not cloned with gill."
62
62
 
63
63
  end
data/lib/gill/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Gill
2
2
  # Gill Version
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dustin Willis Webber
@@ -97,6 +97,7 @@ files:
97
97
  - lib/gill/app.rb
98
98
  - lib/gill/config.rb
99
99
  - lib/gill/git.rb
100
+ - lib/gill/parse.rb
100
101
  - lib/gill/remove.rb
101
102
  - lib/gill/version.rb
102
103
  - spec/gill_spec.rb