hush 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rvmrc ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.2" > .rvmrc
9
+ environment_id="ruby-1.9.2-p318@hush"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.11.6" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ if [[ $- == *i* ]] # check for interactive shells
29
+ then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
30
+ else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
31
+ fi
32
+ else
33
+ # If the environment file has not yet been created, use the RVM CLI to select.
34
+ rvm --create use "$environment_id" || {
35
+ echo "Failed to create RVM environment '${environment_id}'."
36
+ return 1
37
+ }
38
+ fi
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hush.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Andy Hartford
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # Hush
2
+
3
+ This gem provides a command line utility called 'hush' which can
4
+ manage secret info. This was built to solve my problem of not
5
+ wanting to store email addresses and other sensitive info in my
6
+ github managed dotfiles project.
7
+
8
+ The hushs are not meant to be cryptographically secure. They are
9
+ stored in a yaml file (~/.hush.yml) and are protected by unix
10
+ file permissions. This is similar to how ssh private keys are stored in
11
+ an ~/.ssh directory.
12
+
13
+ ## Examples
14
+
15
+ git config user.email ${hush my_email}
16
+
17
+ This will store the value of *my_email* in your git config. If
18
+ *my_email* is not known to hush, you will be prompted to supply it and
19
+ it will be remembered from then on.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "thor"
5
+ require "yaml"
6
+ require "pathname"
7
+
8
+ class HushCommand < Thor
9
+ include Thor::Actions
10
+
11
+ desc "add NAME VALUE", "Adds a field to storage"
12
+ def add(name, value)
13
+ storage = load_storage
14
+ storage[name] = value
15
+ save_storage storage
16
+ end
17
+
18
+ desc "take NAME", "Prints the value of the field with named NAME. If NAME is unknown, the value can be provided at the prompt"
19
+ def take(name)
20
+ storage = load_storage
21
+
22
+ if !storage.key?(name)
23
+ storage[name] = ask "#{name} is undefined. Enter a value to add it to storage:"
24
+ save_storage storage
25
+ end
26
+
27
+ puts storage[name]
28
+ end
29
+
30
+ private
31
+
32
+ # returns hash from storage
33
+ def load_storage
34
+ path = Pathname.new("#{ENV['HOME']}/.hush/storage.yml")
35
+ path.file? ? YAML.load_file(path) : {}
36
+
37
+ if path.file? && y = YAML.load_file(path)
38
+ y
39
+ else
40
+ {}
41
+ end
42
+ end
43
+
44
+ # saves hash from storage
45
+ def save_storage(hash)
46
+ path = Pathname.new("#{ENV['HOME']}/.hush/storage.yml")
47
+ path.dirname.directory? or path.dirname.mkdir(0700)
48
+ unless path.file?
49
+ FileUtils.touch path
50
+ path.chmod 0600
51
+ end
52
+
53
+ path.open('w') {|io| io << YAML.dump(hash) }
54
+ end
55
+ end
56
+
57
+ HushCommand.start
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/hush/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Andy Hartford"]
6
+ gem.email = ["hartforda@gmail.com"]
7
+ gem.description = <<-DESC
8
+ This gem provides a command line utility called 'hush' which can
9
+ manage secret info. This was built to solve my problem of not
10
+ wanting to store email addresses and other sensitive info in my
11
+ github managed dotfiles project.
12
+ DESC
13
+ gem.summary = %q{A Command line utility to manage sensitive info}
14
+ gem.homepage = ""
15
+
16
+ gem.files = `git ls-files`.split($\)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.name = "hush"
20
+ gem.require_paths = ["lib"]
21
+ gem.version = Hush::VERSION
22
+
23
+ gem.add_runtime_dependency 'thor'
24
+ gem.post_install_message = "You've installed hush. See 'hush -h' for more info."
25
+
26
+ gem.add_development_dependency 'rspec', '~> 2'
27
+ end
@@ -0,0 +1,5 @@
1
+ require "hush/version"
2
+
3
+ module Hush
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Hush
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe "configuration" do
4
+ it "should look for configuration file in home dir by default"
5
+ it "should accept option to choose configuration path"
6
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe "hush" do
4
+
5
+
6
+ end
7
+
@@ -0,0 +1,11 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hush
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andy Hartford
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '2'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2'
46
+ description: ! 'This gem provides a command line utility called ''hush'' which can
47
+
48
+ manage secret info. This was built to solve my problem of not
49
+
50
+ wanting to store email addresses and other sensitive info in my
51
+
52
+ github managed dotfiles project.
53
+
54
+ '
55
+ email:
56
+ - hartforda@gmail.com
57
+ executables:
58
+ - hush
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .rvmrc
65
+ - Gemfile
66
+ - LICENSE
67
+ - README.md
68
+ - Rakefile
69
+ - bin/hush
70
+ - hush.gemspec
71
+ - lib/hush.rb
72
+ - lib/hush/version.rb
73
+ - spec/configuration_spec.rb
74
+ - spec/hush_spec.rb
75
+ - spec/spec_helper.rb
76
+ homepage: ''
77
+ licenses: []
78
+ post_install_message: You've installed hush. See 'hush -h' for more info.
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 1.8.21
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: A Command line utility to manage sensitive info
100
+ test_files:
101
+ - spec/configuration_spec.rb
102
+ - spec/hush_spec.rb
103
+ - spec/spec_helper.rb