gito 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a54639cc1df1503eaf535012e5a61b569947255e
4
- data.tar.gz: 73ec3793cff8f9d1b5744dd7b0713fa512a16f0e
3
+ metadata.gz: a85c3491174797ae615e8813408296ec576aa961
4
+ data.tar.gz: 474751d9fb58d4c7e2acb018d6c13fe01b7f2106
5
5
  SHA512:
6
- metadata.gz: 671f49bdf8faeab90805f983e9bd66e7f7de3b550fcb899175ba03eccfd1a13b7ea3f24ae4010a9fc42c62911a8f561e6d55e096ac46ad0cd7b4523aaf3af55c
7
- data.tar.gz: 7256febf8d84d413a7f76a769179cf3245cad7ee4ca67d723d6db157f2baf08d206669ca8e32d008bb94d03f07b5b388b2491486c0b737eef807608cfe6a273d
6
+ metadata.gz: 9b75428890252e0cb8386bbc0b6269bff49aeac67164af731d7c2ca1caab6a0dddfc23f553c7cdf729136949e7b84185472f56813bb2cf53108bbabec1963350
7
+ data.tar.gz: fda5014a0c155278ca8e1b304e2c3b8c84038dbf4b9f88937275f20426eb837ec24df0ef12cd7ef0fb7cfb114d25d28723d502ba60cb12905c9ca721ce131639
data/lib/gito/project.rb CHANGED
@@ -33,16 +33,20 @@ class Project
33
33
  end
34
34
 
35
35
  def destination
36
- unless @base_url.include? 'github.com'
37
- return Digest::SHA256.hexdigest @base_url
38
- end
39
-
40
36
  stripped_url = @base_url.gsub('.git', '')
41
37
  stripped_url = stripped_url.gsub('.git', '')
42
38
  stripped_url = stripped_url.gsub('git@github.com:', '')
43
39
  stripped_url = stripped_url.gsub('https://github.com/', '')
44
40
  stripped_url.gsub('http://github.com/', '')
45
41
 
42
+ if stripped_url.start_with?('http')
43
+ stripped_url = stripped_url.split('/').last(2).join('/')
44
+ end
45
+
46
+ if stripped_url.include?(':') && stripped_url.start_with?('git@')
47
+ stripped_url = stripped_url.split(':').last
48
+ end
49
+
46
50
  stripped_url.gsub('/','-')
47
51
  end
48
52
 
@@ -76,7 +80,7 @@ class Project
76
80
  end
77
81
  end
78
82
 
79
- def cloneable_url
83
+ def retrieve_cloneable_url
80
84
  starts_with_git = @base_url.split(//).first(4).join.eql? 'git@'
81
85
  ends_with_git = @base_url.split(//).last(4).join.eql? '.git'
82
86
 
@@ -93,7 +97,7 @@ class Project
93
97
  ## CLONE THE REPOSITORY
94
98
  ##
95
99
  def clone(is_temp_folder=false, shell_copy=true)
96
- url = cloneable_url
100
+ url = retrieve_cloneable_url
97
101
 
98
102
  unless is_temp_folder
99
103
  prefix = Dir.pwd + '/'
@@ -105,6 +109,8 @@ class Project
105
109
 
106
110
  if File.directory?(@destination_dir)
107
111
  puts "The folder #{@destination_dir.green} is not empty..."
112
+ go_inside_and_run "git reset --hard HEAD"
113
+ go_inside_and_run "git pull"
108
114
  else
109
115
  shell_copy_string = shell_copy ? '--depth 1' : ''
110
116
  AppUtils.execute("git clone #{shell_copy_string} --recursive #{url} #{@destination_dir}")
data/lib/gito/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gito
2
- VERSION = '0.4.8'
2
+ VERSION = '0.4.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - cesar ferreira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake