Module: Gem::MiniMirror::Cli
- Defined in:
- lib/rubygems/mini_mirror/cli.rb
Constant Summary collapse
- DEFAULT_SOURCES =
{:gemcutter => ['http://gemcutter.org'], :github => ['http://gems.github.com'], :default => Gem.sources}
Instance Method Summary collapse
- #gem(name, *reqs) ⇒ Object
- #initialize(runner, options) ⇒ Object
- #load! ⇒ Object
- #resource(options = {}) ⇒ Object
- #source(*sources) ⇒ Object
Instance Method Details
#gem(name, *reqs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rubygems/mini_mirror/cli.rb', line 17 def gem(name, *reqs) = reqs. [:all] = .has_key?(:all) ? [:all] : true reqs.flatten! if reqs.empty? reqs = ['>=0'] end reqs.each do |req| @dependencies << Gem::MiniMirror::Dependency.new(name, req, .delete(:source) || @sources, ) end end |
#initialize(runner, options) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rubygems/mini_mirror/cli.rb', line 10 def initialize(runner, ) @options = @runner ||= runner @sources = nil @dependencies ||= [] end |
#load! ⇒ Object
44 45 46 47 |
# File 'lib/rubygems/mini_mirror/cli.rb', line 44 def load! return if @loaded @loaded = true end |
#resource(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/rubygems/mini_mirror/cli.rb', line 34 def resource(={}) errors = catch(:resource_load_error) do @runner.load_resource!() nil end if errors handle_error(errors) end end |
#source(*sources) ⇒ Object
29 30 31 32 |
# File 'lib/rubygems/mini_mirror/cli.rb', line 29 def source(*sources) @sources ||= [] @sources |= sources.map{|s| DEFAULT_SOURCES[s] || s }.flatten end |