Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated gemfiles for inclusion of root Gemfile, since it's not a gemspec #55

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ bundler_args: --without=development
gemfile:
- gemfiles/Gemfile.chef-11
- gemfiles/Gemfile.chef-10

before_script:
- rake berks
9 changes: 2 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# -*- encoding: utf-8 -*-
source "http://rubygems.org"

chef_version = ENV.key?('CHEF_VERSION') ? "= #{ENV['CHEF_VERSION']}" : ['~> 10']
source "https://rubygems.org"

gem "rake", "~> 10"
gem "chef", chef_version

group :development do
gem "travis-lint", "~> 1.4"
Expand All @@ -17,7 +14,5 @@ group :test do
gem "tailor", "~> 1.1" # Ruby style
gem "foodcritic", "~> 1.6" # Lint testing
gem "berkshelf", "~> 1.0"
gem "chefspec", "~> 0.7"
gem "fauxhai", "~> 0.0"
gem "moneta", "< 0.7.0" # See http://tickets.opscode.com/browse/CHEF-3721
gem "chefspec", "~> 1.0.0.rc1" # See https://github.com/acrmp/chefspec/issues/93
end
18 changes: 11 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ require 'foodcritic'
# https://github.com/turboladen/tailor
require 'tailor/rake_task'

task :default => [:tailor, :foodcritic, :knife, :chefspec]
task :default => [
:tailor,
:foodcritic,
:berks,
:chefspec
]

Tailor::RakeTask.new do |task|
task.file_set('attributes/**/*.rb', "attributes") do |style|
Expand All @@ -30,19 +35,18 @@ FoodCritic::Rake::LintTask.new do |t|
end

# http://berkshelf.com/
desc "Install Berkshelf shims"
desc "Check out cookbooks from Berkshelf to local path"
task :berks do
sh %{berks install --path ./cookbooks}
sh %{bundle exec berks install --path ./cookbooks}
end

# http://wiki.opscode.com/display/chef/Managing+Cookbooks+With+Knife#ManagingCookbooksWithKnife-test
desc "Test cookbooks via knife"
desc "Test Datadog cookbook via knife"
task :knife do
sh %{knife cookbook test -o cookbooks -a}
sh %{bundle exec knife cookbook test datadog -o cookbooks}
end

# https://github.com/acrmp/chefspec
desc "Run ChefSpec Unit Tests"
task :chefspec do
sh %{rspec --color cookbooks/datadog/spec/}
sh %{bundle exec rspec --color cookbooks/datadog/spec/}
end
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.chef-10
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gem 'chef', '~> 10.0'

gemspec :path => '..'
eval(File.read(File.join(File.dirname(__FILE__), '..' ,'Gemfile')))
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.chef-11
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gem 'chef', '~> 11.2'

gemspec :path => '..'
eval(File.read(File.join(File.dirname(__FILE__), '..' ,'Gemfile')))
26 changes: 18 additions & 8 deletions spec/dd-agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
# This recipe needs to have an api_key, otherwise `raise` is called.
# It also depends on specific platofrm versions for software install
context 'when using a debian-family distro' do
before do
Fauxhai.mock(:platform => 'ubuntu', :version => '12.04') do |node|
node['datadog'] = { :api_key => "somethingnotnil" }

let(:chef_run) do
ChefSpec::ChefRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['datadog'] = {
'api_key' => "somethingnotnil"
}
end
end

let (:chef_run) { ChefSpec::ChefRunner.new.converge 'datadog::dd-agent' }
before do
chef_run.converge 'datadog::dd-agent'
end

it 'sets up an apt repository' do
pending "step into apt"
Expand All @@ -35,13 +40,18 @@
end

context 'when using a redhat-family distro above 6.x' do
before do
Fauxhai.mock(platform: 'centos', version: '6.3') do |node|
node['datadog'] = { :api_key => "somethingnotnil" }

let(:chef_run) do
ChefSpec::ChefRunner.new(platform: 'centos', version: '6.3') do |node|
node.set['datadog'] = {
'api_key' => "somethingnotnil"
}
end
end

let (:chef_run) { ChefSpec::ChefRunner.new.converge 'datadog::dd-agent' }
before do
chef_run.converge 'datadog::dd-agent'
end

it 'sets up the EPEL repository' do
pending "step intp yum::epel?"
Expand Down
9 changes: 7 additions & 2 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
require 'spec_helper'

describe 'datadog::default' do
let (:chef_run) { ChefSpec::ChefRunner.new.converge 'datadog::default' }

it 'should do nothing' do
context 'when converging this recipe' do

let(:chef_run) { ChefSpec::ChefRunner.new.converge 'datadog::default' }

it 'should do nothing' do
end

end

end
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
require 'chefspec'
require 'fauxhai'