diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-06 12:55:35 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-06 12:55:35 -0800 |
commit | 5386eb2ffb70416b59bcf763339551df3a01f593 (patch) | |
tree | e1f53b5c2173b495db01f4ec019ddcf7ed0744c1 /omnibus/files | |
parent | f1718d033e0d7e0cce1674de1d10eee3c8ac656c (diff) | |
download | chef-5386eb2ffb70416b59bcf763339551df3a01f593.tar.gz |
build ohai from gitlcg/ohai-from-git
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'omnibus/files')
-rw-r--r-- | omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb b/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb index 3022bf448e..ea6c32e94a 100644 --- a/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb +++ b/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb @@ -21,8 +21,40 @@ module BuildChefGem attr_reader :software, :software_filename + # XXX: why are we programmatically defining config that is already expressed as code-as-configuration? + def define + # this has to come first because gem_metadata depends on it software.name "#{File.basename(software_filename)[0..-4]}" + if installing_from_git? + define_git + else + define_gem + end + end + + def define_git + software.default_version gem_metadata[:ref] + + # If the source directory for building stuff changes, tell omnibus to de-cache us + software.source git: gem_metadata[:git] + + # ruby and bundler and friends + software.dependency "ruby" + software.dependency "rubygems" + + software.relative_path gem_name + + gem_name = self.gem_name + + software.build do + extend BuildChefGem + gem "build #{gem_name}.gemspec", env: env + gem "install #{gem_name}*.gem --no-ri --no-rdoc", env: env + end + end + + def define_gem software.default_version gem_version # If the source directory for building stuff changes, tell omnibus to @@ -44,7 +76,8 @@ module BuildChefGem if gem_version == "<skip>" if gem_metadata block do - log.info(log_key) { "#{gem_name} has source #{gem_metadata} in #{lockfile_path}. We only cache rubygems.org installs in omnibus to keep things simple. The chef step will build #{gem_name} ..." } + raise "can we just remove this use case? what is it for?" + #log.info(log_key) { "#{gem_name} has source #{gem_metadata} in #{lockfile_path}. We only cache rubygems.org installs in omnibus to keep things simple. The chef step will build #{gem_name} ..." } end else block do @@ -105,6 +138,10 @@ module BuildChefGem end end + def installing_from_git? + gem_metadata && gem_metadata[:git] && gem_metadata[:ref] + end + def gem_version @gem_version ||= begin if gem_metadata && URI(gem_metadata[:source]) == URI("https://rubygems.org/") |