Class: Deproll::RailsEnvironment

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/deproll.rb

Instance Method Summary collapse

Methods included from Helper

#file

Instance Method Details

#dependencies(gem) ⇒ Object


207
208
209
# File 'lib/deproll.rb', line 207

def dependencies(gem)
  ([gem] + gem.dependencies.map { |dp| dependencies(dp) }.flatten).flatten
end

#gemsObject


203
204
205
# File 'lib/deproll.rb', line 203

def gems
  gemspecs.map { |gemspec| ProjectGem.new(gemspec) }.flatten
end

#gemspecsObject


211
212
213
214
215
# File 'lib/deproll.rb', line 211

def gemspecs
  Rails.configuration.gems.map do |gem|
    [gem] + dependencies(gem)
  end.flatten.uniq
end

#load_railsObject


195
196
197
198
199
200
201
# File 'lib/deproll.rb', line 195

def load_rails
  puts "Loading Rails..."
  eval(File.read(rakefile))
  $gems_rake_task = true
  require 'rubygems/gem_runner'
  Rake::Task[:environment].invoke
end

#rails?Boolean

Returns:

  • (Boolean)

183
184
185
# File 'lib/deproll.rb', line 183

def rails?
  File.exist?(file("config", "environment.rb"))
end

#rakefileObject


187
188
189
# File 'lib/deproll.rb', line 187

def rakefile
  file("Rakefile")
end

#rakefile?Boolean

Returns:

  • (Boolean)

191
192
193
# File 'lib/deproll.rb', line 191

def rakefile?
  File.exist?(rakefile)
end

#updateable_gemsObject


217
218
219
220
# File 'lib/deproll.rb', line 217

def updateable_gems
  load_rails if rails?
  gems.select(&:updateable?)
end