shellject 1.0.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1adad2b5bf6230314ff760499cc1d72499bdaf42
4
- data.tar.gz: 0ed395b9b253f34fa69f8273b1964acf61194381
2
+ SHA256:
3
+ metadata.gz: 4b103b7f928ac8f4a22697ab7e3a5b06b85596dd5f24a3cef19ed8642ea0d35e
4
+ data.tar.gz: 0e06c919b95fe0b1391b3ceab361281fce45add66485f5753be5ce0b58c2ba1f
5
5
  SHA512:
6
- metadata.gz: 245b13ce9b263102c7fa8a583b78fe2c4e204fef29be582ff3bc844140025e62a1d64b47a79268e5d3ceb819f338724bff5b6ccd98b24425c9e8a0d6820dc23a
7
- data.tar.gz: 571f066016d01375efb5fcfc9dcd7a9b8f4354c499a2f00e5e1e0ec43b936dd6e95531335e149f12797d35187941eb04cbe8bdc0ebaa77dd2613fcb95ab3916f
6
+ metadata.gz: '04419df0eed1095b272fe51f0a48633a5e39bffcad043b7fbd1f9e9d76e215829e1c767ffe9c0aa26f1023b81aea289458878a3518f6e66ad80ed202905dfa36'
7
+ data.tar.gz: 45e1033eb661019c15ab03f9fd8cd5c46d969c28185dceb5f23748950eebb8488e47a0bfaa6da1b9260c68811f218bf71d9167ca93cd103b0ec325906f2ae4ca
data/.rubocop.yml ADDED
@@ -0,0 +1,7 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ Metrics/BlockLength:
4
+ Exclude:
5
+ - 'Rakefile'
6
+ - '**/*.rake'
7
+ - 'spec/**/*.rb'
data/.travis.yml CHANGED
@@ -1,6 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - 2.4.5
4
+ - 2.5.3
5
+ - 2.6.1
6
+ before_install:
7
+ - gem update --system
8
+ - gem install bundler
4
9
  addons:
5
10
  code_climate:
6
11
  repo_token: 0c1e171a171c155a28b285b4f51de50259744fdc720521df22a18d028774881d
12
+ # regular test configuration
13
+ after_success:
14
+ - bundle exec codeclimate-test-reporter
data/README.md CHANGED
@@ -19,23 +19,23 @@ Store your secret environment variables (API keys, AWS secrets etc.) with GPGME,
19
19
 
20
20
  And then execute:
21
21
 
22
- ```
23
- $ bundle
24
- ```
22
+ ```sh
23
+ $ bundle
24
+ ```
25
25
 
26
26
  Or install it yourself as:
27
27
 
28
- ```
29
- $ gem install shellject
30
- ```
28
+ ```sh
29
+ $ gem install shellject
30
+ ```
31
31
 
32
32
  *You may need to brew install gpgme on mac, or use your favourite package manager in linux*
33
33
 
34
34
  4. Finally, run
35
35
 
36
- ```
37
- $ shellject setup
38
- ```
36
+ ```sh
37
+ $ shellject setup
38
+ ```
39
39
  for instructions on how to set up the shell wrapper needed for injection, and, optionally, command-line completion.
40
40
 
41
41
 
@@ -44,26 +44,28 @@ Store your secret environment variables (API keys, AWS secrets etc.) with GPGME,
44
44
  ### Creating a new shelljection
45
45
  1. Create a text file with the shell code you wish to have securely injected. Here's one we prepared earlier:
46
46
 
47
- `$ cat my-secret-stuff.sh`
48
- ```
47
+ $ cat my-secret-stuff.sh
48
+ >
49
49
  export SECRET_APIKEY=abc123
50
50
  export OTHER_VAR=stuff
51
- ```
52
- 1. Save the file contents as a shelljection:
53
- `$ shellject save --name stuff my-secret-stuff.sh`
54
- 1. Test the shelljection:
51
+
52
+ 2. Save the file contents as a shelljection:
53
+
54
+ $ shellject save --name stuff my-secret-stuff.sh
55
+
56
+ 3. Test the shelljection:
55
57
 
56
- `$ shellject load stuff`
58
+ $ shellject load stuff
57
59
 
58
- `echo $SECRET_APIKEY # "abc123"`
60
+ echo $SECRET_APIKEY # "abc123"
59
61
 
60
- `echo $OTHER_VAR # "stuff"`
61
- 1. *REMOVE THE ORIGINAL FILE!*
62
- 1. Now, you can securely load the enviroment variables whenever you wish:
63
-
64
- `$ shellject load stuff`
62
+ echo $OTHER_VAR # "stuff"
63
+ 4. *REMOVE THE ORIGINAL FILE!*
64
+ 5. Now, you can securely load the environment variables whenever you wish:
65
+
66
+ $ shellject load stuff`
65
67
 
66
- ###For further help and options:
68
+ ### For further help and options:
67
69
  `$ shellject --help`
68
70
  ## Development
69
71
 
data/Rakefile CHANGED
@@ -1,12 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
- require 'reek/rake/task'
4
5
  require 'rubocop/rake_task'
5
6
 
6
- Reek::Rake::Task.new do |task|
7
- task.config_file = './config.reek'
8
- end
9
-
10
7
  begin
11
8
  require 'cane/rake_task'
12
9
 
@@ -15,7 +12,6 @@ begin
15
12
  cane.abc_max = 10
16
13
  cane.add_threshold 'coverage/.last_run.json', :>=, 100
17
14
  end
18
-
19
15
  rescue LoadError
20
16
  warn 'cane not available, quality task not provided.'
21
17
  end
@@ -26,4 +22,4 @@ RuboCop::RakeTask.new(:rubocop) do |task|
26
22
  task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
27
23
  end
28
24
 
29
- task default: [:spec, :quality, :reek, :rubocop]
25
+ task default: %i[spec quality rubocop]
data/lib/shellject.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
  require 'pathname'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Shellject
2
4
  # Factory method for creating crypto instances.
3
5
  module CryptoFactory
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Shellject
2
4
  # Models the shelljections directory as a repository.
3
5
  class SaveDirectory
4
6
  attr_reader :path
5
7
 
6
8
  def initialize(path)
7
- @path ||= Pathname.new path
9
+ @path = Pathname.new path
8
10
  end
9
11
 
10
12
  def path_for(name)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Shellject
2
4
  module Tasks
3
5
  # A task that needs access to a crypto instance
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Shellject
2
4
  module Tasks
3
5
  # Loads, decrypts, and outputs a shelljection
@@ -15,7 +17,7 @@ module Shellject
15
17
  file = File.open path
16
18
  STDOUT.print crypto.decrypt(file)
17
19
  ensure
18
- file.close if file
20
+ file&.close
19
21
  end
20
22
 
21
23
  private
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Shellject
2
4
  module Tasks
3
5
  # Encrypts and saves a file as a shelljection.
4
6
  class Save
5
7
  include CryptoTask
6
- attr_reader :save_directory, :input_path, :name
8
+ attr_reader :save_directory, :input_path
7
9
 
8
10
  def initialize(save_directory, input_path, name = nil)
9
11
  @save_directory = save_directory
@@ -26,8 +28,8 @@ module Shellject
26
28
  to = File.open(output_path, 'wb')
27
29
  yield from, to
28
30
  ensure
29
- from.close if from
30
- to.close if to
31
+ from&.close
32
+ to&.close
31
33
  end
32
34
 
33
35
  def ensure_writable
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Provides the gem version.
2
4
  module Shellject
3
- VERSION = '1.0.1'.freeze
5
+ VERSION = '1.0.2'
4
6
  end
data/shellject.gemspec CHANGED
@@ -27,11 +27,10 @@ Shellject:
27
27
  spec.add_dependency 'gpgme'
28
28
  spec.add_dependency 'clamp'
29
29
 
30
- spec.add_development_dependency 'bundler', '~> 1.7'
30
+ spec.add_development_dependency 'bundler', '~> 2.0'
31
31
  spec.add_development_dependency 'rake', '~> 10.0'
32
32
  spec.add_development_dependency 'pry', '~> 0.10'
33
33
 
34
- spec.add_development_dependency 'reek'
35
34
  spec.add_development_dependency 'rubocop'
36
35
  spec.add_development_dependency 'rspec'
37
36
  spec.add_development_dependency 'simplecov'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shellject
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Matheson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gpgme
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.7'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.10'
83
- - !ruby/object:Gem::Dependency
84
- name: reek
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rubocop
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -175,6 +161,7 @@ extra_rdoc_files: []
175
161
  files:
176
162
  - ".gitignore"
177
163
  - ".rspec"
164
+ - ".rubocop.yml"
178
165
  - ".travis.yml"
179
166
  - CODE_OF_CONDUCT.md
180
167
  - Gemfile
@@ -185,7 +172,6 @@ files:
185
172
  - bash/shellject_wrapper.sh
186
173
  - bin/console
187
174
  - bin/setup
188
- - config.reek
189
175
  - exe/shellject
190
176
  - lib/shellject.rb
191
177
  - lib/shellject/crypto_factory.rb
@@ -217,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
203
  version: '0'
218
204
  requirements: []
219
205
  rubyforge_project:
220
- rubygems_version: 2.4.5
206
+ rubygems_version: 2.7.3
221
207
  signing_key:
222
208
  specification_version: 4
223
209
  summary: Secure storage and injection of environment variables.
data/config.reek DELETED
@@ -1 +0,0 @@
1
- ---