Class: Seagull::DeploymentStrategies::DeploymentStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/seagull/deployment_strategies.rb

Direct Known Subclasses

Crashlytics, File, HockeyApp

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ DeploymentStrategy

Returns a new instance of DeploymentStrategy.



14
15
16
17
18
19
20
# File 'lib/seagull/deployment_strategies.rb', line 14

def initialize(configuration)
  @configuration = configuration

  if respond_to?(:extended_configuration_for_strategy)
    @configuration.instance_eval(&extended_configuration_for_strategy)
  end
end

Instance Method Details

#configure {|@configuration.deploy| ... } ⇒ Object

Yields:



22
23
24
25
26
# File 'lib/seagull/deployment_strategies.rb', line 22

def configure(&block)
  @configuration.deploy.from_hash(defaults)

  yield @configuration.deploy
end

#defaultsObject



28
29
30
# File 'lib/seagull/deployment_strategies.rb', line 28

def defaults
  {}
end

#deployObject



36
37
38
# File 'lib/seagull/deployment_strategies.rb', line 36

def deploy
  raise "NOT IMPLEMENTED"
end

#prepareObject



32
33
34
# File 'lib/seagull/deployment_strategies.rb', line 32

def prepare
  puts "Nothing to prepare!"
end

#release_notesObject



40
41
42
43
44
45
46
47
# File 'lib/seagull/deployment_strategies.rb', line 40

def release_notes
  changelog = ::File.exists?(@configuration.changelog_file) ? ::File.read(@configuration.changelog_file) : ""

  parser = Vandamme::Parser.new(changelog: changelog, version_header_exp: '^\*\*?([\w\d\.-]+\.[\w\d\.-]+[a-zA-Z0-9])( \/ (\d{4}-\d{2}-\d{2}|\w+))?\*\*\n?[=-]*', format: 'markdown')
  changes = parser.parse

  changes.first(@configuration.deploy.release_notes_items).collect{|v, c| "**#{v}**\n\n#{c}" }.join("\n\n")
end