Class: GemOnDemand::Project
- Inherits:
-
Object
- Object
- GemOnDemand::Project
- Defined in:
- lib/gem_on_demand/project.rb
Constant Summary collapse
- MAX_VERSIONS =
some projects just have a million versions …
50
- DEPENDENCIES =
"dependencies"
- VERSION_REX =
with or without v and pre-release (cannot do others or we get: ‘Malformed version number string 1.0.0-rails3’ from bundler)
/^v?\d+\.\d+\.\d+(\.\w+)?$/
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#name ⇒ Object
Returns the value of attribute name.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #build_gem(version) ⇒ Object
- #dependencies ⇒ Object
-
#initialize(user, name, cache) ⇒ Project
constructor
A new instance of Project.
Constructor Details
#initialize(user, name, cache) ⇒ Project
Returns a new instance of Project.
9 10 11 12 13 |
# File 'lib/gem_on_demand/project.rb', line 9 def initialize(user, name, cache) self.user = user self.name = name self.cache = cache end |
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
7 8 9 |
# File 'lib/gem_on_demand/project.rb', line 7 def cache @cache end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/gem_on_demand/project.rb', line 7 def name @name end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/gem_on_demand/project.rb', line 7 def user @user end |
Instance Method Details
#build_gem(version) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/gem_on_demand/project.rb', line 29 def build_gem(version) cache.fetch("gem-#{version}") do checkout_version("v#{version}") gemspec = "#{name}.gemspec" Utils.remove_signing(gemspec) Utils.sh("gem build #{gemspec}") File.read("#{name}-#{version}.gem") end end |
#dependencies ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gem_on_demand/project.rb', line 15 def dependencies cache.fetch DEPENDENCIES do versions.last(MAX_VERSIONS).map do |version| next unless dependencies = dependencies_for_version(version) { :name => name, :number => version.sub(/^v/, ""), :platform => "ruby", :dependencies => dependencies } end.compact end end |