Skip to content

Commit

Permalink
Rename to hush
Browse files Browse the repository at this point in the history
  • Loading branch information
ajh committed Apr 25, 2012
1 parent 0ffe343 commit 1e20c77
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--color
--format progress
2 changes: 1 addition & 1 deletion .rvmrc
Expand Up @@ -6,7 +6,7 @@
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
# Only full ruby name is supported here, for short names use:
# echo "rvm use 1.9.2" > .rvmrc
environment_id="ruby-1.9.2-p318@secret"
environment_id="ruby-1.9.2-p318@hush"

# Uncomment the following lines if you want to verify rvm version per project
# rvmrc_rvm_version="1.11.6" # 1.10.1 seams as a safe start
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
@@ -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
14 changes: 7 additions & 7 deletions README.markdown
@@ -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.

6 changes: 3 additions & 3 deletions README.md
@@ -1,20 +1,20 @@
# Secret
# Hush

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

gem 'secret'
gem 'hush'

And then execute:

$ bundle

Or install it yourself as:

$ gem install secret
$ gem install hush

## Usage

Expand Down
48 changes: 48 additions & 0 deletions bin/hush
@@ -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
11 changes: 0 additions & 11 deletions bin/secret

This file was deleted.

8 changes: 4 additions & 4 deletions secret.gemspec → hush.gemspec
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/secret/version', __FILE__)
require File.expand_path('../lib/hush/version', __FILE__)

Gem::Specification.new do |gem|
gem.authors = ["Andy Hartford"]
Expand All @@ -11,12 +11,12 @@ Gem::Specification.new do |gem|
gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = "secret"
gem.name = "hush"
gem.require_paths = ["lib"]
gem.version = Secret::VERSION
gem.version = Hush::VERSION

gem.add_runtime_dependency 'thor'
gem.post_install_message = "Shush - you've installed secret. See 'secret -h' for more info."
gem.post_install_message = "You've installed hush. See 'hush -h' for more info."

gem.add_development_dependency 'rspec', '~> 2'
end
5 changes: 5 additions & 0 deletions lib/hush.rb
@@ -0,0 +1,5 @@
require "hush/version"

module Hush
# Your code goes here...
end
2 changes: 1 addition & 1 deletion lib/secret/version.rb → lib/hush/version.rb
@@ -1,3 +1,3 @@
module Secret
module Hush
VERSION = "0.0.1"
end
5 changes: 0 additions & 5 deletions lib/secret.rb

This file was deleted.

6 changes: 6 additions & 0 deletions spec/configuration_spec.rb
@@ -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
7 changes: 7 additions & 0 deletions spec/hush_spec.rb
@@ -0,0 +1,7 @@
require 'spec_helper'

describe "hush" do


end

11 changes: 11 additions & 0 deletions spec/spec_helper.rb
@@ -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

0 comments on commit 1e20c77

Please sign in to comment.