Class: Gem::Portage::EbuildCommand
- Inherits:
-
PortageCommand
- Object
- Command
- Command
- PortageCommand
- Gem::Portage::EbuildCommand
- Includes:
- LocalRemoteOptions, GemSpecFetcher
- Defined in:
- lib/g-gem/portage_commands.rb
Overview
class PortageCommand
Instance Method Summary collapse
- #arguments ⇒ Object
- #execute ⇒ Object
- #execute_on(atoms) ⇒ Object
-
#initialize(defaults = nil) ⇒ EbuildCommand
constructor
A new instance of EbuildCommand.
- #usage ⇒ Object
Methods included from GemSpecFetcher
LocalOrRemote, #LocalOrRemote, #fetch_local, #fetch_remote, #fetch_spec, #local_fetcher, #remote_fetcher, #spec_fetcher
Methods inherited from Command
class_command_options, #class_command_options, #defaults_str, has_option, has_options_from, #register, register
Constructor Details
#initialize(defaults = nil) ⇒ EbuildCommand
Returns a new instance of EbuildCommand.
28 29 30 31 |
# File 'lib/g-gem/portage_commands.rb', line 28 def initialize(defaults=nil) super('ebuild', 'Generate portage ebuilds from gem specification', defaults) end |
Instance Method Details
#arguments ⇒ Object
37 38 39 40 41 |
# File 'lib/g-gem/portage_commands.rb', line 37 def arguments return " GEMNAME \n ARGUMENTS\nend\n" |
#execute ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/g-gem/portage_commands.rb', line 43 def execute fail Gem::CommandLineError, show_help if [:args].empty? fail " Invalid ebuild commands: \#{ebuild_command.inspect}\n\n Valid values are those listed on ebuild(1) and 'generate'\n EOE\n atoms = DependencyAtom.parse_list(options[:args])\n execute_on(atoms)\nend\n" unless (ebuild_command - Gem::Portage::Ebuild::COMMANDS).empty? |
#execute_on(atoms) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/g-gem/portage_commands.rb', line 54 def execute_on(atoms) specs = Gem::DependencyList.from_atoms(spec_fetcher, atoms) specs.include_dependencies(spec_fetcher) if dependencies? create = ebuild_command.delete('generate') specs.each_spec do |spec| ebuild = Ebuild.for(spec, portdir, category) if create and (overwrite? or not ebuild.exists?) say "Generating #{ebuild.file_path} ..." begin File.delete(ebuild.digest_file) rescue end ebuild.install_dir = File.(install_dir, Dir.pwd) ebuild.enable_test_phase if test_phase? ebuild.generate ebuild.execute(*ebuild_command) elsif force? ebuild.execute(*ebuild_command) end end end |
#usage ⇒ Object
33 34 35 |
# File 'lib/g-gem/portage_commands.rb', line 33 def usage "#{program_name} GEM_NAME" end |