install_gem_local 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 +4 -4
- data/Gemfile +1 -1
- data/lib/install_gem_local.rb +2 -3
- data/lib/install_gem_local/action.rb +74 -33
- data/lib/install_gem_local/navigation.rb +10 -9
- data/lib/install_gem_local/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce714b8b79bf2a7a652e3818bf5ac12dfe571e49f81fcd29d0e305aeecd09b4c
|
4
|
+
data.tar.gz: a05c0d63842d2b3de5d0572e50481c7d0e3a2a4b3132c3fb886aa13fec7b9542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf3f7efac2d9259e68764f155b1ad1f8977d8709d86fa7fed5e55ce57e11af5164c37c0eea0824e9523c8ddda779a68a0f171b521162c8e1cfa5767edbce9823
|
7
|
+
data.tar.gz: 67da087919a77f45ef59f77da878e116310980ab9a313349e579097033eb46fb5fc656b4130633abd9005c3556df726e9d8be7baba95b9a9ab131143cd9385d9
|
data/Gemfile
CHANGED
data/lib/install_gem_local.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'thor'
|
3
4
|
require 'downup'
|
4
5
|
require 'awesome_print'
|
@@ -11,8 +12,6 @@ require 'install_gem_local/action'
|
|
11
12
|
module InstallGemLocal
|
12
13
|
class App < Thor
|
13
14
|
desc 'usage', 'list all commands'
|
14
|
-
def usage
|
15
|
-
|
16
|
-
end
|
15
|
+
def usage; end
|
17
16
|
end
|
18
17
|
end
|
@@ -1,58 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module InstallGemLocal
|
2
4
|
class Action
|
3
5
|
class << self
|
4
6
|
def remove_gem
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
file_exists = file_names
|
8
|
+
if file_exists.count > 1
|
9
|
+
remove_file_from_path(multiple_version_selection)
|
10
|
+
elsif file_exists.count == 1
|
11
|
+
remove_file_from_path(file_exists.first)
|
12
|
+
else
|
13
|
+
ap 'Gem not exist'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def remove_file_from_path(file_name)
|
18
|
+
tty_command.run("rm #{file_name}")
|
9
19
|
end
|
10
20
|
|
11
21
|
def build_gem
|
12
22
|
puts '-----------------------------'
|
13
23
|
puts ''
|
14
|
-
|
15
|
-
file = cmd.run('find -type f -name "*.gemspec"')
|
24
|
+
file = tty_command.run('find -type f -name "*.gemspec"')
|
16
25
|
ap file_name = file.out.strip
|
17
|
-
file_name.empty? ? ap('Gemspec not exist') :
|
26
|
+
file_name.empty? ? ap('Gemspec not exist') : tty_command.run("gem build #{file_name}")
|
18
27
|
end
|
19
28
|
|
20
29
|
def install_gem
|
21
30
|
puts '-----------------------------'
|
22
31
|
puts ''
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
27
40
|
end
|
28
41
|
|
29
|
-
def
|
42
|
+
def install_gem_from_path(file_name)
|
43
|
+
tty_command.run("gem install #{file_name}")
|
44
|
+
end
|
45
|
+
|
46
|
+
def multiple_version_selection
|
47
|
+
options = {}
|
48
|
+
file_names.each_with_index do |file_name, index|
|
49
|
+
options[('a'..'z').to_a[index]] = { 'value' => file_name, 'display' => file_name }
|
50
|
+
end
|
51
|
+
options['/'] = { 'value' => 'exit', 'display' => 'Exit'}
|
52
|
+
Downup::Base.new(flash_message: 'Choose which version',
|
53
|
+
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
|
30
66
|
options = {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
67
|
+
'a' => { 'value' => 'desktop', 'display' => 'Desktop' },
|
68
|
+
'b' => { 'value' => 'downloads', 'display' => 'Downloads' },
|
69
|
+
'c' => { 'value' => 'documents', 'display' => 'Documents' },
|
70
|
+
'/' => { 'value' => 'exit', 'display' => 'Exit' }
|
35
71
|
}
|
36
72
|
|
37
|
-
|
38
|
-
|
73
|
+
Downup::Base.new(flash_message: 'Choose Folder To Copy',
|
74
|
+
options: options).prompt
|
75
|
+
end
|
39
76
|
|
40
|
-
|
77
|
+
def copy_gem
|
78
|
+
files_exists = file_names
|
41
79
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
ap 'Gem not present in the current folder'
|
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)
|
47
84
|
else
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
85
|
+
ap 'Gem not exist'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
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")
|
56
97
|
end
|
57
98
|
end
|
58
99
|
|
@@ -68,4 +109,4 @@ module InstallGemLocal
|
|
68
109
|
end
|
69
110
|
end
|
70
111
|
end
|
71
|
-
end
|
112
|
+
end
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module InstallGemLocal
|
2
4
|
class Navigation
|
3
5
|
class << self
|
4
6
|
def start
|
5
7
|
options = {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
'a' => { 'value' => 'remove', 'display' => 'Remove old version' },
|
9
|
+
'b' => { 'value' => 'build', 'display' => 'Build new version' },
|
10
|
+
'c' => { 'value' => 'install', 'display' => 'Install new version' },
|
11
|
+
'd' => { 'value' => 'copy_gem', 'display' => 'Copy gem to folder' },
|
12
|
+
'e' => { 'value' => 'till_install', 'display' => 'Remove old version, build and install the new version' },
|
13
|
+
'f' => { 'value' => 'till_copy', 'display' => 'Remove old version, build, install and copy the new version' },
|
14
|
+
'/' => { 'value' => 'exit', 'display' => 'Exit' }
|
13
15
|
}
|
14
16
|
|
15
17
|
selection = Downup::Base.new(flash_message: 'Select Action', options: options).prompt
|
@@ -30,11 +32,10 @@ module InstallGemLocal
|
|
30
32
|
when 'till_copy'
|
31
33
|
InstallGemLocal::Action.till_copy
|
32
34
|
end
|
33
|
-
|
34
35
|
rescue StandardError => e
|
35
36
|
ap e
|
36
37
|
ap 'Something Wrong! Try again!'
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
40
|
-
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dhanabal T
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|