class Pod::Command::Gen
Attributes
configuration[R]
@return [Configuration]
the configuration used when generating workspaces
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/cocoapods/command/gen.rb, line 42 def initialize(argv) options_hash = Generate::Configuration.options.each_with_object({}) do |option, options| value = if option.name == :podspec_paths argv.arguments! elsif option.flag? argv.flag?(option.cli_name) else argv.option(option.cli_name) end next if value.nil? options[option.name] = option.coerce(value) end @configuration = merge_configuration(options_hash) super end
options()
click to toggle source
Calls superclass method
# File lib/cocoapods/command/gen.rb, line 23 def self.options super.concat(Generate::Configuration.options.map do |option| next unless option.cli_name flag = "--#{option.cli_name}" flag += "=#{option.arg_name}" if option.arg_name [flag, option.message] end.compact) end
Public Instance Methods
run()
click to toggle source
# File lib/cocoapods/command/gen.rb, line 60 def run UI.puts "[pod gen] Running with #{configuration.to_s.gsub("\n", " \n")}" if configuration.pod_config.verbose? # this is done here rather than in the installer so we only update sources once, # even if there are multiple podspecs update_sources if configuration.repo_update? Generate::PodfileGenerator.new(configuration).podfiles_by_spec.each do |spec, podfile| Generate::Installer.new(configuration, spec, podfile).install! end remove_warnings(UI.warnings) end
validate!()
click to toggle source
Calls superclass method
# File lib/cocoapods/command/gen.rb, line 74 def validate! super config_errors = configuration.validate help! config_errors.join("\n ") if config_errors.any? end
Private Instance Methods
merge_configuration(options)
click to toggle source
# File lib/cocoapods/command/gen.rb, line 83 def merge_configuration(options) # must use #to_enum explicitly since descend doesn't return an enumerator on 2.1 config_hashes = Pathname.pwd.to_enum(:descend).map do |dir| path = dir + '.gen_config.yml' next unless path.file? Pod::Generate::Configuration.from_file(path) end env = Generate::Configuration.from_env(ENV) config_hashes.insert(-2, env) config_hashes << options configuration = config_hashes.compact.each_with_object({}) { |e, h| h.merge!(e) } Pod::Generate::Configuration.new(pod_config: config, **configuration) end
remove_warnings(warnings)
click to toggle source
# File lib/cocoapods/command/gen.rb, line 99 def remove_warnings(warnings) warnings.reject! do |warning| warning[:message].include? 'Automatically assigning platform' end end
update_sources()
click to toggle source
# File lib/cocoapods/command/gen.rb, line 105 def update_sources UI.title 'Updating specs repos' do configuration.sources.each do |source| source = config.sources_manager.source_with_name_or_url(source) UI.titled_section "Updating spec repo `#{source.name}`" do source.update(config.verbose?) source.verify_compatibility! end end end end