rgversion 1.1.1 → 1.1.2
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/README.md +1 -1
- data/lib/rgversion/application.rb +2 -8
- data/lib/rgversion/terminal.rb +3 -36
- data/lib/rgversion/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18392e326b6713466eb5f6aaa8f73ddd828bda9fd918f402ae51d189d8eeff79
|
4
|
+
data.tar.gz: '0300799d9341efb4a2737856ddf125703aa4833f25d9b43705ab31217f48f8c8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c0a2275e6b0b8a242ebb6487beed6b5792846d4a252064c0bbb8aedd38f049770a19c84c516069898d392689d2a6733591bb174ac7384959d074d7315b204cb
|
7
|
+
data.tar.gz: 1a1a052db43a6348ada132d0acf3f40546825335d1af364dc62807eb222cc84bbaa991dbe33d0729136ba0fdce031841d90a2d21f3819d6f79861e669924e0ef
|
data/README.md
CHANGED
@@ -6,9 +6,9 @@ module Rgversion
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def run
|
9
|
-
terminal = Terminal.new(
|
9
|
+
terminal = Terminal.new(results)
|
10
10
|
terminal.report
|
11
|
-
terminal.copy_to_clipboard
|
11
|
+
terminal.copy_to_clipboard if OS.mac?
|
12
12
|
rescue StandardError => ex
|
13
13
|
$stderr.puts ex.message
|
14
14
|
end
|
@@ -19,11 +19,5 @@ module Rgversion
|
|
19
19
|
spider = Spider.new(@gems, @selector)
|
20
20
|
spider.walk
|
21
21
|
end
|
22
|
-
|
23
|
-
def command
|
24
|
-
return :pbcopy if OS.mac?
|
25
|
-
return :xclip if OS.linux?
|
26
|
-
nil
|
27
|
-
end
|
28
22
|
end
|
29
23
|
end
|
data/lib/rgversion/terminal.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Rgversion
|
2
2
|
class Terminal
|
3
|
-
def initialize(
|
4
|
-
@command = command
|
3
|
+
def initialize(results)
|
5
4
|
@results = results
|
6
5
|
end
|
7
6
|
|
@@ -12,12 +11,8 @@ module Rgversion
|
|
12
11
|
|
13
12
|
def copy_to_clipboard
|
14
13
|
return if @output.blank?
|
15
|
-
|
16
|
-
|
17
|
-
puts "Copied to your clipboard!".green
|
18
|
-
else
|
19
|
-
render_instructions
|
20
|
-
end
|
14
|
+
`echo "#{@output}" | pbcopy`
|
15
|
+
puts "\nCopied to your clipboard!".green
|
21
16
|
end
|
22
17
|
|
23
18
|
private
|
@@ -32,34 +27,6 @@ module Rgversion
|
|
32
27
|
return if @results[:gems].blank?
|
33
28
|
@output = @results[:gems].join("\n")
|
34
29
|
puts "#{@output}"
|
35
|
-
puts
|
36
|
-
end
|
37
|
-
|
38
|
-
def command_exists?
|
39
|
-
return false if which(@command.to_s).nil?
|
40
|
-
true
|
41
|
-
end
|
42
|
-
|
43
|
-
# based on https://stackoverflow.com/a/5471032
|
44
|
-
# let's avoid find_executable from mkmf because in this case we need to supress logs
|
45
|
-
def which(cmd)
|
46
|
-
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
47
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
48
|
-
exts.each do |ext|
|
49
|
-
exe = File.join(path, "#{cmd}#{ext}")
|
50
|
-
return exe if File.executable?(exe) && !File.directory?(exe)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
nil
|
54
|
-
end
|
55
|
-
|
56
|
-
def render_instructions
|
57
|
-
if command.nil?
|
58
|
-
puts "Rgversion doesn't support copy to clipboard feature if your OS isn't macOS or Linux. You can manually copy output above."
|
59
|
-
else
|
60
|
-
puts "Unable to copy to clipboard because #{@command} is missed. Try the command below if you are on Ubuntu/Debian:"
|
61
|
-
puts "sudo apt-get install #{command}"
|
62
|
-
end
|
63
30
|
end
|
64
31
|
end
|
65
32
|
end
|
data/lib/rgversion/version.rb
CHANGED