Sha256: 545f4af68653518522579bf6cbe3092aa421b841c40fc1eeafc02d16e47276b8
Contents?: true
Size: 883 Bytes
Versions: 17
Compression:
Stored size: 883 Bytes
Contents
class Environment def initialize(project, environment_name) @project = project @environment_name = environment_name end attr_reader :project, :environment_name def last_deploy @last_deploy ||= project.deploys.completed.to(environment_name).first end def head return (environment_name == "Production" ? "c7c7380" : "98318a3") if Rails.env.development? @head ||= last_deploy.try(:commit) end def read_file(path) project.read_file(path, commit: head) if head rescue Houston::Adapters::VersionControl::CommitNotFound nil end def dependency_version(dependency) lockfile = read_file("Gemfile.lock") return nil unless lockfile dependency = dependency.to_s locked_gems = Bundler::LockfileParser.new(lockfile) spec = locked_gems.specs.find { |spec| spec.name == dependency } spec.version if spec end end
Version data entries
17 entries across 17 versions & 1 rubygems