gitgem 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gitgem +24 -0
- data/lib/gitgem/action.rb +22 -14
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da00c7cddc3099c5e27882730d94cc584f1fea96
|
4
|
+
data.tar.gz: 3e8c4482b438d18287a991d8ce08b2276969bca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0da4eb07c9f9bde2d59bb4cd94cf6e76c6424104751bbf436aeb16ba1ec59c792d7ffd0e585dfbc2d382a742c60528c178e9e1ffa2fe93aeea2a0f7f4db5e1f2
|
7
|
+
data.tar.gz: ab7cf298662857650c74c6f7a9d7d500958e3a1bf1001a6ca3ecbb7c4466229f09859c2b049dfbb9de8411d6433868c57dc4022a0f47e1faefdbd858791816e7
|
data/bin/gitgem
CHANGED
@@ -50,6 +50,30 @@ command :remove do |c|
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
desc "Update gem from git repo"
|
54
|
+
arg_name '-a alias -g gem -n bindir'
|
55
|
+
command :install do |c|
|
56
|
+
|
57
|
+
c.desc 'Alias of git repo'
|
58
|
+
c.arg_name 'alias'
|
59
|
+
c.flag [:a, :alias]
|
60
|
+
|
61
|
+
c.desc 'Name of gem'
|
62
|
+
c.arg_name 'gitgem'
|
63
|
+
c.flag [:g, :gem]
|
64
|
+
|
65
|
+
c.desc 'dir will install'
|
66
|
+
c.arg_name '/usr/local/bin'
|
67
|
+
c.flag [:n, :bindir]
|
68
|
+
|
69
|
+
c.action do |_, opts, _|
|
70
|
+
repo = opts[:a]
|
71
|
+
gem_name = opts[:g]
|
72
|
+
bindir = opts[:n]
|
73
|
+
GitGem::Action.update(repo, gem_name, bindir)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
53
77
|
desc "Install gem from git repo"
|
54
78
|
arg_name '-a alias -g gem -n bindir'
|
55
79
|
command :install do |c|
|
data/lib/gitgem/action.rb
CHANGED
@@ -38,6 +38,12 @@ module GitGem
|
|
38
38
|
system("sed -i '' '/#{repo_alias}=/d' #{alias_path}")
|
39
39
|
end
|
40
40
|
|
41
|
+
def update(repo_alias, gem_name, bindir)
|
42
|
+
# system("sudo gem unisntall #{gem_name} -n #{bindir}")
|
43
|
+
uninstall(repo_alias, gem_name, bindir)
|
44
|
+
install(repo_alias, gem_name, bindir)
|
45
|
+
end
|
46
|
+
|
41
47
|
def install(repo_alias, gem_dir, bindir)
|
42
48
|
abort("Please specify alias like alias/gem") if repo_alias.nil? || repo_alias.empty?
|
43
49
|
result = read_alias(repo_alias)
|
@@ -95,20 +101,22 @@ module GitGem
|
|
95
101
|
end
|
96
102
|
|
97
103
|
def uninstall(repo_alias, gem_name, bindir)
|
98
|
-
abort("Please specify alias like alias/gem") if repo_alias.nil? || repo_alias.empty?
|
99
|
-
result = read_alias(repo_alias)
|
100
|
-
abort("Could not find alias named #{repo_alias}, please check again.") if result.nil?
|
101
|
-
repo = result.gsub("#{repo_alias}=", "")
|
102
|
-
|
103
|
-
alias_dir = File.join(base_dir, repo_alias)
|
104
|
-
repo_dir = File.join(alias_dir, File.basename(repo, ".git"))
|
105
|
-
|
106
|
-
gems = Dir.glob(File.join(repo_dir, gem_dir, "*.gem"))
|
107
|
-
abort("Could not find gem in #{File.join(repo_dir, gem_dir)}") if gems.nil? || gems.empty?
|
108
|
-
|
109
|
-
bin = "-n #{bindir}" unless bindir.nil?
|
110
|
-
gem_name = File.basename(gems.first, ".gem").split("-")[0...-1].join("-")
|
111
|
-
system("sudo gem unisntall #{gem_name} #{bin}")
|
104
|
+
# abort("Please specify alias like alias/gem") if repo_alias.nil? || repo_alias.empty?
|
105
|
+
# result = read_alias(repo_alias)
|
106
|
+
# abort("Could not find alias named #{repo_alias}, please check again.") if result.nil?
|
107
|
+
# repo = result.gsub("#{repo_alias}=", "")
|
108
|
+
#
|
109
|
+
# alias_dir = File.join(base_dir, repo_alias)
|
110
|
+
# repo_dir = File.join(alias_dir, File.basename(repo, ".git"))
|
111
|
+
#
|
112
|
+
# gems = Dir.glob(File.join(repo_dir, gem_dir, "*.gem"))
|
113
|
+
# abort("Could not find gem in #{File.join(repo_dir, gem_dir)}") if gems.nil? || gems.empty?
|
114
|
+
#
|
115
|
+
# bin = "-n #{bindir}" unless bindir.nil?
|
116
|
+
# gem_name = File.basename(gems.first, ".gem").split("-")[0...-1].join("-")
|
117
|
+
# system("sudo gem unisntall #{gem_name} #{bin}")
|
118
|
+
|
119
|
+
system("sudo gem uninstall #{gem_name} -n #{bindir}")
|
112
120
|
end
|
113
121
|
|
114
122
|
private
|
data/lib/version.rb
CHANGED