Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 2a3dea1b8dbfbc95776df715ba5edb571c84dbfc 0 parents
@smith smith authored
4 .gitignore
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in capistrano-chef.gemspec
+gemspec
2  Rakefile
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
23 capistrano-chef.gemspec
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "capistrano/chef/version"
+
+Gem::Specification.new do |s|
+ s.name = "capistrano-chef"
+ s.version = Capistrano::Chef::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.license = 'MIT'
+ s.authors = ['Nathan L Smith']
+ s.email = ['nlloyds@gmail.com']
+ s.homepage = "https://github.com/cramerdev/capistrano-chef"
+ s.summary = %q{TODO: Write a gem summary}
+ s.description = %q{TODO: Write a gem description}
+
+ s.rubyforge_project = "capistrano-chef"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+ s.requirements = [['capistrano', '~> 2.1']]
+end
17 lib/capistrano/chef.rb
@@ -0,0 +1,17 @@
+require 'chef/knife'
+require 'chef/search/query'
+
+Capistrano::Configuration.instance.load do
+ Chef::Knife.new.configure_chef
+
+ # Define a role for capistrano, but instead of a list of addresses, use a chef
+ # query to search nodes.
+ def chef_role(name, query = "*:*", options = {})
+ # TODO: This can only get a node's top-level attributes. Make it get nested
+ # ones.
+ attr = options.delete(:attribute) || :ipaddress
+ nodes = Chef::Search::Query.new.search(:node, query)[0].map {|n| n[attr] }
+ role name, *nodes, options
+ nodes
+ end
+end
5 lib/capistrano/chef/version.rb
@@ -0,0 +1,5 @@
+require 'capistrano'
+
+class Capistrano::Chef
+ VERSION = '0.0.1'
+end
Please sign in to comment.
Something went wrong with that request. Please try again.