Skip to content

Commit

Permalink
first cut
Browse files Browse the repository at this point in the history
  • Loading branch information
knuckolls committed May 14, 2012
0 parents commit 48329ef
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
@@ -0,0 +1,17 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in santoku.gemspec
gemspec
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
Copyright (c) 2012 Kevin Nuckolls

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
@@ -0,0 +1,29 @@
# Santoku

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

gem 'santoku'

And then execute:

$ bundle

Or install it yourself as:

$ gem install santoku

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
2 changes: 2 additions & 0 deletions Rakefile
@@ -0,0 +1,2 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
32 changes: 32 additions & 0 deletions bin/santoku
@@ -0,0 +1,32 @@
#!/usr/bin/env ruby
#
# ./santoku - Flexible Wrapper for the 'knife' Chef CLI interface
#
# Author:: Kevin Nuckolls(<kevin.nuckolls@gmail.com>)
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2009 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

## Adapted from Opscode's knife code

require 'rubygems'
require 'chef/application/knife'

## monkey patch knife to add in santoku's callbacks
require 'santoku'


Chef::Application::Knife.new.run

6 changes: 6 additions & 0 deletions lib/santoku.rb
@@ -0,0 +1,6 @@
require "santoku/version"
require 'santoku/monkey_patches/knife'

module Santoku

end
30 changes: 30 additions & 0 deletions lib/santoku/monkey_patches/knife.rb
@@ -0,0 +1,30 @@
## Monkeypatch knife to add in callback support

class Chef::Application::Knife

# Run knife
def run
Mixlib::Log::Formatter.show_time = false
validate_and_parse_options
quiet_traps

## added by santoku
before_callbacks(ARGV)

Chef::Knife.run(ARGV, options)

## added by santoku
after_callbacks(ARGV)

exit 0
end

def before_callbacks(args)
puts "before"
end

def after_callbacks(args)
puts "after"
end

end
3 changes: 3 additions & 0 deletions lib/santoku/version.rb
@@ -0,0 +1,3 @@
module Santoku
VERSION = "0.0.1"
end
19 changes: 19 additions & 0 deletions santoku.gemspec
@@ -0,0 +1,19 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/santoku/version', __FILE__)

Gem::Specification.new do |gem|
gem.authors = ["Kevin Nuckolls"]
gem.email = ["kevin.nuckolls@gmail.com"]
gem.description = "a wrapper for knife that helps you build up processes around chef"
gem.summary = ""
gem.homepage = "http://www.github.com/knuckolls/santoku"

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 = "santoku"
gem.require_paths = ["lib"]
gem.version = Santoku::VERSION

gem.add_dependency "chef"
end

0 comments on commit 48329ef

Please sign in to comment.