Class: Crackin::Release

Inherits:
Object
  • Object
show all
Defined in:
lib/crackin/release.rb

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Release

Returns a new instance of Release.



3
4
5
6
7
8
9
10
11
# File 'lib/crackin/release.rb', line 3

def initialize(type)
  @config = Crackin.config
  @source = @config.source
  @current = @source.current_branch
  @type = type
  @version = Crackin::VersionFile.new(@config['version'])
  raise "unknown version type: #{type}" unless @version.respond_to?(type.to_sym)
  @version.send(type.to_sym)
end

Instance Method Details

#finish(options = {}) ⇒ Object



24
25
26
27
28
29
# File 'lib/crackin/release.rb', line 24

def finish(options={})
  o = {
      real: true
  }.merge(options)
  run(finish_actions)
end

#rollback(options = {}) ⇒ Object



31
32
33
34
# File 'lib/crackin/release.rb', line 31

def rollback(options={})
  puts "rolling back: #{@version}"
  undo(start_actions)
end

#start(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/crackin/release.rb', line 13

def start(options={})
  o = {
      real: true
  }.merge(options)
  # make sure no pending changes
  raise "there are pending changes" if o[:real] && @source.pending?

  puts "release: #{@version}"
  run(start_actions)
end