Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

lets try some grit

  • Loading branch information...
commit eca356f904b8067710e944b05783e554a85990e5 1 parent 5979a58
@adamhjk authored
View
6 Gemfile
@@ -10,4 +10,10 @@ group :development do
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.6.2"
gem "rcov", ">= 0"
+ gem "ci_reporter", ">= 0"
+ gem "grit", ">= 0"
+ gem "chef", ">= 0.10.4"
+ gem "mixlib-cli", ">= 0"
+ gem "mixlib-config", ">= 0"
+ gem "mixlib-log", ">= 0"
end
View
88 Gemfile.lock
@@ -0,0 +1,88 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ builder (3.0.0)
+ bunny (0.7.4)
+ chef (0.10.4)
+ bunny (>= 0.6.0)
+ erubis
+ highline
+ json (>= 1.4.4, <= 1.5.2)
+ mixlib-authentication (>= 1.1.0)
+ mixlib-cli (>= 1.1.0)
+ mixlib-config (>= 1.1.2)
+ mixlib-log (>= 1.3.0)
+ moneta
+ net-ssh (~> 2.1.3)
+ net-ssh-multi (~> 1.1.0)
+ ohai (>= 0.6.0)
+ rest-client (>= 1.0.4, < 1.7.0)
+ treetop (~> 1.4.9)
+ uuidtools
+ ci_reporter (1.6.5)
+ builder (>= 2.1.2)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ git (1.2.5)
+ grit (2.4.1)
+ diff-lcs (~> 1.1)
+ mime-types (~> 1.15)
+ highline (1.6.2)
+ jeweler (1.6.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ json (1.5.2)
+ mime-types (1.16)
+ mixlib-authentication (1.1.4)
+ mixlib-log
+ mixlib-cli (1.2.0)
+ mixlib-config (1.1.2)
+ mixlib-log (1.3.0)
+ moneta (0.6.0)
+ net-ssh (2.1.4)
+ net-ssh-gateway (1.1.0)
+ net-ssh (>= 1.99.1)
+ net-ssh-multi (1.1)
+ net-ssh (>= 2.1.4)
+ net-ssh-gateway (>= 0.99.0)
+ ohai (0.6.4)
+ mixlib-cli
+ mixlib-config
+ mixlib-log
+ systemu
+ yajl-ruby
+ polyglot (0.3.2)
+ rake (0.9.2)
+ rcov (0.9.10)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+ systemu (2.3.0)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ uuidtools (2.1.2)
+ yajl-ruby (0.8.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ chef (>= 0.10.4)
+ ci_reporter
+ grit
+ jeweler (~> 1.6.2)
+ mixlib-cli
+ mixlib-config
+ mixlib-log
+ rcov
+ rspec (~> 2.3.0)
View
21 README.rdoc
@@ -1,6 +1,23 @@
= chef-jenkins
-Description goes here.
+Use Jenkins to drive continuous deployment and synchronization of your Chef Environments from a git repository
+
+== How it works
+
+# You should always be within a chef-repo when you use chef-jenkins! (we are, after all, going to get run from jenkins - but see that later on)
+
+# To syncronize a git repository with a chef server - the branch is master by default.
+# You must provide an environment to pin to, which will always be current
+$ chef-jenkins sync --env-to dev
+
+# Propogate the cookbook policy from one environment and make it the policy for another environment
+$ chef-jenkins prop --env-from dev --env-to qa
+
+# Use a config file
+$ chef-jenkins prop --config ~/chef-jenkins.rb --env-from dev --env-to qa
+
+# Use the default config file - jenkins.rb
+$ chef-jenkins prop/sync
== Contributing to chef-jenkins
@@ -14,6 +31,6 @@ Description goes here.
== Copyright
-Copyright (c) 2011 Adam Jacob. See LICENSE.txt for
+Copyright (c) 2011 Opscode, Inc. See LICENSE.txt for
further details.
View
11 Rakefile
@@ -27,19 +27,21 @@ Jeweler::RubygemsDotOrgTasks.new
require 'rspec/core'
require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
+RSpec::Core::RakeTask.new(:spec => [ 'ci:setup:rspec' ]) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
-RSpec::Core::RakeTask.new(:rcov) do |spec|
+RSpec::Core::RakeTask.new(:rcov => [ 'ci:setup:rspec' ]) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
task :default => :spec
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
+require 'ci/reporter/rake/rspec'
+
+require 'rdoc/task'
+RDoc::Task.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
@@ -47,3 +49,4 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
+
View
35 lib/chef-jenkins.rb
@@ -0,0 +1,35 @@
+require 'rubygems'
+require 'mixlib/config'
+
+class Chef
+ class Jenkins
+ class Config
+ extend Mixlib::Config
+
+ # The branch to use
+ branch "master"
+
+ # The git repository URL to fetch
+ repo nil
+
+ # The chef server to update
+ chef_server nil
+
+ # The environment to sync from
+ env_from nil
+
+ # The environment to sync to
+ env_to nil
+
+ # The directory holding your git repository - defaults to Dir.pwd
+ cwd Dir.pwd
+ end
+
+ def update
+ git = Git.open(Chef::Jenkins::Config[:pwd])
+ last_commit = git.log(1)
+
+ end
+
+ end
+end
View
38 spec/chef-jenkins_spec.rb
@@ -1,7 +1,39 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe "ChefJenkins" do
- it "fails" do
- fail "hey buddy, you should probably rename this file and start specing for real"
+describe "Chef::Jenkins" do
+ before(:each) do
+ @cj = Chef::Jenkins.new("/Users/adam/src/sandbox/opscode/environments/opscode")
+ end
+
+ describe "initialize" do
+ it "should return a Chef::Jenkins object" do
+ @cj.should be_a_kind_of(Chef::Jenkins)
+ end
+ end
+end
+
+describe "Chef::Jenkins::Config" do
+ it "should have a default branch of master" do
+ Chef::Jenkins::Config[:branch].should == "master"
+ end
+
+ it "should have a default git repository of nil" do
+ Chef::Jenkins::Config[:repo].should == nil
+ end
+
+ it "should have a default chef_server of nil" do
+ Chef::Jenkins::Config[:chef_server].should == nil
+ end
+
+ it "should have a default env_from of nil" do
+ Chef::Jenkins::Config[:env_from].should == nil
+ end
+
+ it "should have a default env_to of nil" do
+ Chef::Jenkins::Config[:env_from].should == nil
+ end
+
+ it "should have a default cwd argument of nil" do
+ Chef::Jenkins::Config[:cwd].should == nil
end
end
View
19 spec/reports/SPEC-Chef-Jenkins-Config.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite name="Chef::Jenkins::Config" tests="6" time="0.002037" failures="0" errors="0" skipped="0">
+ <testcase name="Chef::Jenkins::Config should have a default branch of master" time="0.00014">
+ </testcase>
+ <testcase name="Chef::Jenkins::Config should have a default git repository of nil" time="9.4e-05">
+ </testcase>
+ <testcase name="Chef::Jenkins::Config should have a default chef_server of nil" time="8.9e-05">
+ </testcase>
+ <testcase name="Chef::Jenkins::Config should have a default environemtn of nil" time="9.0e-05">
+ </testcase>
+ <testcase name="Chef::Jenkins::Config should have a default env_from of nil" time="0.000172">
+ </testcase>
+ <testcase name="Chef::Jenkins::Config should have a default env_to of nil" time="0.000127">
+ </testcase>
+ <system-out>
+ </system-out>
+ <system-err>
+ </system-err>
+</testsuite>
View
16 spec/reports/SPEC-Chef-Jenkins-initialize.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite name="Chef::Jenkins initialize" tests="1" time="0.000351" failures="0" errors="1" skipped="0">
+ <testcase name="Chef::Jenkins initialize should return a Chef::Jenkins object" time="0.000243">
+ <failure type="ArgumentError" message="wrong number of arguments (0 for 3)">
+wrong number of arguments (0 for 3) (ArgumentError)
+ArgumentError:
+wrong number of arguments (0 for 3)
+ ./lib/chef-jenkins.rb:30:in `initialize'
+ ./spec/chef-jenkins_spec.rb:5:in `new'
+ ./spec/chef-jenkins_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;' </failure>
+ </testcase>
+ <system-out>
+ </system-out>
+ <system-err>
+ </system-err>
+</testsuite>
View
7 spec/reports/SPEC-Chef-Jenkins.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite name="Chef::Jenkins" tests="0" time="8.8e-05" failures="0" errors="0" skipped="0">
+ <system-out>
+ </system-out>
+ <system-err>
+ </system-err>
+</testsuite>
Please sign in to comment.
Something went wrong with that request. Please try again.