Class: MarkVersionConfig
- Inherits:
-
Object
- Object
- MarkVersionConfig
- Defined in:
- lib/mark_version/mark_version_config.rb
Instance Attribute Summary collapse
-
#base_folder_name ⇒ Object
readonly
Returns the value of attribute base_folder_name.
Instance Method Summary collapse
- #add_release_branch(branch) ⇒ Object
- #auto_push? ⇒ Boolean
- #init ⇒ Object
-
#initialize(base_folder_name = '.mark_version') ⇒ MarkVersionConfig
constructor
A new instance of MarkVersionConfig.
- #local_config_file ⇒ Object
- #project_config_file ⇒ Object
- #release_branches ⇒ Object
- #remove_release_branch(branch) ⇒ Object
- #set_auto_push(set) ⇒ Object
Constructor Details
#initialize(base_folder_name = '.mark_version') ⇒ MarkVersionConfig
Returns a new instance of MarkVersionConfig.
6 7 8 |
# File 'lib/mark_version/mark_version_config.rb', line 6 def initialize(base_folder_name = '.mark_version') @base_folder_name = base_folder_name end |
Instance Attribute Details
#base_folder_name ⇒ Object (readonly)
Returns the value of attribute base_folder_name.
4 5 6 |
# File 'lib/mark_version/mark_version_config.rb', line 4 def base_folder_name @base_folder_name end |
Instance Method Details
#add_release_branch(branch) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/mark_version/mark_version_config.rb', line 31 def add_release_branch(branch) configs = project_configs configs['release_branches'] = [] if configs['release_branches'].nil? configs['release_branches'] << branch write_project(configs) end |
#auto_push? ⇒ Boolean
51 52 53 |
# File 'lib/mark_version/mark_version_config.rb', line 51 def auto_push? local_configs['auto_push'] end |
#init ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/mark_version/mark_version_config.rb', line 10 def init f1 = open(project_config_file, 'w') f1.puts('{ }') f1.close f2 = open(local_config_file, 'w') f2.puts('{ }') f2.close end |
#local_config_file ⇒ Object
23 24 25 |
# File 'lib/mark_version/mark_version_config.rb', line 23 def local_config_file "#{base_folder_name}/LOCAL_CONFIG" end |
#project_config_file ⇒ Object
19 20 21 |
# File 'lib/mark_version/mark_version_config.rb', line 19 def project_config_file "#{base_folder_name}/CONFIG" end |
#release_branches ⇒ Object
27 28 29 |
# File 'lib/mark_version/mark_version_config.rb', line 27 def release_branches project_configs['release_branches'] || [] end |
#remove_release_branch(branch) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/mark_version/mark_version_config.rb', line 41 def remove_release_branch(branch) configs = project_configs return false if configs['release_branches'].nil? configs['release_branches'] = configs['release_branches'] - [branch] write_project(configs) end |
#set_auto_push(set) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/mark_version/mark_version_config.rb', line 55 def set_auto_push(set) configs = local_configs configs['auto_push'] = set write_local(configs) end |