Class: CapsuleCD::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Order of inheritance: file <- environment <- cli options <- means ‘overridden by’, eg. file overridden by environment vars

Parameters:

  • config_path (String)

    The path to the configuration file



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/capsulecd/base/configuration.rb', line 9

def initialize(options={})
  @options = options
  @config_path = @options[:config_file]

  populate_defaults
  populate_system_config_file
  populate_runner_overrides
  populate_env_overrides
  populate_cli_overrides
  standardize_settings
end

Instance Attribute Details

#chef_supermarket_typeObject (readonly)

Returns the value of attribute chef_supermarket_type.



50
51
52
# File 'lib/capsulecd/base/configuration.rb', line 50

def chef_supermarket_type
  @chef_supermarket_type
end

#chef_supermarket_usernameObject (readonly)

Package auth/config (any credentials added here should also be added to the spec_helper.rb VCR config)



46
47
48
# File 'lib/capsulecd/base/configuration.rb', line 46

def chef_supermarket_username
  @chef_supermarket_username
end

#config_pathObject (readonly)

General config



28
29
30
# File 'lib/capsulecd/base/configuration.rb', line 28

def config_path
  @config_path
end

#configurationObject (readonly)

Returns the value of attribute configuration.



29
30
31
# File 'lib/capsulecd/base/configuration.rb', line 29

def configuration
  @configuration
end

#dry_runObject (readonly)

Returns the value of attribute dry_run.



25
26
27
# File 'lib/capsulecd/base/configuration.rb', line 25

def dry_run
  @dry_run
end

#engine_cmd_coverageObject (readonly)

Returns the value of attribute engine_cmd_coverage.



64
65
66
# File 'lib/capsulecd/base/configuration.rb', line 64

def engine_cmd_coverage
  @engine_cmd_coverage
end

#engine_cmd_lintObject (readonly)

Returns the value of attribute engine_cmd_lint.



63
64
65
# File 'lib/capsulecd/base/configuration.rb', line 63

def engine_cmd_lint
  @engine_cmd_lint
end

#engine_cmd_minificationObject (readonly)

Returns the value of attribute engine_cmd_minification.



62
63
64
# File 'lib/capsulecd/base/configuration.rb', line 62

def engine_cmd_minification
  @engine_cmd_minification
end

#engine_cmd_testObject (readonly)

Returns the value of attribute engine_cmd_test.



61
62
63
# File 'lib/capsulecd/base/configuration.rb', line 61

def engine_cmd_test
  @engine_cmd_test
end

#engine_disable_cleanupObject (readonly)

Returns the value of attribute engine_disable_cleanup.



66
67
68
# File 'lib/capsulecd/base/configuration.rb', line 66

def engine_disable_cleanup
  @engine_disable_cleanup
end

#engine_disable_coverageObject (readonly)

Returns the value of attribute engine_disable_coverage.



60
61
62
# File 'lib/capsulecd/base/configuration.rb', line 60

def engine_disable_coverage
  @engine_disable_coverage
end

#engine_disable_lintObject (readonly)

Returns the value of attribute engine_disable_lint.



59
60
61
# File 'lib/capsulecd/base/configuration.rb', line 59

def engine_disable_lint
  @engine_disable_lint
end

#engine_disable_minificationObject (readonly)

Returns the value of attribute engine_disable_minification.



58
59
60
# File 'lib/capsulecd/base/configuration.rb', line 58

def engine_disable_minification
  @engine_disable_minification
end

#engine_disable_testObject (readonly)

Engine config



57
58
59
# File 'lib/capsulecd/base/configuration.rb', line 57

def engine_disable_test
  @engine_disable_test
end

#engine_version_bump_typeObject (readonly)

Returns the value of attribute engine_version_bump_type.



65
66
67
# File 'lib/capsulecd/base/configuration.rb', line 65

def engine_version_bump_type
  @engine_version_bump_type
end

#npm_auth_tokenObject (readonly)

Returns the value of attribute npm_auth_token.



47
48
49
# File 'lib/capsulecd/base/configuration.rb', line 47

def npm_auth_token
  @npm_auth_token
end

#package_typeObject (readonly)

Cli config, shouldnt be set via environmental variables (will be overridden)



22
23
24
# File 'lib/capsulecd/base/configuration.rb', line 22

def package_type
  @package_type
end

#pypi_passwordObject (readonly)

Returns the value of attribute pypi_password.



49
50
51
# File 'lib/capsulecd/base/configuration.rb', line 49

def pypi_password
  @pypi_password
end

#pypi_usernameObject (readonly)

Returns the value of attribute pypi_username.



48
49
50
# File 'lib/capsulecd/base/configuration.rb', line 48

def pypi_username
  @pypi_username
end

#rubygems_api_keyObject (readonly)

Returns the value of attribute rubygems_api_key.



51
52
53
# File 'lib/capsulecd/base/configuration.rb', line 51

def rubygems_api_key
  @rubygems_api_key
end

#runnerObject (readonly)

Returns the value of attribute runner.



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

def runner
  @runner
end

#runner_branchObject (readonly)

Returns the value of attribute runner_branch.



40
41
42
# File 'lib/capsulecd/base/configuration.rb', line 40

def runner_branch
  @runner_branch
end

#runner_clone_urlObject (readonly)

Returns the value of attribute runner_clone_url.



41
42
43
# File 'lib/capsulecd/base/configuration.rb', line 41

def runner_clone_url
  @runner_clone_url
end

#runner_pull_requestObject (readonly)

Runner config



38
39
40
# File 'lib/capsulecd/base/configuration.rb', line 38

def runner_pull_request
  @runner_pull_request
end

#runner_repo_full_nameObject (readonly)

Returns the value of attribute runner_repo_full_name.



42
43
44
# File 'lib/capsulecd/base/configuration.rb', line 42

def runner_repo_full_name
  @runner_repo_full_name
end

#runner_repo_nameObject (readonly)

Returns the value of attribute runner_repo_name.



43
44
45
# File 'lib/capsulecd/base/configuration.rb', line 43

def runner_repo_name
  @runner_repo_name
end

#runner_shaObject (readonly)

Returns the value of attribute runner_sha.



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

def runner_sha
  @runner_sha
end

#sourceObject (readonly)

Returns the value of attribute source.



23
24
25
# File 'lib/capsulecd/base/configuration.rb', line 23

def source
  @source
end

#source_git_parent_pathObject (readonly)

Source config (any credentials added here should also be added to the spec_helper.rb VCR config)



32
33
34
# File 'lib/capsulecd/base/configuration.rb', line 32

def source_git_parent_path
  @source_git_parent_path
end

#source_github_access_tokenObject (readonly)

Returns the value of attribute source_github_access_token.



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

def source_github_access_token
  @source_github_access_token
end

#source_github_api_endpointObject (readonly)

Returns the value of attribute source_github_api_endpoint.



33
34
35
# File 'lib/capsulecd/base/configuration.rb', line 33

def source_github_api_endpoint
  @source_github_api_endpoint
end

#source_github_web_endpointObject (readonly)

Returns the value of attribute source_github_web_endpoint.



34
35
36
# File 'lib/capsulecd/base/configuration.rb', line 34

def source_github_web_endpoint
  @source_github_web_endpoint
end

Instance Method Details

#chef_supermarket_keyObject



52
53
54
# File 'lib/capsulecd/base/configuration.rb', line 52

def chef_supermarket_key
  @chef_supermarket_key.to_s.empty? ? nil : Base64.strict_decode64(@chef_supermarket_key)
end

#populate_repo_config_file(repo_local_path) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/capsulecd/base/configuration.rb', line 69

def populate_repo_config_file(repo_local_path)
  repo_config_file_path = repo_local_path + '/capsule.yml'
  load_config_file(repo_config_file_path)
  populate_runner_overrides
  populate_env_overrides
  populate_cli_overrides
  standardize_settings
end

#populate_system_config_fileObject

The raw parsed configuration file, system level, a repo level configuration file will override settings in this file.



79
80
81
# File 'lib/capsulecd/base/configuration.rb', line 79

def populate_system_config_file
  load_config_file(@config_path)
end