install_gem_local 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/install_gem_local.rb +6 -3
- data/lib/install_gem_local/action.rb +21 -87
- data/lib/install_gem_local/action/build_gem.rb +11 -0
- data/lib/install_gem_local/action/copy_gem.rb +40 -0
- data/lib/install_gem_local/action/install_gem.rb +22 -0
- data/lib/install_gem_local/action/remove_gem.rb +24 -0
- data/lib/install_gem_local/navigation.rb +2 -0
- data/lib/install_gem_local/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ed591bb5dfb1babdf51058dd5bb4ecd4cf609586a94a62c4ec430e8febcfb6b
|
4
|
+
data.tar.gz: f92c19446ee17c8ca9d7f6496d2120e8f0fff8b0a0b9400c289fb871a50c322a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef0c709926f78913ef544aa22441856e31492d455a3fa6d11c964426d58fbbf68b5392e105640ecbd11e642cdbfb06d3c7ca9ce4196b21e082c46c76ddf7ace4
|
7
|
+
data.tar.gz: bcd61bce3f0b99079b040ca22fec00cc0613d374cc89127e17fffae81ef6fbe31ad83262713bc50fda9b40d04902f3c15a409b23580fc0126d676288b5484ad7
|
data/Gemfile.lock
CHANGED
data/lib/install_gem_local.rb
CHANGED
@@ -5,9 +5,12 @@ require 'downup'
|
|
5
5
|
require 'awesome_print'
|
6
6
|
require 'tty-command'
|
7
7
|
|
8
|
-
require 'install_gem_local/
|
9
|
-
require 'install_gem_local/
|
10
|
-
require 'install_gem_local/action'
|
8
|
+
require 'install_gem_local/action/install_gem'
|
9
|
+
require 'install_gem_local/action/build_gem'
|
10
|
+
require 'install_gem_local/action/remove_gem'
|
11
|
+
require 'install_gem_local/action/copy_gem'
|
12
|
+
Dir[File.join(File.expand_path("..",__FILE__), 'install_gem_local', '**/*.rb')].each {|f| require f}
|
13
|
+
|
11
14
|
|
12
15
|
module InstallGemLocal
|
13
16
|
class App < Thor
|
@@ -2,110 +2,44 @@
|
|
2
2
|
|
3
3
|
module InstallGemLocal
|
4
4
|
class Action
|
5
|
+
extend InstallGemLocal::InstallGem
|
6
|
+
extend InstallGemLocal::CopyGem
|
7
|
+
extend InstallGemLocal::RemoveGem
|
8
|
+
extend InstallGemLocal::BuildGem
|
9
|
+
|
5
10
|
class << self
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
elsif file_exists.count == 1
|
11
|
-
remove_file_from_path(file_exists.first)
|
12
|
-
else
|
13
|
-
ap 'Gem not exist'
|
14
|
-
end
|
11
|
+
def till_install
|
12
|
+
remove_gem
|
13
|
+
build_gem
|
14
|
+
install_gem
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def till_copy
|
18
|
+
till_install
|
19
|
+
copy_gem
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
puts '-----------------------------'
|
23
|
-
puts ''
|
24
|
-
file = tty_command.run('find -type f -name "*.gemspec"')
|
25
|
-
ap file_name = file.out.strip
|
26
|
-
file_name.empty? ? ap('Gemspec not exist') : tty_command.run("gem build #{file_name}")
|
27
|
-
end
|
22
|
+
private
|
28
23
|
|
29
|
-
def
|
30
|
-
|
31
|
-
puts ''
|
32
|
-
files_exists = file_names
|
33
|
-
if files_exists.count > 1
|
34
|
-
install_gem_from_path(multiple_version_selection)
|
35
|
-
elsif files_exists.count == 1
|
36
|
-
install_gem_from_path(files_exists.first)
|
37
|
-
else
|
38
|
-
ap 'Gem not exist'
|
39
|
-
end
|
24
|
+
def tty_command
|
25
|
+
@tty_command ||= TTY::Command.new
|
40
26
|
end
|
41
27
|
|
42
|
-
def
|
43
|
-
tty_command.run(
|
28
|
+
def file_names
|
29
|
+
file = tty_command.run('find -type f -name "*.gem"')
|
30
|
+
file.entries
|
44
31
|
end
|
45
32
|
|
46
|
-
def multiple_version_selection
|
47
|
-
options =
|
33
|
+
def multiple_version_selection(include_all: false)
|
34
|
+
options =
|
35
|
+
include_all ? { '*' => { 'value' => 'all', 'display' => 'All Versions' } } : {}
|
48
36
|
file_names.each_with_index do |file_name, index|
|
49
37
|
options[('a'..'z').to_a[index]] = { 'value' => file_name, 'display' => file_name }
|
50
38
|
end
|
51
39
|
options['/'] = { 'value' => 'exit', 'display' => 'Exit'}
|
52
40
|
Downup::Base.new(flash_message: 'Choose which version',
|
53
41
|
options: options).prompt
|
54
|
-
end
|
55
|
-
|
56
|
-
def file_names
|
57
|
-
file = tty_command.run('find -type f -name "*.gem"')
|
58
|
-
file.entries
|
59
|
-
end
|
60
|
-
|
61
|
-
def tty_command
|
62
|
-
@tty_command ||= TTY::Command.new
|
63
|
-
end
|
64
|
-
|
65
|
-
def choose_copy_folder
|
66
|
-
options = {
|
67
|
-
'a' => { 'value' => 'desktop', 'display' => 'Desktop' },
|
68
|
-
'b' => { 'value' => 'downloads', 'display' => 'Downloads' },
|
69
|
-
'c' => { 'value' => 'documents', 'display' => 'Documents' },
|
70
|
-
'/' => { 'value' => 'exit', 'display' => 'Exit' }
|
71
|
-
}
|
72
|
-
|
73
|
-
Downup::Base.new(flash_message: 'Choose Folder To Copy',
|
74
|
-
options: options).prompt
|
75
|
-
end
|
76
|
-
|
77
|
-
def copy_gem
|
78
|
-
files_exists = file_names
|
79
|
-
|
80
|
-
if files_exists.count > 1
|
81
|
-
copy_file_to_path(multiple_version_selection)
|
82
|
-
elsif files_exists.count == 1
|
83
|
-
copy_file_to_path(files_exists.first)
|
84
|
-
else
|
85
|
-
ap 'Gem not exist'
|
86
|
-
end
|
87
|
-
end
|
88
42
|
|
89
|
-
def copy_file_to_path(file_name)
|
90
|
-
case choose_copy_folder
|
91
|
-
when 'desktop'
|
92
|
-
tty_command.run("cp #{file_name} ~/Desktop")
|
93
|
-
when 'downloads'
|
94
|
-
tty_command.run("cp #{file_name} ~/Downloads")
|
95
|
-
when 'documents'
|
96
|
-
tty_command.run("cp #{file_name} ~/Documents")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def till_install
|
101
|
-
remove_gem
|
102
|
-
build_gem
|
103
|
-
install_gem
|
104
|
-
end
|
105
|
-
|
106
|
-
def till_copy
|
107
|
-
till_install
|
108
|
-
copy_gem
|
109
43
|
end
|
110
44
|
end
|
111
45
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module InstallGemLocal
|
2
|
+
module BuildGem
|
3
|
+
def build_gem
|
4
|
+
puts '-----------------------------'
|
5
|
+
puts ''
|
6
|
+
file = tty_command.run('find -type f -name "*.gemspec"')
|
7
|
+
ap file_name = file.out.strip
|
8
|
+
file_name.empty? ? ap('Gemspec not exist') : tty_command.run("gem build #{file_name}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module InstallGemLocal
|
2
|
+
module CopyGem
|
3
|
+
def choose_copy_folder
|
4
|
+
options = {
|
5
|
+
'a' => { 'value' => 'desktop', 'display' => 'Desktop' },
|
6
|
+
'b' => { 'value' => 'downloads', 'display' => 'Downloads' },
|
7
|
+
'c' => { 'value' => 'documents', 'display' => 'Documents' },
|
8
|
+
'/' => { 'value' => 'exit', 'display' => 'Exit' }
|
9
|
+
}
|
10
|
+
|
11
|
+
Downup::Base.new(flash_message: 'Choose Folder To Copy',
|
12
|
+
options: options).prompt
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_gem
|
16
|
+
files_exists = file_names
|
17
|
+
|
18
|
+
if files_exists.count > 1
|
19
|
+
copy_file_to_path(multiple_version_selection)
|
20
|
+
elsif files_exists.count == 1
|
21
|
+
copy_file_to_path(files_exists.first)
|
22
|
+
else
|
23
|
+
ap 'Gem not exist'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def copy_file_to_path(file_name)
|
28
|
+
return if file_name == 'exit'
|
29
|
+
|
30
|
+
case choose_copy_folder
|
31
|
+
when 'desktop'
|
32
|
+
tty_command.run("cp #{file_name} ~/Desktop")
|
33
|
+
when 'downloads'
|
34
|
+
tty_command.run("cp #{file_name} ~/Downloads")
|
35
|
+
when 'documents'
|
36
|
+
tty_command.run("cp #{file_name} ~/Documents")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module InstallGemLocal
|
2
|
+
module InstallGem
|
3
|
+
def install_gem
|
4
|
+
puts '-----------------------------'
|
5
|
+
puts ''
|
6
|
+
files_exists = file_names
|
7
|
+
if files_exists.count > 1
|
8
|
+
install_gem_from_path(multiple_version_selection)
|
9
|
+
elsif files_exists.count == 1
|
10
|
+
install_gem_from_path(files_exists.first)
|
11
|
+
else
|
12
|
+
ap 'Gem not exist'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def install_gem_from_path(file_name)
|
17
|
+
return if file_name == 'exit'
|
18
|
+
|
19
|
+
tty_command.run("gem install #{file_name}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module InstallGemLocal
|
2
|
+
module RemoveGem
|
3
|
+
def remove_gem
|
4
|
+
file_exists = file_names
|
5
|
+
if file_exists.count > 1
|
6
|
+
remove_file_from_path(multiple_version_selection(include_all: true))
|
7
|
+
elsif file_exists.count == 1
|
8
|
+
remove_file_from_path(file_exists.first)
|
9
|
+
else
|
10
|
+
ap 'Gem not exist'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def remove_file_from_path(file_name)
|
15
|
+
return if file_name == 'exit'
|
16
|
+
|
17
|
+
if file_name == 'all'
|
18
|
+
tty_command.run('rm *.gem')
|
19
|
+
else
|
20
|
+
tty_command.run("rm #{file_name}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: install_gem_local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dhanabal T
|
@@ -155,6 +155,10 @@ files:
|
|
155
155
|
- install_gem_local.gemspec
|
156
156
|
- lib/install_gem_local.rb
|
157
157
|
- lib/install_gem_local/action.rb
|
158
|
+
- lib/install_gem_local/action/build_gem.rb
|
159
|
+
- lib/install_gem_local/action/copy_gem.rb
|
160
|
+
- lib/install_gem_local/action/install_gem.rb
|
161
|
+
- lib/install_gem_local/action/remove_gem.rb
|
158
162
|
- lib/install_gem_local/navigation.rb
|
159
163
|
- lib/install_gem_local/version.rb
|
160
164
|
homepage: https://github.com/dhanabalt/install_gem_local
|