gitgem 0.1.4 → 0.1.5

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: 479d7e78a1ecdc575549900fd2799694e1b73243
4
- data.tar.gz: 4cbf05310c5e7a4e3fce5d5ad1efb4e441e53d60
3
+ metadata.gz: da00c7cddc3099c5e27882730d94cc584f1fea96
4
+ data.tar.gz: 3e8c4482b438d18287a991d8ce08b2276969bca9
5
5
  SHA512:
6
- metadata.gz: 6285aa20d9f5526e9fc55b262d9dfa2c4514431af7b807f19cf6dedeae500979747215e4db80256efb06a2ac2449081074659da6fffa613872860cf476e47f61
7
- data.tar.gz: fb9c9fd2c93714b1d7cba82debe04016644ab87d25233673f0fd190bc8f53de80739e13d5dd0f7f5b276986595818c08d9d5ebd45d7cde1698ad42aee880a76f
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|
@@ -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
@@ -1,3 +1,3 @@
1
1
  module GitGem
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - saitjr