Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternacki committed Mar 7, 2013
2 parents 43bb1b0 + d695091 commit d23740d
Show file tree
Hide file tree
Showing 37 changed files with 621 additions and 536 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ rvm:
- 1.8.7
- 1.9.2
- 1.9.3
# - jruby-18mode # JRuby in 1.8 mode
# - jruby-19mode # JRuby in 1.9 mode
- 2.0.0
- ree
- jruby-18mode
- jruby-19mode
- jruby-head
- rbx-18mode
- rbx-19mode
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ source 'https://rubygems.org'
gemspec

group :development do
gem "ZenTest", "4.8.3"
git "git://github.com/mpasternacki/wrong.git",
:ref => 'ad025241e5772373264d1bf62168e2bf3780ccf9' do
gem 'wrong'
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ vendor 'generated', :version => '0.23' do |mod|
end
```

#### download

Downloads a single file:

```ruby
download 'socks.el', :url => 'http://cvs.savannah.gnu.org/viewvc/*checkout*/w3/lisp/socks.el?root=w3&revision=HEAD'
download 'http://mumble.net/~campbell/emacs/paredit.el'
```

#### archive

Archive takes a tar.gz, tar.bz2, or zip file, downloads it, and
Expand Down
8 changes: 7 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ begin
require 'cucumber/rake/task'

desc 'Run Cucumber features'
Cucumber::Rake::Task.new(:features)
Cucumber::Rake::Task.new(:features) do |t|
t.fork = false
end
rescue LoadError
desc 'Cucumber rake task not available'
task :features do
Expand All @@ -32,4 +34,8 @@ Rake::TestTask.new :spec do |task|
task.test_files = FileList['spec/**/*_spec.rb']
end

# https://github.com/jruby/jruby/issues/405
mkdir_p 'tmp'
ENV['TMPDIR'] ||= File.join(Dir.pwd, 'tmp')

task :default => [:spec, :features]
10 changes: 4 additions & 6 deletions features/chef_cookbook.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Feature: Chef cookbooks from Opscode Community website

Scenario: A single cookbook, without dependencies

Scenario: Version & checksum
Given a repository with following Vendorfile:
"""ruby
chef_cookbook 'apt'
"""
When I run "vendor sync"
When I successfully run `vendor sync`
Then following has been conjured:
| Name | cookbooks/apt |
| With file | metadata.rb |
Expand All @@ -17,7 +15,7 @@ Scenario: Dependency hook
"""ruby
chef_cookbook 'memcached'
"""
When I run "vendor sync"
When I successfully run `vendor sync`
Then following has been conjured:
| Name | cookbooks/memcached | cookbooks/runit |
| With file | metadata.rb | metadata.rb |
Expand All @@ -28,7 +26,7 @@ Scenario: Ignored dependency
chef_cookbook_ignore_dependencies ['runit']
chef_cookbook 'memcached'
"""
When I run "vendor sync"
When I successfully run `vendor sync`
Then following has been conjured:
| Name | cookbooks/memcached |
| With file | metadata.rb |
Expand All @@ -42,7 +40,7 @@ Scenario: Ignored all dependencies
chef_cookbook_ignore_dependencies true
chef_cookbook 'chef-server'
"""
When I run "vendor sync"
When I successfully run `vendor sync`
Then following has been conjured:
| Name | cookbooks/chef-server |
| With file | metadata.rb |
Expand Down
8 changes: 4 additions & 4 deletions features/deprecated.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Background:
"""

Scenario: `vendorify` command prints a deprecation warning
When I run "vendorify"
Then command output includes "DEPRECATED: `vendorify` command is deprecated, run `vendor` instead"
When I successfully run `vendorify`
Then the output should contain "DEPRECATED"

Scenario: `vendor` command doesn't print a deprecation warning
When I run "vendor"
Then command output does not include "DEPRECATED: `vendorify` command is deprecated, run `vendor` instead"
When I successfully run `vendor`
Then the output should not contain "DEPRECATED"
43 changes: 41 additions & 2 deletions features/git.feature
Original file line number Diff line number Diff line change
@@ -1,12 +1,51 @@
Feature: Git-based vendor module

Scenario:
Scenario: Vendorificating a git repo
Given a repository with following Vendorfile:
"""ruby
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo"
"""
When I run "vendor sync"
When I successfully run `vendor sync`
Then following has been conjured:
| Name | testrepo |
| Version | 10e9ac58c77bc229d8c59a5b4eb7422916453148 |
| With file | test/alias.c |

Scenario: Vendorificating a subdirectory from a git repo
Given a repository with following Vendorfile:
"""ruby
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
:subdirectory => 'test'
"""
When I successfully run `vendor sync`
Then following has been conjured:
| Name | testrepo |
| Version | 10e9ac58c77bc229d8c59a5b4eb7422916453148 |
| With file | alias.c |
| Without file | test/alias.c |

Scenario: Vendorificating a certain branch from a git repo
Given a repository with following Vendorfile:
"""ruby
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
:branch => 'topic/pink'
"""
When I successfully run `vendor sync`
Then following has been conjured:
| Name | testrepo |
| Version | ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c |
| With file | README.md |

Scenario: Vendorificating a certain revision from a git repo
Given a repository with following Vendorfile:
"""ruby
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
:revision => '6ff1be'
"""
When I successfully run `vendor sync`
Then following has been conjured:
| Name | testrepo |
| Version | 6ff1be9c3819c93a2f41e0ddc09f252fcf154f34 |
| With file | alias.c |
| Without file | test/alias.c |

15 changes: 8 additions & 7 deletions features/needed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Scenario: already downloaded tarball
archive :testrepo, :version => '0.1',
:url => 'http://test-assets.3ofcoins.net.s3-website-us-east-1.amazonaws.com/testrepo-0.1.tar.gz'
"""
When I run "vendor sync"
When I successfully run `vendor sync`
Then I'm on "master" branch
And command output includes /module\s+testrepo/
And command output includes "testrepo-0.1.tar.gz"
Then I run "vendor sync"
And command output includes /module\s+testrepo/
And command output includes /up to date\s+testrepo/
And command output does not include "testrepo-0.1.tar.gz"
And the last output should match /module\s+testrepo/
And the last output should match "testrepo-0.1.tar.gz"

When I successfully run `vendor sync`
Then the last output should match /module\s+testrepo/
And the last output should match /up to date\s+testrepo/
And the last output should not match "testrepo-0.1.tar.gz"
12 changes: 7 additions & 5 deletions features/smoke.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ Feature: smoke test of the test suite
I want to make sure that test environment itself does not emit smoke.

Scenario: The default environment
Given nothing in particular
When nothing happens
Then the README file exists
Given a repository with following Vendorfile:
"""
"""
Then a file named "README" should exist
And a 0 byte file named "Vendorfile" should exist
And git repository is clean
And git history has one commit
And git history has 1 commit
And I'm on "master" branch
And no other branch exists

30 changes: 15 additions & 15 deletions features/status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ Background:
"""

Scenario: status new module
When I run "vendor status"
Then command output includes /new\s+generated\/0.23/
When I successfully run `vendor status`
Then the last output should match /new\s+generated\/0.23/

Scenario: status up-to-date module
When I run "vendor sync"
And I run "vendor status"
Then command output includes /up to date\s+generated\/0.23/
When I successfully run `vendor sync`
And I successfully run `vendor status`
Then the last output should match /up to date\s+generated\/0.23/

Scenario: status outdated modules
When I run "vendor sync"
When I successfully run `vendor sync`
And I change Vendorfile to:
"""ruby
vendor 'generated', :version => '0.42' do |v|
File.open('README', 'w') { |f| f.puts "Hello, Updated, World!" }
File.open('VERSION', 'w') { |f| f.puts v.version }
end
"""
And I run "vendor status"
Then command output includes /outdated\s+generated\/0.42/
And I successfully run `vendor status`
Then the last output should match /outdated\s+generated\/0.42/

Scenario: Module's dependencies are statused if they are known
When I change Vendorfile to:
"""ruby
require 'vendorificator/vendor/chef_cookbook'
chef_cookbook 'memcached'
"""
And I run "vendor status"
Then command output includes /new\s+memcached/
And command output does not include "runit"
When I run "vendor sync"
And I run "vendor status"
Then command output includes /up to date\s+memcached/
And command output includes /up to date\s+runit/
And I successfully run `vendor status`
Then the last output should match /new\s+memcached/
And the last output should not match "runit"
When I successfully run `vendor sync`
And I successfully run `vendor status`
Then the last output should match /up to date\s+memcached/
And the last output should match /up to date\s+runit/
11 changes: 11 additions & 0 deletions features/step_definitions/aruba_ext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Then /^the last output should match (#{PATTERN})$/ do |expected|
assert { last_output =~ expected }
end

Then /^the last output should not match (#{PATTERN})$/ do |expected|
deny { last_output =~ expected }
end

Then /^it should fail$/ do
deny { last_exit_status == 0 }
end
59 changes: 16 additions & 43 deletions features/step_definitions/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,20 @@
nil # NOP
end

Then /^file "(.*?)" exists$/ do |path|
assert { File.exists?(path) }
end

Then /^file "(.*?)" does not exist$/ do |path|
deny { File.exists?(path) }
end

Then /^the README file exists$/ do
step 'file "README" exists'
end

Then /^file "(.*?)" reads "(.*?)"$/ do |path, text|
assert { File.read(path).strip == text.strip }
end

Given /^a repository with following Vendorfile:$/ do |string|
commit_file('Vendorfile', string)
end

When /^I change Vendorfile to:$/ do |string|
commit_file('Vendorfile', string, "Updated Vendorfile")
end

When /^I try to run "(.*?)"$/ do |command_string|
run command_string
end

When /^I run "(.*?)"$/ do |command_string|
step "I try to run \"#{command_string}\""
assert { command_succeeded }
end

Then /the command has failed/ do
deny { command_succeeded(false) }
end

Then /^command (output|stdout|stderr) includes (#{PATTERN})$/ do |stream, pat|
assert { command_output(stream) =~ pat }
end

Then /^command (output|stdout|stderr) does not include (#{PATTERN})$/ do |stream, pat|
deny { command_output(stream) =~ pat }
Given /^a repository with following Vendorfile:$/ do |vendorfile_contents|
create_dir 'working-repository'
cd 'working-repository'
run_simple 'git init'
# Configure Git username & email to unclutter console output
run_simple 'git config user.name Cucumber'
run_simple 'git config user.email cucumber@`hostname --fqdn`'
write_file('README', 'Lorem ipsum dolor sit amet')
write_file('Vendorfile', vendorfile_contents)
run_simple 'git add .'
run_simple 'git commit -m "New repo"'
end

When /^I change Vendorfile to:$/ do |vendorfile_contents|
write_file('Vendorfile', vendorfile_contents)
run_simple 'git commit -m "Updated Vendorfile" Vendorfile'
end
22 changes: 11 additions & 11 deletions features/step_definitions/git.rb
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
Then /^git repository is clean$/ do
assert { repo_clean? }
assert { git.status(:porcelain => true) == '' }
end

Then /^git history has one commit$/ do
assert { git.log.count == 1 }
Then /^git history has (\d+) commit(?:s)?$/ do |ncommits|
assert { git.rev_list(:all => true).lines.count == ncommits.to_i }
end

Then /^I\'m on "(.*?)" branch$/ do |expected_branch|
assert { branch == expected_branch }
assert { git.rev_parse({:abbrev_ref => true}, 'HEAD').strip == expected_branch }
end

Then /^no other branch exists$/ do
assert { branches.length == 1 }
assert { git.branch.lines.count == 1 }
end

Then /^branch "(.*?)" exists$/ do |branch_name|
assert { branches.include?(branch_name) }
assert { git.heads.include?(branch_name) }
end

Then /^branch "(.*?)" does not exist$/ do |branch_name|
deny { branches.include?(branch_name) }
deny { git.heads.include?(branch_name) }
end

Then /^tag "(.*?)" exists$/ do |tag_name|
assert { tags.include?(tag_name) }
assert { git.tags.include?(tag_name) }
end

Then /^tag "(.*?)" does not exist$/ do |tag_name|
deny { tags.include?(tag_name) }
deny { git.tags.include?(tag_name) }
end

Then /^tag matching (#{PATTERN}) exists$/ do |pat|
assert { tags.any?{|t| t=~pat} }
assert { git.tags.any? { |t| t =~ pat } }
end

Then /^tag matching (#{PATTERN}) does not exist$/ do |pat|
deny { tags.any?{|t| t=~pat} }
deny { git.tags.any? { |t| t =~ pat } }
end
Loading

0 comments on commit d23740d

Please sign in to comment.