kubs_cli 0.1.9 → 0.2.0

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: 75a8510453b3db31d2458fbb3e4b8a2bbde2fa5e28639739eb433a957bf00c9d
4
- data.tar.gz: b433d69b8809545b60195238e1208821beb8f69185213af8821db200531fbf35
3
+ metadata.gz: a822e2006d5f00043cbb2e79c8d3a5a0ae6a761a1a50b8c3470752707a5b9f52
4
+ data.tar.gz: 0d202f3d9848165a0b179e8bcaf697f33867f23a8710ffa327671941cf31504d
5
5
  SHA512:
6
- metadata.gz: 20e218b26eddba27039f2140b42b15179da1c17ce795c0bf595fcd26c72b03cec850cfbf623722bf6caa81e13497b589c05e0d740215bd838939afa4e0448a60
7
- data.tar.gz: 7116c7738026beb1e93f1f32e7109f8e133987825bf484df652f27ec51ccfb32d1c27ad3d82bf73ed311813b6db5f3dcaaed3cf037f503b68c369680b74d1f64
6
+ metadata.gz: d012d72dfb5ae6cf13c210d9cd3115301600e0755678bb9c8138e18616e4a99ac93a14acbbcd0274bb0f6049d9c23c3e6f609a99fb84e0564fdf08f2f2b562b0
7
+ data.tar.gz: a9e2726818f6ac21446968364c1c6f73e977e523468a134c37c11bce7ba2cd1bfa17cee5575386b54a09bf7c24e5b5bc27a3545b15b6716f45ce97cd0cdeeb1a
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  tags
10
+ .git
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
data/Dockerfile CHANGED
@@ -1,24 +1,25 @@
1
1
  FROM ruby:2.6.3
2
2
 
3
+
3
4
  RUN apt update && apt upgrade -y
4
5
 
5
6
  # libffi needed for libffi gem
6
7
  RUN apt install -y libffi-dev apt-utils git
7
8
 
8
- RUN git clone https://github.com/ParamagicDev/config-files.git $HOME/config-files
9
+
9
10
 
10
11
  # copy the directory
11
- RUN mkdir $HOME/myapp
12
- WORKDIR $HOME/myapp
13
- COPY . $HOME/myapp
12
+ RUN mkdir /myapp
13
+ WORKDIR /myapp
14
+ COPY . /myapp
14
15
  RUN gem install bundler
15
16
  RUN bundle install
16
17
 
17
18
  RUN rake build && gem install pkg/*
18
19
 
19
-
20
20
  # Create a user, and give them sudo privileges if needed
21
21
  # password is 'docker'
22
- # RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
23
- # USER docker
22
+ RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
23
+ USER docker
24
+ RUN git clone https://github.com/ParamagicDev/config-files.git /home/docker/config-files
24
25
 
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kubs_cli (0.1.9)
4
+ kubs_cli (0.2.0)
5
5
  rake (~> 10.0)
6
6
  thor (~> 0.20)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- coderay (1.1.2)
12
- diff-lcs (1.3)
13
- ffi (1.11.1)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.4.4)
13
+ ffi (1.13.1)
14
14
  formatador (0.2.5)
15
- guard (2.15.0)
15
+ guard (2.16.2)
16
16
  formatador (>= 0.2.4)
17
17
  listen (>= 2.7, < 4.0)
18
18
  lumberjack (>= 1.0.12, < 2.0)
@@ -26,40 +26,38 @@ GEM
26
26
  guard (~> 2.1)
27
27
  guard-compat (~> 1.1)
28
28
  rspec (>= 2.99.0, < 4.0)
29
- listen (3.1.5)
30
- rb-fsevent (~> 0.9, >= 0.9.4)
31
- rb-inotify (~> 0.9, >= 0.9.7)
32
- ruby_dep (~> 1.2)
33
- lumberjack (1.0.13)
29
+ listen (3.3.1)
30
+ rb-fsevent (~> 0.10, >= 0.10.3)
31
+ rb-inotify (~> 0.9, >= 0.9.10)
32
+ lumberjack (1.2.8)
34
33
  method_source (0.9.2)
35
34
  nenv (0.3.0)
36
- notiffany (0.1.1)
35
+ notiffany (0.1.3)
37
36
  nenv (~> 0.1)
38
37
  shellany (~> 0.0)
39
38
  pry (0.12.2)
40
39
  coderay (~> 1.1.0)
41
40
  method_source (~> 0.9.0)
42
41
  rake (10.5.0)
43
- rb-fsevent (0.10.3)
44
- rb-inotify (0.10.0)
42
+ rb-fsevent (0.10.4)
43
+ rb-inotify (0.10.1)
45
44
  ffi (~> 1.0)
46
- rspec (3.8.0)
47
- rspec-core (~> 3.8.0)
48
- rspec-expectations (~> 3.8.0)
49
- rspec-mocks (~> 3.8.0)
50
- rspec-core (3.8.2)
51
- rspec-support (~> 3.8.0)
52
- rspec-expectations (3.8.4)
45
+ rspec (3.10.0)
46
+ rspec-core (~> 3.10.0)
47
+ rspec-expectations (~> 3.10.0)
48
+ rspec-mocks (~> 3.10.0)
49
+ rspec-core (3.10.0)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-expectations (3.10.0)
53
52
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.8.0)
55
- rspec-mocks (3.8.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-mocks (3.10.0)
56
55
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.8.0)
58
- rspec-support (3.8.2)
59
- ruby_dep (1.5.0)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-support (3.10.0)
60
58
  shellany (0.0.1)
61
59
  thor (0.20.3)
62
- yard (0.9.20)
60
+ yard (0.9.25)
63
61
 
64
62
  PLATFORMS
65
63
  ruby
@@ -74,4 +72,4 @@ DEPENDENCIES
74
72
  yard (~> 0.9)
75
73
 
76
74
  BUNDLED WITH
77
- 2.0.2
75
+ 2.1.4
data/README.md CHANGED
@@ -30,7 +30,9 @@ Or install it yourself as:
30
30
  gem install kubs_cli
31
31
  kubs -v # version
32
32
  kubs init # Creates a $HOME/.kubs directory
33
- kubs install # Installs items as defined by $HOME/.kubs/dependencies.yaml
33
+ kubs install_dependencies # Installs items as defined by $HOME/.kubs/dependencies.yaml
34
+ source ~/.zshrc # or ~/.bashrc, whatever youre using
35
+ kubs install_packages
34
36
  kubs copy # Copies from $HOME/config-files/(dotfiles|gnome-terminal-settings) to $HOME
35
37
  kubs pull # Copes from $HOME/.(dotfiles) to $HOME/config-files(dotfiles|gnome-terminal-settings)
36
38
  kubs git_pull
@@ -41,7 +43,9 @@ kubs git_push
41
43
 
42
44
  The `$HOME/.kubs` is a good directory to check out
43
45
 
44
- The `$HOME/.kubs/dependencies.yaml` is structed to be extended without updating my gem
46
+ The `$HOME/.kubs/dependencies.yaml` and `$HOME/.kubs/packages.yaml` are
47
+ constructed to be extended without having to update the gem everytime
48
+ I want to add something new
45
49
 
46
50
  ### Messing with docker
47
51
 
@@ -4,6 +4,7 @@ KubsCLI.configure do |config|
4
4
  # Where you want the dotfiles to be saved
5
5
  config.local_dir = Dir.home
6
6
  config.dependencies = File.join(Dir.home, '.kubs', 'dependencies.yaml')
7
+ config.packages = File.join(Dir.home, '.kubs', 'packages.yaml')
7
8
 
8
9
  # Where you have your dotfiles / misc_files saved
9
10
  config.config_files = File.join(Dir.home, 'config-files')
@@ -20,29 +20,3 @@ apt:
20
20
  postgresql pry rubygems fail2ban
21
21
  neovim asciinema docker mosh yarn
22
22
  silversearcher-ag virtualbox
23
-
24
- gems:
25
- command: gem install
26
- packages: colorls neovim rake pry rubocop gem-ctags rails yard
27
- thor bundler solargraph
28
-
29
- npm_packages:
30
- command: npm install -g
31
- packages: neovim eslint
32
- bash-language-server --unsafe-perm
33
- vscode-html-languageserver-bin
34
- vscode-css-languageserver-bin
35
- javascript-typescript-langserv
36
- dockerfile-language-server-nodejs
37
-
38
- pip2_packages:
39
- command: pip2 install --user --upgrade
40
- packages: pynvim neovim
41
-
42
- pip3_packages:
43
- command: pip3 install --user --upgrade
44
- packages: pynvim neovim
45
-
46
- snap_packages:
47
- command: sudo snap install
48
- packages: heroku
@@ -0,0 +1,25 @@
1
+ gems:
2
+ command: gem install
3
+ packages: colorls neovim rake pry rubocop gem-ctags rails yard
4
+ thor bundler solargraph
5
+
6
+ npm_packages:
7
+ command: npm install -g
8
+ packages: neovim eslint
9
+ bash-language-server --unsafe-perm
10
+ vscode-html-languageserver-bin
11
+ vscode-css-languageserver-bin
12
+ javascript-typescript-langserv
13
+ dockerfile-language-server-nodejs
14
+
15
+ pip2_packages:
16
+ command: pip2 install --user --upgrade
17
+ packages: pynvim neovim
18
+
19
+ pip3_packages:
20
+ command: pip3 install --user --upgrade
21
+ packages: pynvim neovim
22
+
23
+ snap_packages:
24
+ command: sudo snap install
25
+ packages: heroku
@@ -32,14 +32,20 @@ module KubsCLI
32
32
  run_command { KubsCLI::Pull.new.pull_all }
33
33
  end
34
34
 
35
- desc 'install', 'installs from .kubs/dependencies.yaml'
36
- def install
37
- run_command { KubsCLI::Install.new.install_all }
35
+ desc 'install_dependencies', 'installs from .kubs/dependencies.yaml'
36
+ def install_dependencies
37
+ run_command { KubsCLI::Install.new.install_dependencies }
38
+ Rake.sh('echo "Restart your shell"')
39
+ end
40
+
41
+ desc 'install_packages', 'installs from .kubs/packages.yaml'
42
+ def install_packages
43
+ run_command { KubsCLI::Install.new.install_packages }
38
44
  end
39
45
 
40
46
  # desc 'git push [-r CONFIG_FILES_REPO]', 'pushes your config_files upstream'
41
47
  desc 'git_push', 'pushes your config_files upstream'
42
- def git_push
48
+ def git_push(message = nil)
43
49
  message ||= 'auto push files'
44
50
 
45
51
  swap_dir do
@@ -66,7 +72,7 @@ module KubsCLI
66
72
 
67
73
  no_commands do
68
74
  def swap_dir
69
- KubsCLI.load_configuration(options[:config])
75
+ KubsCLI.load_configuration
70
76
  Rake.cd(KubsCLI.configuration.config_files)
71
77
  yield
72
78
  end
@@ -8,6 +8,7 @@ module KubsCLI
8
8
 
9
9
  # Dependencies to install
10
10
  attr_accessor :dependencies
11
+ attr_accessor :packages
11
12
 
12
13
  # remote files to be used
13
14
  attr_accessor :config_files, :dotfiles, :gnome_terminal_settings
@@ -20,6 +21,7 @@ module KubsCLI
20
21
  # set to nil so that someone must set a path
21
22
  @config_files = nil
22
23
  @dotfiles = nil
24
+ @packages = nil
23
25
  @gnome_terminal_settings = nil
24
26
  @dependencies = nil
25
27
  end
@@ -53,6 +55,9 @@ module KubsCLI
53
55
 
54
56
  puts "Creating a default configuration files @ #{path}"
55
57
  fh.mkdirs(path)
56
- fh.copy(from: EXAMPLES, to: path)
58
+
59
+ Dir["#{EXAMPLES}/*"].each do |file|
60
+ fh.copy(from: file, to: path)
61
+ end
57
62
  end
58
63
  end
@@ -27,6 +27,9 @@ module KubsCLI
27
27
  end
28
28
 
29
29
  def copy_gnome_terminal_settings
30
+ unless @config.gnome_terminal_settings
31
+ return
32
+ end
30
33
  # This is the ONLY spot for gnome terminal
31
34
  gnome_path = '/org/gnome/terminal/'
32
35
  gnome_file = @config.gnome_terminal_settings
@@ -17,8 +17,13 @@ module KubsCLI
17
17
  Rake.mkdir_p(to_dir) unless Dir.exist?(to_dir)
18
18
  return Rake.cp(from, to) unless File.directory?(from)
19
19
 
20
- Rake.mkdir_p(to) unless Dir.exist?(to)
21
- Rake.cp_r(from, to)
20
+ Rake.mkdir_p(to)
21
+
22
+ Dir["#{from}/*"].each do |dir|
23
+ Rake.cp_r(dir, to) # next if File.directory?(dir)
24
+
25
+ # Rake.cp(dir, to)
26
+ end
22
27
  end
23
28
 
24
29
  # Creates dirs using Rake.mkdir_p if it does not exist
@@ -5,31 +5,41 @@ module KubsCLI
5
5
  class Install
6
6
  def initialize(config = KubsCLI.configuration)
7
7
  @fh = FileHelper.new
8
- @yaml_file = config.dependencies
8
+ @dependencies = config.dependencies
9
+ @packages = config.packages
10
+ end
11
+
12
+ def install_dependencies
13
+ install_from_file(@dependencies)
14
+ end
15
+
16
+ def install_packages
17
+ install_from_file(@packages)
9
18
  end
10
19
 
11
20
  # Installs dependencies from a given YAML file
12
21
  # @see lib/examples/dependencies.yaml
13
22
  # @return Array<String> Returns an array of strings to run via Rake to install
14
23
  # various packages
15
- def create_dependencies_ary
16
- hash = @fh.load_yaml(@yaml_file)
24
+ def create_ary_from_yaml(file)
25
+ hash = @fh.load_yaml(file)
17
26
  hash.map do |_key, value|
18
27
  command = value['command']
19
28
 
20
29
  packages = value['packages']
21
- packages = packages.join("\n") if packages.is_a?(Array)
30
+ packages = packages.join(' ') if packages.is_a?(Array)
22
31
 
23
32
  "#{command} #{packages}"
24
33
  end
25
34
  rescue StandardError => e
26
- KubsCLI.add_error(e: e, msg: "There was an issue with creating a dependencies array from #{@yaml_file}")
35
+ msg = "There was an issue with creating a dependencies array from #{file}"
36
+ KubsCLI.add_error(e: e, msg: msg)
27
37
  end
28
38
 
29
39
  # Installs dependencies from a give yaml_file via Rake.sh
30
40
  # @return void
31
- def install_all
32
- ary = create_dependencies_ary
41
+ def install_from_file(file)
42
+ ary = create_ary_from_yaml(file)
33
43
 
34
44
  ary.each do |command|
35
45
  Rake.sh(command.to_s)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'rake'
2
3
 
3
4
  module KubsCLI
4
5
  # Used to pull items into your config-files repo
@@ -28,18 +29,20 @@ module KubsCLI
28
29
  end
29
30
 
30
31
  def copy_files(orig_file, new_file)
31
- return @fh.copy(from: orig_file, to: new_file) unless File.directory?(new_file)
32
- return @fh.copy(from: orig_file, to: new_file) unless File.directory?(orig_file)
32
+ if File.directory?(new_file) || File.directory?(new_file)
33
+ Dir.each_child(orig_file) do |o_file|
34
+ Dir.each_child(new_file) do |n_file|
35
+ next unless o_file == n_file
33
36
 
34
- Dir.each_child(orig_file) do |o_file|
35
- Dir.each_child(new_file) do |n_file|
36
- next unless o_file == n_file
37
+ o_file = File.join(File.expand_path(orig_file), o_file)
38
+ n_file = File.expand_path(new_file)
37
39
 
38
- o_file = File.join(File.expand_path(orig_file), o_file)
39
- n_file = File.expand_path(new_file)
40
+ Rake.cp_r(o_file, n_file)
41
+ end
40
42
 
41
- @fh.copy(from: o_file, to: n_file)
42
43
  end
44
+ else
45
+ Rake.cp(orig_file, new_file)
43
46
  end
44
47
  end
45
48
 
@@ -58,6 +61,9 @@ module KubsCLI
58
61
 
59
62
  # Pulls gnome_terminal_settings into your dotfiles inside your repo
60
63
  def pull_gnome_terminal_settings
64
+ unless @config.gnome_terminal_settings
65
+ return
66
+ end
61
67
  # This is where dconf stores gnome terminal
62
68
  gnome_dconf = '/org/gnome/terminal/'
63
69
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubsCLI
4
- VERSION = '0.1.9'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubs_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - paramagicdev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-24 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.20'
125
- description:
125
+ description:
126
126
  email:
127
127
  - konnor5456@gmail.com
128
128
  executables:
@@ -146,6 +146,7 @@ files:
146
146
  - kubs_cli.gemspec
147
147
  - lib/examples/config.rb
148
148
  - lib/examples/dependencies.yaml
149
+ - lib/examples/packages.yaml
149
150
  - lib/kubs_cli.rb
150
151
  - lib/kubs_cli/cli.rb
151
152
  - lib/kubs_cli/configuration.rb
@@ -162,7 +163,7 @@ metadata:
162
163
  homepage_uri: https://github.com/ParamagicDev/kubs_cli
163
164
  source_code_uri: https://github.com/ParamagicDev/kubs_cli
164
165
  changelog_uri: https://github.com/ParamagicDev/kubs_cli/CHANGELOG.md
165
- post_install_message:
166
+ post_install_message:
166
167
  rdoc_options: []
167
168
  require_paths:
168
169
  - lib
@@ -177,8 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  - !ruby/object:Gem::Version
178
179
  version: '0'
179
180
  requirements: []
180
- rubygems_version: 3.0.3
181
- signing_key:
181
+ rubygems_version: 3.1.4
182
+ signing_key:
182
183
  specification_version: 4
183
184
  summary: Konnor's Ubuntu Based Setup & CLI
184
185
  test_files: []