Class: Chandler::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/chandler/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
# File 'lib/chandler/configuration.rb', line 12

def initialize
  @changelog_path = "CHANGELOG.md"
  @git_path = ".git"
  @logger = Chandler::Logger.new
  @dry_run = false
  @github_repository = nil
end

Instance Attribute Details

#changelog_pathObject

Returns the value of attribute changelog_path.



8
9
10
# File 'lib/chandler/configuration.rb', line 8

def changelog_path
  @changelog_path
end

#dry_runObject

Returns the value of attribute dry_run.



8
9
10
# File 'lib/chandler/configuration.rb', line 8

def dry_run
  @dry_run
end

#environmentObject

Returns the value of attribute environment.



8
9
10
# File 'lib/chandler/configuration.rb', line 8

def environment
  @environment
end

#git_pathObject

Returns the value of attribute git_path.



8
9
10
# File 'lib/chandler/configuration.rb', line 8

def git_path
  @git_path
end

#github_repositoryObject



39
40
41
# File 'lib/chandler/configuration.rb', line 39

def github_repository
  @github_repository || git.origin_remote
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/chandler/configuration.rb', line 8

def logger
  @logger
end

#tag_prefixObject

Returns the value of attribute tag_prefix.



8
9
10
# File 'lib/chandler/configuration.rb', line 8

def tag_prefix
  @tag_prefix
end

Instance Method Details

#changelogObject



35
36
37
# File 'lib/chandler/configuration.rb', line 35

def changelog
  @changelog ||= Chandler::Changelog.new(:path => changelog_path)
end

#dry_run?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/chandler/configuration.rb', line 20

def dry_run?
  dry_run
end

#gitObject



24
25
26
# File 'lib/chandler/configuration.rb', line 24

def git
  @git ||= Chandler::Git.new(:path => git_path, :tag_mapper => tag_mapper)
end

#githubObject



28
29
30
31
32
33
# File 'lib/chandler/configuration.rb', line 28

def github
  @github ||= Chandler::GitHub.new(
    :repository => github_repository,
    :config => self
  )
end

#tag_mapperObject



43
44
45
46
# File 'lib/chandler/configuration.rb', line 43

def tag_mapper
  return ->(tag) { tag } if tag_prefix.nil?
  ->(tag) { tag[/^#{Regexp.escape(tag_prefix)}(.*)/, 1] }
end