thorium 0.3.6 → 0.3.7

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: 06cc86ecfb89a29ea8c2f507b923a8f88f9b2d3d
4
- data.tar.gz: ad50508ad6c1696bee2416dc96383830ab815b73
3
+ metadata.gz: 5db9df4d8edcf8c12684ed088c24929bcd5dc537
4
+ data.tar.gz: 48def82486f09746dc14a2bfda7aaff01afc7e45
5
5
  SHA512:
6
- metadata.gz: 250b1a68de0e25c7acaa77302cb0198745102a2d53c9b7135338978e87c8ea285478f16962376117278c7061f8eadadc9457719918757854f5b80b6c08bbbaad
7
- data.tar.gz: 0b6bd5d5ef3d4542a92eed92f516b605ea741bf3d720b27f327839e7202cae238e4834283cbb662961d26dd8dd3c81712c39b8f91c0d12d15726ef7b46ecf002
6
+ metadata.gz: deff5ddad3edc2e0b240e295aef17bf43153f2fadb81742db8318a02b00414018830757b1ca229042b9a96d4018fdad48d0ef68a8a6e58652541761d183728f2
7
+ data.tar.gz: a0df9c51bfb792a54daf2742f9ad301f1e30492cdd0510f327f34009459eb2198d324d8444f3fef49476eef9f6d39162c1ddab82f113048cf84e36fa868c5c24
@@ -22,9 +22,17 @@ module ThoriumCLI
22
22
 
23
23
  class_option :verbose, type: :boolean, default: false, aliases: :v
24
24
 
25
- desc 'pubkey', 'Get id_rsa.pub (default) in your clipboard'
25
+ desc 'pubkey', 'Copy `id_rsa.pub` (default) in your clipboard'
26
26
  def pubkey
27
- copy_to_clipboard Dir.glob(File.expand_path('~/.ssh/id_rsa.pub')).first
27
+ path = '~/.ssh/id_rsa.pub'
28
+ file = Dir.glob(File.expand_path(path)).first
29
+ if file
30
+ say "Use `thorium pubkeys` if you want to select a specific key.", :yellow
31
+ copy_to_clipboard file
32
+ else
33
+ say "File `#{path}` has not been found.", :red
34
+ generate_pubkey?
35
+ end
28
36
  end
29
37
 
30
38
  desc 'pubkeys', 'Simple public keys manipulation'
@@ -39,13 +47,12 @@ module ThoriumCLI
39
47
  copy_to_clipboard public_keys[index.to_i - 1] if index != ask_options[:skip]
40
48
  else
41
49
  say 'No public keys have been found.', :red
42
- generate_new = yes?('Do you want to generate a new one?', :green)
43
- run 'ssh-keygen' if generate_new
50
+ generate_pubkey?
44
51
  end
45
52
  end
46
53
 
47
54
  # Apache subcommand
48
- desc 'apache [SUBCOMMAND] [ARGS]', 'Control Apache with ease!'
55
+ desc 'apache [SUBCOMMAND] [ARGS]', 'Apache controller'
49
56
  subcommand 'apache', Apache
50
57
 
51
58
  # Git subcommand
@@ -55,6 +62,13 @@ module ThoriumCLI
55
62
  no_commands do
56
63
 
57
64
  private
65
+
66
+ # Prompts to run `ssh-keygen`
67
+ def generate_pubkey?
68
+ answered_yes = yes?('Do you want to generate a new public pubkey?', :green)
69
+ run 'ssh-keygen', verbose: false if answered_yes
70
+ end
71
+
58
72
  # Prints public keys with indexes
59
73
  def print_keys(public_keys)
60
74
  public_keys.each_with_index do |f, i|
@@ -64,9 +78,10 @@ module ThoriumCLI
64
78
  end
65
79
 
66
80
  def copy_to_clipboard(content)
67
- if run 'which pbcopy > /dev/null', verbose: false
81
+ say "(!) No content provided.", :red unless content
82
+ if (run 'which pbcopy > /dev/null', verbose: false)
68
83
  run "pbcopy < #{content}", verbose: false
69
- say "---> `#{content}` copied to your clipboard.", :blue
84
+ say "--> `#{content}` copied to your clipboard.", :blue
70
85
  else
71
86
  say 'pbcopy is not installed, cannot copy to clipboard', :red
72
87
  end
@@ -10,7 +10,7 @@ module GitCLI
10
10
 
11
11
  class_option :verbose, type: :boolean, default: 1
12
12
 
13
- desc 'list', 'Lists Github repositories'
13
+ desc 'list', 'Lists repositories (Github)'
14
14
  def list
15
15
  gh_uname = ask('Enter Github username: ', :green)
16
16
  abort if gh_uname.empty?
@@ -22,7 +22,7 @@ module GitCLI
22
22
  print_table @repos
23
23
  end
24
24
 
25
- desc 'clone', 'Clones a repository from the list'
25
+ desc 'clone', 'Clones a repository from the list (Github)'
26
26
  def clone
27
27
  list
28
28
  # Do not do anything if list is empty
@@ -1,4 +1,4 @@
1
1
  # Top level comment for thorium
2
2
  module Thorium
3
- VERSION = '0.3.6'
3
+ VERSION = '0.3.7'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thorium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Stankevich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor