Module: ImageCompressorPack
- Defined in:
- lib/image_compressor_pack.rb,
lib/image_compressor_pack/recipes.rb,
lib/image_compressor_pack/version.rb
Constant Summary collapse
- VERSION =
"1.0.0.0"
Class Method Summary collapse
- .activate ⇒ Object
- .dynamically_linked_recipes ⇒ Object
- .parse_recipes(file) ⇒ Object
- .paths ⇒ Object
- .recipes ⇒ Object
- .statically_linked_recipes ⇒ Object
Class Method Details
.activate ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/image_compressor_pack.rb', line 11 def self.activate paths.each do |path| path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR old_value = ENV['PATH'] || '' unless old_value.include?(path) ENV['PATH'] = "#{path}#{File::PATH_SEPARATOR}#{old_value}" end end end |
.dynamically_linked_recipes ⇒ Object
18 19 20 |
# File 'lib/image_compressor_pack/recipes.rb', line 18 def self.dynamically_linked_recipes parse_recipes File.('../dynamically_linked_recipes.yml', __FILE__) end |
.parse_recipes(file) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/image_compressor_pack/recipes.rb', line 22 def self.parse_recipes(file) recipes = YAML.load_file(file) recipes.map do |name, parameters| MiniPortile.new(name, parameters['version']).tap do |recipe| recipe.files = parameters['files'] recipe.target = if parameters['target'].nil? File.('../../../ports', __FILE__) else parameters['target'] end unless parameters['patch_files'].nil? recipe.patch_files = parameters['patch_files'].map do |patch| File.("../../../ports/patches/#{name}/#{patch}", __FILE__) end end recipe. = parameters['configure_options'] unless parameters['configure_options'].nil? end end end |
.paths ⇒ Object
5 6 7 8 9 |
# File 'lib/image_compressor_pack.rb', line 5 def self.paths root = File.("../../", __FILE__) relative_paths = YAML.load_file File.('../.paths.yml', __FILE__) relative_paths.map { |path| File.join root, path } end |
.recipes ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/image_compressor_pack/recipes.rb', line 6 def self.recipes unless RbConfig::CONFIG['target_os'] =~ /darwin/ statically_linked_recipes else dynamically_linked_recipes end end |
.statically_linked_recipes ⇒ Object
14 15 16 |
# File 'lib/image_compressor_pack/recipes.rb', line 14 def self.statically_linked_recipes parse_recipes File.('../statically_linked_recipes.yml', __FILE__) end |