module Halite
Library to convert a Ruby gem to a Chef cookbook.
@since 1.0.0 @see convert
Copyright 2015, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Constants
- VERSION
Halite
version.
Public Class Methods
Method version of SpecHelper
module. Used to inject a gem data to load a synthetic cookbook during testing.
@see Halite::SpecHelper
@param gemspec [Gem::Specification] Gem
spec to load as cookbook.
# File lib/halite/spec_helper.rb, line 485 def self.SpecHelper(gemspec) # Create a new anonymous module mod = Module.new # Fake the name def mod.name super || 'Halite::SpecHelper' end mod.define_singleton_method(:included) do |klass| super(klass) # Pull in the main helper to cover most of the needed logic klass.class_exec do include Halite::SpecHelper let(:halite_gemspec) { gemspec } end end mod end
Convert a Ruby gem to a Chef cookbook.
@param gem_name [String, Gem::Specification] Gem
to convert. @param base_path [String] Output path. @return [void] @example Converting a gem by name
Halite.convert('mygem', 'dest')
@example Converting a gem from a loaded gemspec
Halite.convert(Bundler.load_gemspec('mygem.gemspec'), 'dest')
# File lib/halite.rb, line 39 def self.convert(gem_name, base_path) gem_data = if gem_name.is_a?(Gem) gem_name else Gem.new(gem_name) end Converter.write(gem_data, base_path) end