Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternacki committed May 6, 2013
2 parents d23740d + 3cb367e commit 95e56bd
Show file tree
Hide file tree
Showing 35 changed files with 902 additions and 414 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ test/tmp
test/version_tmp
tmp
/.rbx
/.ruby-version
/.ruby-gemset
/log
.DS_Store
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changes

## 0.3.0

- New command `vendor push` for pushing managed branches and tags to
remote repository
- Nicer syntax for mixin hooks
- Add `:tag` option for `git` submodule
- Better stashing of local changes when syncing
- Verbosity tweaks
- Refactor implementation of configuration, other internal refactors
- Improved test coverage

## 0.2.0

- New vendor type `download` for downloading a single file
- Support `--version` and `-h` / `--help` switches
- New `:subdirectory` option for vendor modules
- Support JRuby
- Fix error when cleaning empty repository
- Misc verbosity tweaks
- Use MiniGit instead of Grit as Git library; other internal refactors
- Run Cucumber tests with Aruba

## 0.1.1

- Add `--update` option to `vendor sync` and `vendor status` to check
whether upstream version has changed
- It is now possible to explicitly set module's category to `nil`
- Ruby 1.8.7 compatibility fix
- Gem runtime/development dependency fixes
- Initial minitest specs
- Make Cucumber tests use Webmock

## 0.1.0

Initial release.



4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ source 'https://rubygems.org'
gemspec

group :development do
git "git://github.com/mpasternacki/wrong.git",
:ref => 'ad025241e5772373264d1bf62168e2bf3780ccf9' do
git "git://github.com/sconover/wrong.git",
:ref => '0cbc35a07cb63f6f409bb85da6ad7d107bdab021' do
gem 'wrong'
end
gem 'minitest-ansi'
Expand Down
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ detail.

* `vendor sync` will update all vendor modules that need updating
* `vendor status` will list all the modules and their status
* `vendor pull` will pull all vendor branches, tags, and notes from a
Git remote
* `vendor pull` will pull all vendor branches, tags, and notes from
a Git remote
* `vendor push` will push all vendor branches, tags, and notes to
a Git remote
* `vendor diff` will show the differences between vendor module's
pristine branch and curent work tree
* `vendor log` will show a `git log` of all changes made to a particular
Expand Down Expand Up @@ -123,9 +125,9 @@ block).
Example:

```ruby
vendor 'generated', :version => '0.23' do |mod|
File.open('README') { |f| f.puts "Hello, World!" }
File.open('VERSION') { |f| f.puts mod.version }
vendor 'generated', :version => '0.23' do |v|
File.open('README', 'w') { |f| f.puts "Hello, World!" }
File.open('VERSION', 'w') { |f| f.puts v.version }
end
```

Expand Down Expand Up @@ -160,7 +162,7 @@ unpacks it as contents of the module. It takes same options as
disables this behaviour.
* `:checksum` -- if set to SHA256 checksum of the file, it will be
checked on download.

Archive's `:version` defaults to file name.

Example:
Expand All @@ -181,10 +183,11 @@ Downloads snapshot of a Git repository. Takes the same options as
sets name to its basename then), just like `:url` for `archive`
(e.g. `git "git://github.com/github/testrepo.git"` will be cloned
from that repository, and named `testrepo`).
* `:branch`, `:revision` -- what to check out when repository is
cloned.
* `:branch`, `:revision`, `:tag` -- what to check out when repository
is cloned.

Git module's `:version` defaults to the conjured revision.
Git module's `:version` defaults to the `:tag` if given, or the
conjured revision otherwise.

Example:

Expand All @@ -208,7 +211,7 @@ always enough), plus:
completely. If an array, don't download dependencies that are in
the array. Default for that is `chef_cookbook_ignore_dependencies`
setting.

Examples:

```ruby
Expand All @@ -227,18 +230,16 @@ chef_cookbook 'memcached', ignore_dependencies => ['runit']
```

If you get Chef cookbooks from Git or anywhere else than Opscode's
community website, you can still use dependency resolution by mixing
in the hook class:
community website, you can still use dependency resolution by using a :hooks
option to add it:

```ruby
class << git 'git://github.com/user/cookbook.git', :category => :cookbooks
include Vendorificator::Hooks::ChefCookbookDependencies
git 'git://github.com/user/cookbook.git',
:category => :cookbooks,
:hooks => 'ChefCookbookDependencies'
end
```

This is a bit convoluted, but there will soon be an argument to do
that in a nicer way.

## Contributing

1. Fork it
Expand Down
16 changes: 15 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ namespace :relish do
end
end

task :info do
sh 'which git'
sh 'git --version'
end

begin
require 'cucumber'
require 'cucumber/rake/task'
Expand All @@ -38,4 +43,13 @@ end
mkdir_p 'tmp'
ENV['TMPDIR'] ||= File.join(Dir.pwd, 'tmp')

task :default => [:spec, :features]
task :default => [:info, :spec, :features]

if ENV['COVERAGE']
task :clean_coverage do
rm_rf 'coverage'
end

task :spec => :clean_coverage
task :features => :clean_coverage
end
34 changes: 34 additions & 0 deletions features/edgecases.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Feature: weird edge cases

Scenario: module with a .gitignore file
Given a repository with following Vendorfile:
"""ruby
vendor 'ignore', :version => 1 do
File.open('.gitignore', 'w') { |f| f.puts 'ignored.txt' }
end
"""
When I successfully run `vendor sync`
Then the following has been conjured:
| Name | ignore |
| With file | .gitignore |

When I write to "vendor/ignore/ignored.txt" with:
"""
whatever
"""
Then git repository is clean

When I change Vendorfile to:
"""ruby
vendor 'ignore', :version => 2 do
File.open('files.txt', 'w') { |f| f.puts Dir.entries('.').join("\n") }
File.open('.gitignore', 'w') { |f| f.puts 'ignored.txt' }
end
"""
And I successfully run `vendor sync`
Then the file "vendor/ignore/files.txt" should not contain "ignored.txt"
And the file "vendor/ignore/ignored.txt" should contain exactly:
"""
whatever
"""
And git repository is clean
17 changes: 17 additions & 0 deletions features/environment.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Environment management.

Scenario:
Given a repository with following Vendorfile:
"""ruby
vendor 'generated', :version => '0.23' do |v|
File.open('README', 'w') { |f| f.puts "Hello, World!" }
end
"""
And a remote repository
When I successfully run `vendor sync`
And I successfully run `vendor push`
Then branch "vendor/generated" exists in the remote repo
And tag "vendor/generated/0.23" exists in the remote repo



Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
xE�A
�0@Q�9��E�IӦ���B2��TӖ:��ڍ��OCT�n���Bj�:;q�| ��m�2c䄱��BM��g੔�FWCJ�������Y����2~d8��]��;�������S�� јM�U���1l
1 change: 1 addition & 0 deletions features/fixtures/git/testrepo/refs/tags/email-v0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
53ac1a96882e666cee31504179abc21eac522f8d
20 changes: 19 additions & 1 deletion features/git.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Scenario: Vendorificating a git repo
| Name | testrepo |
| Version | 10e9ac58c77bc229d8c59a5b4eb7422916453148 |
| With file | test/alias.c |
And there's a git log message including "at revision 10e9ac58c77bc229d8c59a5b4eb7422916453148"

Scenario: Vendorificating a subdirectory from a git repo
Given a repository with following Vendorfile:
Expand All @@ -23,6 +24,7 @@ Scenario: Vendorificating a subdirectory from a git repo
| Version | 10e9ac58c77bc229d8c59a5b4eb7422916453148 |
| With file | alias.c |
| Without file | test/alias.c |
And there's a git log message including "at revision 10e9ac58c77bc229d8c59a5b4eb7422916453148"

Scenario: Vendorificating a certain branch from a git repo
Given a repository with following Vendorfile:
Expand All @@ -35,6 +37,22 @@ Scenario: Vendorificating a certain branch from a git repo
| Name | testrepo |
| Version | ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c |
| With file | README.md |
And there's a git log message including "at revision ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c"

@wip
Scenario: Vendorificating a certain tag from a git repo
Given a repository with following Vendorfile:
"""ruby
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
:tag => 'email-v0'
"""
When I successfully run `vendor sync`
Then following has been conjured:
| Name | testrepo |
| Version | email-v0 |
| Without file | README.md |
| With file | test/alias.c |
And there's a git log message including "at revision f81247bde4ef7a1c7d280140cc0bcf0b8221a51f"

Scenario: Vendorificating a certain revision from a git repo
Given a repository with following Vendorfile:
Expand All @@ -48,4 +66,4 @@ Scenario: Vendorificating a certain revision from a git repo
| Version | 6ff1be9c3819c93a2f41e0ddc09f252fcf154f34 |
| With file | alias.c |
| Without file | test/alias.c |

And there's a git log message including "at revision 6ff1be9c3819c93a2f41e0ddc09f252fcf154f34"
2 changes: 1 addition & 1 deletion features/status.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: Module status

The `status` subcommand statuss all known modules and their status.
The `status` subcommand displays all known modules and their status.

Background:
Given a repository with following Vendorfile:
Expand Down
11 changes: 11 additions & 0 deletions features/step_definitions/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
run_simple 'git commit -m "New repo"'
end

Given /^a remote repository$/ do
create_dir '../remote-repository'
cd '../remote-repository'
run_simple 'git init --bare'
# Configure Git username & email to unclutter console output
run_simple 'git config user.name Cucumber'
run_simple 'git config user.email cucumber@`hostname --fqdn`'
cd '../working-repository'
run_simple 'git remote add origin ../remote-repository'
end

When /^I change Vendorfile to:$/ do |vendorfile_contents|
write_file('Vendorfile', vendorfile_contents)
run_simple 'git commit -m "Updated Vendorfile" Vendorfile'
Expand Down
12 changes: 12 additions & 0 deletions features/step_definitions/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@
Then /^tag matching (#{PATTERN}) does not exist$/ do |pat|
deny { git.tags.any? { |t| t =~ pat } }
end

Then(/^there's a git log message including "(.*?)"$/) do |message|
assert { git.log.lines.any? { |ln| ln.include?(message) } }
end

Then /^branch "(.*?)" exists in the remote repo$/ do |branch_name|
assert { remote_git.heads.include?(branch_name) }
end

Then /^tag "(.*?)" exists in the remote repo$/ do |tag_name|
assert { remote_git.tags.include?(tag_name) }
end
7 changes: 3 additions & 4 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

Before do
@aruba_timeout_seconds = case defined?(RUBY_ENGINE) && RUBY_ENGINE
when 'ruby', nil then 3
when 'jruby' then 20
when 'rbx' then 10
else 5
when 'jruby' then 45
when 'rbx' then 30
else 30
end
end
4 changes: 4 additions & 0 deletions features/support/minigit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def tags
def git
@git ||= ::MiniGit::Capturing.new(current_dir)
end

def remote_git
@remote_git ||= ::MiniGit::Capturing.new(current_dir + '/../remote-repository')
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/vendorificator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require 'vendorificator/config'
require 'vendorificator/environment'
require 'vendorificator/errors'

require 'vendorificator/vendor'
require 'vendorificator/vendor/download'
Expand Down
Loading

0 comments on commit 95e56bd

Please sign in to comment.