Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
96 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--color | ||
--format progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in secret.gemspec | ||
# Specify your gem's dependencies in hush.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
Secret unix utility | ||
Hush unix utility | ||
=================== | ||
|
||
This gem provides a command line utility called 'secret' which can | ||
manage secret info. This was built to solve my problem of not wanting to | ||
This gem provides a command line utility called 'hush' which can | ||
manage hush info. This was built to solve my problem of not wanting to | ||
store email addresses and other sensitive info in my github managed | ||
dotfiles project. | ||
|
||
The secrets are not meant to be cryptographically secure. They are | ||
stored in a yaml file (~/.secret.yml) and are protected by unix | ||
The hushs are not meant to be cryptographically secure. They are | ||
stored in a yaml file (~/.hush.yml) and are protected by unix | ||
file permissions. This is similar to how ssh private keys are stored in | ||
an ~/.ssh directory. | ||
|
||
Examples | ||
========== | ||
|
||
git config user.email ${secret my_email} | ||
git config user.email ${hush my_email} | ||
|
||
This will store the value of *my_email* in your git config. If | ||
*my_email* is not known to secret, you will be prompted to supply it and | ||
*my_email* is not known to hush, you will be prompted to supply it and | ||
it will be remembered from then on. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "rubygems" | ||
require "thor" | ||
require "yaml" | ||
require "pathname" | ||
|
||
class HushCommand < Thor | ||
include Thor::Actions | ||
|
||
desc "foo", "Prints foo" | ||
def foo; puts "foo"; end | ||
|
||
desc "add NAME VALUE", "Adds a field to storage" | ||
def add(name, value) | ||
storage = load_storage | ||
storage[name] = value | ||
save_storage storage | ||
end | ||
|
||
desc "take NAME", "Prints the value of the field with named NAME. If NAME is unknown, the value can be provided at the prompt" | ||
def take(name) | ||
storage = load_storage | ||
|
||
if !storage.key?(name) | ||
storage[name] = ask "#{name} is undefined. Enter a value to add it to storage:" | ||
save_storage storage | ||
end | ||
|
||
puts storage[name] | ||
end | ||
|
||
private | ||
|
||
# returns hash from storage | ||
def load_storage | ||
path = Pathname.new("#{ENV['HOME']}/.hush.yml") | ||
path.file? ? YAML.load(path) : {} | ||
end | ||
|
||
# saves hash from storage | ||
def save_storage(hash) | ||
path = Pathname.new("#{ENV['HOME']}/.hush.yml") | ||
path.open('w') {|io| io << YAML.dump(hash) } | ||
end | ||
end | ||
|
||
HushCommand.start |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require "hush/version" | ||
|
||
module Hush | ||
# Your code goes here... | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Secret | ||
module Hush | ||
VERSION = "0.0.1" | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'spec_helper' | ||
|
||
describe "configuration" do | ||
it "should look for configuration file in home dir by default" | ||
it "should accept option to choose configuration path" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'spec_helper' | ||
|
||
describe "hush" do | ||
|
||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was generated by the `rspec --init` command. Conventionally, all | ||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | ||
# Require this file using `require "spec_helper.rb"` to ensure that it is only | ||
# loaded once. | ||
# | ||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | ||
RSpec.configure do |config| | ||
config.treat_symbols_as_metadata_keys_with_true_values = true | ||
config.run_all_when_everything_filtered = true | ||
config.filter_run :focus | ||
end |