[DRE-commits] [librarian-puppet] 10/97: Use librarian gem
Stig Sandbeck Mathisen
ssm at debian.org
Tue Mar 11 12:12:47 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository librarian-puppet.
commit 3fdb7185dcab4174b33daa2614b5c3d25076cc63
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date: Fri Apr 19 00:39:42 2013 +0200
Use librarian gem
Move librarian changes to monkey patches so we can use their latest gem
---
Rakefile | 17 +-
bin/librarian-puppet | 2 -
lib/librarian/puppet/extension.rb | 392 ++++++++++++++++++
librarian-puppet.gemspec | 5 +-
vendor/librarian/.rspec | 1 -
vendor/librarian/.travis.yml | 6 -
vendor/librarian/CHANGELOG.md | 185 ---------
vendor/librarian/Gemfile | 6 -
vendor/librarian/MIT-LICENSE | 20 -
vendor/librarian/README.md | 403 ------------------
vendor/librarian/Rakefile | 34 --
vendor/librarian/bin/librarian-chef | 7 -
vendor/librarian/bin/librarian-mock | 7 -
vendor/librarian/config/cucumber.yaml | 1 -
vendor/librarian/features/chef/cli/init.feature | 11 -
vendor/librarian/features/chef/cli/install.feature | 64 ---
vendor/librarian/features/chef/cli/show.feature | 77 ----
vendor/librarian/features/chef/cli/version.feature | 11 -
vendor/librarian/features/support/env.rb | 9 -
vendor/librarian/lib/librarian.rb | 19 -
vendor/librarian/lib/librarian/action.rb | 5 -
vendor/librarian/lib/librarian/action/base.rb | 24 --
vendor/librarian/lib/librarian/action/clean.rb | 44 --
vendor/librarian/lib/librarian/action/ensure.rb | 24 --
vendor/librarian/lib/librarian/action/install.rb | 99 -----
vendor/librarian/lib/librarian/action/resolve.rb | 81 ----
vendor/librarian/lib/librarian/action/update.rb | 78 ----
vendor/librarian/lib/librarian/chef.rb | 1 -
vendor/librarian/lib/librarian/chef/cli.rb | 48 ---
vendor/librarian/lib/librarian/chef/dsl.rb | 15 -
vendor/librarian/lib/librarian/chef/environment.rb | 27 --
vendor/librarian/lib/librarian/chef/extension.rb | 9 -
.../lib/librarian/chef/integration/knife.rb | 42 --
.../lib/librarian/chef/manifest_reader.rb | 59 ---
vendor/librarian/lib/librarian/chef/source.rb | 3 -
vendor/librarian/lib/librarian/chef/source/git.rb | 25 --
.../librarian/lib/librarian/chef/source/local.rb | 69 ----
vendor/librarian/lib/librarian/chef/source/path.rb | 12 -
vendor/librarian/lib/librarian/chef/source/site.rb | 452 ---------------------
.../lib/librarian/chef/templates/Cheffile | 15 -
vendor/librarian/lib/librarian/cli.rb | 205 ----------
.../lib/librarian/cli/manifest_presenter.rb | 79 ----
vendor/librarian/lib/librarian/config.rb | 7 -
vendor/librarian/lib/librarian/config/database.rb | 205 ----------
.../librarian/lib/librarian/config/file_source.rb | 47 ---
.../librarian/lib/librarian/config/hash_source.rb | 33 --
vendor/librarian/lib/librarian/config/source.rb | 149 -------
vendor/librarian/lib/librarian/dependency.rb | 91 -----
vendor/librarian/lib/librarian/dsl.rb | 108 -----
vendor/librarian/lib/librarian/dsl/receiver.rb | 48 ---
vendor/librarian/lib/librarian/dsl/target.rb | 172 --------
vendor/librarian/lib/librarian/environment.rb | 134 ------
vendor/librarian/lib/librarian/error.rb | 4 -
vendor/librarian/lib/librarian/helpers.rb | 13 -
vendor/librarian/lib/librarian/lockfile.rb | 29 --
.../librarian/lib/librarian/lockfile/compiler.rb | 66 ---
vendor/librarian/lib/librarian/lockfile/parser.rb | 100 -----
vendor/librarian/lib/librarian/logger.rb | 46 ---
vendor/librarian/lib/librarian/manifest.rb | 234 -----------
vendor/librarian/lib/librarian/manifest_set.rb | 153 -------
vendor/librarian/lib/librarian/mock.rb | 1 -
vendor/librarian/lib/librarian/mock/cli.rb | 19 -
vendor/librarian/lib/librarian/mock/dsl.rb | 15 -
vendor/librarian/lib/librarian/mock/environment.rb | 24 --
vendor/librarian/lib/librarian/mock/extension.rb | 9 -
vendor/librarian/lib/librarian/mock/source.rb | 1 -
vendor/librarian/lib/librarian/mock/source/mock.rb | 103 -----
.../lib/librarian/mock/source/mock/registry.rb | 83 ----
vendor/librarian/lib/librarian/resolution.rb | 44 --
vendor/librarian/lib/librarian/resolver.rb | 78 ----
.../lib/librarian/resolver/implementation.rb | 118 ------
vendor/librarian/lib/librarian/source.rb | 2 -
vendor/librarian/lib/librarian/source/git.rb | 156 -------
.../lib/librarian/source/git/repository.rb | 217 ----------
vendor/librarian/lib/librarian/source/local.rb | 61 ---
vendor/librarian/lib/librarian/source/path.rb | 80 ----
vendor/librarian/lib/librarian/spec.rb | 13 -
vendor/librarian/lib/librarian/spec_change_set.rb | 173 --------
vendor/librarian/lib/librarian/specfile.rb | 18 -
.../lib/librarian/support/abstract_method.rb | 21 -
vendor/librarian/lib/librarian/ui.rb | 64 ---
vendor/librarian/lib/librarian/version.rb | 3 -
vendor/librarian/librarian.gemspec | 34 --
.../spec/functional/chef/source/git_spec.rb | 432 --------------------
.../spec/functional/chef/source/site_spec.rb | 215 ----------
.../spec/functional/source/git/repository_spec.rb | 149 -------
vendor/librarian/spec/unit/action/base_spec.rb | 18 -
vendor/librarian/spec/unit/action/clean_spec.rb | 102 -----
vendor/librarian/spec/unit/action/ensure_spec.rb | 37 --
vendor/librarian/spec/unit/action/install_spec.rb | 111 -----
vendor/librarian/spec/unit/config/database_spec.rb | 319 ---------------
vendor/librarian/spec/unit/dependency_spec.rb | 36 --
vendor/librarian/spec/unit/dsl_spec.rb | 194 ---------
vendor/librarian/spec/unit/environment_spec.rb | 9 -
vendor/librarian/spec/unit/lockfile/parser_spec.rb | 162 --------
vendor/librarian/spec/unit/lockfile_spec.rb | 65 ---
vendor/librarian/spec/unit/manifest_set_spec.rb | 202 ---------
vendor/librarian/spec/unit/manifest_spec.rb | 36 --
.../librarian/spec/unit/manifest_version_spec.rb | 94 -----
.../librarian/spec/unit/mock/source/mock_spec.rb | 22 -
vendor/librarian/spec/unit/resolver_spec.rb | 192 ---------
vendor/librarian/spec/unit/source/git_spec.rb | 29 --
vendor/librarian/spec/unit/spec_change_set_spec.rb | 169 --------
103 files changed, 405 insertions(+), 7857 deletions(-)
diff --git a/Rakefile b/Rakefile
index 7111bba..0d4e598 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,9 +1,12 @@
-begin
- require 'cucumber/rake/task'
- Cucumber::Rake::Task.new(:features)
+require 'rake/clean'
+require 'cucumber/rake/task'
+require 'rspec/core/rake_task'
+require 'bundler/gem_tasks'
- task :default => :features
-rescue LoadError
-end
+CLEAN.include('pkg/', 'tmp/')
+CLOBBER.include('Gemfile.lock')
-require 'bundler/gem_tasks'
+RSpec::Core::RakeTask.new
+Cucumber::Rake::Task.new(:features)
+
+task :default => [:features]
diff --git a/bin/librarian-puppet b/bin/librarian-puppet
index 2c62145..8199149 100755
--- a/bin/librarian-puppet
+++ b/bin/librarian-puppet
@@ -1,9 +1,7 @@
#!/usr/bin/env ruby
lib = File.expand_path('../../lib', __FILE__)
-vendor = File.expand_path('../../vendor/librarian/lib', __FILE__)
$:.unshift(lib) unless $:.include?(lib)
-$:.unshift(vendor) unless $:.include?(vendor)
require 'librarian/puppet/cli'
Librarian::Puppet::Cli.bin!
diff --git a/lib/librarian/puppet/extension.rb b/lib/librarian/puppet/extension.rb
index 4e091b8..62e40ba 100644
--- a/lib/librarian/puppet/extension.rb
+++ b/lib/librarian/puppet/extension.rb
@@ -1,4 +1,5 @@
require 'librarian/puppet/environment'
+require 'librarian/action/base'
module Librarian
module Puppet
@@ -7,3 +8,394 @@ module Librarian
end
end
+
+module Librarian
+ class Dependency
+ class Requirement
+ def initialize(*args)
+ args = initialize_normalize_args(args)
+ self.backing = Gem::Requirement.create(puppet_to_gem_versions(args))
+ end
+
+ def puppet_to_gem_versions(args)
+ args.map do |arg|
+ case arg
+ when Array
+ arg.map { |v| Librarian::Puppet::Requirement.new(v).gem_requirement }
+ when String
+ Librarian::Puppet::Requirement.new(arg).gem_requirement
+ else
+ # Gem::Requirement, convert to string (ie. =1.0) so we can concat later
+ # Gem::Requirements can not be concatenated
+ arg.requirements.map{|x,y| "#{x}#{y}"}
+ end
+ end.flatten
+ end
+ end
+ end
+
+ # Fixes for librarian not yet released in their gem
+ module Mock
+ module Source
+ class Mock
+ alias :eql? :==
+
+ def hash
+ self.to_s.hash
+ end
+ end
+ end
+ end
+ module Source
+ class Git
+ alias :eql? :==
+
+ def hash
+ self.to_s.hash
+ end
+ end
+
+ class Path
+ alias :eql? :==
+
+ def hash
+ self.to_s.hash
+ end
+ end
+ end
+
+
+ module Action
+ class Install < Base
+
+ private
+
+ def create_install_path
+ install_path.rmtree if install_path.exist? && destructive?
+ install_path.mkpath
+ end
+
+ def destructive?
+ environment.config_db.local['destructive'] == 'true'
+ end
+ end
+ end
+
+ class ManifestSet
+ private
+
+ # Check if module doesn't exist and fail fast
+ def dependencies_of(names)
+ names = Array === names ? names.dup : names.to_a
+ assert_strings!(names)
+
+ deps = Set.new
+ until names.empty?
+ name = names.shift
+ next if deps.include?(name)
+
+ deps << name
+ raise(Error, "Unable to find module #{name}") if index[name].nil?
+ names.concat index[name].dependencies.map(&:name)
+ end
+ deps.to_a
+ end
+ end
+
+ class Manifest
+
+ class PreReleaseVersion
+
+ # Compares pre-release component ids using Semver 2.0.0 spec
+ def self.compare_components(this_id,other_id)
+ case # Strings have higher precedence than numbers
+ when (this_id.is_a?(Integer) and other_id.is_a?(String))
+ -1
+ when (this_id.is_a?(String) and other_id.is_a?(Integer))
+ 1
+ else
+ this_id <=> other_id
+ end
+ end
+
+ # Parses pre-release components `a.b.c` into an array ``[a,b,c]`
+ # Converts numeric components into +Integer+
+ def self.parse(prerelease)
+ if prerelease.nil?
+ []
+ else
+ prerelease.split('.').collect do |id|
+ id = Integer(id) if /^[0-9]+$/ =~ id
+ id
+ end
+ end
+ end
+
+ include Comparable
+
+ attr_reader :components
+
+ def initialize(prerelease)
+ @prerelease = prerelease
+ @components = PreReleaseVersion.parse(prerelease)
+ end
+
+ def to_s
+ @prerelease
+ end
+
+ def <=>(other)
+ # null-fill zip array to prevent loss of components
+ z = Array.new([components.length,other.components.length])
+
+ # Compare each component against the other
+ comp = z.zip(components,other.components).collect do |ids|
+ case # All components being equal, the version with more of them takes precedence
+ when ids[1].nil? # Self has less elements, other wins
+ -1
+ when ids[2].nil? # Other has less elements, self wins
+ 1
+ else
+ PreReleaseVersion.compare_components(ids[1],ids[2])
+ end
+ end
+ # Chose the first non-zero comparison or return 0
+ comp.delete_if {|c| c == 0}[0] || 0
+ end
+ end
+ class Version
+ @@SEMANTIC_VERSION_PATTERN = /^([0-9]+\.[0-9]+(?:\.[0-9]+)?)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
+ def self.parse_semver(version_string)
+ parsed = @@SEMANTIC_VERSION_PATTERN.match(version_string.strip)
+ if parsed
+ {
+ :full_version => parsed[0],
+ :version => parsed[1],
+ :prerelease => (PreReleaseVersion.new(parsed[2]) if parsed[2]),
+ :build => parsed[3]
+ }
+ end
+ end
+
+ attr_reader :prerelease
+
+ def initialize(*args)
+ args = initialize_normalize_args(args)
+ semver = Version.parse_semver(*args)
+ if semver
+ self.backing = Gem::Version.new(semver[:version])
+ @prerelease = semver[:prerelease]
+ @full_version = semver[:full_version]
+ else
+ self.backing = Gem::Version.new(*args)
+ @full_version = to_gem_version.to_s
+ end
+ end
+
+ def <=>(other)
+ cmp = to_gem_version <=> other.to_gem_version
+
+ # Should compare pre-release versions?
+ if cmp == 0 and not (prerelease.nil? and other.prerelease.nil?)
+ case # Versions without prerelease take precedence
+ when (prerelease.nil? and not other.prerelease.nil?)
+ 1
+ when (not prerelease.nil? and other.prerelease.nil?)
+ -1
+ else
+ prerelease <=> other.prerelease
+ end
+ else
+ cmp
+ end
+ end
+
+ def to_s
+ @full_version
+ end
+ end
+ end
+
+ # Fixes for librarian not yet released in their gem
+ module Mock
+ module Source
+ class Mock
+ alias :eql? :==
+
+ def hash
+ self.to_s.hash
+ end
+ end
+ end
+ end
+ module Source
+ class Git
+ alias :eql? :==
+
+ def hash
+ self.to_s.hash
+ end
+ end
+
+ class Path
+ alias :eql? :==
+
+ def hash
+ self.to_s.hash
+ end
+ end
+ end
+
+
+ module Action
+ class Install < Base
+
+ private
+
+ def create_install_path
+ install_path.rmtree if install_path.exist? && destructive?
+ install_path.mkpath
+ end
+
+ def destructive?
+ environment.config_db.local['destructive'] == 'true'
+ end
+ end
+ end
+
+ class ManifestSet
+ private
+
+ # Check if module doesn't exist and fail fast
+ def dependencies_of(names)
+ names = Array === names ? names.dup : names.to_a
+ assert_strings!(names)
+
+ deps = Set.new
+ until names.empty?
+ name = names.shift
+ next if deps.include?(name)
+
+ deps << name
+ raise(Error, "Unable to find module #{name}") if index[name].nil?
+ names.concat index[name].dependencies.map(&:name)
+ end
+ deps.to_a
+ end
+ end
+
+ class Manifest
+
+ class PreReleaseVersion
+
+ # Compares pre-release component ids using Semver 2.0.0 spec
+ def self.compare_components(this_id,other_id)
+ case # Strings have higher precedence than numbers
+ when (this_id.is_a?(Integer) and other_id.is_a?(String))
+ -1
+ when (this_id.is_a?(String) and other_id.is_a?(Integer))
+ 1
+ else
+ this_id <=> other_id
+ end
+ end
+
+ # Parses pre-release components `a.b.c` into an array ``[a,b,c]`
+ # Converts numeric components into +Integer+
+ def self.parse(prerelease)
+ if prerelease.nil?
+ []
+ else
+ prerelease.split('.').collect do |id|
+ id = Integer(id) if /^[0-9]+$/ =~ id
+ id
+ end
+ end
+ end
+
+ include Comparable
+
+ attr_reader :components
+
+ def initialize(prerelease)
+ @prerelease = prerelease
+ @components = PreReleaseVersion.parse(prerelease)
+ end
+
+ def to_s
+ @prerelease
+ end
+
+ def <=>(other)
+ # null-fill zip array to prevent loss of components
+ z = Array.new([components.length,other.components.length])
+
+ # Compare each component against the other
+ comp = z.zip(components,other.components).collect do |ids|
+ case # All components being equal, the version with more of them takes precedence
+ when ids[1].nil? # Self has less elements, other wins
+ -1
+ when ids[2].nil? # Other has less elements, self wins
+ 1
+ else
+ PreReleaseVersion.compare_components(ids[1],ids[2])
+ end
+ end
+ # Chose the first non-zero comparison or return 0
+ comp.delete_if {|c| c == 0}[0] || 0
+ end
+ end
+ class Version
+ @@SEMANTIC_VERSION_PATTERN = /^([0-9]+\.[0-9]+(?:\.[0-9]+)?)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
+ def self.parse_semver(version_string)
+ parsed = @@SEMANTIC_VERSION_PATTERN.match(version_string.strip)
+ if parsed
+ {
+ :full_version => parsed[0],
+ :version => parsed[1],
+ :prerelease => (PreReleaseVersion.new(parsed[2]) if parsed[2]),
+ :build => parsed[3]
+ }
+ end
+ end
+
+ attr_reader :prerelease
+
+ def initialize(*args)
+ args = initialize_normalize_args(args)
+ semver = Version.parse_semver(*args)
+ if semver
+ self.backing = Gem::Version.new(semver[:version])
+ @prerelease = semver[:prerelease]
+ @full_version = semver[:full_version]
+ else
+ self.backing = Gem::Version.new(*args)
+ @full_version = to_gem_version.to_s
+ end
+ end
+
+ def <=>(other)
+ cmp = to_gem_version <=> other.to_gem_version
+
+ # Should compare pre-release versions?
+ if cmp == 0 and not (prerelease.nil? and other.prerelease.nil?)
+ case # Versions without prerelease take precedence
+ when (prerelease.nil? and not other.prerelease.nil?)
+ 1
+ when (not prerelease.nil? and other.prerelease.nil?)
+ -1
+ else
+ prerelease <=> other.prerelease
+ end
+ else
+ cmp
+ end
+ end
+
+ def to_s
+ @full_version
+ end
+ end
+ end
+
+end
diff --git a/librarian-puppet.gemspec b/librarian-puppet.gemspec
index 57e0ea4..95c9a1c 100644
--- a/librarian-puppet.gemspec
+++ b/librarian-puppet.gemspec
@@ -18,14 +18,15 @@ Gem::Specification.new do |s|
'.gitignore',
'LICENSE',
'README.md',
- ] + Dir['{bin,lib,vendor}/**/*']
+ ] + Dir['{bin,lib}/**/*']
s.executables = ['librarian-puppet']
- s.add_dependency "thor", "~> 0.15"
+ s.add_dependency "librarian", ">=0.1.1"
s.add_dependency "json"
s.add_development_dependency "rake"
+ s.add_development_dependency "rspec"
s.add_development_dependency "cucumber"
s.add_development_dependency "aruba"
s.add_development_dependency "puppet"
diff --git a/vendor/librarian/.rspec b/vendor/librarian/.rspec
deleted file mode 100644
index 4e1e0d2..0000000
--- a/vendor/librarian/.rspec
+++ /dev/null
@@ -1 +0,0 @@
---color
diff --git a/vendor/librarian/.travis.yml b/vendor/librarian/.travis.yml
deleted file mode 100644
index 5726600..0000000
--- a/vendor/librarian/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: ruby
-rvm:
- - 1.8.7
- - 1.9.2
- - 1.9.3
- - rbx
diff --git a/vendor/librarian/CHANGELOG.md b/vendor/librarian/CHANGELOG.md
deleted file mode 100644
index a4d4a7f..0000000
--- a/vendor/librarian/CHANGELOG.md
+++ /dev/null
@@ -1,185 +0,0 @@
-# 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.
diff --git a/vendor/librarian/Gemfile b/vendor/librarian/Gemfile
deleted file mode 100644
index 362a8de..0000000
--- a/vendor/librarian/Gemfile
+++ /dev/null
@@ -1,6 +0,0 @@
-source "http://rubygems.org"
-
-# Specify your gem's dependencies in librarian.gemspec
-gemspec
-
-gem "fakefs", :require => "fakefs/safe"
diff --git a/vendor/librarian/MIT-LICENSE b/vendor/librarian/MIT-LICENSE
deleted file mode 100644
index f6a58a8..0000000
--- a/vendor/librarian/MIT-LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-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.
diff --git a/vendor/librarian/README.md b/vendor/librarian/README.md
deleted file mode 100644
index 0769439..0000000
--- a/vendor/librarian/README.md
+++ /dev/null
@@ -1,403 +0,0 @@
-Librarian [](http://travis-ci.org/applicationsonline/librarian)
-=========
-
-Librarian is a framework for writing bundlers, which are tools that resolve,
-fetch, install, and isolate a project's dependencies, in Ruby.
-
-Librarian ships with Librarian-Chef, which is a bundler for your Chef-based
-infrastructure repositories. In the future, Librarian-Chef will be a separate
-project.
-
-A bundler written with Librarian will expect you to provide a specfile listing
-your project's declared dependencies, including any version constraints and
-including the upstream sources for finding them. Librarian can resolve the spec,
-write a lockfile listing the full resolution, fetch the resolved dependencies,
-install them, and isolate them in your project.
-
-A bundler written with Librarian will be similar in kind to [Bundler](http://gembundler.com),
-the bundler for Ruby gems that many modern Rails applications use.
-
-Librarian-Chef
----------------
-
-Librarian-Chef is a tool that helps you manage the cookbooks that your chef-repo
-depends on. Here are some more details.
-
-Librarian-Chef is a bundler for infrastructure repositories using Chef. You can
-use Librarian-Chef to resolve your infrastructure's cookbook dependencies, fetch
-them, and install them into your infrastructure repository.
-
-Librarian-Chef can resolve and fetch third-party, publicly-released cookbooks,
-and install them into your infrastructure repository. It can also source
-cookbooks directly from their own source control repositories.
-
-Librarian-Chef can also deal with cookbooks you may actively be working on
-outside your infrastructure repository. For example, it can deal with cookbooks
-directly from their own private source control repositories, whether they are
-remote or local to your machine, and it can deal with cookbooks released to and
-hosted on a private cookbooks server.
-
-Librarian-Chef is not primarily intended for dealing with the cookbooks you are
-actively working on *within* your infrastructure repository. In such a case, you
-can still use Librarian-Chef, but it is likely unnecessary.
-
-Librarian-Chef *takes over* your `cookbooks/` directory and manages it for you
-based on your `Cheffile`. Your `Cheffile` becomes the authoritative source for
-the cookbooks your infrastructure repository depends on. You should not modify
-the contents of your `cookbooks/` directory when using Librarian-Chef. If you
-have cookbooks which are, rather than being separate projects, inherently part
-of your infrastructure repository, then they should go in a separate directory,
-like your `site-cookbooks/` directory, and you do not need to use Librarian-Chef
-to manage them.
-
-### The Cheffile
-
-Every infrastruture repository that uses Librarian-Chef will have a file named
-`Cheffile` in the root directory of that repository. The full specification for
-which third-party, publicly-released cookbooks your infrastructure repository
-depends will go here.
-
-Here's an example `Cheffile`:
-
- site "http://community.opscode.com/api/v1"
-
- cookbook "ntp"
- cookbook "timezone", "0.0.1"
-
- cookbook "rvm",
- :git => "https://github.com/fnichol/chef-rvm",
- :ref => "v0.7.1"
-
- cookbook "cloudera",
- :path => "vendor/cookbooks/cloudera-cookbook"
-
-Here's how it works:
-
-We start off by declaring the *default source* for this `Cheffile`.
-
- site "http://community.opscode.com/api/v1"
-
-This default source in this example is the Opscode Community Site API. This is
-most likely what you will want for your default source. However, you can
-certainly set up your own API-compatible HTTP endpoint if you want more control.
-
-Any time we declare a cookbook dependency without also declaring a source for
-that cookbook dependency, Librarian-Chef assumes we want it to look for that
-cookbook in the default source.
-
-Any time we declare a cookbook dependency that has subsidiary cookbook
-dependencies of its own, Librarian-Chef assumes we want it to look for the
-subsidiary cookbook dependencies in the default source.
-
- cookbook "ntp"
-
-Our infrastructure repository depends on the `ntp` cookbook from the default
-source. Any version of the `ntp` cookbook will fulfill our requirements.
-
- cookbook "timezone", "0.0.1"
-
-Our infrastructure repository depends on the `timezone` cookbook from the
-default source. But only version `0.0.1` of that cookbook will do.
-
- cookbook "rvm",
- :git => "https://github.com/fnichol/chef-rvm",
- :ref => "v0.7.1"
-
-Our infrastructure repository depends on the `rvm` cookbook, but not the one
-from the default source. Instead, the cookbook is to be fetched from the
-specified Git repository and from the specified Git tag only.
-
-When using a Git source, we do not have to use a `:ref =>`. If we do not,
-then Librarian-Chef will assume we meant the `master` branch. (In the future,
-this will be changed to whatever branch is the default branch according to
-the Git remote, which may not be `master`.)
-
-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-Chef to update the cookbook by fetching the
-most recent version of the cookbook from that same branch.
-
-The Git source also supports a `:path =>` option. If we use the path option,
-Librarian-Chef will navigate down into the Git repository and only use the
-specified subdirectory. Many people have the habit of having a single repository
-with many cookbooks in it. If we need a cookbook from such a repository, we can
-use the `:path =>` option here to help Librarian-Chef drill down and find the
-cookbook subdirectory.
-
- cookbook "cloudera",
- :path => "vendor/cookbooks/cloudera-cookbook"
-
-Our infrastructure repository depends on the `cloudera` cookbook, which we have
-downloaded and copied into our repository. In this example, `vendor/cookbooks/`
-is only for use with Librarian-Chef. This directory should not appear in the
-`.chef/knife.rb`. Librarian-Chef will, instead, copy this cookbook from where
-we vendored it in our repository into the `cookbooks/` directory for us.
-
-The `:path =>` source won't be confused with the `:git =>` source's `:path =>`
-option.
-
-### How to Use
-
-Install Librarian-Chef:
-
- $ gem install librarian
-
-Prepare your infrastructure repository:
-
- $ cd ~/path/to/chef-repo
- $ git rm -r cookbooks
- $ echo /cookbooks >> .gitignore
- $ echo /tmp >> .gitignore
-
-Librarian-Chef takes over your `cookbooks/` directory, and will always reinstall
-the cookbooks listed the `Cheffile.lock` into your `cookbooks/` directory. Hence
-you do not need your `cookbooks/` directory to be tracked in Git. If you
-nevertheless want your `cookbooks/` directory to be tracked in Git, simple don't
-`.gitignore` the directory.
-
-If you are manually tracking/vendoring outside cookbooks within the repository,
-put them in another directory such as `vendor/cookbooks/` and use the `:path =>`
-source when declaring these cookbooks in your `Cheffile`. Most people will
-typically not be manually tracking/vendoring outside cookbooks.
-
-Librarian-Chef uses your `tmp/` directory for tempfiles and caches. You do not
-need to track this directory in Git.
-
-Make a Cheffile:
-
- $ librarian-chef init
-
-This creates an empty `Cheffile` with the Opscode Community Site API as the
-default source.
-
-Add dependencies and their sources to the `Cheffile`:
-
- $ cat Cheffile
- site 'http://community.opscode.com/api/v1'
- cookbook 'ntp'
- cookbook 'timezone', '0.0.1'
- cookbook 'rvm',
- :git => 'https://github.com/fnichol/chef-rvm',
- :ref => 'v0.7.1'
- cookbook 'cloudera',
- :path => 'vendor/cookbooks/cloudera-cookbook'
-
-This is the same `Cheffile` we saw above.
-
- $ librarian-chef install [--clean] [--verbose]
-
-This command looks at each `cookbook` declaration and fetches the cookbook from
-the source specified, or from the default source if none is provided.
-
-Each cookbook is inspected, its dependencies are determined, and each dependency
-is also fetched. For example, if you declare `cookbook 'nagios'`, which
-depends on other cookbooks such as `'php'`, then those other cookbooks
-including `'php'` will be fetched. This goes all the way down the chain of
-dependencies.
-
-This command writes the complete resolution into `Cheffile.lock`.
-
-This command then copies all of the fetched cookbooks into your `cookbooks/`
-directory, overwriting whatever was there before. You can then use `knife
-cookbook upload -all` to upload the cookbooks to your chef-server, if you are
-using the client-server model.
-
-Check your `Cheffile` and `Cheffile.lock` into version control:
-
- $ git add Cheffile
- $ git add Cheffile.lock
- $ git commit -m "I want these particular versions of these particular cookbooks from these particular."
-
-Make sure you check your `Cheffile.lock` into version control. This will ensure
-dependencies do not need to be resolved every run, greatly reducing dependency
-resolution time.
-
-Get an overview of your `Cheffile.lock` with:
-
- $ librarian-chef show
-
-Inspect the details of specific resolved dependencies with:
-
- $ librarian-chef show NAME1 [NAME2, ...]
-
-Update your `Cheffile` with new/changed/removed constraints/sources/dependencies:
-
- $ cat Cheffile
- site 'http://community.opscode.com/api/v1'
- cookbook 'ntp'
- cookbook 'timezone', '0.0.1'
- cookbook 'rvm',
- :git => 'https://github.com/fnichol/chef-rvm',
- :ref => 'v0.7.1'
- cookbook 'monit' # new!
- $ git diff Cheffile
- $ librarian-chef install [--verbose]
- $ git diff Cheffile.lock
- $ git add Cheffile
- $ git add Cheffile.lock
- $ git commit -m "I also want these additional cookbooks."
-
-Find out which dependencies are outdated and may be updated:
-
- $ librarian-chef outdated [--verbose]
-
-Update the version of a dependency:
-
- $ librarian-chef update ntp timezone monit [--verbose]
- $ git diff Cheffile.lock
- $ git add Cheffile.lock
- $ git commit -m "I want updated versions of these cookbooks."
-
-Push your changes to the git repository:
-
- $ git push origin master
-
-Upload the cookbooks to your chef-server:
-
- $ knife cookbook upload --all
-
-### Configuration
-
-Configuration comes from three sources with the following highest-to-lowest
-precedence:
-
-* The local config (`./.librarian/chef/config`)
-* The environment
-* The global config (`~/.librarian/chef/config`)
-
-You can inspect the final configuration with:
-
- $ librarian-chef config
-
-You can find out where a particular key is set with:
-
- $ librarian-chef config KEY
-
-You can set a key at the global level with:
-
- $ librarian-chef config KEY VALUE --global
-
-And remove it with:
-
- $ librarian-chef config KEY --global --delete
-
-You can set a key at the local level with:
-
- $ librarian-chef config KEY VALUE --local
-
-And remove it with:
-
- $ librarian-chef config KEY --local --delete
-
-You cannot set or delete environment-level config keys with the CLI.
-
-Configuration set at either the global or local level will affect subsequent
-invocations of `librarian-chef`. Configurations set at the environment level are
-not saved and will not affect subsequent invocations of `librarian-chef`.
-
-You can pass a config at the environment level by taking the original config key
-and transforming it: replace hyphens (`-`) with underscores (`_`) and periods
-(`.`) with doubled underscores (`__`), uppercase, and finally prefix with
-`LIBRARIAN_CHEF_`. For example, to pass a config in the environment for the key
-`part-one.part-two`, set the environment variable
-`LIBRARIAN_CHEF_PART_ONE__PART_TWO`.
-
-Configuration affects how various commands operate.
-
-* The `path` config sets the cookbooks directory to install to. If a relative
- path, it is relative to the directory containing the `Cheffile`. The
- equivalent environment variable is `LIBRARIAN_CHEF_PATH`.
-
-* The `install.strip-dot-git` config causes the `.git/` directory to be stripped
- out when installing cookbooks from a git source. This must be set to exactly
- "1" to cause this behavior. The equivalent environment variable is
- `LIBRARIAN_CHEF_INSTALL__STRIP_DOT_GIT`.
-
-Configuration can be set by passing specific options to other commands.
-
-* The `path` config can be set at the local level by passing the `--path` option
- to the `install` command. It can be unset at the local level by passing the
- `--no-path` option to the `install` command. Note that if this is set at the
- environment or global level then, even if `--no-path` is given as an option,
- the environment or global config will be used.
-
-* The `install.strip-dot-git` config can be set at the local level by passing
- the `--strip-dot-git` option to the `install` command. It can be unset at the
- local level by passing the `--no-strip-dot-git` option.
-
-### Knife Integration
-
-You can integrate your `knife.rb` with Librarian-Chef.
-
-Stick the following in your `knife.rb`:
-
- require 'librarian/chef/integration/knife'
- cookbook_path Librarian::Chef.install_path,
- "/path/to/chef-repo/site-cookbooks"
-
-In the above, do *not* to include the path to your `cookbooks/` directory. If
-you have additional cookbooks directories in your chef-repo that you use for
-vendored cookbooks (where you use the `:path =>` source in your `Cheffile`),
-make sure *not* to include the paths to those additional cookbooks directories
-either.
-
-You still need to include your `site-cookbooks/` directory in the above list.
-
-What this integration does is whenever you use any `knife` command, it will:
-
-* Enforce that your `Cheffile` and `Cheffile.lock` are in sync
-* Install the resolved cookbooks to a temporary directory
-* Configure Knife to look in the temporary directory for the installed cookbooks
- and not in the normal `cookbooks/` directory.
-
-When you use this integration, any changes you make to anything in the
-`cookbooks/` directory will be ignored by Knife, because Knife won't look in
-that directory for your cookbooks.
-
-How to Contribute
------------------
-
-### Running the tests
-
- # Either
- $ rspec spec
- $ cucumber
-
- # Or
- $ rake
-
-You will probably need some way to isolate gems. Librarian provides a `Gemfile`,
-so if you want to use bundler, you can prepare the directory with the usual
-`bundle install` and run each command prefixed with the usual `bundle exec`, as:
-
- $ bundle install
- $ bundle exec rspec spec
- $ bundle exec cucumber
- $ bundle exec rake
-
-### Installing locally
-
- $ rake install
-
-You should typically not need to install locally, if you are simply trying to
-patch a bug and test the result on a test case. Instead of installing locally,
-you are probably better served by:
-
- $ cd $PATH_TO_INFRASTRUCTURE_REPO
- $ $PATH_TO_LIBRARIAN_CHECKOUT/bin/librarian-chef install [--verbose]
-
-### Reporting Issues
-
-Please include relevant `Cheffile` and `Cheffile.lock` files. Please run the
-`librarian-chef` commands in verbose mode by using the `--verbose` flag, and
-include the verbose output in the bug report as well.
-
-License
--------
-
-Written by Jay Feldblum.
-
-Copyright (c) 2011-2012 ApplicationsOnline, LLC.
-
-Released under the terms of the MIT License. For further information, please see
-the file `MIT-LICENSE`.
diff --git a/vendor/librarian/Rakefile b/vendor/librarian/Rakefile
deleted file mode 100644
index 6fd5bc1..0000000
--- a/vendor/librarian/Rakefile
+++ /dev/null
@@ -1,34 +0,0 @@
-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
diff --git a/vendor/librarian/bin/librarian-chef b/vendor/librarian/bin/librarian-chef
deleted file mode 100755
index 8c7084e..0000000
--- a/vendor/librarian/bin/librarian-chef
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env ruby
-
-lib = File.expand_path('../../lib', __FILE__)
-$:.unshift(lib) unless $:.include?(lib)
-
-require 'librarian/chef/cli'
-Librarian::Chef::Cli.bin!
diff --git a/vendor/librarian/bin/librarian-mock b/vendor/librarian/bin/librarian-mock
deleted file mode 100755
index 1824718..0000000
--- a/vendor/librarian/bin/librarian-mock
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env ruby
-
-lib = File.expand_path('../../lib', __FILE__)
-$:.unshift(lib) unless $:.include?(lib)
-
-require 'librarian/mock/cli'
-Librarian::Mock::Cli.bin!
diff --git a/vendor/librarian/config/cucumber.yaml b/vendor/librarian/config/cucumber.yaml
deleted file mode 100644
index 8e843ab..0000000
--- a/vendor/librarian/config/cucumber.yaml
+++ /dev/null
@@ -1 +0,0 @@
-default: --tags ~@wip --format progress
diff --git a/vendor/librarian/features/chef/cli/init.feature b/vendor/librarian/features/chef/cli/init.feature
deleted file mode 100644
index 623f50c..0000000
--- a/vendor/librarian/features/chef/cli/init.feature
+++ /dev/null
@@ -1,11 +0,0 @@
-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
-
-
-
diff --git a/vendor/librarian/features/chef/cli/install.feature b/vendor/librarian/features/chef/cli/install.feature
deleted file mode 100644
index 34a236c..0000000
--- a/vendor/librarian/features/chef/cli/install.feature
+++ /dev/null
@@ -1,64 +0,0 @@
-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: {}
- """
-
-
-
diff --git a/vendor/librarian/features/chef/cli/show.feature b/vendor/librarian/features/chef/cli/show.feature
deleted file mode 100644
index 67d571e..0000000
--- a/vendor/librarian/features/chef/cli/show.feature
+++ /dev/null
@@ -1,77 +0,0 @@
-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)
-
- """
-
-
-
diff --git a/vendor/librarian/features/chef/cli/version.feature b/vendor/librarian/features/chef/cli/version.feature
deleted file mode 100644
index a949595..0000000
--- a/vendor/librarian/features/chef/cli/version.feature
+++ /dev/null
@@ -1,11 +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-"
-
-
-
diff --git a/vendor/librarian/features/support/env.rb b/vendor/librarian/features/support/env.rb
deleted file mode 100644
index 6db1b3e..0000000
--- a/vendor/librarian/features/support/env.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-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
diff --git a/vendor/librarian/lib/librarian.rb b/vendor/librarian/lib/librarian.rb
deleted file mode 100644
index cdf2d4e..0000000
--- a/vendor/librarian/lib/librarian.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-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
diff --git a/vendor/librarian/lib/librarian/action.rb b/vendor/librarian/lib/librarian/action.rb
deleted file mode 100644
index 7b462de..0000000
--- a/vendor/librarian/lib/librarian/action.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require "librarian/action/clean"
-require "librarian/action/ensure"
-require "librarian/action/install"
-require "librarian/action/resolve"
-require "librarian/action/update"
diff --git a/vendor/librarian/lib/librarian/action/base.rb b/vendor/librarian/lib/librarian/action/base.rb
deleted file mode 100644
index c8935d0..0000000
--- a/vendor/librarian/lib/librarian/action/base.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-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
diff --git a/vendor/librarian/lib/librarian/action/clean.rb b/vendor/librarian/lib/librarian/action/clean.rb
deleted file mode 100644
index f558409..0000000
--- a/vendor/librarian/lib/librarian/action/clean.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-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
diff --git a/vendor/librarian/lib/librarian/action/ensure.rb b/vendor/librarian/lib/librarian/action/ensure.rb
deleted file mode 100644
index c973df2..0000000
--- a/vendor/librarian/lib/librarian/action/ensure.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-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
diff --git a/vendor/librarian/lib/librarian/action/install.rb b/vendor/librarian/lib/librarian/action/install.rb
deleted file mode 100644
index aa25eab..0000000
--- a/vendor/librarian/lib/librarian/action/install.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-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
-
- def check_consistent
- raise Error, "#{specfile_name} and #{lockfile_name} are out of sync!" unless spec_consistent_with_lock?
- end
-
- def perform_installation
- manifests = sorted_manifests
-
- create_install_path
- install_manifests(manifests)
- end
-
- def create_install_path
- install_path.rmtree if install_path.exist? && destructive?
- install_path.mkpath
- end
-
- def install_manifests(manifests)
- manifests.each do |manifest|
- manifest.install!
- end
- end
-
- def sorted_manifests
- ManifestSet.sort(lock.manifests)
- end
-
- def destructive?
- environment.config_db.local['destructive'] == 'true'
- end
-
- def specfile_name
- environment.specfile_name
- end
-
- def specfile_path
- environment.specfile_path
- end
-
- def lockfile_name
- environment.lockfile_name
- end
-
- def lockfile_path
- environment.lockfile_path
- end
-
- def spec
- environment.spec
- end
-
- def lock
- environment.lock
- end
-
- def spec_change_set(spec, lock)
- SpecChangeSet.new(environment, spec, lock)
- end
-
- def spec_consistent_with_lock?
- spec_change_set(spec, lock).same?
- end
-
- def install_path
- environment.install_path
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/action/resolve.rb b/vendor/librarian/lib/librarian/action/resolve.rb
deleted file mode 100644
index 189ef05..0000000
--- a/vendor/librarian/lib/librarian/action/resolve.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-require "librarian/error"
-require "librarian/resolver"
-require "librarian/spec_change_set"
-require "librarian/action/base"
-
-module Librarian
- module Action
- class Resolve < Base
-
- def run
- if force? || !lockfile_path.exist?
- spec = specfile.read
- manifests = []
- else
- lock = lockfile.read
- spec = specfile.read(lock.sources)
- changes = spec_change_set(spec, lock)
- if changes.same?
- debug { "The specfile is unchanged: nothing to do." }
- return
- end
- manifests = changes.analyze
- end
-
- resolution = resolver.resolve(spec, manifests)
- unless resolution.correct?
- raise Error, "Could not resolve the dependencies."
- else
- lockfile_text = lockfile.save(resolution)
- debug { "Bouncing #{lockfile_name}" }
- bounced_lockfile_text = lockfile.save(lockfile.load(lockfile_text))
- unless bounced_lockfile_text == lockfile_text
- debug { "lockfile_text: \n#{lockfile_text}"}
- debug { "bounced_lockfile_text: \n#{bounced_lockfile_text}"}
- raise Error, "Cannot bounce #{lockfile_name}!"
- end
- lockfile_path.open('wb') { |f| f.write(lockfile_text) }
- end
- end
-
- private
-
- def force?
- options[:force]
- end
-
- def specfile_name
- environment.specfile_name
- end
-
- def lockfile_name
- environment.lockfile_name
- end
-
- def specfile_path
- environment.specfile_path
- end
-
- def lockfile_path
- environment.lockfile_path
- end
-
- def specfile
- environment.specfile
- end
-
- def lockfile
- environment.lockfile
- end
-
- def resolver
- Resolver.new(environment)
- end
-
- def spec_change_set(spec, lock)
- SpecChangeSet.new(environment, spec, lock)
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/action/update.rb b/vendor/librarian/lib/librarian/action/update.rb
deleted file mode 100644
index 3894adb..0000000
--- a/vendor/librarian/lib/librarian/action/update.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-require "librarian/error"
-require "librarian/manifest_set"
-require "librarian/resolver"
-require "librarian/spec_change_set"
-require "librarian/action/base"
-
-module Librarian
- module Action
- class Update < Base
-
- def run
- unless lockfile_path.exist?
- raise Error, "Lockfile missing!"
- end
- previous_resolution = lockfile.load(lockfile_path.read)
- spec = specfile.read(previous_resolution.sources)
- changes = spec_change_set(spec, previous_resolution)
- manifests = changes.same? ? previous_resolution.manifests : changes.analyze
- partial_manifests = ManifestSet.deep_strip(manifests, dependency_names)
- unpinnable_sources = previous_resolution.sources - partial_manifests.map(&:source)
- unpinnable_sources.each(&:unpin!)
- resolution = resolver.resolve(spec, partial_manifests)
- unless resolution.correct?
- raise Error, "Could not resolve the dependencies."
- else
- lockfile_text = lockfile.save(resolution)
- debug { "Bouncing #{lockfile_name}" }
- bounced_lockfile_text = lockfile.save(lockfile.load(lockfile_text))
- unless bounced_lockfile_text == lockfile_text
- debug { "lockfile_text: \n#{lockfile_text}"}
- debug { "bounced_lockfile_text: \n#{bounced_lockfile_text}"}
- raise Error, "Cannot bounce #{lockfile_name}!"
- end
- lockfile_path.open('wb') { |f| f.write(lockfile_text) }
- end
- end
-
- private
-
- def dependency_names
- options[:names]
- end
-
- def specfile_name
- environment.specfile_name
- end
-
- def lockfile_name
- environment.lockfile_name
- end
-
- def specfile_path
- environment.specfile_path
- end
-
- def lockfile_path
- environment.lockfile_path
- end
-
- def specfile
- environment.specfile
- end
-
- def lockfile
- environment.lockfile
- end
-
- def resolver
- Resolver.new(environment)
- end
-
- def spec_change_set(spec, lock)
- SpecChangeSet.new(environment, spec, lock)
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef.rb b/vendor/librarian/lib/librarian/chef.rb
deleted file mode 100644
index ec20e1a..0000000
--- a/vendor/librarian/lib/librarian/chef.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'librarian/chef/extension'
diff --git a/vendor/librarian/lib/librarian/chef/cli.rb b/vendor/librarian/lib/librarian/chef/cli.rb
deleted file mode 100644
index 04a9882..0000000
--- a/vendor/librarian/lib/librarian/chef/cli.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-require 'librarian/helpers'
-
-require 'librarian/cli'
-require 'librarian/chef'
-
-module Librarian
- module Chef
- class Cli < Librarian::Cli
-
- module Particularity
- def root_module
- Chef
- end
- end
-
- include Particularity
- extend Particularity
-
- source_root Pathname.new(__FILE__).dirname.join("templates")
-
- def init
- copy_file environment.specfile_name
- end
-
- desc "install", "Resolves and installs all of the dependencies you specify."
- option "quiet", :type => :boolean, :default => false
- option "verbose", :type => :boolean, :default => false
- option "line-numbers", :type => :boolean, :default => false
- option "clean", :type => :boolean, :default => false
- option "strip-dot-git", :type => :boolean
- option "path", :type => :string
- def install
- ensure!
- clean! if options["clean"]
- if options.include?("strip-dot-git")
- strip_dot_git_val = options["strip-dot-git"] ? "1" : nil
- environment.config_db.local["install.strip-dot-git"] = strip_dot_git_val
- end
- if options.include?("path")
- environment.config_db.local["path"] = options["path"]
- end
- resolve!
- install!
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/dsl.rb b/vendor/librarian/lib/librarian/chef/dsl.rb
deleted file mode 100644
index 2b798dd..0000000
--- a/vendor/librarian/lib/librarian/chef/dsl.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'librarian/dsl'
-require 'librarian/chef/source'
-
-module Librarian
- module Chef
- class Dsl < Librarian::Dsl
-
- dependency :cookbook
-
- source :site => Source::Site
- source :git => Source::Git
- source :path => Source::Path
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/environment.rb b/vendor/librarian/lib/librarian/chef/environment.rb
deleted file mode 100644
index 8081612..0000000
--- a/vendor/librarian/lib/librarian/chef/environment.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require "librarian/environment"
-require "librarian/chef/dsl"
-require "librarian/chef/source"
-
-module Librarian
- module Chef
- class Environment < Environment
-
- def adapter_name
- "chef"
- end
-
- def install_path
- part = config_db["path"] || "cookbooks"
- project_path.join(part)
- end
-
- def config_keys
- super + %w[
- install.strip-dot-git
- path
- ]
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/extension.rb b/vendor/librarian/lib/librarian/chef/extension.rb
deleted file mode 100644
index 9c02e22..0000000
--- a/vendor/librarian/lib/librarian/chef/extension.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'librarian/chef/environment'
-
-module Librarian
- module Chef
- extend self
- extend Librarian
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/integration/knife.rb b/vendor/librarian/lib/librarian/chef/integration/knife.rb
deleted file mode 100644
index 84b54a3..0000000
--- a/vendor/librarian/lib/librarian/chef/integration/knife.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'pathname'
-require 'securerandom'
-require 'highline'
-
-require 'librarian'
-require 'librarian/action/install'
-require 'librarian/chef'
-
-module Librarian
- module Chef
-
- class Environment
- def install_path
- @install_path ||= begin
- has_home = ENV["HOME"] && File.directory?(ENV["HOME"])
- tmp_dir = Pathname.new(has_home ? "~/.librarian/tmp" : "/tmp/librarian").expand_path
- enclosing = tmp_dir.join("chef/integration/knife/install")
- enclosing.mkpath unless enclosing.exist?
- dir = enclosing.join(SecureRandom.hex(16))
- dir.mkpath
- at_exit { dir.rmtree }
- dir
- end
- end
- end
-
- def install_path
- environment.install_path
- end
-
- hl = HighLine.new
-
- begin
- Action::Install.new(environment).run
- rescue Error => e
- message = hl.color(e.message, HighLine::RED)
- hl.say(message)
- Process.exit!(1)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/manifest_reader.rb b/vendor/librarian/lib/librarian/chef/manifest_reader.rb
deleted file mode 100644
index 2bf65c4..0000000
--- a/vendor/librarian/lib/librarian/chef/manifest_reader.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-require 'json'
-require 'yaml'
-
-require 'librarian/manifest'
-
-module Librarian
- module Chef
- module ManifestReader
- extend self
-
- MANIFESTS = %w(metadata.json metadata.yml metadata.yaml metadata.rb)
-
- def manifest_path(path)
- MANIFESTS.map{|s| path.join(s)}.find{|s| s.exist?}
- end
-
- def read_manifest(name, manifest_path)
- case manifest_path.extname
- when ".json" then JSON.parse(binread(manifest_path))
- when ".yml", ".yaml" then YAML.load(binread(manifest_path))
- when ".rb" then compile_manifest(name, manifest_path.dirname)
- end
- end
-
- def compile_manifest(name, path)
- # Inefficient, if there are many cookbooks with uncompiled metadata.
- require 'chef/json_compat'
- require 'chef/cookbook/metadata'
- md = ::Chef::Cookbook::Metadata.new
- md.name(name)
- md.from_file(path.join('metadata.rb').to_s)
- {"name" => md.name, "version" => md.version, "dependencies" => md.dependencies}
- end
-
- def manifest?(name, path)
- path = Pathname.new(path)
- !!manifest_path(path)
- end
-
- def check_manifest(name, manifest_path)
- manifest = read_manifest(name, manifest_path)
- manifest["name"] == name
- end
-
- private
-
- if IO.respond_to?(:binread)
- def binread(path)
- path.binread
- end
- else
- def binread(path)
- path.read
- end
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/source.rb b/vendor/librarian/lib/librarian/chef/source.rb
deleted file mode 100644
index e212b26..0000000
--- a/vendor/librarian/lib/librarian/chef/source.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'librarian/chef/source/path'
-require 'librarian/chef/source/git'
-require 'librarian/chef/source/site'
diff --git a/vendor/librarian/lib/librarian/chef/source/git.rb b/vendor/librarian/lib/librarian/chef/source/git.rb
deleted file mode 100644
index 1eedecc..0000000
--- a/vendor/librarian/lib/librarian/chef/source/git.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'librarian/source/git'
-require 'librarian/chef/source/local'
-
-module Librarian
- module Chef
- module Source
- class Git < Librarian::Source::Git
- include Local
-
- private
-
- def install_perform_step_copy!(found_path, install_path)
- debug { "Copying #{relative_path_to(found_path)} to #{relative_path_to(install_path)}" }
- FileUtils.cp_r(found_path, install_path)
-
- if environment.config_db["install.strip-dot-git"] == "1"
- dot_git = install_path.join(".git")
- dot_git.rmtree if dot_git.directory?
- end
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/source/local.rb b/vendor/librarian/lib/librarian/chef/source/local.rb
deleted file mode 100644
index 830bf1f..0000000
--- a/vendor/librarian/lib/librarian/chef/source/local.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'librarian/chef/manifest_reader'
-
-module Librarian
- module Chef
- module Source
- module Local
-
- def install!(manifest)
- manifest.source == self or raise ArgumentError
-
- info { "Installing #{manifest.name} (#{manifest.version})" }
-
- debug { "Installing #{manifest}" }
-
- name, version = manifest.name, manifest.version
- found_path = found_path(name)
-
- install_path = environment.install_path.join(name)
- if install_path.exist?
- debug { "Deleting #{relative_path_to(install_path)}" }
- install_path.rmtree
- end
-
- install_perform_step_copy!(found_path, install_path)
- end
-
- def fetch_version(name, extra)
- manifest_data(name)["version"]
- end
-
- def fetch_dependencies(name, version, extra)
- manifest_data(name)["dependencies"]
- end
-
- private
-
- def install_perform_step_copy!(found_path, install_path)
- debug { "Copying #{relative_path_to(found_path)} to #{relative_path_to(install_path)}" }
- FileUtils.cp_r(found_path, install_path)
- end
-
- def manifest_data(name)
- @manifest_data ||= { }
- @manifest_data[name] ||= fetch_manifest_data(name)
- end
-
- def fetch_manifest_data(name)
- expect_manifest!(name)
-
- found_path = found_path(name)
- manifest_path = ManifestReader.manifest_path(found_path)
- ManifestReader.read_manifest(name, manifest_path)
- end
-
- def manifest?(name, path)
- ManifestReader.manifest?(name, path)
- end
-
- def expect_manifest!(name)
- found_path = found_path(name)
- return if found_path && ManifestReader.manifest_path(found_path)
-
- raise Error, "No metadata file found for #{name} from #{self}! If this should be a cookbook, you might consider contributing a metadata file upstream or forking the cookbook to add your own metadata file."
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/source/path.rb b/vendor/librarian/lib/librarian/chef/source/path.rb
deleted file mode 100644
index 27e00cf..0000000
--- a/vendor/librarian/lib/librarian/chef/source/path.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'librarian/source/path'
-require 'librarian/chef/source/local'
-
-module Librarian
- module Chef
- module Source
- class Path < Librarian::Source::Path
- include Local
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/source/site.rb b/vendor/librarian/lib/librarian/chef/source/site.rb
deleted file mode 100644
index 5f7d017..0000000
--- a/vendor/librarian/lib/librarian/chef/source/site.rb
+++ /dev/null
@@ -1,452 +0,0 @@
-require 'fileutils'
-require 'pathname'
-require 'uri'
-require 'net/http'
-require 'json'
-require 'digest'
-require 'zlib'
-require 'securerandom'
-require 'archive/tar/minitar'
-
-require 'librarian/chef/manifest_reader'
-
-module Librarian
- module Chef
- module Source
- class Site
-
- class Line
-
- attr_accessor :source, :name
- private :source=, :name=
-
- def initialize(source, name)
- self.source = source
- self.name = name
- end
-
- def install_version!(version, install_path)
- cache_version_unpacked! version
-
- if install_path.exist?
- debug { "Deleting #{relative_path_to(install_path)}" }
- install_path.rmtree
- end
-
- unpacked_path = version_unpacked_cache_path(version)
-
- debug { "Copying #{relative_path_to(unpacked_path)} to #{relative_path_to(install_path)}" }
- FileUtils.cp_r(unpacked_path, install_path)
- end
-
- def manifests
- version_uris.map do |version_uri|
- Manifest.new(source, name, version_uri)
- end
- end
-
- def to_version(version_uri)
- version_uri_metadata(version_uri)["version"]
- end
-
- def version_dependencies(version)
- version_manifest(version)["dependencies"]
- end
-
- private
-
- attr_accessor :metadata_cached
- alias metadata_cached? metadata_cached
-
- def environment
- source.environment
- end
-
- def uri
- @uri ||= URI.parse("#{source.uri}/cookbooks/#{name}")
- end
-
- def version_uris
- metadata["versions"]
- end
-
- def version_metadata(version)
- version_uri = to_version_uri(version)
- version_uri_metadata(version_uri)
- end
-
- def version_uri_metadata(version_uri)
- @version_uri_metadata ||= { }
- @version_uri_metadata[version_uri.to_s] ||= begin
- cache_version_uri_metadata! version_uri
- parse_local_json(version_uri_metadata_cache_path(version_uri))
- end
- end
-
- def version_manifest(version)
- version_uri = to_version_uri(version)
- version_uri_manifest(version_uri)
- end
-
- def version_uri_manifest(version_uri)
- @version_uri_manifest ||= { }
- @version_uri_manifest[version_uri.to_s] ||= begin
- cache_version_uri_unpacked! version_uri
- unpacked_path = version_uri_unpacked_cache_path(version_uri)
- manifest_path = ManifestReader.manifest_path(unpacked_path)
- ManifestReader.read_manifest(name, manifest_path)
- end
- end
-
- def metadata
- @metadata ||= begin
- cache_metadata!
- parse_local_json(metadata_cache_path)
- end
- end
-
- def to_version_uri(version)
- @to_version_uri ||= { }
- @to_version_uri[version.to_s] ||= begin
- cache_version! version
- version_cache_path(version).read
- end
- end
-
- def metadata_cached!
- self.metadata_cached = true
- end
-
- def cache_path
- @cache_path ||= source.cache_path.join(name)
- end
-
- def metadata_cache_path
- @metadata_cache_path ||= cache_path.join("metadata.json")
- end
-
- def version_cache_path(version)
- @version_cache_path ||= { }
- @version_cache_path[version.to_s] ||= begin
- cache_path.join("version").join(version.to_s)
- end
- end
-
- def version_uri_cache_path(version_uri)
- @version_uri_cache_path ||= { }
- @version_uri_cache_path[version_uri.to_s] ||= begin
- cache_path.join("version-uri").join(hexdigest(version_uri))
- end
- end
-
- def version_metadata_cache_path(version)
- version_uri = to_version_uri(version)
- version_uri_metadata_cache_path(version_uri)
- end
-
- def version_uri_metadata_cache_path(version_uri)
- @version_uri_metadata_cache_path ||= { }
- @version_uri_metadata_cache_path[version_uri.to_s] ||= begin
- version_uri_cache_path(version_uri).join("metadata.json")
- end
- end
-
- def version_package_cache_path(version)
- version_uri = to_version_uri(version)
- version_uri_package_cache_path(version_uri)
- end
-
- def version_uri_package_cache_path(version_uri)
- @version_uri_package_cache_path ||= { }
- @version_uri_package_cache_path[version_uri.to_s] ||= begin
- version_uri_cache_path(version_uri).join("package.tar.gz")
- end
- end
-
- def version_unpacked_cache_path(version)
- version_uri = to_version_uri(version)
- version_uri_unpacked_cache_path(version_uri)
- end
-
- def version_uri_unpacked_cache_path(version_uri)
- @version_uri_unpacked_cache_path ||= { }
- @version_uri_unpacked_cache_path[version_uri.to_s] ||= begin
- version_uri_cache_path(version_uri).join("package")
- end
- end
-
- def cache_metadata!
- metadata_cached? and return or metadata_cached!
- cache_remote_json! metadata_cache_path, uri
- end
-
- def cache_version_uri_metadata!(version_uri)
- path = version_uri_metadata_cache_path(version_uri)
- path.file? and return
-
- cache_remote_json! path, version_uri
- end
-
- def cache_version!(version)
- path = version_cache_path(version)
- path.file? and return
-
- version_uris.each do |version_uri|
- m = version_uri_metadata(version_uri)
- v = m["version"]
- if version.to_s == v
- write! path, version_uri.to_s
- break
- end
- end
- end
-
- def cache_version_package!(version)
- version_uri = to_version_uri(version)
- cache_version_uri_package! version_uri
- end
-
- def cache_version_uri_package!(version_uri)
- path = version_uri_package_cache_path(version_uri)
- path.file? and return
-
- file_uri = version_uri_metadata(version_uri)["file"]
- cache_remote_object! path, file_uri
- end
-
- def cache_version_unpacked!(version)
- version_uri = to_version_uri(version)
- cache_version_uri_unpacked! version_uri
- end
-
- def cache_version_uri_unpacked!(version_uri)
- cache_version_uri_package!(version_uri)
-
- path = version_uri_unpacked_cache_path(version_uri)
- path.directory? and return
-
- package_path = version_uri_package_cache_path(version_uri)
- unpacked_path = version_uri_unpacked_cache_path(version_uri)
-
- unpack_package! unpacked_path, package_path
- end
-
- def cache_remote_json!(path, uri)
- path = Pathname(path)
- uri = to_uri(uri)
-
- path.dirname.mkpath unless path.dirname.directory?
-
- debug { "Caching #{uri} to #{path}" }
-
- http = Net::HTTP.new(uri.host, uri.port)
- request = Net::HTTP::Get.new(uri.path)
- response = http.start{|http| http.request(request)}
- unless Net::HTTPSuccess === response
- raise Error, "Could not get #{uri} because #{response.code} #{response.message}!"
- end
- json = response.body
- JSON.parse(json) # verify that it's really JSON.
- write! path, json
- end
-
- def cache_remote_object!(path, uri)
- path = Pathname(path)
- uri = to_uri(uri)
-
- path.dirname.mkpath unless path.dirname.directory?
-
- debug { "Caching #{uri} to #{path}" }
-
- http = Net::HTTP.new(uri.host, uri.port)
- request = Net::HTTP::Get.new(uri.path)
- response = http.start{|http| http.request(request)}
- unless Net::HTTPSuccess === response
- raise Error, "Could not get #{uri} because #{response.code} #{response.message}!"
- end
- write! path, response.body
- end
-
- def write!(path, bytes)
- path.dirname.mkpath
- path.open("wb"){|f| f.write(bytes)}
- end
-
- def unpack_package!(path, source)
- path = Pathname(path)
- source = Pathname(source)
-
- temp = environment.scratch_path.join(SecureRandom.hex(16))
- temp.mkpath
-
- debug { "Unpacking #{relative_path_to(source)} to #{relative_path_to(temp)}" }
- Zlib::GzipReader.open(source) do |input|
- Archive::Tar::Minitar.unpack(input, temp.to_s)
- end
-
- # Cookbook files, as pulled from Opscode Community Site API, are
- # embedded in a subdirectory of the tarball, and the subdirectory's
- # name is equal to the name of the cookbook.
- subtemp = temp.join(name)
- debug { "Moving #{relative_path_to(subtemp)} to #{relative_path_to(path)}" }
- FileUtils.mv(subtemp, path)
- ensure
- temp.rmtree if temp && temp.exist?
- end
-
- def parse_local_json(path)
- JSON.parse(path.read)
- end
-
- def hexdigest(bytes)
- Digest::MD5.hexdigest(bytes)
- end
-
- def to_uri(uri)
- uri = URI(uri) unless URI === uri
- uri
- end
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- def relative_path_to(path)
- environment.logger.relative_path_to(path)
- end
-
- end
-
- class << self
-
- LOCK_NAME = 'SITE'
-
- def lock_name
- LOCK_NAME
- end
-
- def from_lock_options(environment, options)
- new(environment, options[:remote], options.reject{|k, v| k == :remote})
- end
-
- def from_spec_args(environment, uri, options)
- recognized_options = []
- unrecognized_options = options.keys - recognized_options
- unrecognized_options.empty? or raise Error, "unrecognized options: #{unrecognized_options.join(", ")}"
-
- new(environment, uri, options)
- end
-
- end
-
- attr_accessor :environment
- private :environment=
- attr_reader :uri
-
- attr_accessor :_metadata_cache
- private :_metadata_cache, :_metadata_cache=
-
- def initialize(environment, uri, options = {})
- self.environment = environment
- @uri = uri
- @cache_path = nil
- self._metadata_cache = { }
- end
-
- def to_s
- uri
- end
-
- def ==(other)
- other &&
- self.class == other.class &&
- self.uri == other.uri
- end
-
- alias :eql? :==
-
- def hash
- self.to_s.hash
- end
-
- def to_spec_args
- [uri, {}]
- end
-
- def to_lock_options
- {:remote => uri}
- end
-
- def pinned?
- false
- end
-
- def unpin!
- end
-
- def install!(manifest)
- manifest.source == self or raise ArgumentError
-
- name = manifest.name
- version = manifest.version
- install_path = install_path(name)
- line = line(name)
-
- info { "Installing #{manifest.name} (#{manifest.version})" }
-
- debug { "Installing #{manifest}" }
-
- line.install_version! version, install_path
- end
-
- # NOTE:
- # Assumes the Opscode Site API responds with versions in reverse sorted order
- def manifests(name)
- line(name).manifests
- end
-
- def manifest(name, version, dependencies)
- manifest = Manifest.new(self, name)
- manifest.version = version
- manifest.dependencies = dependencies
- manifest
- end
-
- def cache_path
- @cache_path ||= begin
- dir = Digest::MD5.hexdigest(uri)
- environment.cache_path.join("source/chef/site/#{dir}")
- end
- end
-
- def install_path(name)
- environment.install_path.join(name)
- end
-
- def fetch_version(name, version_uri)
- line(name).to_version(version_uri)
- end
-
- def fetch_dependencies(name, version, version_uri)
- line(name).version_dependencies(version).map{|k, v| Dependency.new(k, v, nil)}
- end
-
- private
-
- def line(name)
- @line ||= { }
- @line[name] ||= Line.new(self, name)
- end
-
- def info(*args, &block)
- environment.logger.info(*args, &block)
- end
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/chef/templates/Cheffile b/vendor/librarian/lib/librarian/chef/templates/Cheffile
deleted file mode 100644
index 2f0852e..0000000
--- a/vendor/librarian/lib/librarian/chef/templates/Cheffile
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env ruby
-#^syntax detection
-
-site 'http://community.opscode.com/api/v1'
-
-# cookbook 'chef-client'
-
-# cookbook 'apache2', '>= 1.0.0'
-
-# cookbook 'rvm',
-# :git => 'https://github.com/fnichol/chef-rvm'
-
-# cookbook 'postgresql',
-# :git => 'https://github.com/findsyou/cookbooks',
-# :ref => 'postgresql-improvements'
diff --git a/vendor/librarian/lib/librarian/cli.rb b/vendor/librarian/lib/librarian/cli.rb
deleted file mode 100644
index 4797436..0000000
--- a/vendor/librarian/lib/librarian/cli.rb
+++ /dev/null
@@ -1,205 +0,0 @@
-require 'thor'
-require 'thor/actions'
-
-require 'librarian'
-require 'librarian/error'
-require 'librarian/action'
-require "librarian/ui"
-
-module Librarian
- class Cli < Thor
-
- autoload :ManifestPresenter, "librarian/cli/manifest_presenter"
-
- include Thor::Actions
-
- module Particularity
- def root_module
- nil
- end
- end
-
- include Particularity
- extend Particularity
-
- class << self
- def bin!
- begin
- environment = root_module.environment
- start
- rescue Librarian::Error => e
- environment.ui.error e.message
- environment.ui.debug e.backtrace.join("\n")
- exit (e.respond_to?(:status_code) ? e.status_code : 1)
- rescue Interrupt => e
- environment.ui.error "\nQuitting..."
- exit 1
- end
- end
- end
-
- def initialize(*)
- super
- the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
- environment.ui = UI::Shell.new(the_shell)
- environment.ui.be_quiet! if options["quiet"]
- environment.ui.debug! if options["verbose"]
- environment.ui.debug_line_numbers! if options["verbose"] && options["line-numbers"]
-
- write_debug_header
- end
-
- desc "version", "Displays the version."
- def version
- say "librarian-#{root_module.version}"
- end
-
- desc "config", "Show or edit the config."
- option "verbose", :type => :boolean, :default => false
- option "line-numbers", :type => :boolean, :default => false
- option "global", :type => :boolean, :default => false
- option "local", :type => :boolean, :default => false
- option "delete", :type => :boolean, :default => false
- def config(key = nil, value = nil)
- if key
- raise Error, "cannot set both value and delete" if value && options["delete"]
- if options["delete"]
- raise Error, "must set either global or local" unless options["global"] ^ options["local"]
- scope = options["global"] ? :global : options["local"] ? :local : nil
- environment.config_db[key, scope] = nil
- elsif value
- raise Error, "must set either global or local" unless options["global"] ^ options["local"]
- scope = options["global"] ? :global : options["local"] ? :local : nil
- environment.config_db[key, scope] = value
- else
- raise Error, "cannot set both global and local" if options["global"] && options["local"]
- scope = options["global"] ? :global : options["local"] ? :local : nil
- if value = environment.config_db[key, scope]
- prefix = scope ? "#{key} (#{scope})" : key
- say "#{prefix}: #{value}"
- end
- end
- else
- environment.config_db.keys.each do |key|
- say "#{key}: #{environment.config_db[key]}"
- end
- end
- end
-
- desc "clean", "Cleans out the cache and install paths."
- option "verbose", :type => :boolean, :default => false
- option "line-numbers", :type => :boolean, :default => false
- def clean
- ensure!
- clean!
- end
-
- desc "update", "Updates and installs the dependencies you specify."
- option "verbose", :type => :boolean, :default => false
- option "line-numbers", :type => :boolean, :default => false
- def update(*names)
- ensure!
- if names.empty?
- resolve!(:force => true)
- else
- update!(:names => names)
- end
- install!
- end
-
- desc "outdated", "Lists outdated dependencies."
- option "verbose", :type => :boolean, :default => false
- option "line-numbers", :type => :boolean, :default => false
- def outdated
- ensure!
- resolution = environment.lock
- resolution.manifests.sort_by(&:name).each do |manifest|
- source = manifest.source
- source_manifest = source.manifests(manifest.name).first
- next if manifest.version == source_manifest.version
- say "#{manifest.name} (#{manifest.version} -> #{source_manifest.version})"
- end
- end
-
- desc "show", "Shows dependencies"
- option "verbose", :type => :boolean, :default => false
- option "line-numbers", :type => :boolean, :default => false
- option "detailed", :type => :boolean
- def show(*names)
- ensure!
- if environment.lockfile_path.file?
- manifest_presenter.present(names, :detailed => options["detailed"])
- else
- raise Error, "Be sure to install first!"
- end
- end
-
- desc "init", "Initializes the current directory."
- def init
- puts "Nothing to do."
- end
-
- private
-
- def environment
- root_module.environment
- end
-
- def ensure!(options = { })
- Action::Ensure.new(environment, options).run
- end
-
- def clean!(options = { })
- Action::Clean.new(environment, options).run
- end
-
- def install!(options = { })
- Action::Install.new(environment, options).run
- end
-
- def resolve!(options = { })
- Action::Resolve.new(environment, options).run
- end
-
- def update!(options = { })
- Action::Update.new(environment, options).run
- end
-
- def manifest_presenter
- ManifestPresenter.new(self, environment.lock.manifests)
- end
-
- def write_debug_header
- debug { "Ruby Version: #{RUBY_VERSION}" }
- debug { "Ruby Platform: #{RUBY_PLATFORM}" }
- debug { "Rubinius Version: #{Rubinius::VERSION}" } if defined?(Rubinius)
- debug { "JRuby Version: #{JRUBY_VERSION}" } if defined?(JRUBY_VERSION)
- debug { "Rubygems Version: #{Gem::VERSION}" }
- debug { "Librarian Version: #{VERSION}" }
- debug { "Librarian Adapter: #{environment.adapter_name}"}
- debug { "Project: #{environment.project_path}" }
- debug { "Specfile: #{relative_path_to(environment.specfile_path)}" }
- debug { "Lockfile: #{relative_path_to(environment.lockfile_path)}" }
- debug { "Git: #{Source::Git::Repository.bin}" }
- debug { "Git Version: #{Source::Git::Repository.new(environment, environment.project_path).version(:silent => true)}" }
- debug { "Git Environment Variables:" }
- git_env = ENV.to_a.select{|(k, v)| k =~ /\AGIT/}.sort_by{|(k, v)| k}
- if git_env.empty?
- debug { " (empty)" }
- else
- git_env.each do |(k, v)|
- debug { " #{k}=#{v}"}
- end
- end
- end
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- def relative_path_to(path)
- environment.logger.relative_path_to(path)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/cli/manifest_presenter.rb b/vendor/librarian/lib/librarian/cli/manifest_presenter.rb
deleted file mode 100644
index 538ace0..0000000
--- a/vendor/librarian/lib/librarian/cli/manifest_presenter.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-module Librarian
- class Cli
- class ManifestPresenter
-
- attr_accessor :cli, :manifests
- private :cli=, :manifests=
-
- def initialize(cli, manifests)
- self.cli = cli or raise ArgumentError, "cli required"
- self.manifests = manifests or raise ArgumentError, "manifests required"
- self.manifests_index = Hash[manifests.map{|m| [m.name, m]}]
-
- self.scope_level = 0
- end
-
- def present(names = [], options = { })
- full = options[:detailed]
- full = !names.empty? if full.nil?
-
- if names.empty?
- names = manifests.map(&:name).sort if names.empty?
- else
- missing_names = names.reject{|name| manifest(name)}
- unless missing_names.empty?
- raise Error, "not found: #{missing_names.map(&:inspect).join(', ')}"
- end
- end
-
- names.each do |name|
- manifest = manifest(name)
- present_one(manifest, :detailed => full)
- end
- end
-
- def present_one(manifest, options = { })
- full = options[:detailed]
-
- say "#{manifest.name} (#{manifest.version})" do
- if full
- say "source: #{manifest.source}"
- unless manifest.dependencies.empty?
- say "dependencies:" do
- manifest.dependencies.sort_by(&:name).each do |dependency|
- say "#{dependency.name} (#{dependency.requirement})"
- end
- end
- end
- end
- end
- end
-
- private
-
- attr_accessor :scope_level, :manifests_index
-
- def manifest(name)
- manifests_index[name]
- end
-
- def say(string)
- cli.say " " * scope_level << string
- if block_given?
- scope do
- yield
- end
- end
- end
-
- def scope
- original_scope_level = scope_level
- self.scope_level = scope_level + 1
- yield
- ensure
- self.scope_level = original_scope_level
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/config.rb b/vendor/librarian/lib/librarian/config.rb
deleted file mode 100644
index 963cdfd..0000000
--- a/vendor/librarian/lib/librarian/config.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require "librarian/config/database"
-
-module Librarian
- module Config
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/config/database.rb b/vendor/librarian/lib/librarian/config/database.rb
deleted file mode 100644
index 5456c1e..0000000
--- a/vendor/librarian/lib/librarian/config/database.rb
+++ /dev/null
@@ -1,205 +0,0 @@
-require "pathname"
-
-require "librarian/config/file_source"
-require "librarian/config/hash_source"
-
-module Librarian
- module Config
- class Database
-
- class << self
- def library
- name.split("::").first.downcase
- end
- end
-
- attr_accessor :adapter_name
- private :adapter_name=
-
- attr_accessor :root, :assigned_specfile_name
- private :root=, :assigned_specfile_name=
-
- attr_accessor :underlying_env, :underlying_pwd, :underlying_home
- private :underlying_env=, :underlying_pwd=, :underlying_home=
-
- def initialize(adapter_name, options = { })
- self.adapter_name = adapter_name or raise ArgumentError, "must provide adapter_name"
-
- options[:project_path] || options[:pwd] or raise ArgumentError, "must provide project_path or pwd"
-
- self.root = options[:project_path] && Pathname(options[:project_path])
- self.assigned_specfile_name = options[:specfile_name]
- self.underlying_env = options[:env] or raise ArgumentError, "must provide env"
- self.underlying_pwd = options[:pwd] && Pathname(options[:pwd])
- self.underlying_home = options[:home] && Pathname(options[:home])
- end
-
- def global
- memo(__method__) { new_file_source(global_config_path) }
- end
-
- def env
- memo(__method__) { HashSource.new(adapter_name, :name => "environment", :raw => env_source_data) }
- end
-
- def local
- memo(__method__) { new_file_source(local_config_path) }
- end
-
- def [](key, scope = nil)
- case scope
- when "local", :local then local[key]
- when "env", :env then env[key]
- when "global", :global then global[key]
- when nil then local[key] || env[key] || global[key]
- else raise Error, "bad scope"
- end
- end
-
- def []=(key, scope, value)
- case scope
- when "local", :local then local[key] = value
- when "global", :global then global[key] = value
- else raise Error, "bad scope"
- end
- end
-
- def keys
- [local, env, global].inject([]){|a, e| a.concat(e.keys) ; a}.sort.uniq
- end
-
- def project_path
- root || specfile_path.dirname
- end
-
- def specfile_path
- if root
- root + (assigned_specfile_name || default_specfile_name)
- else
- env_specfile_path || default_specfile_path
- end
- end
-
- def specfile_name
- specfile_path.basename.to_s
- end
-
- def lockfile_path
- project_path + lockfile_name
- end
-
- def lockfile_name
- "#{specfile_name}.lock"
- end
-
- private
-
- def new_file_source(config_path)
- return unless config_path
-
- FileSource.new(adapter_name,
- :config_path => config_path,
- :forbidden_keys => [config_key, specfile_key]
- )
- end
-
- def global_config_path
- env_global_config_path || default_global_config_path
- end
-
- def env_global_config_path
- memo(__method__) { env[config_key] }
- end
-
- def default_global_config_path
- underlying_home && underlying_home + config_name
- end
-
- def local_config_path
- root_local_config_path || env_local_config_path || default_local_config_path
- end
-
- def root_local_config_path
- root && root + config_name
- end
-
- def env_specfile_path
- memo(__method__) do
- path = env[specfile_key]
- path && Pathname(path)
- end
- end
-
- def default_specfile_path
- default_project_root_path + (assigned_specfile_name || default_specfile_name)
- end
-
- def env_local_config_path
- return unless env_specfile_path
-
- env_specfile_path.dirname + config_name
- end
-
- def default_local_config_path
- default_project_root_path + config_name
- end
-
- def default_project_root_path
- if root
- root
- else
- path = underlying_pwd
- path = path.dirname until project_root_path?(path) || path.dirname == path
- project_root_path?(path) ? path : underlying_pwd
- end
- end
-
- def project_root_path?(path)
- File.file?(path + default_specfile_name)
- end
-
- def config_key
- "config"
- end
-
- def specfile_key
- "#{adapter_name}file"
- end
-
- def default_specfile_name
- "#{adapter_name.capitalize}file"
- end
-
- def library
- self.class.library
- end
-
- def config_name_prefix
- ".#{library}"
- end
-
- def config_name
- File.join(*[config_name_prefix, adapter_name, "config"])
- end
-
- def raw_key_prefix
- "#{library.upcase}_#{adapter_name.upcase}_"
- end
-
- def env_source_data
- prefix = raw_key_prefix
-
- data = underlying_env.dup
- data.reject!{|k, _| !k.start_with?(prefix) || k.size <= prefix.size}
- data
- end
-
- def memo(key)
- key = "@#{key}"
- instance_variable_set(key, yield) unless instance_variable_defined?(key)
- instance_variable_get(key)
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/config/file_source.rb b/vendor/librarian/lib/librarian/config/file_source.rb
deleted file mode 100644
index d64435e..0000000
--- a/vendor/librarian/lib/librarian/config/file_source.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require "yaml"
-
-require "librarian/config/source"
-
-module Librarian
- module Config
- class FileSource < Source
-
- attr_accessor :config_path
- private :config_path=
-
- def initialize(adapter_name, options = { })
- super
-
- self.config_path = options.delete(:config_path) or raise ArgumentError, "must provide config_path"
- end
-
- def to_s
- config_path
- end
-
- private
-
- def load
- return { } unless File.file?(config_path)
-
- raw = YAML.load_file(config_path)
- return { } unless Hash === raw
-
- translate_raw_to_config(raw)
- end
-
- def save(config)
- raw = translate_config_to_raw(config)
-
- if config.empty?
- File.delete(config_path) if File.file?(config_path)
- else
- config_dir = File.dirname(config_path)
- FileUtils.mkpath(config_dir) unless File.directory?(config_dir)
- File.open(config_path, "wb"){|f| YAML.dump(raw, f)}
- end
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/config/hash_source.rb b/vendor/librarian/lib/librarian/config/hash_source.rb
deleted file mode 100644
index d264372..0000000
--- a/vendor/librarian/lib/librarian/config/hash_source.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require "librarian/source"
-
-module Librarian
- module Config
- class HashSource < Source
-
- attr_accessor :name, :raw
- private :name=, :raw=
-
- def initialize(adapter_name, options = { })
- super
-
- self.name = options.delete(:name) or raise ArgumentError, "must provide name"
- self.raw = options.delete(:raw) or raise ArgumentError, "must provide raw"
- end
-
- def to_s
- name
- end
-
- private
-
- def load
- translate_raw_to_config(raw)
- end
-
- def save(config)
- raise Error, "nonsense!"
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/config/source.rb b/vendor/librarian/lib/librarian/config/source.rb
deleted file mode 100644
index 97160f8..0000000
--- a/vendor/librarian/lib/librarian/config/source.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-require "librarian/error"
-
-module Librarian
- module Config
- class Source
-
- RAW_KEY_SUFFIX_VALIDITY_PATTERN =
- /\A[A-Z0-9_]+\z/
- CONFIG_KEY_VALIDITY_PATTERN =
- /\A[a-z][a-z0-9\-]+(?:\.[a-z0-9\-]+)*\z/
-
- class << self
- def raw_key_suffix_validity_pattern
- RAW_KEY_SUFFIX_VALIDITY_PATTERN
- end
- def config_key_validity_pattern
- CONFIG_KEY_VALIDITY_PATTERN
- end
- end
-
- attr_accessor :adapter_name
- private :adapter_name=
-
- def initialize(adapter_name, options = { })
- self.adapter_name = adapter_name
-
- self.forbidden_keys = options.delete(:forbidden_keys) || []
- end
-
- def [](key)
- load!
-
- data[key]
- end
-
- def []=(key, value)
- key_permitted?(key) or raise Error, "key not permitted: #{key.inspect}"
- value_permitted?(key, value) or raise Error, "value for key #{key.inspect} not permitted: #{value.inspect}"
-
- load!
- if value.nil?
- data.delete(key)
- else
- data[key] = value
- end
- save(data)
- end
-
- def keys
- load!
-
- data.keys
- end
-
- private
-
- attr_accessor :data, :forbidden_keys
-
- def load!
- self.data = load unless data
- end
-
- def key_permitted?(key)
- String === key &&
- config_key_validity_pattern === key &&
- !forbidden_keys.any?{|k| k === key}
- end
-
- def value_permitted?(key, value)
- return true if value.nil?
-
- String === value
- end
-
- def raw_key_valid?(key)
- return false unless key.start_with?(raw_key_prefix)
-
- suffix = key[raw_key_prefix.size..-1]
- raw_key_suffix_validity_pattern =~ suffix
- end
-
- def raw_key_suffix_validity_pattern
- self.class.raw_key_suffix_validity_pattern
- end
-
- def config_key_valid?(key)
- config_key_validity_pattern === key
- end
-
- def config_key_validity_pattern
- self.class.config_key_validity_pattern
- end
-
- def raw_key_prefix
- @key_prefix ||= "LIBRARIAN_#{adapter_name.upcase}_"
- end
-
- def assert_raw_keys_valid!(raw)
- bad_keys = raw.keys.reject{|k| raw_key_valid?(k)}
- unless bad_keys.empty?
- config_path_s = config_path.to_s.inspect
- bad_keys_s = bad_keys.map(&:inspect).join(", ")
- raise Error, "config #{to_s} has bad keys: #{bad_keys_s}"
- end
- end
-
- def assert_config_keys_valid!(config)
- bad_keys = config.keys.reject{|k| config_key_valid?(k)}
- unless bad_keys.empty?
- bad_keys_s = bad_keys.map(&:inspect).join(", ")
- raise Error, "config has bad keys: #{bad_keys_s}"
- end
- end
-
- def assert_values_valid!(data)
- bad_data = data.reject{|k, v| String === v}
- bad_keys = bad_data.keys
-
- unless bad_keys.empty?
- bad_keys_s = bad_keys.map(&:inspect).join(", ")
- raise Error, "config has bad values for keys: #{bad_keys_s}"
- end
- end
-
- def translate_raw_to_config(raw)
- assert_raw_keys_valid!(raw)
- assert_values_valid!(raw)
-
- Hash[raw.map do |key, value|
- key = key[raw_key_prefix.size .. -1]
- key = key.downcase.gsub(/__/, ".").gsub(/_/, "-")
- [key, value]
- end]
- end
-
- def translate_config_to_raw(config)
- assert_config_keys_valid!(config)
- assert_values_valid!(config)
-
- Hash[config.map do |key, value|
- key = key.gsub(/\./, "__").gsub(/\-/, "_").upcase
- key = "#{raw_key_prefix}#{key}"
- [key, value]
- end]
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/dependency.rb b/vendor/librarian/lib/librarian/dependency.rb
deleted file mode 100644
index 78cc343..0000000
--- a/vendor/librarian/lib/librarian/dependency.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-require 'rubygems'
-
-module Librarian
- class Dependency
-
- class Requirement
- def initialize(*args)
- args = initialize_normalize_args(args)
-
- self.backing = Gem::Requirement.create(*args)
- end
-
- def to_gem_requirement
- backing
- end
-
- def satisfied_by?(version)
- to_gem_requirement.satisfied_by?(version.to_gem_version)
- end
-
- def ==(other)
- to_gem_requirement == other.to_gem_requirement
- end
-
- def to_s
- to_gem_requirement.to_s
- end
-
- protected
-
- attr_accessor :backing
-
- private
-
- def initialize_normalize_args(args)
- args.map do |arg|
- arg = arg.backing if self.class === arg
- arg
- end
- end
- end
-
- attr_accessor :name, :requirement, :source
- private :name=, :requirement=, :source=
-
- def initialize(name, requirement, source)
- assert_name_valid! name
-
- self.name = name
- self.requirement = Requirement.new(requirement)
- self.source = source
-
- @manifests = nil
- end
-
- def manifests
- @manifests ||= cache_manifests!
- end
-
- def cache_manifests!
- source.manifests(name)
- end
-
- def satisfied_by?(manifest)
- manifest.satisfies?(self)
- end
-
- def to_s
- "#{name} (#{requirement}) <#{source}>"
- end
-
- def ==(other)
- !other.nil? &&
- self.class == other.class &&
- self.name == other.name &&
- self.requirement == other.requirement &&
- self.source == other.source
- end
-
- private
-
- def environment
- source.environment
- end
-
- def assert_name_valid!(name)
- raise ArgumentError, "name (#{name.inspect}) must be sensible" unless name =~ /\A\S(?:.*\S)?\z/
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/dsl.rb b/vendor/librarian/lib/librarian/dsl.rb
deleted file mode 100644
index b53f264..0000000
--- a/vendor/librarian/lib/librarian/dsl.rb
+++ /dev/null
@@ -1,108 +0,0 @@
-require 'librarian/dependency'
-require 'librarian/dsl/receiver'
-require 'librarian/dsl/target'
-
-module Librarian
- class Dsl
-
- class Error < Exception
- end
-
- attr_accessor :environment
- private :environment=
-
- class << self
-
- def run(environment, specfile = nil, precache_sources = [], &block)
- new(environment).run(specfile, precache_sources, &block)
- end
-
- private
-
- def dependency(name)
- dependency_name = name
- dependency_type = Dependency
- singleton_class = class << self; self end
- singleton_class.instance_eval do
- define_method(:dependency_name) { dependency_name }
- define_method(:dependency_type) { dependency_type }
- end
- end
-
- define_method(:source_types) { [] }
-
- def source(options)
- name = options.keys.first
- type = options[name]
- types = source_types
- types << [name, type]
- singleton_class = class << self; self end
- singleton_class.instance_eval do
- define_method(:source_types) { types }
- end
- end
-
- define_method(:source_shortcuts) { {} }
-
- def shortcut(name, options)
- instances = source_shortcuts
- instances[name] = options
- singleton_class = class << self; self end
- singleton_class.instance_eval do
- define_method(:source_shortcuts) { instances }
- end
- end
-
- def delegate_to_class(*names)
- names.each do |name|
- define_method(name) { self.class.send(name) }
- end
- end
-
- end
-
- delegate_to_class :dependency_name, :dependency_type, :source_types, :source_shortcuts
-
- def initialize(environment)
- self.environment = environment
- end
-
- def run(specfile = nil, sources = [])
- Target.new(self).tap do |target|
- target.precache_sources(sources)
- debug_named_source_cache("Pre-Cached Sources", target)
-
- receiver = Receiver.new(target)
- if block_given?
- receiver.run(&Proc.new)
- else
- case specfile
- when Specfile, String, Proc
- receiver.run(specfile)
- else
- raise ArgumentError, "specfile must be a #{Specfile}, #{String}, or #{Proc} if no block is given (it was #{specfile.inspect})"
- end
- end
-
- debug_named_source_cache("Post-Cached Sources", target)
- end.to_spec
- end
-
- def debug_named_source_cache(name, target)
- source_cache = target.source_cache
- debug { "#{name}:" }
- source_cache.each do |key, value|
- type = key[0]
- attributes = key[1...key.size]
- debug { " #{key.inspect}" }
- end
- end
-
- private
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/dsl/receiver.rb b/vendor/librarian/lib/librarian/dsl/receiver.rb
deleted file mode 100644
index 846b955..0000000
--- a/vendor/librarian/lib/librarian/dsl/receiver.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-require 'librarian/specfile'
-
-module Librarian
- class Dsl
- class Receiver
-
- def initialize(target)
- singleton_class = class << self; self end
- singleton_class.class_eval do
- define_method(target.dependency_name) do |*args, &block|
- target.dependency(*args, &block)
- end
- define_method(:source) do |*args, &block|
- target.source(*args, &block)
- end
- target.source_types.each do |source_type|
- name = source_type[0]
- define_method(name) do |*args, &block|
- target.source(name, *args, &block)
- end
- end
- end
- end
-
- def run(specfile = nil)
- if block_given?
- instance_eval(&Proc.new)
- else
- case specfile
- when Specfile
- eval(specfile.path.read, instance_binding, specfile.path.to_s, 1)
- when String
- eval(specfile, instance_binding)
- when Proc
- instance_eval(&specfile)
- else
- raise ArgumentError, "specfile must be a #{Specfile}, #{String}, or #{Proc} if no block is given (it was #{specfile.inspect})"
- end
- end
- end
-
- def instance_binding
- binding
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/dsl/target.rb b/vendor/librarian/lib/librarian/dsl/target.rb
deleted file mode 100644
index 6f8738e..0000000
--- a/vendor/librarian/lib/librarian/dsl/target.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-require 'librarian/spec'
-
-module Librarian
- class Dsl
- class Target
-
- class SourceShortcutDefinitionReceiver
- def initialize(target)
- singleton_class = class << self; self end
- singleton_class.class_eval do
- define_method(:source) do |options|
- target.source_from_options(options)
- end
- target.source_types.each do |source_type|
- name = source_type[0]
- define_method(name) do |*args|
- args.push({}) unless Hash === args.last
- target.source_from_params(name, *args)
- end
- end
- end
- end
- end
-
- SCOPABLES = [:sources]
-
- attr_accessor :dsl
- private :dsl=
-
- attr_reader :dependency_name, :dependency_type
- attr_reader :source_types, :source_types_map, :source_types_reverse_map, :source_type_names, :source_shortcuts
- attr_reader :dependencies, :source_cache, *SCOPABLES
-
- def initialize(dsl)
- self.dsl = dsl
- @dependency_name = dsl.dependency_name
- @dependency_type = dsl.dependency_type
- @source_types = dsl.source_types
- @source_types_map = Hash[source_types]
- @source_types_reverse_map = Hash[source_types.map{|pair| a, b = pair ; [b, a]}]
- @source_type_names = source_types.map{|t| t[0]}
- @source_cache = {}
- @source_shortcuts = {}
- @dependencies = []
- SCOPABLES.each do |scopable|
- instance_variable_set(:"@#{scopable}", [])
- end
- dsl.source_shortcuts.each do |name, param|
- define_source_shortcut(name, param)
- end
- end
-
- def to_spec
- Spec.new(@sources.first, @dependencies)
- end
-
- def dependency(name, *args)
- options = args.last.is_a?(Hash) ? args.pop : {}
- source = source_from_options(options) || @sources.last
- unless source
- raise Error, "#{dependency_name} #{name} is specified without a source!"
- end
- dep = dependency_type.new(name, args, source)
- @dependencies << dep
- end
-
- def source(name, param = nil, options = nil, &block)
- if !(Hash === name) && [Array, Hash, Proc].any?{|c| c === param} && !options && !block
- define_source_shortcut(name, param)
- elsif !(Hash === name) && !param && !options
- source = source_shortcuts[name]
- scope_or_directive(block) do
- @sources = @sources.dup << source
- end
- else
- name, param, options = *normalize_source_options(name, param, options || {})
- source = source_from_params(name, param, options)
- scope_or_directive(block) do
- @sources = @sources.dup << source
- end
- end
- end
-
- def precache_sources(sources)
- sources.each do |source|
- key = [source_types_reverse_map[source.class], *source.to_spec_args]
- source_cache[key] = source
- end
- end
-
- def scope
- currents = { }
- SCOPABLES.each do |scopable|
- currents[scopable] = instance_variable_get(:"@#{scopable}").dup
- end
- yield
- ensure
- SCOPABLES.reverse.each do |scopable|
- instance_variable_set(:"@#{scopable}", currents[scopable])
- end
- end
-
- def scope_or_directive(scoped_block = nil)
- unless scoped_block
- yield
- else
- scope do
- yield
- scoped_block.call
- end
- end
- end
-
- def normalize_source_options(name, param, options)
- if name.is_a?(Hash)
- extract_source_parts(name)
- else
- [name, param, options]
- end
- end
-
- def extract_source_parts(options)
- if name = source_type_names.find{|name| options.key?(name)}
- options = options.dup
- param = options.delete(name)
- [name, param, options]
- else
- nil
- end
- end
-
- def source_from_options(options)
- if options[:source]
- source_shortcuts[options[:source]]
- elsif source_parts = extract_source_parts(options)
- source_from_params(*source_parts)
- else
- nil
- end
- end
-
- def source_from_params(name, param, options)
- source_cache[[name, param, options]] ||= begin
- type = source_types_map[name]
- type.from_spec_args(environment, param, options)
- end
- end
-
- def source_from_source_shortcut_definition(definition)
- case definition
- when Array
- source_from_params(*definition)
- when Hash
- source_from_options(definition)
- when Proc
- receiver = SourceShortcutDefinitionReceiver.new(self)
- receiver.instance_eval(&definition)
- end
- end
-
- def define_source_shortcut(name, definition)
- source = source_from_source_shortcut_definition(definition)
- source_shortcuts[name] = source
- end
-
- def environment
- dsl.environment
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/environment.rb b/vendor/librarian/lib/librarian/environment.rb
deleted file mode 100644
index 212eacf..0000000
--- a/vendor/librarian/lib/librarian/environment.rb
+++ /dev/null
@@ -1,134 +0,0 @@
-require "pathname"
-
-require "librarian/support/abstract_method"
-
-require "librarian/error"
-require "librarian/config"
-require "librarian/lockfile"
-require "librarian/logger"
-require "librarian/specfile"
-require "librarian/resolver"
-require "librarian/dsl"
-require "librarian/source"
-
-module Librarian
- class Environment
-
- include Support::AbstractMethod
-
- attr_accessor :ui
-
- abstract_method :specfile_name, :dsl_class, :install_path
-
- def initialize(options = { })
- @pwd = options.fetch(:pwd) { Dir.pwd }
- @env = options.fetch(:env) { ENV.to_hash }
- @home = options.fetch(:home) { File.expand_path("~") }
- @project_path = options[:project_path]
- @specfile_name = options[:specfile_name]
- end
-
- def logger
- @logger ||= Logger.new(self)
- end
-
- def config_db
- @config_db ||= begin
- Config::Database.new(adapter_name,
- :pwd => @pwd,
- :env => @env,
- :home => @home,
- :project_path => @project_path,
- :specfile_name => default_specfile_name
- )
- end
- end
-
- def default_specfile_name
- @default_specfile_name ||= begin
- capped = adapter_name.capitalize
- "#{capped}file"
- end
- end
-
- def project_path
- config_db.project_path
- end
-
- def specfile_name
- config_db.specfile_name
- end
-
- def specfile_path
- config_db.specfile_path
- end
-
- def specfile
- Specfile.new(self, specfile_path)
- end
-
- def adapter_name
- nil
- end
-
- def lockfile_name
- config_db.lockfile_name
- end
-
- def lockfile_path
- config_db.lockfile_path
- end
-
- def lockfile
- Lockfile.new(self, lockfile_path)
- end
-
- def ephemeral_lockfile
- Lockfile.new(self, nil)
- end
-
- def resolver
- Resolver.new(self)
- end
-
- def cache_path
- project_path.join("tmp/librarian/cache")
- end
-
- def scratch_path
- project_path.join("tmp/librarian/scratch")
- end
-
- def project_relative_path_to(path)
- Pathname.new(path).relative_path_from(project_path)
- end
-
- def spec
- specfile.read
- end
-
- def lock
- lockfile.read
- end
-
- def dsl(*args, &block)
- dsl_class.run(self, *args, &block)
- end
-
- def dsl_class
- self.class.name.split("::")[0 ... -1].inject(Object, &:const_get)::Dsl
- end
-
- def config_keys
- %[
- ]
- end
-
- private
-
- def environment
- self
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/error.rb b/vendor/librarian/lib/librarian/error.rb
deleted file mode 100644
index f32e9f4..0000000
--- a/vendor/librarian/lib/librarian/error.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module Librarian
- class Error < StandardError
- end
-end
diff --git a/vendor/librarian/lib/librarian/helpers.rb b/vendor/librarian/lib/librarian/helpers.rb
deleted file mode 100644
index 5f1d4fa..0000000
--- a/vendor/librarian/lib/librarian/helpers.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Librarian
- module Helpers
- extend self
-
- # [active_support/core_ext/string/strip]
- def strip_heredoc(string)
- indent = string.scan(/^[ \t]*(?=\S)/).min
- indent = indent.respond_to?(:size) ? indent.size : 0
- string.gsub(/^[ \t]{#{indent}}/, '')
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/lockfile.rb b/vendor/librarian/lib/librarian/lockfile.rb
deleted file mode 100644
index 70fee76..0000000
--- a/vendor/librarian/lib/librarian/lockfile.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require 'librarian/lockfile/compiler'
-require 'librarian/lockfile/parser'
-
-module Librarian
- class Lockfile
-
- attr_accessor :environment
- private :environment=
- attr_reader :path
-
- def initialize(environment, path)
- self.environment = environment
- @path = path
- end
-
- def save(resolution)
- Compiler.new(environment).compile(resolution)
- end
-
- def load(string)
- Parser.new(environment).parse(string)
- end
-
- def read
- load(path.read)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/lockfile/compiler.rb b/vendor/librarian/lib/librarian/lockfile/compiler.rb
deleted file mode 100644
index f19fcd9..0000000
--- a/vendor/librarian/lib/librarian/lockfile/compiler.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-module Librarian
- class Lockfile
- class Compiler
-
- attr_accessor :environment
- private :environment=
-
- def initialize(environment)
- self.environment = environment
- end
-
- def compile(resolution)
- out = StringIO.new
- save_sources(out, resolution.manifests)
- save_dependencies(out, resolution.dependencies)
- out.string
- end
-
- private
-
- def save_sources(out, manifests)
- dsl_class.source_types.map{|t| t[1]}.each do |type|
- type_manifests = manifests.select{|m| type === m.source}
- sources = type_manifests.map{|m| m.source}.uniq.sort_by{|s| s.to_s}
- sources.each do |source|
- source_manifests = type_manifests.select{|m| source == m.source}
- save_source(out, source, source_manifests)
- end
- end
- end
-
- def save_source(out, source, manifests)
- out.puts "#{source.class.lock_name}"
- options = source.to_lock_options
- remote = options.delete(:remote)
- out.puts " remote: #{remote}"
- options.to_a.sort_by{|a| a[0].to_s}.each do |o|
- out.puts " #{o[0]}: #{o[1]}"
- end
- out.puts " specs:"
- manifests.sort_by{|a| a.name}.each do |manifest|
- out.puts " #{manifest.name} (#{manifest.version})"
- manifest.dependencies.sort_by{|a| a.name}.each do |dependency|
- out.puts " #{dependency.name} (#{dependency.requirement})"
- end
- end
- out.puts ""
- end
-
- def save_dependencies(out, dependencies)
- out.puts "DEPENDENCIES"
- dependencies.sort_by{|a| a.name}.each do |d|
- res = "#{d.name}"
- res << " (#{d.requirement})" if d.requirement
- out.puts " #{res}"
- end
- out.puts ""
- end
-
- def dsl_class
- environment.dsl_class
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/lockfile/parser.rb b/vendor/librarian/lib/librarian/lockfile/parser.rb
deleted file mode 100644
index 10c0c7e..0000000
--- a/vendor/librarian/lib/librarian/lockfile/parser.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-require 'librarian/manifest'
-require 'librarian/dependency'
-require 'librarian/manifest_set'
-
-module Librarian
- class Lockfile
- class Parser
-
- class ManifestPlaceholder
- attr_reader :source, :name, :version, :dependencies
- def initialize(source, name, version, dependencies)
- @source, @name, @version, @dependencies = source, name, version, dependencies
- end
- end
-
- attr_accessor :environment
- private :environment=
-
- def initialize(environment)
- self.environment = environment
- end
-
- def parse(string)
- string = string.dup
- source_type_names_map = Hash[dsl_class.source_types.map{|t| [t[1].lock_name, t[1]]}]
- source_type_names = dsl_class.source_types.map{|t| t[1].lock_name}
- lines = string.split(/(\r|\n|\r\n)+/).select{|l| l =~ /\S/}
- sources = []
- while source_type_names.include?(lines.first)
- source = {}
- source_type_name = lines.shift
- source[:type] = source_type_names_map[source_type_name]
- options = {}
- while lines.first =~ /^ {2}([\w-]+):\s+(.+)$/
- lines.shift
- options[$1.to_sym] = $2
- end
- source[:options] = options
- lines.shift # specs
- manifests = {}
- while lines.first =~ /^ {4}([\w-]+) \((.*)\)$/
- lines.shift
- name = $1
- manifests[name] = {:version => $2, :dependencies => {}}
- while lines.first =~ /^ {6}([\w-]+) \((.*)\)$/
- lines.shift
- manifests[name][:dependencies][$1] = $2.split(/,\s*/)
- end
- end
- source[:manifests] = manifests
- sources << source
- end
- manifests = compile(sources)
- manifests_index = Hash[manifests.map{|m| [m.name, m]}]
- raise StandardError, "Expected DEPENDENCIES topic!" unless lines.shift == "DEPENDENCIES"
- dependencies = []
- while lines.first =~ /^ {2}([\w-]+)(?: \((.*)\))?$/
- lines.shift
- name, requirement = $1, $2.split(/,\s*/)
- dependencies << Dependency.new(name, requirement, manifests_index[name].source)
- end
- Resolution.new(dependencies, manifests)
- end
-
- private
-
- def compile(sources_ast)
- manifests = {}
- sources_ast.each do |source_ast|
- source_type = source_ast[:type]
- source = source_type.from_lock_options(environment, source_ast[:options])
- source_ast[:manifests].each do |manifest_name, manifest_ast|
- manifests[manifest_name] = ManifestPlaceholder.new(
- source,
- manifest_name,
- manifest_ast[:version],
- manifest_ast[:dependencies].map{|k, v| Dependency.new(k, v, nil)}
- )
- end
- end
- manifests = manifests.map do |name, manifest|
- dependencies = manifest.dependencies.map do |d|
- Dependency.new(d.name, d.requirement, manifests[d.name].source)
- end
- manifest.source.manifest(
- manifest.name,
- manifest.version,
- dependencies
- )
- end
- ManifestSet.sort(manifests)
- end
-
- def dsl_class
- environment.dsl_class
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/logger.rb b/vendor/librarian/lib/librarian/logger.rb
deleted file mode 100644
index 564247a..0000000
--- a/vendor/librarian/lib/librarian/logger.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-module Librarian
- class Logger
-
- librarian_path = Pathname(__FILE__)
- librarian_path = librarian_path.dirname until librarian_path.join("lib").directory?
- LIBRARIAN_PATH = librarian_path
-
- attr_accessor :environment
- private :environment=
-
- def initialize(environment)
- self.environment = environment
- end
-
- def info(string = nil, &block)
- return unless ui
-
- ui.info(string || yield)
- end
-
- def debug(string = nil, &block)
- return unless ui
-
- if ui.respond_to?(:debug_line_numbers) && ui.debug_line_numbers
- loc = caller.find{|l| !(l =~ /in `debug'$/)}
- if loc =~ /^(.+):(\d+):in `(.+)'$/
- loc = "#{Pathname.new($1).relative_path_from(LIBRARIAN_PATH)}:#{$2}:in `#{$3}'"
- end
- ui.debug { "[Librarian] #{string || yield} [#{loc}]" }
- else
- ui.debug { "[Librarian] #{string || yield}" }
- end
- end
-
- def relative_path_to(path)
- environment.project_relative_path_to(path)
- end
-
- private
-
- def ui
- environment.ui
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/manifest.rb b/vendor/librarian/lib/librarian/manifest.rb
deleted file mode 100644
index a6b2cf4..0000000
--- a/vendor/librarian/lib/librarian/manifest.rb
+++ /dev/null
@@ -1,234 +0,0 @@
-require 'rubygems'
-
-module Librarian
- class Manifest
-
- class PreReleaseVersion
-
- # Compares pre-release component ids using Semver 2.0.0 spec
- def self.compare_components(this_id,other_id)
- case # Strings have higher precedence than numbers
- when (this_id.is_a?(Integer) and other_id.is_a?(String))
- -1
- when (this_id.is_a?(String) and other_id.is_a?(Integer))
- 1
- else
- this_id <=> other_id
- end
- end
-
- # Parses pre-release components `a.b.c` into an array ``[a,b,c]`
- # Converts numeric components into +Integer+
- def self.parse(prerelease)
- if prerelease.nil?
- []
- else
- prerelease.split('.').collect do |id|
- id = Integer(id) if /^[0-9]+$/ =~ id
- id
- end
- end
- end
-
- include Comparable
-
- attr_reader :components
-
- def initialize(prerelease)
- @prerelease = prerelease
- @components = PreReleaseVersion.parse(prerelease)
- end
-
- def to_s
- @prerelease
- end
-
- def <=>(other)
- # null-fill zip array to prevent loss of components
- z = Array.new([components.length,other.components.length])
-
- # Compare each component against the other
- comp = z.zip(components,other.components).collect do |ids|
- case # All components being equal, the version with more of them takes precedence
- when ids[1].nil? # Self has less elements, other wins
- -1
- when ids[2].nil? # Other has less elements, self wins
- 1
- else
- PreReleaseVersion.compare_components(ids[1],ids[2])
- end
- end
- # Chose the first non-zero comparison or return 0
- comp.delete_if {|c| c == 0}[0] || 0
- end
- end
- class Version
- @@SEMANTIC_VERSION_PATTERN = /^([0-9]+\.[0-9]+(?:\.[0-9]+)?)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
- def self.parse_semver(version_string)
- parsed = @@SEMANTIC_VERSION_PATTERN.match(version_string.strip)
- if parsed
- {
- :full_version => parsed[0],
- :version => parsed[1],
- :prerelease => (PreReleaseVersion.new(parsed[2]) if parsed[2]),
- :build => parsed[3]
- }
- end
- end
- include Comparable
-
- attr_reader :prerelease
-
- def initialize(*args)
- args = initialize_normalize_args(args)
- semver = Version.parse_semver(*args)
- if semver
- self.backing = Gem::Version.new(semver[:version])
- @prerelease = semver[:prerelease]
- @full_version = semver[:full_version]
- else
- self.backing = Gem::Version.new(*args)
- @full_version = to_gem_version.to_s
- end
- end
-
- def to_gem_version
- backing
- end
-
- def <=>(other)
- cmp = to_gem_version <=> other.to_gem_version
-
- # Should compare pre-release versions?
- if cmp == 0 and not (prerelease.nil? and other.prerelease.nil?)
- case # Versions without prerelease take precedence
- when (prerelease.nil? and not other.prerelease.nil?)
- 1
- when (not prerelease.nil? and other.prerelease.nil?)
- -1
- else
- prerelease <=> other.prerelease
- end
- else
- cmp
- end
- end
-
- def to_s
- @full_version
- end
-
- private
-
- def initialize_normalize_args(args)
- args.map do |arg|
- arg = [arg] if self.class === arg
- arg
- end
- end
-
- attr_accessor :backing
- end
-
- attr_accessor :source, :name, :extra
- private :source=, :name=, :extra=
-
- def initialize(source, name, extra = nil)
- assert_name_valid! name
-
- self.source = source
- self.name = name
- self.extra = extra
- end
-
- def to_s
- "#{name}/#{version} <#{source}>"
- end
-
- def version
- defined_version || fetched_version
- end
-
- def version=(version)
- self.defined_version = _normalize_version(version)
- end
-
- def version?
- return unless defined_version
-
- defined_version == fetched_version
- end
-
- def latest
- @latest ||= source.manifests(name).first
- end
-
- def outdated?
- latest.version > version
- end
-
- def dependencies
- defined_dependencies || fetched_dependencies
- end
-
- def dependencies=(dependencies)
- self.defined_dependencies = _normalize_dependencies(dependencies)
- end
-
- def dependencies?
- return unless defined_dependencies
-
- defined_dependencies.zip(fetched_dependencies).all? do |(a, b)|
- a.name == b.name && a.requirement == b.requirement
- end
- end
-
- def satisfies?(dependency)
- dependency.requirement.satisfied_by?(version)
- end
-
- def install!
- source.install!(self)
- end
-
- private
-
- attr_accessor :defined_version, :defined_dependencies
-
- def environment
- source.environment
- end
-
- def fetched_version
- @fetched_version ||= _normalize_version(fetch_version!)
- end
-
- def fetched_dependencies
- @fetched_dependencies ||= _normalize_dependencies(fetch_dependencies!)
- end
-
- def fetch_version!
- source.fetch_version(name, extra)
- end
-
- def fetch_dependencies!
- source.fetch_dependencies(name, version, extra)
- end
-
- def _normalize_version(version)
- Version.new(version)
- end
-
- def _normalize_dependencies(dependencies)
- if Hash === dependencies
- dependencies = dependencies.map{|k, v| Dependency.new(k, v, nil)}
- end
- dependencies.sort_by(&:name)
- end
-
- def assert_name_valid!(name)
- raise ArgumentError, "name (#{name.inspect}) must be sensible" unless name =~ /\A\S(?:.*\S)?\z/
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/manifest_set.rb b/vendor/librarian/lib/librarian/manifest_set.rb
deleted file mode 100644
index 82d97de..0000000
--- a/vendor/librarian/lib/librarian/manifest_set.rb
+++ /dev/null
@@ -1,153 +0,0 @@
-require 'set'
-require 'tsort'
-
-module Librarian
- class ManifestSet
-
- class GraphHash < Hash
- include TSort
- alias tsort_each_node each_key
- def tsort_each_child(node, &block)
- self[node].each(&block)
- end
- end
-
- class << self
- def shallow_strip(manifests, names)
- new(manifests).shallow_strip!(names).send(method_for(manifests))
- end
- def deep_strip(manifests, names)
- new(manifests).deep_strip!(names).send(method_for(manifests))
- end
- def shallow_keep(manifests, names)
- new(manifests).shallow_keep!(names).send(method_for(manifests))
- end
- def deep_keep(manifests, names)
- new(manifests).deep_keep!(names).send(method_for(manifests))
- end
- def sort(manifests)
- manifests = Hash[manifests.map{|m| [m.name, m]}] if Array === manifests
- manifest_pairs = GraphHash[manifests.map{|k, m| [k, m.dependencies.map{|d| d.name}]}]
- manifest_names = manifest_pairs.tsort
- manifest_names.map{|n| manifests[n]}
- end
- private
- def method_for(manifests)
- case manifests
- when Hash
- :to_hash
- when Array
- :to_a
- end
- end
- end
-
- def initialize(manifests)
- self.index = Hash === manifests ? manifests.dup : Hash[manifests.map{|m| [m.name, m]}]
- end
-
- def to_a
- index.values
- end
-
- def to_hash
- index.dup
- end
-
- def dup
- self.class.new(index)
- end
-
- def shallow_strip(names)
- dup.shallow_strip!(names)
- end
-
- def shallow_strip!(names)
- assert_strings!(names)
-
- names.each do |name|
- index.delete(name)
- end
- self
- end
-
- def deep_strip(names)
- dup.deep_strip!(names)
- end
-
- def deep_strip!(names)
- names = Array === names ? names.dup : names.to_a
- assert_strings!(names)
-
- strippables = dependencies_of(names)
- shallow_strip!(strippables)
-
- self
- end
-
- def shallow_keep(names)
- dup.shallow_keep!(names)
- end
-
- def shallow_keep!(names)
- assert_strings!(names)
-
- names = Set.new(names) unless Set === names
- index.reject! { |k, v| !names.include?(k) }
- self
- end
-
- def deep_keep(names)
- dup.conservative_strip!(names)
- end
-
- def deep_keep!(names)
- names = Array === names ? names.dup : names.to_a
- assert_strings!(names)
-
- keepables = dependencies_of(names)
- shallow_keep!(keepables)
-
- self
- end
-
- def consistent?
- index.values.all? do |manifest|
- in_compliance_with?(manifest.dependencies)
- end
- end
-
- def in_compliance_with?(dependencies)
- dependencies.all? do |dependency|
- manifest = index[dependency.name]
- manifest && manifest.satisfies?(dependency)
- end
- end
-
- private
-
- attr_accessor :index
-
- def assert_strings!(names)
- non_strings = names.reject{|name| String === name}
- non_strings.empty? or raise TypeError, "names must all be strings"
- end
-
- # Straightforward breadth-first graph traversal algorithm.
- def dependencies_of(names)
- names = Array === names ? names.dup : names.to_a
- assert_strings!(names)
-
- deps = Set.new
- until names.empty?
- name = names.shift
- next if deps.include?(name)
-
- deps << name
- names.concat index[name].dependencies.map(&:name)
- end
- deps.to_a
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/mock.rb b/vendor/librarian/lib/librarian/mock.rb
deleted file mode 100644
index 91fd5cc..0000000
--- a/vendor/librarian/lib/librarian/mock.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'librarian/mock/extension'
diff --git a/vendor/librarian/lib/librarian/mock/cli.rb b/vendor/librarian/lib/librarian/mock/cli.rb
deleted file mode 100644
index a26a881..0000000
--- a/vendor/librarian/lib/librarian/mock/cli.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'librarian/cli'
-require 'librarian/mock'
-
-module Librarian
- module Mock
- class Cli < Librarian::Cli
-
- module Particularity
- def root_module
- Mock
- end
- end
-
- include Particularity
- extend Particularity
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/mock/dsl.rb b/vendor/librarian/lib/librarian/mock/dsl.rb
deleted file mode 100644
index 5685ccc..0000000
--- a/vendor/librarian/lib/librarian/mock/dsl.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'librarian/dsl'
-require 'librarian/mock/source'
-
-module Librarian
- module Mock
- class Dsl < Librarian::Dsl
-
- dependency :dep
-
- source :src => Source::Mock
-
- shortcut :a, :src => 'source-a'
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/mock/environment.rb b/vendor/librarian/lib/librarian/mock/environment.rb
deleted file mode 100644
index 7554fbf..0000000
--- a/vendor/librarian/lib/librarian/mock/environment.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require "librarian/environment"
-require "librarian/mock/dsl"
-
-module Librarian
- module Mock
- class Environment < Environment
-
- def adapter_name
- "mock"
- end
-
- def install_path
- nil
- end
-
- def registry(options = nil, &block)
- @registry ||= Source::Mock::Registry.new
- @registry.merge!(options, &block)
- @registry
- end
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/mock/extension.rb b/vendor/librarian/lib/librarian/mock/extension.rb
deleted file mode 100644
index fca3993..0000000
--- a/vendor/librarian/lib/librarian/mock/extension.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'librarian/mock/environment'
-
-module Librarian
- module Mock
- extend self
- extend Librarian
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/mock/source.rb b/vendor/librarian/lib/librarian/mock/source.rb
deleted file mode 100644
index 3c6ccfa..0000000
--- a/vendor/librarian/lib/librarian/mock/source.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'librarian/mock/source/mock'
diff --git a/vendor/librarian/lib/librarian/mock/source/mock.rb b/vendor/librarian/lib/librarian/mock/source/mock.rb
deleted file mode 100644
index f39a032..0000000
--- a/vendor/librarian/lib/librarian/mock/source/mock.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-require 'librarian/manifest'
-require 'librarian/mock/source/mock/registry'
-
-module Librarian
- module Mock
- module Source
- class Mock
-
- class << self
-
- LOCK_NAME = 'MOCK'
-
- def lock_name
- LOCK_NAME
- end
-
- def from_lock_options(environment, options)
- new(environment, options[:remote], options.reject{|k, v| k == :remote})
- end
-
- def from_spec_args(environment, name, options)
- recognized_options = []
- unrecognized_options = options.keys - recognized_options
- unrecognized_options.empty? or raise Error, "unrecognized options: #{unrecognized_options.join(", ")}"
-
- new(environment, name, options)
- end
-
- end
-
- attr_accessor :environment
- private :environment=
- attr_reader :name
-
- def initialize(environment, name, options)
- self.environment = environment
- @name = name
- end
-
- def to_s
- name
- end
-
- def ==(other)
- other &&
- self.class == other.class &&
- self.name == other.name
- end
-
- alias :eql? :==
-
- def hash
- self.to_s.hash
- end
-
- def to_spec_args
- [name, {}]
- end
-
- def to_lock_options
- {:remote => name}
- end
-
- def registry
- environment.registry[name]
- end
-
- def manifest(name, version, dependencies)
- manifest = Manifest.new(self, name)
- manifest.version = version
- manifest.dependencies = dependencies
- manifest
- end
-
- def manifests(name)
- if d = registry[name]
- d.map{|v| manifest(name, v[:version], v[:dependencies])}
- else
- nil
- end
- end
-
- def install!(manifest)
- end
-
- def to_s
- name
- end
-
- def fetch_version(name, extra)
- extra
- end
-
- def fetch_dependencies(name, version, extra)
- d = registry[name]
- m = d.find{|v| v[:version] == version.to_s}
- m[:dependencies]
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/mock/source/mock/registry.rb b/vendor/librarian/lib/librarian/mock/source/mock/registry.rb
deleted file mode 100644
index bbd75b9..0000000
--- a/vendor/librarian/lib/librarian/mock/source/mock/registry.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-module Librarian
- module Mock
- module Source
- class Mock
- class Registry
-
- module Dsl
-
- class Top
- def initialize(sources)
- @sources = sources
- end
- def source(name, &block)
- @sources[name] ||= {}
- Source.new(@sources[name]).instance_eval(&block) if block
- end
- end
-
- class Source
- def initialize(source)
- @source = source
- end
- def spec(name, version = nil, &block)
- @source[name] ||= []
- unless version
- Spec.new(@source[name]).instance_eval(&block) if block
- else
- Spec.new(@source[name]).version(version, &block)
- end
- @source[name] = @source[name].sort_by{|a| Manifest::Version.new(a[:version])}.reverse
- end
- end
-
- class Spec
- def initialize(spec)
- @spec = spec
- end
- def version(name, &block)
- @spec << { :version => name, :dependencies => {} }
- Version.new(@spec.last[:dependencies]).instance_eval(&block) if block
- end
- end
-
- class Version
- def initialize(version)
- @version = version
- end
- def dependency(name, *requirement)
- @version[name] = requirement
- end
- end
-
- class << self
- def run!(sources, &block)
- Top.new(sources).instance_eval(&block) if block
- end
- end
-
- end
-
- def initialize
- clear!
- end
- def clear!
- self.sources = { }
- end
- def merge!(options = nil, &block)
- clear! if options && options[:clear]
- Dsl.run!(sources, &block) if block
- end
- def [](name)
- sources[name] ||= {}
- end
-
- private
-
- attr_accessor :sources
-
- end
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/resolution.rb b/vendor/librarian/lib/librarian/resolution.rb
deleted file mode 100644
index b00ec05..0000000
--- a/vendor/librarian/lib/librarian/resolution.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-module Librarian
- #
- # Represents the output of the resolution process. Captures the declared
- # dependencies plus the full set of resolved manifests. The sources are
- # already known by the dependencies and by the resolved manifests, so they do
- # not need to be captured explicitly.
- #
- # This representation may be produced by the resolver, may be serialized into
- # a lockfile, and may be deserialized from a lockfile. It is expected that the
- # lockfile is a direct representation in text of this representation, so that
- # the serialization-deserialization process is just the identity function.
- #
- class Resolution
- attr_reader :dependencies, :manifests, :manifests_index
-
- def initialize(dependencies, manifests)
- @dependencies, @manifests = dependencies, manifests
- @manifests_index = build_manifests_index(manifests)
- end
-
- def correct?
- manifests && manifests_consistent_with_dependencies? && manifests_internally_consistent?
- end
-
- def sources
- manifests.map{|m| m.source}.uniq
- end
-
- private
-
- def build_manifests_index(manifests)
- Hash[manifests.map{|m| [m.name, m]}] if manifests
- end
-
- def manifests_consistent_with_dependencies?
- ManifestSet.new(manifests).in_compliance_with?(dependencies)
- end
-
- def manifests_internally_consistent?
- ManifestSet.new(manifests).consistent?
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/resolver.rb b/vendor/librarian/lib/librarian/resolver.rb
deleted file mode 100644
index 4684517..0000000
--- a/vendor/librarian/lib/librarian/resolver.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-require 'librarian/resolver/implementation'
-require 'librarian/manifest_set'
-require 'librarian/resolution'
-
-module Librarian
- class Resolver
-
- attr_accessor :environment
- private :environment=
-
- def initialize(environment)
- self.environment = environment
- end
-
- def resolve(spec, partial_manifests = [])
- implementation = Implementation.new(self, spec)
- partial_manifests_index = Hash[partial_manifests.map{|m| [m.name, m]}]
- manifests = implementation.resolve(spec.dependencies, partial_manifests_index)
- enforce_consistency!(spec.dependencies, manifests) if manifests
- manifests = sort(manifests) if manifests
- Resolution.new(spec.dependencies, manifests)
- end
-
- def enforce_consistency!(dependencies, manifests)
- return if dependencies.all?{|d|
- m = manifests[d.name]
- m && d.satisfied_by?(m)
- } && ManifestSet.new(manifests).consistent?
-
- debug { "Resolver Malfunctioned!" }
- errors = []
- dependencies.sort_by(&:name).each do |d|
- m = manifests[d.name]
- if !m
- errors << ["Depends on #{d}", "Missing!"]
- elsif !d.satisfied_by?(m)
- errors << ["Depends on #{d}", "Found: #{m}"]
- end
- end
- unless errors.empty?
- errors.each do |a, b|
- debug { " #{a}" }
- debug { " #{b}" }
- end
- end
- manifests.values.sort_by(&:name).each do |manifest|
- errors = []
- manifest.dependencies.sort_by(&:name).each do |d|
- m = manifests[d.name]
- if !m
- errors << ["Depends on: #{d}", "Missing!"]
- elsif !d.satisfied_by?(m)
- errors << ["Depends on: #{d}", "Found: #{m}"]
- end
- end
- unless errors.empty?
- debug { " #{manifest}" }
- errors.each do |a, b|
- debug { " #{a}" }
- debug { " #{b}" }
- end
- end
- end
- raise Error, "Resolver Malfunctioned!"
- end
-
- def sort(manifests)
- ManifestSet.sort(manifests)
- end
-
- private
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/resolver/implementation.rb b/vendor/librarian/lib/librarian/resolver/implementation.rb
deleted file mode 100644
index e78b8a2..0000000
--- a/vendor/librarian/lib/librarian/resolver/implementation.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-require 'librarian/dependency'
-
-module Librarian
- class Resolver
- class Implementation
-
- attr_reader :resolver, :source, :dependency_source_map
-
- def initialize(resolver, spec)
- @resolver = resolver
- @source = spec.source
- @dependency_source_map = Hash[spec.dependencies.map{|d| [d.name, d.source]}]
- @level = 0
- end
-
- def resolve(dependencies, manifests = {})
- dependencies += manifests.values.map { |m|
- m.dependencies.map { |d| sourced_dependency_for(d) }
- }.flatten(1)
- resolution = recursive_resolve([], manifests, dependencies)
- resolution ? resolution[1] : nil
- end
-
- def sourced_dependency_for(dependency)
- return dependency if dependency.source
-
- s = dependency_source_map[dependency.name] || source
- Dependency.new(dependency.name, dependency.requirement, s)
- end
-
- def recursive_resolve(dependencies, manifests, queue)
- if dependencies.empty?
- queue.each do |dependency|
- debug { "Scheduling #{dependency}" }
- end
- end
- failure = false
- until failure || queue.empty?
- dependency = queue.shift
- dependencies << dependency
- debug { "Resolving #{dependency}" }
- scope do
- if manifests.key?(dependency.name)
- unless dependency.satisfied_by?(manifests[dependency.name])
- debug { "Conflicts with #{manifests[dependency.name]}" }
- failure = true
- else
- debug { "Accords with all prior constraints" }
- # nothing left to do
- end
- else
- debug { "No known prior constraints" }
- resolution = nil
- related_dependencies = dependencies.select{|d| d.name == dependency.name}
- unless dependency.manifests && dependency.manifests.first
- debug { "No known manifests" }
- else
- debug { "Checking manifests" }
- scope do
- dependency.manifests.each do |manifest|
- break if resolution
-
- debug { "Checking #{manifest}" }
- scope do
- if related_dependencies.all?{|d| d.satisfied_by?(manifest)}
- m = manifests.merge(dependency.name => manifest)
- a = manifest.dependencies.map { |d| sourced_dependency_for(d) }
- a.each do |d|
- debug { "Scheduling #{d}" }
- end
- q = queue + a
- resolution = recursive_resolve(dependencies.dup, m, q)
- end
- if resolution
- debug { "Resolved #{dependency} at #{manifest}" }
- else
- debug { "Backtracking from #{manifest}" }
- end
- end
- end
- end
- if resolution
- debug { "Resolved #{dependency}" }
- else
- debug { "Failed to resolve #{dependency}" }
- end
- end
- unless resolution
- failure = true
- else
- dependencies, manifests, queue = *resolution
- end
- end
- end
- end
- failure ? nil : [dependencies, manifests, queue]
- end
-
- private
-
- def scope
- @level += 1
- yield
- ensure
- @level -= 1
- end
-
- def debug
- environment.logger.debug { ' ' * @level + yield }
- end
-
- def environment
- resolver.environment
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/source.rb b/vendor/librarian/lib/librarian/source.rb
deleted file mode 100644
index 03ddb4a..0000000
--- a/vendor/librarian/lib/librarian/source.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'librarian/source/git'
-require 'librarian/source/path'
diff --git a/vendor/librarian/lib/librarian/source/git.rb b/vendor/librarian/lib/librarian/source/git.rb
deleted file mode 100644
index 93ef2e1..0000000
--- a/vendor/librarian/lib/librarian/source/git.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-require 'fileutils'
-require 'pathname'
-require 'digest'
-
-require 'librarian/source/git/repository'
-require 'librarian/source/local'
-
-module Librarian
- module Source
- class Git
-
- include Local
-
- class << self
-
- LOCK_NAME = 'GIT'
-
- def lock_name
- LOCK_NAME
- end
-
- def from_lock_options(environment, options)
- new(environment, options[:remote], options.reject{|k, v| k == :remote})
- end
-
- def from_spec_args(environment, uri, options)
- recognized_options = [:ref, :path]
- unrecognized_options = options.keys - recognized_options
- unrecognized_options.empty? or raise Error, "unrecognized options: #{unrecognized_options.join(", ")}"
-
- new(environment, uri, options)
- end
-
- end
-
- DEFAULTS = {
- :ref => 'master'
- }
-
- attr_accessor :environment
- private :environment=
-
- attr_accessor :uri, :ref, :sha, :path
- private :uri=, :ref=, :sha=, :path=
-
- def initialize(environment, uri, options)
- self.environment = environment
- self.uri = uri
- self.ref = options[:ref] || DEFAULTS[:ref]
- self.sha = options[:sha]
- self.path = options[:path]
-
- @repository = nil
- @repository_cache_path = nil
- end
-
- def to_s
- path ? "#{uri}##{ref}(#{path})" : "#{uri}##{ref}"
- end
-
- def ==(other)
- other &&
- self.class == other.class &&
- self.uri == other.uri &&
- self.ref == other.ref &&
- self.path == other.path &&
- (self.sha.nil? || other.sha.nil? || self.sha == other.sha)
- end
-
- alias :eql? :==
-
- def hash
- self.to_s.hash
- end
-
- def to_spec_args
- options = {}
- options.merge!(:ref => ref) if ref != DEFAULTS[:ref]
- options.merge!(:path => path) if path
- [uri, options]
- end
-
- def to_lock_options
- options = {:remote => uri, :ref => ref, :sha => sha}
- options.merge!(:path => path) if path
- options
- end
-
- def pinned?
- !!sha
- end
-
- def unpin!
- @sha = nil
- end
-
- def cache!
- repository_cached? and return or repository_cached!
-
- unless repository.git?
- repository.path.rmtree if repository.path.exist?
- repository.path.mkpath
- repository.clone!(uri)
- end
- repository.reset_hard!
- repository.clean!
- unless repository.checked_out?(sha)
- remote = repository.default_remote
- repository.fetch!(remote)
- repository.fetch!(remote, :tags => true)
-
- self.sha = repository.hash_from(remote, ref) unless sha
- repository.checkout!(sha) unless repository.checked_out?(sha)
-
- raise Error, "failed to checkout #{sha}" unless repository.checked_out?(sha)
- end
- end
-
- private
-
- attr_accessor :repository_cached
- alias repository_cached? repository_cached
-
- def repository_cached!
- self.repository_cached = true
- end
-
- def repository_cache_path
- @repository_cache_path ||= begin
- environment.cache_path.join("source/git/#{cache_key}")
- end
- end
-
- def repository
- @repository ||= begin
- Repository.new(environment, repository_cache_path)
- end
- end
-
- def filesystem_path
- @filesystem_path ||= path ? repository.path.join(path) : repository.path
- end
-
- def cache_key
- @cache_key ||= begin
- uri_part = uri
- path_part = "/#{path}" if path
- ref_part = "##{ref}"
- key_source = [uri_part, path_part, ref_part].join
- Digest::MD5.hexdigest(key_source)
- end
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/source/git/repository.rb b/vendor/librarian/lib/librarian/source/git/repository.rb
deleted file mode 100644
index 42cf67c..0000000
--- a/vendor/librarian/lib/librarian/source/git/repository.rb
+++ /dev/null
@@ -1,217 +0,0 @@
-require 'open3'
-
-module Librarian
- module Source
- class Git
- class Repository
-
- class << self
- def clone!(environment, path, repository_url)
- path = Pathname.new(path)
- path.mkpath
- git = new(environment, path)
- git.clone!(repository_url)
- git
- end
-
- def bin
- @bin ||= which("git") or raise Error, "cannot find git"
- end
-
- private
-
- # Cross-platform way of finding an executable in the $PATH.
- #
- # which('ruby') #=> /usr/bin/ruby
- #
- # From:
- # https://github.com/defunkt/hub/commit/353031307e704d860826fc756ff0070be5e1b430#L2R173
- def which(cmd)
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
- path = File.expand_path(path)
- exts.each do |ext|
- exe = File.join(path, cmd + ext)
- return exe if File.file?(exe) && File.executable?(exe)
- end
- end
- nil
- end
- end
-
- attr_accessor :environment, :path
- private :environment=, :path=
-
- def initialize(environment, path)
- self.environment = environment
- self.path = Pathname.new(path)
- end
-
- def git?
- path.join('.git').exist?
- end
-
- def default_remote
- "origin"
- end
-
- def version(options = { })
- version!(options).strip
- end
-
- def version!(options = { })
- silent = options.delete(:silent)
-
- command = %w(--version)
- run!(command, :silent => silent)
- end
-
- def clone!(repository_url)
- command = %W(clone #{repository_url} . --quiet)
- run!(command, :chdir => true)
- end
-
- def checkout!(reference, options ={ })
- command = %W(checkout #{reference} --quiet)
- command << "--force" if options[:force]
- run!(command, :chdir => true)
- end
-
- def fetch!(remote, options = { })
- command = %W(fetch #{remote} --quiet)
- command << "--tags" if options[:tags]
- run!(command, :chdir => true)
- end
-
- def reset_hard!
- command = %W(reset --hard --quiet)
- run!(command, :chdir => true)
- end
-
- def clean!
- command = %w(clean -x -d --force --force)
- run!(command, :chdir => true)
- end
-
- def checked_out?(sha)
- current_commit_hash == sha
- end
-
- def remote_names
- command = %W(remote)
- run!(command, :chdir => true).strip.lines.map(&:strip)
- end
-
- def remote_branch_names
- remotes = remote_names.sort_by(&:length).reverse
-
- command = %W(branch -r)
- names = run!(command, :chdir => true).strip.lines.map(&:strip).to_a
- names.each{|n| n.gsub!(/\s*->.*$/, "")}
- names.reject!{|n| n =~ /\/HEAD$/}
- Hash[remotes.map do |r|
- matching_names = names.select{|n| n.start_with?("#{r}/")}
- matching_names.each{|n| names.delete(n)}
- matching_names.each{|n| n.slice!(0, r.size + 1)}
- [r, matching_names]
- end]
- end
-
- def hash_from(remote, reference)
- branch_names = remote_branch_names[remote]
- if branch_names.include?(reference)
- reference = "#{remote}/#{reference}"
- end
-
- command = %W(rev-list #{reference} -1)
- run!(command, :chdir => true).strip
- end
-
- def current_commit_hash
- command = %W(rev-parse HEAD --quiet)
- run!(command, :chdir => true).strip!
- end
-
- private
-
- def bin
- self.class.bin
- end
-
- def run!(args, options = { })
- chdir = options.delete(:chdir)
- chdir = path.to_s if chdir == true
-
- silent = options.delete(:silent)
-
- command = [bin]
- command.concat(args)
-
- maybe_within(chdir) do
- logging_command(command, :silent => silent) do
- run_command_internal(command)
- end
- end
- end
-
- def maybe_within(path)
- if path
- Dir.chdir(path) { with_env_var("GIT_DIR", nil) { yield } }
- else
- yield
- end
- end
-
- def with_env_var(name, value)
- original_value = ENV[name]
- begin
- ENV[name] = value
- yield
- ensure
- ENV[name] = original_value
- end
- end
-
- def logging_command(command, options)
- silent = options.delete(:silent)
-
- pwd = Dir.pwd
-
- unless silent
- debug { "Running `#{command.join(' ')}` in #{relative_path_to(pwd)}" }
- end
-
- out = yield
-
- unless silent
- if out.size > 0
- out.lines.each do |line|
- debug { " --> #{line}" }
- end
- else
- debug { " --- No output" }
- end
- end
-
- out
- end
-
- def run_command_internal(command)
- Open3.popen3(*command) do |i, o, e, t|
- raise StandardError, e.read unless (t ? t.value : $?).success?
- o.read
- end
- end
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- def relative_path_to(path)
- environment.logger.relative_path_to(path)
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/source/local.rb b/vendor/librarian/lib/librarian/source/local.rb
deleted file mode 100644
index 2fce92a..0000000
--- a/vendor/librarian/lib/librarian/source/local.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-require 'librarian/support/abstract_method'
-
-module Librarian
- module Source
- # Requires that the including source class have methods:
- # #path
- # #environment
- module Local
-
- include Support::AbstractMethod
-
- abstract_method :path, :fetch_version, :fetch_dependencies
-
- def manifests(name)
- manifest = Manifest.new(self, name)
- [manifest].compact
- end
-
- def manifest(name, version, dependencies)
- manifest = Manifest.new(self, name)
- manifest.version = version
- manifest.dependencies = dependencies
- manifest
- end
-
- def manifest_search_paths(name)
- @manifest_search_paths ||= { }
- @manifest_search_paths[name] ||= begin
- cache!
- paths = [filesystem_path, filesystem_path.join(name)]
- paths.select{|s| s.exist?}
- end
- end
-
- def found_path(name)
- @_found_paths ||= { }
- @_found_paths[name] ||= begin
- paths = manifest_search_paths(name)
- paths.find{|p| manifest?(name, p)}
- end
- end
-
- private
-
- abstract_method :manifest? # (name, path) -> boolean
-
- def info(*args, &block)
- environment.logger.info(*args, &block)
- end
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- def relative_path_to(path)
- environment.logger.relative_path_to(path)
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/source/path.rb b/vendor/librarian/lib/librarian/source/path.rb
deleted file mode 100644
index ed60129..0000000
--- a/vendor/librarian/lib/librarian/source/path.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-require 'librarian/source/local'
-
-module Librarian
- module Source
- class Path
-
- include Local
-
- class << self
-
- LOCK_NAME = 'PATH'
-
- def lock_name
- LOCK_NAME
- end
-
- def from_lock_options(environment, options)
- new(environment, options[:remote], options.reject{|k, v| k == :remote})
- end
-
- def from_spec_args(environment, path, options)
- recognized_options = []
- unrecognized_options = options.keys - recognized_options
- unrecognized_options.empty? or raise Error, "unrecognized options: #{unrecognized_options.join(", ")}"
-
- new(environment, path, options)
- end
-
- end
-
- attr_accessor :environment
- private :environment=
- attr_reader :path
-
- def initialize(environment, path, options)
- self.environment = environment
- @path = path
- end
-
- def to_s
- path.to_s
- end
-
- def ==(other)
- other &&
- self.class == other.class &&
- self.path == other.path
- end
-
- alias :eql? :==
-
- def hash
- self.to_s.hash
- end
-
- def to_spec_args
- [path.to_s, {}]
- end
-
- def to_lock_options
- {:remote => path}
- end
-
- def pinned?
- false
- end
-
- def unpin!
- end
-
- def cache!
- end
-
- def filesystem_path
- @filesystem_path ||= Pathname.new(path).expand_path(environment.project_path)
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/spec.rb b/vendor/librarian/lib/librarian/spec.rb
deleted file mode 100644
index 3225e07..0000000
--- a/vendor/librarian/lib/librarian/spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Librarian
- class Spec
-
- attr_accessor :source, :dependencies
- private :source=, :dependencies=
-
- def initialize(source, dependencies)
- self.source = source
- self.dependencies = dependencies
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/spec_change_set.rb b/vendor/librarian/lib/librarian/spec_change_set.rb
deleted file mode 100644
index 2f3cbdc..0000000
--- a/vendor/librarian/lib/librarian/spec_change_set.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-require 'librarian/helpers'
-
-require 'librarian/manifest_set'
-require 'librarian/resolution'
-require 'librarian/spec'
-
-module Librarian
- class SpecChangeSet
-
- attr_accessor :environment
- private :environment=
- attr_reader :spec, :lock
-
- def initialize(environment, spec, lock)
- self.environment = environment
- raise TypeError, "can't convert #{spec.class} into #{Spec}" unless Spec === spec
- raise TypeError, "can't convert #{lock.class} into #{Resolution}" unless Resolution === lock
- @spec, @lock = spec, lock
- end
-
- def same?
- @same ||= spec.dependencies.sort_by{|d| d.name} == lock.dependencies.sort_by{|d| d.name}
- end
-
- def changed?
- !same?
- end
-
- def spec_dependencies
- @spec_dependencies ||= spec.dependencies
- end
- def spec_dependency_names
- @spec_dependency_names ||= Set.new(spec_dependencies.map{|d| d.name})
- end
- def spec_dependency_index
- @spec_dependency_index ||= Hash[spec_dependencies.map{|d| [d.name, d]}]
- end
-
- def lock_dependencies
- @lock_dependencies ||= lock.dependencies
- end
- def lock_dependency_names
- @lock_dependency_names ||= Set.new(lock_dependencies.map{|d| d.name})
- end
- def lock_dependency_index
- @lock_dependency_index ||= Hash[lock_dependencies.map{|d| [d.name, d]}]
- end
-
- def lock_manifests
- @lock_manifests ||= lock.manifests
- end
- def lock_manifests_index
- @lock_manifests_index ||= ManifestSet.new(lock_manifests).to_hash
- end
-
- def removed_dependency_names
- @removed_dependency_names ||= lock_dependency_names - spec_dependency_names
- end
-
- # A dependency which is deleted from the specfile will, in the general case,
- # be removed conservatively. This means it might not actually be removed.
- # But if the dependency originally declared a source which is now non-
- # default, it must be removed, even if another dependency has a transitive
- # dependency on the one that was removed (which is the scenario in which
- # a conservative removal would not remove it). In this case, we must also
- # remove it explicitly so that it can be re-resolved from the default
- # source.
- def explicit_removed_dependency_names
- @explicit_removed_dependency_names ||= removed_dependency_names.reject do |name|
- lock_manifest = lock_manifests_index[name]
- lock_manifest.source == spec.source
- end.to_set
- end
-
- def added_dependency_names
- @added_dependency_names ||= spec_dependency_names - lock_dependency_names
- end
-
- def nonmatching_added_dependency_names
- @nonmatching_added_dependency_names ||= added_dependency_names.reject do |name|
- spec_dependency = spec_dependency_index[name]
- lock_manifest = lock_manifests_index[name]
- if lock_manifest
- matching = true
- matching &&= spec_dependency.satisfied_by?(lock_manifest)
- matching &&= spec_dependency.source == lock_manifest.source
- matching
- else
- false
- end
- end.to_set
- end
-
- def common_dependency_names
- @common_dependency_names ||= lock_dependency_names & spec_dependency_names
- end
-
- def changed_dependency_names
- @changed_dependency_names ||= common_dependency_names.reject do |name|
- spec_dependency = spec_dependency_index[name]
- lock_dependency = lock_dependency_index[name]
- lock_manifest = lock_manifests_index[name]
- same = true
- same &&= spec_dependency.satisfied_by?(lock_manifest)
- same &&= spec_dependency.source == lock_dependency.source
- same
- end.to_set
- end
-
- def deep_keep_manifest_names
- @deep_keep_manifest_names ||= begin
- lock_dependency_names - (
- removed_dependency_names +
- changed_dependency_names +
- nonmatching_added_dependency_names
- )
- end
- end
-
- def shallow_strip_manifest_names
- @shallow_strip_manifest_names ||= begin
- explicit_removed_dependency_names + changed_dependency_names
- end
- end
-
- def inspect
- Helpers.strip_heredoc(<<-INSPECT)
- <##{self.class.name}:
- Removed: #{removed_dependency_names.to_a.join(", ")}
- ExplicitRemoved: #{explicit_removed_dependency_names.to_a.join(", ")}
- Added: #{added_dependency_names.to_a.join(", ")}
- NonMatchingAdded: #{nonmatching_added_dependency_names.to_a.join(", ")}
- Changed: #{changed_dependency_names.to_a.join(", ")}
- DeepKeep: #{deep_keep_manifest_names.to_a.join(", ")}
- ShallowStrip: #{shallow_strip_manifest_names.to_a.join(", ")}
- >
- INSPECT
- end
-
- # Returns an array of those manifests from the previous spec which should be kept,
- # based on inspecting the new spec against the locked resolution from the previous spec.
- def analyze
- @analyze ||= begin
- debug { "Analyzing spec and lock:" }
-
- if same?
- debug { " Same!" }
- return lock.manifests
- end
-
- debug { " Removed:" } ; removed_dependency_names.each { |name| debug { " #{name}" } }
- debug { " ExplicitRemoved:" } ; explicit_removed_dependency_names.each { |name| debug { " #{name}" } }
- debug { " Added:" } ; added_dependency_names.each { |name| debug { " #{name}" } }
- debug { " NonMatchingAdded:" } ; nonmatching_added_dependency_names.each { |name| debug { " #{name}" } }
- debug { " Changed:" } ; changed_dependency_names.each { |name| debug { " #{name}" } }
- debug { " DeepKeep:" } ; deep_keep_manifest_names.each { |name| debug { " #{name}" } }
- debug { " ShallowStrip:" } ; shallow_strip_manifest_names.each { |name| debug { " #{name}" } }
-
- manifests = ManifestSet.new(lock_manifests)
- manifests.deep_keep!(deep_keep_manifest_names)
- manifests.shallow_strip!(shallow_strip_manifest_names)
- manifests.to_a
- end
- end
-
- private
-
- def debug(*args, &block)
- environment.logger.debug(*args, &block)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/specfile.rb b/vendor/librarian/lib/librarian/specfile.rb
deleted file mode 100644
index 8172aac..0000000
--- a/vendor/librarian/lib/librarian/specfile.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-module Librarian
- class Specfile
-
- attr_accessor :environment
- private :environment=
- attr_reader :path, :dependencies, :source
-
- def initialize(environment, path)
- self.environment = environment
- @path = path
- end
-
- def read(precache_sources = [])
- environment.dsl(path.read, precache_sources)
- end
-
- end
-end
diff --git a/vendor/librarian/lib/librarian/support/abstract_method.rb b/vendor/librarian/lib/librarian/support/abstract_method.rb
deleted file mode 100644
index a4019ac..0000000
--- a/vendor/librarian/lib/librarian/support/abstract_method.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module Librarian
- module Support
- module AbstractMethod
-
- class << self
- def included(base)
- base.extend ClassMethods
- end
- end
-
- module ClassMethods
- def abstract_method(*names)
- names.reject{|name| respond_to?(name)}.each do |name, *args|
- define_method(name) { raise Exception, "Method #{self.class.name}##{name} is abstract!" }
- end
- end
- end
-
- end
- end
-end
diff --git a/vendor/librarian/lib/librarian/ui.rb b/vendor/librarian/lib/librarian/ui.rb
deleted file mode 100644
index bd64455..0000000
--- a/vendor/librarian/lib/librarian/ui.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-require 'rubygems/user_interaction'
-
-module Librarian
- class UI
- def warn(message = nil)
- end
-
- def debug(message = nil)
- end
-
- def error(message = nil)
- end
-
- def info(message = nil)
- end
-
- def confirm(message = nil)
- end
-
- class Shell < UI
- attr_writer :shell
- attr_reader :debug_line_numbers
-
- def initialize(shell)
- @shell = shell
- @quiet = false
- @debug = ENV['DEBUG']
- @debug_line_numbers = false
- end
-
- def debug(message = nil)
- @shell.say(message || yield) if @debug && !@quiet
- end
-
- def info(message = nil)
- @shell.say(message || yield) if !@quiet
- end
-
- def confirm(message = nil)
- @shell.say(message || yield, :green) if !@quiet
- end
-
- def warn(message = nil)
- @shell.say(message || yield, :yellow)
- end
-
- def error(message = nil)
- @shell.say(message || yield, :red)
- end
-
- def be_quiet!
- @quiet = true
- end
-
- def debug!
- @debug = true
- end
-
- def debug_line_numbers!
- @debug_line_numbers = true
- end
- end
- end
-end
\ No newline at end of file
diff --git a/vendor/librarian/lib/librarian/version.rb b/vendor/librarian/lib/librarian/version.rb
deleted file mode 100644
index bd2daa4..0000000
--- a/vendor/librarian/lib/librarian/version.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-module Librarian
- VERSION = "0.0.24"
-end
diff --git a/vendor/librarian/librarian.gemspec b/vendor/librarian/librarian.gemspec
deleted file mode 100644
index f1d7984..0000000
--- a/vendor/librarian/librarian.gemspec
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- encoding: utf-8 -*-
-$:.push File.expand_path("../lib", __FILE__)
-require "librarian/version"
-
-Gem::Specification.new do |s|
- s.name = "librarian"
- s.version = Librarian::VERSION
- s.platform = Gem::Platform::RUBY
- s.authors = ["Jay Feldblum"]
- s.email = ["y_feldblum at yahoo.com"]
- s.homepage = ""
- s.summary = %q{Librarian}
- s.description = %q{Librarian}
-
- s.rubyforge_project = "librarian"
-
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- s.require_paths = ["lib"]
-
- s.add_dependency "thor", "~> 0.15"
-
- s.add_development_dependency "rake"
- s.add_development_dependency "rspec"
- s.add_development_dependency "cucumber"
- s.add_development_dependency "aruba"
- s.add_development_dependency "webmock"
- s.add_development_dependency "fakefs"
-
- s.add_dependency "chef", ">= 0.10"
- s.add_dependency "highline"
- s.add_dependency "archive-tar-minitar", ">= 0.5.2"
-end
diff --git a/vendor/librarian/spec/functional/chef/source/git_spec.rb b/vendor/librarian/spec/functional/chef/source/git_spec.rb
deleted file mode 100644
index faa0d23..0000000
--- a/vendor/librarian/spec/functional/chef/source/git_spec.rb
+++ /dev/null
@@ -1,432 +0,0 @@
-require 'pathname'
-require 'securerandom'
-
-require 'librarian'
-require 'librarian/helpers'
-require 'librarian/error'
-require 'librarian/action/resolve'
-require 'librarian/action/install'
-require 'librarian/action/update'
-require 'librarian/chef'
-
-module Librarian
- module Chef
- module Source
- describe Git do
-
- let(:project_path) do
- project_path = Pathname.new(__FILE__).expand_path
- project_path = project_path.dirname until project_path.join("Rakefile").exist?
- project_path
- end
- let(:tmp_path) { project_path.join("tmp/spec/chef/git-source") }
-
- let(:cookbooks_path) { tmp_path.join("cookbooks") }
-
- # depends on repo_path being defined in each context
- let(:env) { Environment.new(:project_path => repo_path) }
-
- context "a single dependency with a git source" do
-
- let(:sample_path) { tmp_path.join("sample") }
- let(:sample_metadata) do
- Helpers.strip_heredoc(<<-METADATA)
- version "0.6.5"
- METADATA
- end
-
- let(:first_sample_path) { cookbooks_path.join("first-sample") }
- let(:first_sample_metadata) do
- Helpers.strip_heredoc(<<-METADATA)
- version "3.2.1"
- METADATA
- end
-
- let(:second_sample_path) { cookbooks_path.join("second-sample") }
- let(:second_sample_metadata) do
- Helpers.strip_heredoc(<<-METADATA)
- version "4.3.2"
- METADATA
- end
-
- before :all do
- sample_path.rmtree if sample_path.exist?
- sample_path.mkpath
- sample_path.join("metadata.rb").open("wb") { |f| f.write(sample_metadata) }
- Dir.chdir(sample_path) do
- `git init`
- `git add metadata.rb`
- `git commit -m "Initial commit."`
- end
-
- cookbooks_path.rmtree if cookbooks_path.exist?
- cookbooks_path.mkpath
- first_sample_path.mkpath
- first_sample_path.join("metadata.rb").open("wb") { |f| f.write(first_sample_metadata) }
- second_sample_path.mkpath
- second_sample_path.join("metadata.rb").open("wb") { |f| f.write(second_sample_metadata) }
- Dir.chdir(cookbooks_path) do
- `git init`
- `git add .`
- `git commit -m "Initial commit."`
- end
- end
-
- context "resolving" do
- let(:repo_path) { tmp_path.join("repo/resolve") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :git => #{sample_path.to_s.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- context "the resolve" do
- it "should not raise an exception" do
- expect { Action::Resolve.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Resolve.new(env).run }
-
- it "should create the lockfile" do
- repo_path.join("Cheffile.lock").should exist
- end
-
- it "should not attempt to install the sample cookbok" do
- repo_path.join("cookbooks/sample").should_not exist
- end
- end
- end
-
- context "installing" do
- let(:repo_path) { tmp_path.join("repo/install") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :git => #{sample_path.to_s.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
-
- Action::Resolve.new(env).run
- end
-
- context "the install" do
- it "should not raise an exception" do
- expect { Action::Install.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Install.new(env).run }
-
- it "should create the lockfile" do
- repo_path.join("Cheffile.lock").should exist
- end
-
- it "should create the directory for the cookbook" do
- repo_path.join("cookbooks/sample").should exist
- end
-
- it "should copy the cookbook files into the cookbook directory" do
- repo_path.join("cookbooks/sample/metadata.rb").should exist
- end
- end
- end
-
- context "resolving and and separately installing" do
- let(:repo_path) { tmp_path.join("repo/resolve-install") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :git => #{sample_path.to_s.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
-
- Action::Resolve.new(env).run
- repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
- end
-
- context "the install" do
- it "should not raise an exception" do
- expect { Action::Install.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Install.new(env).run }
-
- it "should create the directory for the cookbook" do
- repo_path.join("cookbooks/sample").should exist
- end
-
- it "should copy the cookbook files into the cookbook directory" do
- repo_path.join("cookbooks/sample/metadata.rb").should exist
- end
- end
- end
-
- context "resolving, changing, and resolving" do
- let(:repo_path) { tmp_path.join("repo/resolve-update") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- git #{cookbooks_path.to_s.inspect}
- cookbook "first-sample"
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- Action::Resolve.new(env).run
-
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- git #{cookbooks_path.to_s.inspect}
- cookbook "first-sample"
- cookbook "second-sample"
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- context "the second resolve" do
- it "should not raise an exception" do
- expect { Action::Resolve.new(env).run }.to_not raise_error
- end
- end
- end
-
- end
-
- context "with a path" do
-
- let(:git_path) { tmp_path.join("big-git-repo") }
- let(:sample_path) { git_path.join("buttercup") }
- let(:sample_metadata) do
- Helpers.strip_heredoc(<<-METADATA)
- version "0.6.5"
- METADATA
- end
-
- before :all do
- git_path.rmtree if git_path.exist?
- git_path.mkpath
- sample_path.mkpath
- sample_path.join("metadata.rb").open("wb") { |f| f.write(sample_metadata) }
- Dir.chdir(git_path) do
- `git init`
- `git add .`
- `git commit -m "Initial commit."`
- end
- end
-
- context "if no path option is given" do
- let(:repo_path) { tmp_path.join("repo/resolve") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample",
- :git => #{git_path.to_s.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- it "should not resolve" do
- expect{ Action::Resolve.new(env).run }.to raise_error
- end
- end
-
- context "if the path option is wrong" do
- let(:repo_path) { tmp_path.join("repo/resolve") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample",
- :git => #{git_path.to_s.inspect},
- :path => "jelly"
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- it "should not resolve" do
- expect{ Action::Resolve.new(env).run }.to raise_error
- end
- end
-
- context "if the path option is right" do
- let(:repo_path) { tmp_path.join("repo/resolve") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample",
- :git => #{git_path.to_s.inspect},
- :path => "buttercup"
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- context "the resolve" do
- it "should not raise an exception" do
- expect { Action::Resolve.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Resolve.new(env).run }
-
- it "should create the lockfile" do
- repo_path.join("Cheffile.lock").should exist
- end
- end
- end
-
- end
-
- context "missing a metadata" do
- let(:git_path) { tmp_path.join("big-git-repo") }
- let(:repo_path) { tmp_path.join("repo/resolve") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- cookbook "sample",
- :git => #{git_path.to_s.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- context "the resolve" do
- it "should raise an exception" do
- expect { Action::Resolve.new(env).run }.to raise_error
- end
-
- it "should explain the problem" do
- expect { Action::Resolve.new(env).run }.
- to raise_error(Error, /no metadata file found/i)
- end
- end
-
- context "the results" do
- before { Action::Resolve.new(env).run rescue nil }
-
- it "should not create the lockfile" do
- repo_path.join("Cheffile.lock").should_not exist
- end
-
- it "should not create the directory for the cookbook" do
- repo_path.join("cookbooks/sample").should_not exist
- end
- end
- end
-
- context "when upstream updates" do
- let(:git_path) { tmp_path.join("upstream-updates-repo") }
- let(:repo_path) { tmp_path.join("repo/resolve-with-upstream-updates") }
-
- let(:sample_metadata) do
- Helpers.strip_heredoc(<<-METADATA)
- version "0.6.5"
- METADATA
- end
- before do
-
- # set up the git repo as normal, but let's also set up a release-stable branch
- # from which our Cheffile will only pull stable releases
- git_path.rmtree if git_path.exist?
- git_path.mkpath
- git_path.join("metadata.rb").open("w+b"){|f| f.write(sample_metadata)}
-
- Dir.chdir(git_path) do
- `git init`
- `git add metadata.rb`
- `git commit -m "Initial Commit."`
- `git checkout -b some-branch --quiet`
- `echo 'hi' > some-file`
- `git add some-file`
- `git commit -m 'Some File.'`
- `git checkout master --quiet`
- end
-
- # set up the chef repo as normal, except the Cheffile points to the release-stable
- # branch - we expect when the upstream copy of that branch is changed, then we can
- # fetch & merge those changes when we update
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- cookbook "sample",
- :git => #{git_path.to_s.inspect},
- :ref => "some-branch"
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- Action::Resolve.new(env).run
-
- # change the upstream copy of that branch: we expect to be able to pull the latest
- # when we re-resolve
- Dir.chdir(git_path) do
- `git checkout some-branch --quiet`
- `echo 'ho' > some-other-file`
- `git add some-other-file`
- `git commit -m 'Some Other File.'`
- `git checkout master --quiet`
- end
- end
-
- let(:metadata_file) { repo_path.join("cookbooks/sample/metadata.rb") }
- let(:old_code_file) { repo_path.join("cookbooks/sample/some-file") }
- let(:new_code_file) { repo_path.join("cookbooks/sample/some-other-file") }
-
- context "when updating not a cookbook from that source" do
- before do
- Action::Update.new(env).run
- end
-
- it "should pull the tip from upstream" do
- Action::Install.new(env).run
-
- metadata_file.should exist #sanity
- old_code_file.should exist #sanity
-
- new_code_file.should_not exist # the assertion
- end
- end
-
- context "when updating a cookbook from that source" do
- before do
- Action::Update.new(env, :names => %w(sample)).run
- end
-
- it "should pull the tip from upstream" do
- Action::Install.new(env).run
-
- metadata_file.should exist #sanity
- old_code_file.should exist #sanity
-
- new_code_file.should exist # the assertion
- end
- end
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/spec/functional/chef/source/site_spec.rb b/vendor/librarian/spec/functional/chef/source/site_spec.rb
deleted file mode 100644
index 2136af1..0000000
--- a/vendor/librarian/spec/functional/chef/source/site_spec.rb
+++ /dev/null
@@ -1,215 +0,0 @@
-require 'pathname'
-require 'json'
-require 'webmock'
-
-require 'librarian'
-require 'librarian/helpers'
-require 'librarian/action/resolve'
-require 'librarian/action/install'
-require 'librarian/chef'
-
-module Librarian
- module Chef
- module Source
- describe Site do
-
- include WebMock::API
-
- let(:project_path) do
- project_path = Pathname.new(__FILE__).expand_path
- project_path = project_path.dirname until project_path.join("Rakefile").exist?
- project_path
- end
- let(:tmp_path) { project_path.join("tmp/spec/chef/site-source") }
- let(:sample_path) { tmp_path.join("sample") }
- let(:sample_metadata) do
- Helpers.strip_heredoc(<<-METADATA)
- version "0.6.5"
- METADATA
- end
-
- let(:api_url) { "http://site.cookbooks.com" }
-
- let(:sample_index_data) do
- {
- "name" => "sample",
- "versions" => [
- "#{api_url}/cookbooks/sample/versions/0_6_5"
- ]
- }
- end
- let(:sample_0_6_5_data) do
- {
- "version" => "0.6.5",
- "file" => "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz"
- }
- end
-
- # depends on repo_path being defined in each context
- let(:env) { Environment.new(:project_path => repo_path) }
-
- before :all do
- sample_path.rmtree if sample_path.exist?
- sample_path.mkpath
- sample_path.join("metadata.rb").open("wb") { |f| f.write(sample_metadata) }
- Dir.chdir(sample_path.dirname) do
- system "tar --create --gzip --file sample.tar.gz #{sample_path.basename}"
- end
- end
-
- before do
- stub_request(:get, "#{api_url}/cookbooks/sample").
- to_return(:body => JSON.dump(sample_index_data))
-
- stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5").
- to_return(:body => JSON.dump(sample_0_6_5_data))
-
- stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz").
- to_return(:body => sample_path.dirname.join("sample.tar.gz").read)
- end
-
- after do
- WebMock.reset!
- end
-
- context "a single dependency with a site source" do
-
- context "resolving" do
- let(:repo_path) { tmp_path.join("repo/resolve") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :site => #{api_url.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- context "the resolve" do
- it "should not raise an exception" do
- expect { Action::Resolve.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Resolve.new(env).run }
-
- it "should create the lockfile" do
- repo_path.join("Cheffile.lock").should exist
- end
-
- it "should not attempt to install the cookbok" do
- repo_path.join("cookbooks/sample").should_not exist
- end
- end
- end
-
- context "intalling" do
- let(:repo_path) { tmp_path.join("repo/install") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :site => #{api_url.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
-
- Action::Resolve.new(env).run
- end
-
- context "the install" do
- it "should not raise an exception" do
- expect { Action::Install.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Install.new(env).run }
-
- it "should create the lockfile" do
- repo_path.join("Cheffile.lock").should exist
- end
-
- it "should create a directory for the cookbook" do
- repo_path.join("cookbooks/sample").should exist
- end
-
- it "should copy the cookbook files into the cookbook directory" do
- repo_path.join("cookbooks/sample/metadata.rb").should exist
- end
- end
- end
-
- context "resolving and separately installing" do
- let(:repo_path) { tmp_path.join("repo/resolve-install") }
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :site => #{api_url.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
-
- Action::Resolve.new(env).run
- repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
- end
-
- context "the install" do
- it "should not raise an exception" do
- expect { Action::Install.new(env).run }.to_not raise_error
- end
- end
-
- context "the results" do
- before { Action::Install.new(env).run }
-
- it "should create a directory for the cookbook" do
- repo_path.join("cookbooks/sample").should exist
- end
-
- it "should copy the cookbook files into the cookbook directory" do
- repo_path.join("cookbooks/sample/metadata.rb").should exist
- end
- end
- end
-
- end
-
- context "when the repo path has a space" do
-
- let(:repo_path) { tmp_path.join("repo/with extra spaces/resolve") }
-
- before do
- repo_path.rmtree if repo_path.exist?
- repo_path.mkpath
- repo_path.join("cookbooks").mkpath
-
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
- #!/usr/bin/env ruby
- cookbook "sample", :site => #{api_url.inspect}
- CHEFFILE
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
- end
-
- after do
- repo_path.rmtree
- end
-
- context "the resolution" do
- it "should not raise an exception" do
- expect { Action::Resolve.new(env).run }.to_not raise_error
- end
- end
-
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/spec/functional/source/git/repository_spec.rb b/vendor/librarian/spec/functional/source/git/repository_spec.rb
deleted file mode 100644
index 7f0f953..0000000
--- a/vendor/librarian/spec/functional/source/git/repository_spec.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-require "fileutils"
-require "pathname"
-require "securerandom"
-
-require "librarian/source/git/repository"
-
-describe Librarian::Source::Git::Repository do
-
- let(:env) do
- double(:ui => nil, :logger => double(:debug => nil, :info => nil))
- end
-
- let(:project_path) do
- project_path = Pathname.new(__FILE__).expand_path
- project_path = project_path.dirname until project_path.join("Rakefile").exist?
- project_path
- end
- let(:tmp_path) { project_path + "tmp/spec/unit/source/git/repository-spec" }
- let(:git_source_path) { tmp_path + SecureRandom.hex(16) }
- let(:branch) { "the-branch" }
- let(:tag) { "the-tag" }
- let(:atag) { "the-atag" }
-
- before do
- git_source_path.mkpath
- Dir.chdir(git_source_path) do
- `git init`
-
- # master
- `touch butter.txt`
- `git add butter.txt`
- `git commit -m "Initial Commit"`
-
- # branch
- `git checkout -b #{branch} --quiet`
- `touch jam.txt`
- `git add jam.txt`
- `git commit -m "Branch Commit"`
- `git checkout master --quiet`
-
- # tag
- `git checkout -b deletable --quiet`
- `touch jelly.txt`
- `git add jelly.txt`
- `git commit -m "Tag Commit"`
- `git tag #{tag}`
- `git checkout master --quiet`
- `git branch -D deletable`
-
- # annotated tag
- `git checkout -b deletable --quiet`
- `touch jelly.txt`
- `git add jelly.txt`
- `git commit -m "Tag Commit"`
- `git tag -am "Annotated Tag Commit" #{atag}`
- `git checkout master --quiet`
- `git branch -D deletable`
- end
- end
-
- context "the original" do
- subject { described_class.new(env, git_source_path) }
-
- it "should recognize it" do
- subject.should be_git
- end
-
- it "should not list any remotes for it" do
- subject.remote_names.should be_empty
- end
-
- it "should not list any remote branches for it" do
- subject.remote_branch_names.should be_empty
- end
- end
-
- context "a clone" do
- let(:git_clone_path) { tmp_path + SecureRandom.hex(16) }
- subject { described_class.clone!(env, git_clone_path, git_source_path) }
-
- let(:master_sha) { subject.hash_from("origin", "master") }
- let(:branch_sha) { subject.hash_from("origin", branch) }
- let(:tag_sha) { subject.hash_from("origin", tag) }
- let(:atag_sha) { subject.hash_from("origin", atag) }
-
- it "should recognize it" do
- subject.should be_git
- end
-
- it "should have a single remote for it" do
- subject.should have(1).remote_names
- end
-
- it "should have a remote with the expected name" do
- subject.remote_names.first.should == "origin"
- end
-
- it "should have the remote branch" do
- subject.remote_branch_names["origin"].should include branch
- end
-
- it "should be checked out on the master" do
- subject.should be_checked_out(master_sha)
- end
-
- context "checking out the branch" do
- before do
- subject.checkout! branch
- end
-
- it "should be checked out on the branch" do
- subject.should be_checked_out(branch_sha)
- end
-
- it "should not be checked out on the master" do
- subject.should_not be_checked_out(master_sha)
- end
- end
-
- context "checking out the tag" do
- before do
- subject.checkout! tag
- end
-
- it "should be checked out on the tag" do
- subject.should be_checked_out(tag_sha)
- end
-
- it "should not be checked out on the master" do
- subject.should_not be_checked_out(master_sha)
- end
- end
-
- context "checking out the annotated tag" do
- before do
- subject.checkout! atag
- end
-
- it "should be checked out on the annotated tag" do
- subject.should be_checked_out(atag_sha)
- end
-
- it "should not be checked out on the master" do
- subject.should_not be_checked_out(master_sha)
- end
- end
- end
-
-end
diff --git a/vendor/librarian/spec/unit/action/base_spec.rb b/vendor/librarian/spec/unit/action/base_spec.rb
deleted file mode 100644
index ef2d1f7..0000000
--- a/vendor/librarian/spec/unit/action/base_spec.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require "librarian/action/base"
-
-module Librarian
- describe Action::Base do
-
- let(:env) { mock }
- let(:action) { described_class.new(env) }
-
- subject { action }
-
- it { should respond_to :environment }
-
- it "should have the environment that was assigned to it" do
- action.environment.should be env
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/action/clean_spec.rb b/vendor/librarian/spec/unit/action/clean_spec.rb
deleted file mode 100644
index 7110af4..0000000
--- a/vendor/librarian/spec/unit/action/clean_spec.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-require "librarian/action/clean"
-
-module Librarian
- describe Action::Clean do
-
- let(:env) { mock }
- let(:action) { described_class.new(env) }
-
- before do
- action.stub(:debug)
- end
-
- describe "#run" do
-
- describe "behavior" do
-
- after do
- action.run
- end
-
- describe "clearing the cache path" do
-
- before do
- action.stub(:clean_install_path)
- end
-
- context "when the cache path is missing" do
- before do
- env.stub_chain(:cache_path, :exist?) { false }
- end
-
- it "should not try to clear the cache path" do
- env.cache_path.should_receive(:rmtree).never
- end
- end
-
- context "when the cache path is present" do
- before do
- env.stub_chain(:cache_path, :exist?) { true }
- end
-
- it "should try to clear the cache path" do
- env.cache_path.should_receive(:rmtree).exactly(:once)
- end
- end
-
- end
-
- describe "clearing the install path" do
-
- before do
- action.stub(:clean_cache_path)
- end
-
- context "when the install path is missing" do
- before do
- env.stub_chain(:install_path, :exist?) { false }
- end
-
- it "should not try to clear the install path" do
- env.install_path.should_receive(:children).never
- end
- end
-
- context "when the install path is present" do
- before do
- env.stub_chain(:install_path, :exist?) { true }
- end
-
- it "should try to clear the install path" do
- children = [mock, mock, mock]
- children.each do |child|
- child.stub(:file?) { false }
- end
- env.stub_chain(:install_path, :children) { children }
-
- children.each do |child|
- child.should_receive(:rmtree).exactly(:once)
- end
- end
-
- it "should only try to clear out directories from the install path, not files" do
- children = [mock(:file? => false), mock(:file? => true), mock(:file? => true)]
- env.stub_chain(:install_path, :children) { children }
-
- children.select(&:file?).each do |child|
- child.should_receive(:rmtree).never
- end
- children.reject(&:file?).each do |child|
- child.should_receive(:rmtree).exactly(:once)
- end
- end
- end
-
- end
-
- end
-
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/action/ensure_spec.rb b/vendor/librarian/spec/unit/action/ensure_spec.rb
deleted file mode 100644
index f4f6645..0000000
--- a/vendor/librarian/spec/unit/action/ensure_spec.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-require "tmpdir"
-
-require "librarian/error"
-require "librarian/action/ensure"
-
-module Librarian
- describe Action::Ensure do
-
- let(:env) { mock }
- let(:action) { described_class.new(env) }
-
- before do
- env.stub(:specfile_name) { "Specfile" }
- end
-
- describe "#run" do
-
- context "when the environment does not know its project path" do
- before { env.stub(:project_path) { nil } }
-
- it "should raise an error describing that the specfile is mising" do
- expect { action.run }.to raise_error(Error, "Cannot find Specfile!")
- end
- end
-
- context "when the environment knows its project path" do
- before { env.stub(:project_path) { Dir.tmpdir } }
-
- it "should not raise an error" do
- expect { action.run }.to_not raise_error
- end
- end
-
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/action/install_spec.rb b/vendor/librarian/spec/unit/action/install_spec.rb
deleted file mode 100644
index 3c3a24b..0000000
--- a/vendor/librarian/spec/unit/action/install_spec.rb
+++ /dev/null
@@ -1,111 +0,0 @@
-require "librarian/error"
-require "librarian/action/install"
-
-module Librarian
- describe Action::Install do
-
- let(:env) { mock(:specfile_name => "Specfile", :lockfile_name => "Specfile.lock") }
- let(:action) { described_class.new(env) }
-
- describe "#run" do
-
- describe "behavior" do
-
- describe "checking preconditions" do
-
- context "when the specfile is missing" do
- before do
- env.stub_chain(:specfile_path, :exist?) { false }
- end
-
- it "should raise an error explaining that the specfile is missing" do
- expect { action.run }.to raise_error(Error, "Specfile missing!")
- end
- end
-
- context "when the specfile is present but the lockfile is missing" do
- before do
- env.stub_chain(:specfile_path, :exist?) { true }
- env.stub_chain(:lockfile_path, :exist?) { false }
- end
-
- it "should raise an error explaining that the lockfile is missing" do
- expect { action.run }.to raise_error(Error, "Specfile.lock missing!")
- end
- end
-
- context "when the specfile and lockfile are present but inconsistent" do
- before do
- env.stub_chain(:specfile_path, :exist?) { true }
- env.stub_chain(:lockfile_path, :exist?) { true }
- action.stub(:spec_consistent_with_lock?) { false }
- end
-
- it "should raise an error explaining the inconsistenty" do
- expect { action.run }.to raise_error(Error, "Specfile and Specfile.lock are out of sync!")
- end
- end
-
- context "when the specfile and lockfile are present and consistent" do
- before do
- env.stub_chain(:specfile_path, :exist?) { true }
- env.stub_chain(:lockfile_path, :exist?) { true }
- action.stub(:spec_consistent_with_lock?) { true }
- action.stub(:perform_installation)
- end
-
- it "should not raise an error" do
- expect { action.run }.to_not raise_error
- end
- end
-
- end
-
- describe "performing the install" do
-
- def mock_manifest(i)
- double(:name => "manifest-#{i}")
- end
-
- let(:manifests) { 3.times.map{|i| mock_manifest(i)} }
- let(:sorted_manifests) { 4.times.map{|i| mock_manifest(i + 3)} }
- let(:install_path) { mock }
-
- before do
- env.stub(:install_path) { install_path }
- action.stub(:check_preconditions)
- action.stub_chain(:lock, :manifests) { manifests }
- end
-
- after do
- action.run
- end
-
- it "should sort and install the manifests" do
- ManifestSet.should_receive(:sort).with(manifests).exactly(:once).ordered { sorted_manifests }
-
- install_path.stub(:exist?) { false }
- install_path.should_receive(:mkpath).exactly(:once).ordered
-
- sorted_manifests.each do |manifest|
- manifest.should_receive(:install!).exactly(:once).ordered
- end
- end
-
- it "should recreate the install path if it already exists" do
- action.stub(:sorted_manifests) { sorted_manifests }
- action.stub(:install_manifests)
-
- install_path.stub(:exist?) { true }
- install_path.should_receive(:rmtree)
- install_path.should_receive(:mkpath)
- end
-
- end
-
- end
-
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/config/database_spec.rb b/vendor/librarian/spec/unit/config/database_spec.rb
deleted file mode 100644
index a6e197a..0000000
--- a/vendor/librarian/spec/unit/config/database_spec.rb
+++ /dev/null
@@ -1,319 +0,0 @@
-require "fileutils"
-require "pathname"
-require "yaml"
-
-require "fakefs/spec_helpers"
-
-require "librarian/config/database"
-
-describe Librarian::Config::Database do
- include FakeFS::SpecHelpers
-
- def write_yaml!(path, *yamlables)
- dir = File.dirname(path)
- FileUtils.mkpath(dir) unless File.directory?(dir)
- File.open(path, "wb"){|f| yamlables.each{|y| YAML.dump(y, f)}}
- end
-
- let(:adapter_name) { "gem" }
-
- let(:env) { { } }
- let(:pwd) { Pathname("/tmp") }
- let(:home) { Pathname("~").expand_path }
- let(:project_path) { nil }
- let(:specfile_name) { nil }
- let(:global) { home.join(".librarian/gem/config") }
- let(:local) { pwd.join(".librarian/gem/config") }
- let(:specfile) { pwd.join("Gemfile") }
-
- before do
- FileUtils.mkpath(pwd)
- FileUtils.touch(specfile)
- end
-
- let(:database) do
- described_class.new(adapter_name,
- :env => env,
- :pwd => pwd.to_s,
- :home => home.to_s,
- :project_path => project_path,
- :specfile_name => specfile_name
- )
- end
-
- context "when a key is given globally" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- before do
- write_yaml! global, raw_key => value
- end
-
- it "should have the key globally" do
- database.global[key].should == value
- end
-
- it "should not have the key in the env" do
- database.env[key].should be_nil
- end
-
- it "should not have the key locally" do
- database.local[key].should be_nil
- end
-
- it "should have the key generally" do
- database[key].should == value
- end
- end
-
- context "when a key is set globally" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- before do
- database.global[key] = value
- end
-
- it "should have the key globally" do
- database.global[key].should == value
- end
-
- it "should not have the key in the env" do
- database.env[key].should be_nil
- end
-
- it "should not have the key locally" do
- database.local[key].should be_nil
- end
-
- it "should have the key generally" do
- database[key].should == value
- end
-
- it "should persist the key" do
- data = YAML.load_file(global)
-
- data.should == {raw_key => value}
- end
- end
-
- context "when the key is set and unset globally" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- before do
- database.global[key] = value
- database.global[key] = nil
- end
-
- it "should not have the key globally" do
- database.global[key].should be_nil
- end
-
- it "should not have the key in the env" do
- database.env[key].should be_nil
- end
-
- it "should not have the key locally" do
- database.local[key].should be_nil
- end
-
- it "should not have the key generally" do
- database[key].should be_nil
- end
-
- it "should unpersist the key" do
- File.should_not exist global
- end
- end
-
- context "when a key is given in the env" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- #override
- let(:env) { {raw_key => value} }
-
- it "should not have the key globally" do
- database.global[key].should be_nil
- end
-
- it "should have the key in the env" do
- database.env[key].should == value
- end
-
- it "should not have the key locally" do
- database.local[key].should be_nil
- end
-
- it "should have the key generally" do
- database[key].should == value
- end
- end
-
- context "when a key is given locally" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- before do
- write_yaml! local, raw_key => value
- end
-
- it "should not have the key globally" do
- database.global[key].should be_nil
- end
-
- it "should not have the key in the env" do
- database.env[key].should be_nil
- end
-
- it "should have the key locally" do
- database.local[key].should == value
- end
-
- it "should have the key generally" do
- database[key].should == value
- end
- end
-
- context "when a key is set locally" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- before do
- database.local[key] = value
- end
-
- it "should not have the key globally" do
- database.global[key].should be_nil
- end
-
- it "should not have the key in the env" do
- database.env[key].should be_nil
- end
-
- it "should have the key locally" do
- database.local[key].should == value
- end
-
- it "should have the key generally" do
- database[key].should == value
- end
-
- it "should persist the key" do
- data = YAML.load_file(local)
-
- data.should == {raw_key => value}
- end
- end
-
- context "when the key is set and unset locally" do
- let(:key) { "jam" }
- let(:value) { "jelly" }
- let(:raw_key) { "LIBRARIAN_GEM_JAM" }
-
- before do
- database.local[key] = value
- database.local[key] = nil
- end
-
- it "should not have the key globally" do
- database.global[key].should be_nil
- end
-
- it "should not have the key in the env" do
- database.env[key].should be_nil
- end
-
- it "should not have the key locally" do
- database.local[key].should be_nil
- end
-
- it "should not have the key generally" do
- database[key].should be_nil
- end
-
- it "should unpersist the key" do
- File.should_not exist local
- end
- end
-
- context "setting malformatted keys" do
- it "should ban caps" do
- expect { database.global["JAM"] = "jelly" }.
- to raise_error Librarian::Error, %[key not permitted: "JAM"]
- end
-
- it "should ban double dots" do
- expect { database.global["jam..jam"] = "jelly" }.
- to raise_error Librarian::Error, %[key not permitted: "jam..jam"]
- end
- end
-
- context "setting banned keys" do
- it "should ban the specfile key" do
- expect { database.global["gemfile"] = "jelly" }.
- to raise_error Librarian::Error, %[key not permitted: "gemfile"]
- end
-
- it "should ban the global-config key" do
- expect { database.global["config"] = "jelly" }.
- to raise_error Librarian::Error, %[key not permitted: "config"]
- end
- end
-
- context "project_path" do
- context "by default" do
- it "should give the default project path" do
- database.project_path.should == Pathname("/tmp")
- end
- end
-
- context "when the specfile is set in the env" do
- let(:env) { {"LIBRARIAN_GEM_GEMFILE" => "/non/sense/path/to/Sillyfile"} }
-
- it "should give the project path from the env-set specfile" do
- database.project_path.should == Pathname("/non/sense/path/to")
- end
- end
- end
-
- context "specfile_path" do
- context "by default" do
- it "should give the default specfile path" do
- database.specfile_path.should == specfile
- end
- end
-
- context "when set in the env" do
- let(:env) { {"LIBRARIAN_GEM_GEMFILE" => "/non/sense/path/to/Sillyfile"} }
-
- it "should give the given specfile path" do
- database.specfile_path.should == Pathname("/non/sense/path/to/Sillyfile")
- end
- end
-
- context "when the project_path is assigned" do
- let(:project_path) { "/non/sense/path/to" }
-
- it "should give the assigned specfile path" do
- database.specfile_path.should == Pathname("/non/sense/path/to/Gemfile")
- end
- end
-
- context "when the specfile_name is assigned" do
- let(:specfile_name) { "Sillyfile" }
-
- it "should give the assigned specfile path" do
- database.specfile_path.should == Pathname("/tmp/Sillyfile")
- end
- end
- end
-
-end
diff --git a/vendor/librarian/spec/unit/dependency_spec.rb b/vendor/librarian/spec/unit/dependency_spec.rb
deleted file mode 100644
index 9891c96..0000000
--- a/vendor/librarian/spec/unit/dependency_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require "librarian/dependency"
-
-describe Librarian::Dependency do
-
- describe "validations" do
-
- context "when the name is blank" do
- it "raises" do
- expect { described_class.new("", [], nil) }.
- to raise_error(ArgumentError, %{name ("") must be sensible})
- end
- end
-
- context "when the name has leading whitespace" do
- it "raises" do
- expect { described_class.new(" the-name", [], nil) }.
- to raise_error(ArgumentError, %{name (" the-name") must be sensible})
- end
- end
-
- context "when the name has trailing whitespace" do
- it "raises" do
- expect { described_class.new("the-name ", [], nil) }.
- to raise_error(ArgumentError, %{name ("the-name ") must be sensible})
- end
- end
-
- context "when the name is a single character" do
- it "passes" do
- described_class.new("R", [], nil)
- end
- end
-
- end
-
-end
diff --git a/vendor/librarian/spec/unit/dsl_spec.rb b/vendor/librarian/spec/unit/dsl_spec.rb
deleted file mode 100644
index a46af25..0000000
--- a/vendor/librarian/spec/unit/dsl_spec.rb
+++ /dev/null
@@ -1,194 +0,0 @@
-require 'librarian'
-require 'librarian/mock'
-
-module Librarian
- module Mock
-
- describe Dsl do
-
- let(:env) { Environment.new }
-
- context "a single source and a single dependency with a blank name" do
- it "should not not run with a blank name" do
- expect do
- env.dsl do
- src 'source-1'
- dep ''
- end
- end.to raise_error(ArgumentError, %{name ("") must be sensible})
- end
- end
-
- context "a single dependency but no applicable source" do
-
- it "should not run without any sources" do
- expect do
- env.dsl do
- dep 'dependency-1'
- end
- end.to raise_error(Dsl::Error)
- end
-
- it "should not run when a block source is defined but the dependency is outside the block" do
- expect do
- env.dsl do
- src 'source-1' do end
- dep 'dependency-1'
- end
- end.to raise_error(Dsl::Error)
- end
-
- end
-
- context "a simple specfile - a single source, a single dependency, no transitive dependencies" do
-
- it "should run with a hash source" do
- spec = env.dsl do
- dep 'dependency-1',
- :src => 'source-1'
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-1'
- spec.source.should be_nil
- end
-
- it "should run with a shortcut source" do
- spec = env.dsl do
- dep 'dependency-1',
- :source => :a
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-a'
- spec.source.should be_nil
- end
-
- it "should run with a block hash source" do
- spec = env.dsl do
- source :src => 'source-1' do
- dep 'dependency-1'
- end
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-1'
- spec.source.should be_nil
- end
-
- it "should run with a block named source" do
- spec = env.dsl do
- src 'source-1' do
- dep 'dependency-1'
- end
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-1'
- spec.source.should be_nil
- end
-
- it "should run with a default hash source" do
- spec = env.dsl do
- source :src => 'source-1'
- dep 'dependency-1'
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-1'
- spec.source.should_not be_nil
- spec.dependencies.first.source.should == spec.source
- end
-
- it "should run with a default named source" do
- spec = env.dsl do
- src 'source-1'
- dep 'dependency-1'
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-1'
- spec.source.should_not be_nil
- spec.dependencies.first.source.should == spec.source
- end
-
- it "should run with a default shortcut source" do
- spec = env.dsl do
- source :a
- dep 'dependency-1'
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-a'
- spec.source.should_not be_nil
- spec.dependencies.first.source.should == spec.source
- end
-
- it "should run with a shortcut source hash definition" do
- spec = env.dsl do
- source :b, :src => 'source-b'
- dep 'dependency-1', :source => :b
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-b'
- spec.source.should be_nil
- end
-
- it "should run with a shortcut source block definition" do
- spec = env.dsl do
- source :b, proc { src 'source-b' }
- dep 'dependency-1', :source => :b
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-b'
- spec.source.should be_nil
- end
-
- it "should run with a default shortcut source hash definition" do
- spec = env.dsl do
- source :b, :src => 'source-b'
- source :b
- dep 'dependency-1'
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-b'
- spec.source.should_not be_nil
- spec.source.name.should == 'source-b'
- end
-
- it "should run with a default shortcut source block definition" do
- spec = env.dsl do
- source :b, proc { src 'source-b' }
- source :b
- dep 'dependency-1'
- end
- spec.dependencies.should_not be_empty
- spec.dependencies.first.name.should == 'dependency-1'
- spec.dependencies.first.source.name.should == 'source-b'
- spec.source.should_not be_nil
- spec.source.name.should == 'source-b'
- end
-
- end
-
- context "validating source options" do
-
- it "should raise when given unrecognized optiosn options" do
- expect do
- env.dsl do
- dep 'dependency-1',
- :src => 'source-1',
- :huh => 'yikes'
- end
- end.to raise_error(Error, %{unrecognized options: huh})
- end
-
- end
-
- end
-
- end
-end
\ No newline at end of file
diff --git a/vendor/librarian/spec/unit/environment_spec.rb b/vendor/librarian/spec/unit/environment_spec.rb
deleted file mode 100644
index 2bec85c..0000000
--- a/vendor/librarian/spec/unit/environment_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require "librarian/environment"
-
-module Librarian
- describe Environment do
-
- let(:env) { described_class.new }
-
- end
-end
diff --git a/vendor/librarian/spec/unit/lockfile/parser_spec.rb b/vendor/librarian/spec/unit/lockfile/parser_spec.rb
deleted file mode 100644
index 74e3675..0000000
--- a/vendor/librarian/spec/unit/lockfile/parser_spec.rb
+++ /dev/null
@@ -1,162 +0,0 @@
-require "librarian/helpers"
-require "librarian/lockfile/parser"
-require "librarian/mock"
-
-module Librarian
- describe Lockfile::Parser do
-
- let(:env) { Mock::Environment.new }
- let(:parser) { described_class.new(env) }
- let(:resolution) { parser.parse(lockfile) }
-
- context "a mock lockfile with one source and no dependencies" do
- let(:lockfile) do
- Helpers.strip_heredoc <<-LOCKFILE
- MOCK
- remote: source-a
- specs:
-
- DEPENDENCIES
-
- LOCKFILE
- end
-
- it "should give an empty list of dependencies" do
- resolution.dependencies.should be_empty
- end
-
- it "should give an empty list of manifests" do
- resolution.manifests.should be_empty
- end
- end
-
- context "a mock lockfile with one source and one dependency" do
- let(:lockfile) do
- Helpers.strip_heredoc <<-LOCKFILE
- MOCK
- remote: source-a
- specs:
- jelly (1.3.5)
-
- DEPENDENCIES
- jelly (!= 1.2.6, ~> 1.1)
-
- LOCKFILE
- end
-
- it "should give a list of one dependency" do
- resolution.should have(1).dependencies
- end
-
- it "should give a dependency with the expected name" do
- dependency = resolution.dependencies.first
-
- dependency.name.should == "jelly"
- end
-
- it "should give a dependency with the expected requirement" do
- dependency = resolution.dependencies.first
-
- # Note: it must be this order because this order is lexicographically sorted.
- dependency.requirement.to_s.should == "!= 1.2.6, ~> 1.1"
- end
-
- it "should give a dependency wth the expected source" do
- dependency = resolution.dependencies.first
- source = dependency.source
-
- source.name.should == "source-a"
- end
-
- it "should give a list of one manifest" do
- resolution.should have(1).manifests
- end
-
- it "should give a manifest with the expected name" do
- manifest = resolution.manifests.first
-
- manifest.name.should == "jelly"
- end
-
- it "should give a manifest with the expected version" do
- manifest = resolution.manifests.first
-
- manifest.version.to_s.should == "1.3.5"
- end
-
- it "should give a manifest with no dependencies" do
- manifest = resolution.manifests.first
-
- manifest.dependencies.should be_empty
- end
-
- it "should give a manifest with the expected source" do
- manifest = resolution.manifests.first
- source = manifest.source
-
- source.name.should == "source-a"
- end
-
- it "should give the dependency and the manifest the same source instance" do
- dependency = resolution.dependencies.first
- manifest = resolution.manifests.first
-
- dependency_source = dependency.source
- manifest_source = manifest.source
-
- manifest_source.should be dependency_source
- end
- end
-
- context "a mock lockfile with one source and a complex dependency" do
- let(:lockfile) do
- Helpers.strip_heredoc <<-LOCKFILE
- MOCK
- remote: source-a
- specs:
- butter (2.5.3)
- jelly (1.3.5)
- butter (< 3, >= 1.1)
-
- DEPENDENCIES
- jelly (!= 1.2.6, ~> 1.1)
-
- LOCKFILE
- end
-
- it "should give a list of one dependency" do
- resolution.should have(1).dependencies
- end
-
- it "should have the expected dependency" do
- dependency = resolution.dependencies.first
-
- dependency.name.should == "jelly"
- end
-
- it "should give a list of all the manifests" do
- resolution.should have(2).manifests
- end
-
- it "should include all the expected manifests" do
- manifests = ManifestSet.new(resolution.manifests)
-
- manifests.to_hash.keys.should =~ %w(butter jelly)
- end
-
- it "should have an internally consistent set of manifests" do
- manifests = ManifestSet.new(resolution.manifests)
-
- manifests.should be_consistent
- end
-
- it "should have an externally consistent set of manifests" do
- dependencies = resolution.dependencies
- manifests = ManifestSet.new(resolution.manifests)
-
- manifests.should be_in_compliance_with dependencies
- end
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/lockfile_spec.rb b/vendor/librarian/spec/unit/lockfile_spec.rb
deleted file mode 100644
index 7c0b2a6..0000000
--- a/vendor/librarian/spec/unit/lockfile_spec.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-require 'librarian'
-require 'librarian/mock'
-
-module Librarian
- describe Lockfile do
-
- let(:env) { Mock::Environment.new }
-
- before do
- env.registry :clear => true do
- source 'source-1' do
- spec 'alpha', '1.1'
- end
- end
- end
-
- let(:spec) do
- env.dsl do
- src 'source-1'
- dep 'alpha', '1.1'
- end
- end
-
- let(:resolver) { env.resolver }
- let(:resolution) { resolver.resolve(spec) }
-
- context "sanity" do
- context "the resolution" do
- subject { resolution }
-
- it { should be_correct }
- it { should have(1).manifests }
- end
- end
-
- describe "#save" do
- let(:lockfile) { env.ephemeral_lockfile }
- let(:lockfile_text) { lockfile.save(resolution) }
-
- context "just saving" do
- it "should return the lockfile text" do
- lockfile_text.should_not be_nil
- end
- end
-
- context "saving and reloading" do
- let(:reloaded_resolution) { lockfile.load(lockfile_text) }
-
- it "should have the expected manifests" do
- reloaded_resolution.manifests.count.should == resolution.manifests.count
- end
- end
-
- context "bouncing" do
- let(:bounced_resolution) { lockfile.load(lockfile_text) }
- let(:bounced_lockfile_text) { lockfile.save(bounced_resolution) }
-
- it "should return the same lockfile text after bouncing as before bouncing" do
- bounced_lockfile_text.should == lockfile_text
- end
- end
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/manifest_set_spec.rb b/vendor/librarian/spec/unit/manifest_set_spec.rb
deleted file mode 100644
index a54d97d..0000000
--- a/vendor/librarian/spec/unit/manifest_set_spec.rb
+++ /dev/null
@@ -1,202 +0,0 @@
-require 'librarian'
-
-module Librarian
- describe ManifestSet do
-
- describe ".new" do
- let(:jelly) { double(:name => "jelly") }
- let(:butter) { double(:name => "butter") }
- let(:jam) { double(:name => "jam") }
-
- let(:array) { [jelly, butter, jam] }
- let(:hash) { {"jelly" => jelly, "butter" => butter, "jam" => jam} }
-
- context "with an array" do
- let(:set) { described_class.new(array) }
-
- it "should give back the array" do
- set.to_a.should =~ array
- end
-
- it "should give back the hash" do
- set.to_hash.should == hash
- end
- end
-
- context "with a hash" do
- let(:set) { described_class.new(hash) }
-
- it "should give back the array" do
- set.to_a.should =~ array
- end
-
- it "should give back the hash" do
- set.to_hash.should == hash
- end
- end
- end
-
- # Does not trace dependencies.
- # That's why it's "shallow".
- describe "#shallow_strip!" do
- let(:jelly) { double(:name => "jelly") }
- let(:butter) { double(:name => "butter") }
- let(:jam) { double(:name => "jam") }
-
- let(:set) { described_class.new([jelly, butter, jam]) }
-
- it "should not do anything when given no names" do
- set.shallow_strip!([])
-
- set.to_a.should =~ [jelly, butter, jam]
- end
-
- it "should remove only the named elements" do
- set.shallow_strip!(["butter", "jam"])
-
- set.to_a.should =~ [jelly]
- end
-
- it "should allow removing all the elements" do
- set.shallow_strip!(["jelly", "butter", "jam"])
-
- set.to_a.should =~ []
- end
- end
-
- # Does not trace dependencies.
- # That's why it's "shallow".
- describe "#shallow_keep!" do
- let(:jelly) { double(:name => "jelly") }
- let(:butter) { double(:name => "butter") }
- let(:jam) { double(:name => "jam") }
-
- let(:set) { described_class.new([jelly, butter, jam]) }
-
- it "should empty the set when given no names" do
- set.shallow_keep!([])
-
- set.to_a.should =~ []
- end
-
- it "should keep only the named elements" do
- set.shallow_keep!(["butter", "jam"])
-
- set.to_a.should =~ [butter, jam]
- end
-
- it "should allow keeping all the elements" do
- set.shallow_keep!(["jelly", "butter", "jam"])
-
- set.to_a.should =~ [jelly, butter, jam]
- end
- end
-
- describe "#deep_strip!" do
- def man(o)
- k, v = o.keys.first, o.values.first
- double(k, :name => k, :dependencies => deps(v))
- end
-
- def deps(names)
- names.map{|n| double(:name => n)}
- end
-
- let(:a) { man("a" => %w[b c]) }
- let(:b) { man("b" => %w[c d]) }
- let(:c) { man("c" => %w[ ]) }
- let(:d) { man("d" => %w[ ]) }
-
- let(:e) { man("e" => %w[f g]) }
- let(:f) { man("f" => %w[g h]) }
- let(:g) { man("g" => %w[ ]) }
- let(:h) { man("h" => %w[ ]) }
-
- let(:set) { described_class.new([a, b, c, d, e, f, g, h]) }
-
- it "should not do anything when given no names" do
- set.deep_strip!([])
-
- set.to_a.should =~ [a, b, c, d, e, f, g, h]
- end
-
- it "should remove just the named elements if they have no dependencies" do
- set.deep_strip!(["c", "h"])
-
- set.to_a.should =~ [a, b, d, e, f, g]
- end
-
- it "should remove the named elements and all their dependencies" do
- set.deep_strip!(["b"])
-
- set.to_a.should =~ [a, e, f, g, h]
- end
-
- it "should remove an entire tree of dependencies" do
- set.deep_strip!(["e"])
-
- set.to_a.should =~ [a, b, c, d]
- end
-
- it "should allow removing all the elements" do
- set.deep_strip!(["a", "e"])
-
- set.to_a.should =~ []
- end
- end
-
- describe "#deep_keep!" do
- def man(o)
- k, v = o.keys.first, o.values.first
- double(k, :name => k, :dependencies => deps(v))
- end
-
- def deps(names)
- names.map{|n| double(:name => n)}
- end
-
- let(:a) { man("a" => %w[b c]) }
- let(:b) { man("b" => %w[c d]) }
- let(:c) { man("c" => %w[ ]) }
- let(:d) { man("d" => %w[ ]) }
-
- let(:e) { man("e" => %w[f g]) }
- let(:f) { man("f" => %w[g h]) }
- let(:g) { man("g" => %w[ ]) }
- let(:h) { man("h" => %w[ ]) }
-
- let(:set) { described_class.new([a, b, c, d, e, f, g, h]) }
-
- it "should remove all the elements when given no names" do
- set.deep_keep!([])
-
- set.to_a.should =~ []
- end
-
- it "should keep just the named elements if they have no dependencies" do
- set.deep_keep!(["c", "h"])
-
- set.to_a.should =~ [c, h]
- end
-
- it "should keep the named elements and all their dependencies" do
- set.deep_keep!(["b"])
-
- set.to_a.should =~ [b, c, d]
- end
-
- it "should keep an entire tree of dependencies" do
- set.deep_keep!(["e"])
-
- set.to_a.should =~ [e, f, g, h]
- end
-
- it "should allow keeping all the elements" do
- set.deep_keep!(["a", "e"])
-
- set.to_a.should =~ [a, b, c, d, e, f, g, h]
- end
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/manifest_spec.rb b/vendor/librarian/spec/unit/manifest_spec.rb
deleted file mode 100644
index 8e3f2f5..0000000
--- a/vendor/librarian/spec/unit/manifest_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require "librarian/manifest"
-
-describe Librarian::Manifest do
-
- describe "validations" do
-
- context "when the name is blank" do
- it "raises" do
- expect { described_class.new(nil, "") }.
- to raise_error(ArgumentError, %{name ("") must be sensible})
- end
- end
-
- context "when the name has leading whitespace" do
- it "raises" do
- expect { described_class.new(nil, " the-name") }.
- to raise_error(ArgumentError, %{name (" the-name") must be sensible})
- end
- end
-
- context "when the name has trailing whitespace" do
- it "raises" do
- expect { described_class.new(nil, "the-name ") }.
- to raise_error(ArgumentError, %{name ("the-name ") must be sensible})
- end
- end
-
- context "when the name is a single character" do
- it "passes" do
- described_class.new(nil, "R")
- end
- end
-
- end
-
-end
diff --git a/vendor/librarian/spec/unit/manifest_version_spec.rb b/vendor/librarian/spec/unit/manifest_version_spec.rb
deleted file mode 100644
index f3830c9..0000000
--- a/vendor/librarian/spec/unit/manifest_version_spec.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-require "librarian/manifest"
-
-describe Librarian::Manifest::Version do
-
- describe "version comparison" do
-
- context "when version has only two components" do
- it "creates a new version with only 2 version components" do
- v1 = described_class.new("1.0")
- end
- end
-
- context "when neither version has pre-release items" do
- it "compares 1.0.0 < 2.0.0" do
- v1 = described_class.new("1.0.0")
- v2 = described_class.new("2.0.0")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 2.0.0 < 2.1.0" do
- v1 = described_class.new("2.0.0")
- v2 = described_class.new("2.1.0")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 2.1.0 < 2.1.1" do
- v1 = described_class.new("2.1.0")
- v2 = described_class.new("2.1.1")
- expect(v1 <=> v2).to eq(-1)
- end
- end
-
- context "when versions have pre-release information" do
- it "compares 1.0.0-alpha < 1.0.0-alpha1" do
- v1 = described_class.new("1.0.0-alpha")
- v2 = described_class.new("1.0.0-alpha.1")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 1.0.0-alpha.1 < 1.0.0-alpha.beta" do
- v1 = described_class.new("1.0.0-alpha.1")
- v2 = described_class.new("1.0.0-alpha.beta")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 1.0.0-alpha.beta < 1.0.0-beta" do
- v1 = described_class.new("1.0.0-alpha.beta")
- v2 = described_class.new("1.0.0-beta")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 1.0.0-beta < 1.0.0-beta.2" do
- v1 = described_class.new("1.0.0-beta")
- v2 = described_class.new("1.0.0-beta.2")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 1.0.0-beta.2 < 1.0.0-beta.11" do
- v1 = described_class.new("1.0.0-beta.2")
- v2 = described_class.new("1.0.0-beta.11")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 1.0.0-beta.11 < 1.0.0-rc.1" do
- v1 = described_class.new("1.0.0-beta.11")
- v2 = described_class.new("1.0.0-rc.1")
- expect(v1 <=> v2).to eq(-1)
- end
- it "compares 1.0.0-rc.1 < 1.0.0" do
- v1 = described_class.new("1.0.0-rc.1")
- v2 = described_class.new("1.0.0")
- expect(v1 <=> v2).to eq(-1)
- end
- end
-
- context "when an invalid version number is provided" do
- it "raises" do
- expect { described_class.new("invalidversion") }.
- to raise_error(ArgumentError)
- end
- end
-
- context "when a version is converted to string" do
- it "should be the full semver" do
- version = "1.0.0-beta.11+200.1.2"
- v1 = described_class.new(version)
- expect(v1.to_s).to eq(version)
- end
- it "should be the full gem version" do
- version = "1.0.0.a"
- v1 = described_class.new(version)
- expect(v1.to_s).to eq(version)
- end
- it "should be the two-component version" do
- version = "1.0"
- v1 = described_class.new(version)
- expect(v1.to_s).to eq(version)
- end
- end
- end
-end
\ No newline at end of file
diff --git a/vendor/librarian/spec/unit/mock/source/mock_spec.rb b/vendor/librarian/spec/unit/mock/source/mock_spec.rb
deleted file mode 100644
index 127813d..0000000
--- a/vendor/librarian/spec/unit/mock/source/mock_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require "librarian/mock"
-
-module Librarian
- module Mock
- module Source
- describe Mock do
-
- let(:env) { Librarian::Mock::Environment.new }
-
- describe ".new" do
-
- let(:source) { described_class.new(env, "source-a", {}) }
- subject { source }
-
- its(:environment) { should_not be_nil }
-
- end
-
- end
- end
- end
-end
diff --git a/vendor/librarian/spec/unit/resolver_spec.rb b/vendor/librarian/spec/unit/resolver_spec.rb
deleted file mode 100644
index 2c35455..0000000
--- a/vendor/librarian/spec/unit/resolver_spec.rb
+++ /dev/null
@@ -1,192 +0,0 @@
-require 'librarian/resolver'
-require 'librarian/spec_change_set'
-require 'librarian/mock'
-
-module Librarian
- describe Resolver do
-
- let(:env) { Mock::Environment.new }
- let(:resolver) { env.resolver }
-
- context "a simple specfile" do
-
- before do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.1'
- end
- end
- end
-
- let(:spec) do
- env.dsl do
- src 'source-1'
- dep 'butter'
- end
- end
-
- let(:resolution) { resolver.resolve(spec) }
-
- specify { resolution.should be_correct }
-
- end
-
- context "a specfile with a dep from one src depending on a dep from another src" do
-
- before do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.1'
- end
- source 'source-2' do
- spec 'jam', '1.2' do
- dependency 'butter', '>= 1.0'
- end
- end
- end
- end
-
- let(:spec) do
- env.dsl do
- src 'source-1'
- src 'source-2' do
- dep 'jam'
- end
- end
- end
-
- let(:resolution) { resolver.resolve(spec) }
-
- specify { resolution.should be_correct }
-
- end
-
- context "a specfile with a dep depending on a nonexistent dep" do
-
- before do
- env.registry :clear => true do
- source 'source-1' do
- spec 'jam', '1.2' do
- dependency 'butter', '>= 1.0'
- end
- end
- end
- end
-
- let(:spec) do
- env.dsl do
- src 'source-1'
- dep 'jam'
- end
- end
-
- let(:resolution) { resolver.resolve(spec) }
-
- specify { resolution.should_not be_correct }
-
- end
-
- context "a specfile with conflicting constraints" do
-
- before do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- spec 'butter', '1.1'
- spec 'jam', '1.2' do
- dependency 'butter', '1.1'
- end
- end
- end
- end
-
- let(:spec) do
- env.dsl do
- src 'source-1'
- dep 'butter', '1.0'
- dep 'jam'
- end
- end
-
- let(:resolution) { resolver.resolve(spec) }
-
- specify { resolution.should_not be_correct }
-
- end
-
- context "updating" do
-
- it "should not work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- spec 'butter', '1.1'
- spec 'jam', '1.2' do
- dependency 'butter'
- end
- end
- end
- first_spec = env.dsl do
- src 'source-1'
- dep 'butter', '1.1'
- dep 'jam'
- end
- first_resolution = resolver.resolve(first_spec)
- first_resolution.should be_correct
- first_manifests = first_resolution.manifests
- first_manifests_index = Hash[first_manifests.map{|m| [m.name, m]}]
- first_manifests_index['butter'].version.to_s.should == '1.1'
-
- second_spec = env.dsl do
- src 'source-1'
- dep 'butter', '1.0'
- dep 'jam'
- end
- locked_manifests = ManifestSet.deep_strip(first_manifests, ['butter'])
- second_resolution =resolver.resolve(second_spec, locked_manifests)
- second_resolution.should be_correct
- second_manifests = second_resolution.manifests
- second_manifests_index = Hash[second_manifests.map{|m| [m.name, m]}]
- second_manifests_index['butter'].version.to_s.should == '1.0'
- end
-
- end
-
- context "a change to the spec" do
-
- it "should work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- end
- source 'source-2' do
- spec 'butter', '1.0'
- end
- end
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- end
- lock = resolver.resolve(spec)
- lock.should be_correct
-
- spec = env.dsl do
- src 'source-1'
- dep 'butter', :src => 'source-2'
- end
- changes = SpecChangeSet.new(env, spec, lock)
- changes.should_not be_same
- manifests = ManifestSet.new(changes.analyze).to_hash
- manifests.should_not have_key('butter')
- lock = resolver.resolve(spec, changes.analyze)
- lock.should be_correct
- lock.manifests.map{|m| m.name}.should include('butter')
- manifest = lock.manifests.find{|m| m.name == 'butter'}
- manifest.should_not be_nil
- manifest.source.name.should == 'source-2'
- end
-
- end
-
- end
-end
diff --git a/vendor/librarian/spec/unit/source/git_spec.rb b/vendor/librarian/spec/unit/source/git_spec.rb
deleted file mode 100644
index 0d8cacb..0000000
--- a/vendor/librarian/spec/unit/source/git_spec.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require "librarian"
-
-module Librarian
- module Source
- describe Git do
-
- let(:env) { Environment.new }
-
- describe "validating options for the specfile" do
-
- context "with only known options" do
- it "should not raise" do
- expect { described_class.from_spec_args(env, "some://git/repo.git", :ref => "megapatches") }.
- to_not raise_error
- end
- end
-
- context "with an unknown option" do
- it "should raise" do
- expect { described_class.from_spec_args(env, "some://git/repo.git", :branch => "megapatches") }.
- to raise_error Error, "unrecognized options: branch"
- end
- end
-
- end
-
- end
- end
-end
diff --git a/vendor/librarian/spec/unit/spec_change_set_spec.rb b/vendor/librarian/spec/unit/spec_change_set_spec.rb
deleted file mode 100644
index ab637a1..0000000
--- a/vendor/librarian/spec/unit/spec_change_set_spec.rb
+++ /dev/null
@@ -1,169 +0,0 @@
-require 'librarian'
-require 'librarian/spec_change_set'
-require 'librarian/mock'
-
-module Librarian
- describe SpecChangeSet do
-
- let(:env) { Mock::Environment.new }
- let(:resolver) { env.resolver }
-
- context "a simple root removal" do
-
- it "should work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- spec 'jam', '1.0'
- end
- end
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- dep 'jam'
- end
- lock = resolver.resolve(spec)
- lock.should be_correct
-
- spec = env.dsl do
- src 'source-1'
- dep 'jam'
- end
- changes = described_class.new(env, spec, lock)
- changes.should_not be_same
-
- manifests = ManifestSet.new(changes.analyze).to_hash
- manifests.should have_key('jam')
- manifests.should_not have_key('butter')
- end
-
- end
-
- context "a simple root add" do
-
- it "should work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- spec 'jam', '1.0'
- end
- end
- spec = env.dsl do
- src 'source-1'
- dep 'jam'
- end
- lock = resolver.resolve(spec)
- lock.should be_correct
-
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- dep 'jam'
- end
- changes = described_class.new(env, spec, lock)
- changes.should_not be_same
- manifests = ManifestSet.new(changes.analyze).to_hash
- manifests.should have_key('jam')
- manifests.should_not have_key('butter')
- end
-
- end
-
- context "a simple root change" do
-
- context "when the change is consistent" do
-
- it "should work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- spec 'jam', '1.0'
- spec 'jam', '1.1'
- end
- end
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- dep 'jam', '= 1.1'
- end
- lock = resolver.resolve(spec)
- lock.should be_correct
-
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- dep 'jam', '>= 1.0'
- end
- changes = described_class.new(env, spec, lock)
- changes.should_not be_same
- manifests = ManifestSet.new(changes.analyze).to_hash
- manifests.should have_key('butter')
- manifests.should have_key('jam')
- end
-
- end
-
- context "when the change is inconsistent" do
-
- it "should work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- spec 'jam', '1.0'
- spec 'jam', '1.1'
- end
- end
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- dep 'jam', '= 1.0'
- end
- lock = resolver.resolve(spec)
- lock.should be_correct
-
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- dep 'jam', '>= 1.1'
- end
- changes = described_class.new(env, spec, lock)
- changes.should_not be_same
- manifests = ManifestSet.new(changes.analyze).to_hash
- manifests.should have_key('butter')
- manifests.should_not have_key('jam')
- end
-
- end
-
- end
-
- context "a simple root source change" do
- it "should work" do
- env.registry :clear => true do
- source 'source-1' do
- spec 'butter', '1.0'
- end
- source 'source-2' do
- spec 'butter', '1.0'
- end
- end
- spec = env.dsl do
- src 'source-1'
- dep 'butter'
- end
- lock = resolver.resolve(spec)
- lock.should be_correct
-
- spec = env.dsl do
- src 'source-1'
- dep 'butter', :src => 'source-2'
- end
- changes = described_class.new(env, spec, lock)
- changes.should_not be_same
- manifests = ManifestSet.new(changes.analyze).to_hash
- manifests.should_not have_key('butter')
- end
- end
-
- end
-end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git
More information about the Pkg-ruby-extras-commits
mailing list