rgversion 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f679f5e8a92e54d3f4e1be4d4ade7b585d2afcf1e60803115c1a0e057ffa5439
4
- data.tar.gz: e997b762436ef24f9921d4edbd0c9d23745d92ee0bd8d1bf71714fa8939d18ba
3
+ metadata.gz: 18392e326b6713466eb5f6aaa8f73ddd828bda9fd918f402ae51d189d8eeff79
4
+ data.tar.gz: '0300799d9341efb4a2737856ddf125703aa4833f25d9b43705ab31217f48f8c8'
5
5
  SHA512:
6
- metadata.gz: 5446b3412ae516c1c77ea64a6eb1c3573888d63f5aeffe86c2b7b19389253b46edcc5ce725e7073129b2ca26da8e866e8cc75628f42126133566a07b3ac3a1bf
7
- data.tar.gz: f731ded2e2ddcc1422eb4aaf97dfa8b41c988ed96db23312ecb79494d1788b708d5965f6841b39123864b2e265d09736ac4afd2c43a04eee919e0ebfd4804fbe
6
+ metadata.gz: 1c0a2275e6b0b8a242ebb6487beed6b5792846d4a252064c0bbb8aedd38f049770a19c84c516069898d392689d2a6733591bb174ac7384959d074d7315b204cb
7
+ data.tar.gz: 1a1a052db43a6348ada132d0acf3f40546825335d1af364dc62807eb222cc84bbaa991dbe33d0729136ba0fdce031841d90a2d21f3819d6f79861e669924e0ef
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem install rgversion
13
13
  ```
14
14
 
15
15
  ### macOS / OS X
16
- No further actions required.
16
+ No further actions required.=
17
17
 
18
18
  ### Ubuntu / Debian
19
19
  You may need to install xclip for clipboard feature:
@@ -6,9 +6,9 @@ module Rgversion
6
6
  end
7
7
 
8
8
  def run
9
- terminal = Terminal.new(command, results)
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
@@ -1,7 +1,6 @@
1
1
  module Rgversion
2
2
  class Terminal
3
- def initialize(command, results)
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
- if command_exists?
16
- `echo "#{@output}" | #{@command}`
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
@@ -1,4 +1,4 @@
1
1
  module Rgversion
2
- VERSION = "1.1.1".freeze
3
- PREVIOUS_VERSION = "1.0.1".freeze
2
+ VERSION = "1.1.2".freeze
3
+ PREVIOUS_VERSION = "1.1.1".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgversion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - vavgustov