Commit eee21df0 authored by Stig Mathisen's avatar Stig Mathisen

Imported Upstream version 0.9.8+ds

parent 7fa65ed6
......@@ -80,7 +80,7 @@ If we do not, then librarian-puppet will assume we meant the `master` branch.
If we use a `:ref =>`, we can use anything that Git will recognize as a ref.
This includes any branch name, tag name, SHA, or SHA unique prefix. If we use a
branch, we can later ask Librarian-pupet to update the modulek by fetching the
branch, we can later ask Librarian-puppet to update the module by fetching the
most recent version of the module from that same branch.
The Git source also supports a `:path =>` option. If we use the path option,
......@@ -156,8 +156,8 @@ Update the version of a dependency:
Bug reports to the github issue tracker please.
Please include:
* relevant `Puppetfile` and `Puppetfile.lock` files.
* version of ruby, librarian-puppet
* Relevant `Puppetfile` and `Puppetfile.lock` files
* Version of ruby, librarian-puppet
* What distro
* Please run the `librarian-puppet` commands in verbose mode by using the
`--verbose` flag, and include the verbose output in the bug report as well.
......
require 'librarian'
require 'puppet'
require 'fileutils'
begin
require 'puppet'
rescue LoadError
$stderr.puts <<-EOF
Unable to load puppet. Either install it using native packages for your
platform (eg .deb, .rpm, .dmg, etc) or as a gem (gem install puppet).
EOF
exit 1
end
require 'librarian/puppet/extension'
require 'librarian/puppet/version'
......
......@@ -109,10 +109,10 @@ module Librarian
def check_puppet_module_options
min_version = Gem::Version.create('2.7.13')
puppet_version = Gem::Version.create(`puppet --version`.strip)
puppet_version = Gem::Version.create(`puppet --version`.split(' ').first.strip.gsub('-', '.'))
if puppet_version < min_version
raise Error, "To get modules from the forge, we use the puppet faces module command. Your current version does not support the options #{options.join(',')} . For this you need at least puppet version 2.7.13 and you have #{puppet_version}"
raise Error, "To get modules from the forge, we use the puppet faces module command. For this you need at least puppet version 2.7.13 and you have #{puppet_version}"
end
end
......@@ -204,6 +204,12 @@ module Librarian
self.uri == other.uri
end
alias :eql? :==
def hash
self.to_s.hash
end
def to_spec_args
[uri, {}]
end
......
......@@ -23,7 +23,16 @@ module Librarian
end
all_versions = data.map { |r| r['name'] }.sort.reverse
all_versions.reject { |version| version =~ /^v/ }.compact
all_versions = all_versions.map do |version|
version.gsub(/^v/, '')
end
all_versions.delete_if do |version|
version !~ /\A\d\.\d(\.\d.*)?\z/
end
all_versions.compact
end
def manifests
......@@ -161,6 +170,12 @@ module Librarian
self.uri == other.uri
end
alias :eql? :==
def hash
self.to_s.hash
end
def to_spec_args
[uri, {}]
end
......
module Librarian
module Puppet
VERSION = "0.9.7"
VERSION = "0.9.8"
end
end
This diff is collapsed.
# Change Log
## 0.0.24
* \#15. A remembered configuration system.
* \#16. Configure, and remember configuration for, chef install paths.
* \#38. Configure, and remember configuration for, stripping out `.git`
directories from git-sources chef dependencies.
* \#76. Support git annotated tags.
* \#80. Ignore directories in the `PATH` named `git` when looking for the `git`
bin.
* \#85. Provide a helpful message when running the `show` command without a
lockfile present.
## 0.0.23
* \#41. Build gems with a built gemspec.
* \#67. Cache remote objects at the latest possible moments, and only when they
are needed.
* \#68. Fix unpacking chef site-sourced packages on Windows by pivoting from a
Librarian-managed scratch space, rather than pivoting from Windows' temp
directory. There were unexplained problems with using the Windows temp
directory in certain cases, possibly related to the temp directory and the
Librarian cache directory being on different volumes.
* \#69. Fix invoking Librarian with git-sourced dependencies from git hooks by
unsetting `GIT_DIR` around shelling out to git.
* Print general environment information when running with `--verbose`.
## 0.0.22
* Fix the `outdated` CLI command.
## 0.0.21
* \#64. Sources now raise when given unrecognized options in the specfile.
* A new `show` CLI command.
* Changed the `clean` CLI command no longer to delete the lockfile.
* Simplify the architecture of `Librarian::Manifest` vis-a-vis sources. It is no
longer a base class for adapters to inherit. Now, sources expose a small
interface, which `Librarian::Manifest` can call, for delay-loading attributes.
* The git source now resolves the `git` binary before `chdir`ing.
* Test on Rubinius.
## 0.0.20
* A command to print outdated dependencies.
## 0.0.19
* Fix breakage on 1.8.
## 0.0.18
* \#57. Include existing manifests' dependencies in resolution.
* Permit the update action even with a changed specfile.
## 0.0.17
* Use a pure-Ruby implementation of tar/gz. Helps with Windows support, since
Windows boxes are less likely than *NIX boxes to have the `tar` executable.
* Fix an issue where the chef site source considers uncached manifests to be
cached, and skips caching them, causing the install action to fail.
* Fail fast if the resolver produces an inconsistent resolution. It is a known
issue that the resolver will sometimes (deterministically, not randomly)
produce an inconsistent resolution when performing an update action (#57).
Start debugging this by failing fast at this point and spitting out gobs of
debug-level log details.
## 0.0.16
* Recache site-sourced dependency metadata per each run.
* \#46. Always install.
* \#53. Abstract versions & requirements from rubygems.
* Own the install path. Recreate it on each install.
WARNING: If you have your own content in the install path, it will be deleted without mercy.
## 0.0.15
* Rewrite the README.
* \#44, \#49. Better updating of cached git sources without using local merges.
## 0.0.14
* \#39 Fixes a regression induced by using `git reset --hard SHA`.
## 0.0.13
* \#36 Fixes an issue where, if a dependency has a git source (the upstream), and the upstream is updated,
then attempting to update that dependency in the local resolution would not update that dependency so
long as that git source were cached (@databus23).
* More immediate detection of, and better error messages for, cases of blank dependency or manifest names
or cases of names that are otherwise insensible, such as names that are untrimmed.
## 0.0.12
* Fixes an issue where, if a dependency has a git source with a ref, re-resolving may fail.
## 0.0.11
* Fix a regression where the cli command "version" failed.
## 0.0.10
This release focuses on refactoring some of the internals. There are no functional changes.
## 0.0.9
* \#11 Fixes a problem where, if the repo is in a path where a component has a space, attempting to resolve a
site-sourced dependency fails.
## 0.0.8
* A `version` task.
* A change log.
* \#10 Fixes the problem with bouncing the lockfile when updating, when using a git source with the default ref.
## 0.0.7
* \#8 Add highline temporarily as a runtime dependency of `librarian` (@fnichol).
When the project is split into `librarian` and `librarian-chef`, the `chef` runtime dependency will
be moved to `librarian-chef`. If the project is further split into a knife plugin, the dependency
will be moved there.
## 0.0.6
* \#7 Show a better error message when a cookbook is missing the required metadata file.
* Miscellaneous bugfixes.
## 0.0.5
* \#4 An `init` task for `librarian-chef`.
This task creates a nearly-blank `Cheffile` with just the default Opscode Community Site source.
* Automatically create the `cookbooks` directory, if it's missing, when running the `install` task.
* \#3 Add `chef` temporarily as a runtime dependency of `librarian` (@fnichol).
When the project is split into `librarian` and `librarian-chef`, the `chef` runtime dependency will
be moved to `librarian-chef`.
## 0.0.4
* A simple knife integration.
This integration allows you to specify a `librarian-chef`-managed tempdir as a `cookbook_path`.
This is useful to force knife only to upload the exact cookbooks that `librarian-chef` knows
about, rather than whatever happens to be found in the `cookbooks` directory.
## 0.0.3
* Miscellaneous bugfixes.
## 0.0.2
* An optional `:path` attribute for `:git` sources.
This allows you to specify exactly where within a git repository a given cookbook is to be found.
* A full example of a Cheffile and its usage in the readme.
## 0.0.1
* Initial release.
source "http://rubygems.org"
# Specify your gem's dependencies in librarian.gemspec
gemspec
gem "fakefs", :require => "fakefs/safe"
Copyright (c) 2011 ApplicationsOnline, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This diff is collapsed.
require 'bundler'
module Bundler
class GemHelper
def build_gem_with_built_spec
spec = Gem::Specification.load(spec_path)
spec_ruby = spec.to_ruby
original_spec_path = spec_path + ".original"
FileUtils.mv(spec_path, original_spec_path)
File.open(spec_path, "wb"){|f| f.write(spec_ruby)}
build_gem_without_built_spec
ensure
FileUtils.mv(original_spec_path, spec_path)
end
alias build_gem_without_built_spec build_gem
alias build_gem build_gem_with_built_spec
end
end
Bundler::GemHelper.install_tasks
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features)
task :default => [:spec, :features]
rescue LoadError
end
#!/usr/bin/env ruby
lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?(lib)
require 'librarian/chef/cli'
Librarian::Chef::Cli.bin!
#!/usr/bin/env ruby
lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?(lib)
require 'librarian/mock/cli'
Librarian::Mock::Cli.bin!
default: --tags ~@wip --format progress
Feature: cli/init
Scenario: Initing a directory
When I run `librarian-chef init`
Then the exit status should be 0
Then a file named "Cheffile" should exist
Feature: cli/install
Scenario: A simple Cheffile with one cookbook
Given a file named "cookbook-sources/apt/metadata.yaml" with:
"""
name: apt
version: 1.0.0
dependencies: { }
"""
Given a file named "Cheffile" with:
"""
cookbook 'apt',
:path => 'cookbook-sources'
"""
When I run `librarian-chef install --verbose`
Then the exit status should be 0
And the file "cookbooks/apt/metadata.yaml" should contain exactly:
"""
name: apt
version: 1.0.0
dependencies: { }
"""
Scenario: A simple Cheffile with one cookbook with one dependency
Given a file named "cookbook-sources/main/metadata.yaml" with:
"""
name: main
version: 1.0.0
dependencies:
sub: 1.0.0
"""
Given a file named "cookbook-sources/sub/metadata.yaml" with:
"""
name: sub
version: 1.0.0
dependencies: {}
"""
Given a file named "Cheffile" with:
"""
path 'cookbook-sources'
cookbook 'main'
"""
When I run `librarian-chef install --verbose`
Then the exit status should be 0
And the file "cookbooks/main/metadata.yaml" should contain exactly:
"""
name: main
version: 1.0.0
dependencies:
sub: 1.0.0
"""
And the file "cookbooks/sub/metadata.yaml" should contain exactly:
"""
name: sub
version: 1.0.0
dependencies: {}
"""
Feature: cli/show
Background: A simple Cheffile with one cookbook with one dependency
Given a file named "cookbook-sources/main/metadata.yaml" with:
"""
name: main
version: 1.0.0
dependencies:
sub: 1.0.0
"""
Given a file named "cookbook-sources/sub/metadata.yaml" with:
"""
name: sub
version: 1.0.0
dependencies: {}
"""
Given a file named "Cheffile" with:
"""
path 'cookbook-sources'
cookbook 'main'
"""
Given I run `librarian-chef install --quiet`
Scenario: Showing al without a lockfile
Given I remove the file "Cheffile.lock"
When I run `librarian-chef show`
Then the exit status should be 1
Then the output should contain exactly:
"""
Be sure to install first!
"""
Scenario: Showing all
When I run `librarian-chef show`
Then the exit status should be 0
Then the output should contain exactly:
"""
main (1.0.0)
sub (1.0.0)
"""
Scenario: Showing one without dependencies
When I run `librarian-chef show sub`
Then the exit status should be 0
Then the output should contain exactly:
"""
sub (1.0.0)
source: cookbook-sources
"""
Scenario: Showing one with dependencies
When I run `librarian-chef show main`
Then the exit status should be 0
Then the output should contain exactly:
"""
main (1.0.0)
source: cookbook-sources
dependencies:
sub (= 1.0.0)
"""
Feature: cli/version
Scenario: Getting the version
When I run `librarian-chef version`
Then the exit status should be 0
And the output should contain "librarian-"
require 'aruba/cucumber'
Before do
slow_boot = false
slow_boot ||= RUBY_PLATFORM == "java"
slow_boot ||= defined?(::Rubinius)
@aruba_timeout_seconds = slow_boot ? 5 : 2
end
require 'librarian/version'
require 'librarian/environment'
module Librarian
extend self
def environment_class
self::Environment
end
def environment
@environment ||= environment_class.new
end
def version
VERSION
end
end
require "librarian/action/clean"
require "librarian/action/ensure"
require "librarian/action/install"
require "librarian/action/resolve"
require "librarian/action/update"
module Librarian
module Action
class Base
attr_accessor :environment
private :environment=
attr_accessor :options
private :options=
def initialize(environment, options = { })
self.environment = environment
self.options = options
end
private
def debug(*args, &block)
environment.logger.debug(*args, &block)
end
end
end
end
require "librarian/action/base"
module Librarian
module Action
class Clean < Base
def run
clean_cache_path
clean_install_path
end
private
def clean_cache_path
if cache_path.exist?
debug { "Deleting #{project_relative_path_to(cache_path)}" }
cache_path.rmtree
end
end
def clean_install_path
if install_path.exist?
install_path.children.each do |c|
debug { "Deleting #{project_relative_path_to(c)}" }
c.rmtree unless c.file?
end
end
end
def cache_path
environment.cache_path
end
def install_path
environment.install_path
end
def project_relative_path_to(path)
environment.project_relative_path_to(path)
end
end
end
end
require "librarian/error"
require "librarian/action/base"
module Librarian
module Action
class Ensure < Base
def run
raise Error, "Cannot find #{specfile_name}!" unless project_path
end
private
def specfile_name
environment.specfile_name
end
def project_path
environment.project_path
end
end
end
end
require "librarian/manifest_set"
require "librarian/spec_change_set"
require "librarian/action/base"
module Librarian
module Action
class Install < Base
def run
check_preconditions
perform_installation
end
private
def check_preconditions
check_specfile
check_lockfile
check_consistent
end
def check_specfile
raise Error, "#{specfile_name} missing!" unless specfile_path.exist?
end
def check_lockfile
raise Error, "#{lockfile_name} missing!" unless lockfile_path.exist?
end