Class: Pumper::Project

Inherits:
Struct
  • Object
show all
Defined in:
lib/pumper/project.rb

Defined Under Namespace

Classes: UndefinedGem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Project

Returns a new instance of Project.



5
6
7
8
# File 'lib/pumper/project.rb', line 5

def initialize(options)
  set_options(options)
  @gemfile = gemfile_path
end

Instance Attribute Details

#gemsetObject

Returns the value of attribute gemset

Returns:

  • (Object)

    the current value of gemset



2
3
4
# File 'lib/pumper/project.rb', line 2

def gemset
  @gemset
end

#is_absolute_pathObject

Returns the value of attribute is_absolute_path

Returns:

  • (Object)

    the current value of is_absolute_path



2
3
4
# File 'lib/pumper/project.rb', line 2

def is_absolute_path
  @is_absolute_path
end

#is_vendorObject

Returns the value of attribute is_vendor

Returns:

  • (Object)

    the current value of is_vendor



2
3
4
# File 'lib/pumper/project.rb', line 2

def is_vendor
  @is_vendor
end

#projectObject

Returns the value of attribute project

Returns:

  • (Object)

    the current value of project



2
3
4
# File 'lib/pumper/project.rb', line 2

def project
  @project
end

Instance Method Details

#bump_version!(specification) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/pumper/project.rb', line 10

def bump_version!(specification)
  text = File.read(@gemfile)
  if gem_defined?(text, specification.name)
    File.open(@gemfile, 'w') do |file|
      file.puts(text.gsub(/#{ gem_name(specification.name) }.*/, specification.for_gemfile))
    end
  else
    raise Project::UndefinedGem
  end
end

#pathObject



21
22
23
24
25
# File 'lib/pumper/project.rb', line 21

def path
  is_absolute_path ?
    project :
    File.join(Dir.pwd, "../#{ project }")
end