vps_cli 0.1.8 → 0.1.9

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
  SHA256:
3
- metadata.gz: 8c79f00707b5c1498935dbcd4c2d6cf9574a819a95431e0be14a315ea176efdd
4
- data.tar.gz: 3a40b7df15968833f90308a1f9bb6955854350fd2bc39982af7d41b9198c2536
3
+ metadata.gz: 7c6696db497416341ea5cebc2f8b1bb1df569159bdd0c219917a6ac85650ca00
4
+ data.tar.gz: 69becc9a5ef9088e570f3b79ee8673e9be3d01d55d903b43af482977c026711e
5
5
  SHA512:
6
- metadata.gz: d4230105862398502026744aa13fc7cd2c0fe0bfad6150d648ee1cb23fc5e450eac48272eae71c1821db1d162f5a6b23723d45c994d6ca193049019cab6be580
7
- data.tar.gz: f2c38c5a5d2f521c07b3d8cd612d95eef34ccadd2c43d8c10899a1143ae54a0de1b0c1ab26ab650a462c2b26700cfba64c97744fa5bb5b147c1638bf2688df1f
6
+ metadata.gz: 33569fbf2c50ba92a66f8bb3b97b4106f171e25cffa5845ca8186299209823511c4ace1ad2e9bc293739ca61f5207bc1f77e014343bc7c9d93219ee38ae47385
7
+ data.tar.gz: f4fe8f63b6cee8b0bb5bfa23f791f31a802f58a72d3dd849f9a4a6c124edcf988c305f1be5010bfd01d8bd4858daaa6112f0fb400777140a17b326e00a2f9889
data/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (Or at least attempts to)
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [1.9.0] - 05-26-2019
9
+
10
+ ### Added
11
+ - This changelog
12
+ - Language server support
13
+ - additional commands
14
+ * update_all, login, and version
15
+ - additional documentation
16
+
17
+ ### Changed
18
+ - Changed the way ssh keys are handled
19
+ - Changed some minor syntax
20
+ - Updated the README to include SOPS / GPG prereqs
data/README.md CHANGED
@@ -6,6 +6,10 @@ This gem is currently unfinished and purely for my own personal use.
6
6
  This project of pulling and pushing dotfiles as well as performing installations
7
7
  etc has taken many iterations and this is its 3rd iteration
8
8
 
9
+ ## Prerequisites
10
+
11
+ In order for the test suite to pass, you must have SOPS & GPG installed.
12
+
9
13
  ## Installation
10
14
 
11
15
  Add this line to your application's Gemfile:
@@ -23,13 +23,13 @@ module VpsCli
23
23
  def self.provide_credentials(config = VpsCli.configuration)
24
24
  if File.exist?(config.credentials)
25
25
  file_login(yaml_file: config.credentials, netrc_file: config.netrc)
26
+ post_github_ssh_key(config)
26
27
  else
27
28
  command_line_login
28
29
  end
29
30
 
30
31
  # originally accepts an opts arguemnt
31
32
  generate_ssh_key
32
- post_github_ssh_key(config)
33
33
  end
34
34
 
35
35
  # Provides all login credentials via a SOPS encrypted yaml file
@@ -144,15 +144,15 @@ module VpsCli
144
144
  # @option opts [File] :yaml_file (nil) the file to decrypt values with.
145
145
  #
146
146
  def self.post_github_ssh_key(config = VpsCli.configuration)
147
+ return puts no_credentials_found unless File.exist?(config.credentials)
147
148
  uri = URI('https://api.github.com/user/keys')
148
149
 
149
- api_token = proc do |yaml, path|
150
- decrypt(yaml_file: yaml, path: path)
151
- end
150
+ api_token = proc { |yaml, path| decrypt(yaml_file: yaml, path: path) }
152
151
 
152
+ # only create the token if the credentials file exists
153
153
  api_path = dig_for_path(:github, :api_token)
154
-
155
154
  token = api_token.call(config.credentials, api_path)
155
+
156
156
  ssh_file = File.join(Dir.home, '.ssh', 'id_rsa.pub')
157
157
  title = get_title
158
158
 
@@ -172,5 +172,10 @@ module VpsCli
172
172
  puts 'please enter a title for your ssh key'
173
173
  $stdin.gets.chomp
174
174
  end
175
+
176
+ def self.no_credentials_found
177
+ puts "No credentials file found. Please check that your .vps_cli contains
178
+ a valid .credentials file path"
179
+ end
175
180
  end
176
181
  end
data/lib/vps_cli/cli.rb CHANGED
@@ -25,7 +25,7 @@ module VpsCli
25
25
 
26
26
  Access.provide_credentials
27
27
 
28
- VpsCli.errors.each { |error| puts error.message }
28
+ print_errors
29
29
  end
30
30
 
31
31
  desc 'init [-c (File)]', 'Creates a default vps_cli configuration file in the home directory'
@@ -53,22 +53,26 @@ module VpsCli
53
53
  Pull.all
54
54
  end
55
55
 
56
- desc 'install [OPTIONS]', 'installs based on the flag provided'
57
- def install
58
- msg = puts 'Only VpsCli::Install#all_install has been implemented'
59
- return msg unless options[:all]
56
+ desc 'update_all', 'updates all packages'
57
+ def update_all
58
+ VpsCli.load_configuration(options[:config])
59
+ Install.prep
60
+ Install.install_non_apt_packages
61
+ end
60
62
 
63
+ desc 'install_all', 'installs all packages'
64
+ def install_all
61
65
  Install.all_install
62
66
 
63
67
  return if VpsCli.errors.empty?
64
68
 
65
- VpsCli.errors.each do |error|
66
- if error.responds_to?(:message)
67
- puts error.message
68
- else
69
- puts error
70
- end
71
- end
69
+ print_errors
70
+ end
71
+
72
+ desc 'login', 'pushes keys from your ~/.credentials.yaml file'
73
+ def login
74
+ VpsCli.load_configuration(options[:config])
75
+ VpsCli.provide_credentials
72
76
  end
73
77
 
74
78
  desc 'git_pull', 'Automatically pulls in changes in your config_files repo'
@@ -93,9 +93,15 @@ module VpsCli
93
93
  def ssh_key_exist?(json_string:)
94
94
  # just in case your ssh key has a comment in it
95
95
  # keys pulled from github will not have comments
96
- ssh_key = @ssh_key.split('==')[0].concat('==')
96
+ ssh_key = if @ssh_key.include?('==')
97
+ @ssh_key.split('==')[0].concat('==')
98
+ else
99
+ @ssh_key
100
+ end
97
101
 
98
102
  JSON.parse(json_string).any? do |data|
103
+ p data
104
+ p ssh_key
99
105
  data['key'] == ssh_key
100
106
  end
101
107
  end
@@ -24,6 +24,13 @@ module VpsCli
24
24
  # Runs through multiple methods listed below
25
25
  # @see #prep
26
26
  # @see #packages
27
+ def self.all_install
28
+ prep
29
+ packages
30
+ install_non_apt_packages
31
+ end
32
+
33
+ # runs #all_install without the sudo apt-get packages
27
34
  # @see #other_tools
28
35
  # @see #neovim_support
29
36
  # @see #omz_full_install
@@ -32,9 +39,7 @@ module VpsCli
32
39
  # @see #plug_install_vim_neovim
33
40
  # @see #install_gems
34
41
  # @see add_language_servers
35
- def self.all_install
36
- prep
37
- packages
42
+ def self.install_non_apt_packages
38
43
  other_tools
39
44
  neovim_support
40
45
  omz_full_install
@@ -152,14 +157,6 @@ module VpsCli
152
157
  Rake.mkdir_p(install_path)
153
158
  Rake.sh("git clone https://github.com/tmux-plugins/tpm #{install_path}")
154
159
  end
155
- # start a server but don't attach to it
156
- Rake.sh('tmux start-server')
157
- # create a new session but don't attach to it either
158
- Rake.sh('tmux new-session -d')
159
- # install the plugins
160
- Rake.sh('~/.tmux/plugins/tpm/scripts/install_plugins.sh')
161
- # killing the server is not required, I guess
162
- Rake.sh('tmux kill-server')
163
160
  end
164
161
 
165
162
  # Installs all gems located in Packages::GEMS
@@ -1,3 +1,3 @@
1
1
  module VpsCli
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
data/lib/vps_cli.rb CHANGED
@@ -52,36 +52,18 @@ module VpsCli
52
52
  # The local dir is where files are copied to
53
53
  attr_writer :configuration
54
54
 
55
- # Base set of options, will set the defaults for the various options
56
- # Take a hash due to people being able to set their own directories
57
- # @param [Hash] Takes the hash to modify
58
- # @return [Hash] Returns the options hash with the various options
59
- # Possible options:
60
- # :backup_dir
61
- # :local_dir
62
- # :dotfiles_dir
63
- # :misc_files_dir
64
- # :local_sshd_config
65
- # :verbose
66
- # :testing
67
- # def create_options(opts = {})
68
- # opts[:backup_dir] ||= BACKUP_FILES_DIR
69
- # opts[:local_dir] ||= Dir.home
70
- # opts[:dotfiles_dir] ||= DOTFILES_DIR
71
- # opts[:misc_files_dir] ||= MISC_FILES_DIR
72
- # opts[:local_sshd_config] ||= '/etc/ssh/sshd_config'
73
-
74
- # opts[:verbose] = false if opts[:verbose].nil?
75
- # opts[:interactive] = true if opts[:interactive].nil?
76
-
77
- # opts
78
- # end
79
-
80
- def full_install(options = {})
55
+ def full_install
81
56
  VpsCli::Setup.full
82
57
  VpsCli::Install.full
83
- VpsCli::Access.provide_credentials(options)
84
- VpsCli::Copy.all(options)
58
+ VpsCli::Access.provide_credentials
59
+ VpsCli::Copy.all
60
+ end
61
+
62
+ def print_errors
63
+ VpsCli.errors.each do |error|
64
+ puts error.message if error.responds_to?(:message)
65
+ puts error unless error.responds_to?(:message)
66
+ end
85
67
  end
86
68
  end
87
69
 
data/vps_cli.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.metadata['homepage_uri'] = 'https://github.com/ParamagicDev/vps_cli'
23
23
  spec.metadata['source_code_uri'] = 'https://github.com/ParamagicDev/vps_cli'
24
- spec.metadata['changelog_uri'] = 'https://github.com/ParamagicDev/vps_cli'
24
+ spec.metadata['changelog_uri'] = 'https://github.com/ParamagicDev/vps_cli/CHANGELOG.md'
25
25
  else
26
26
  raise 'RubyGems 2.0 or newer is required to protect against ' \
27
27
  'public gem pushes.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vps_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - paramagicdev
@@ -118,6 +118,7 @@ extra_rdoc_files: []
118
118
  files:
119
119
  - ".gitignore"
120
120
  - ".travis.yml"
121
+ - CHANGELOG.md
121
122
  - Gemfile
122
123
  - LICENSE.txt
123
124
  - README.md
@@ -152,7 +153,7 @@ metadata:
152
153
  allowed_push_host: https://rubygems.org/
153
154
  homepage_uri: https://github.com/ParamagicDev/vps_cli
154
155
  source_code_uri: https://github.com/ParamagicDev/vps_cli
155
- changelog_uri: https://github.com/ParamagicDev/vps_cli
156
+ changelog_uri: https://github.com/ParamagicDev/vps_cli/CHANGELOG.md
156
157
  post_install_message:
157
158
  rdoc_options: []
158
159
  require_paths: