Class: Pixab::RepoManager
- Inherits:
-
Object
- Object
- Pixab::RepoManager
- Defined in:
- lib/projects/RepoManager.rb
Instance Attribute Summary collapse
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #feature_branch ⇒ Object
- #feature_name ⇒ Object
-
#initialize ⇒ RepoManager
constructor
A new instance of RepoManager.
- #main_repo ⇒ Object
- #main_repo_name ⇒ Object
- #read_repo_infos ⇒ Object
- #repos ⇒ Object
- #sub_repo_names ⇒ Object
- #sub_repos ⇒ Object
Constructor Details
#initialize ⇒ RepoManager
Returns a new instance of RepoManager.
13 14 15 |
# File 'lib/projects/RepoManager.rb', line 13 def initialize() read_repo_infos end |
Instance Attribute Details
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
11 12 13 |
# File 'lib/projects/RepoManager.rb', line 11 def feature @feature end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
11 12 13 |
# File 'lib/projects/RepoManager.rb', line 11 def root_path @root_path end |
Instance Method Details
#feature_branch ⇒ Object
64 65 66 |
# File 'lib/projects/RepoManager.rb', line 64 def feature_branch feature["branch_prefix"] + feature_name end |
#feature_name ⇒ Object
60 61 62 |
# File 'lib/projects/RepoManager.rb', line 60 def feature_name feature["name"] end |
#main_repo ⇒ Object
37 38 39 |
# File 'lib/projects/RepoManager.rb', line 37 def main_repo repos.first end |
#main_repo_name ⇒ Object
41 42 43 |
# File 'lib/projects/RepoManager.rb', line 41 def main_repo_name main_repo["name"] end |
#read_repo_infos ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/projects/RepoManager.rb', line 17 def read_repo_infos mbox_root = `mbox status --only root` Utilities.check_shell_result('Error: This is not `Mbox` directory') @root_path = mbox_root.split().last FileUtils.cd(root_path) json = File.read(".mbox/config.json") obj = JSON.parse(json) current_feature_name = obj["current_feature_name"] if current_feature_name.empty? puts "Error: You are currently in Free Mode".red exit(1) end @feature = obj["features"][current_feature_name.downcase] end |
#repos ⇒ Object
33 34 35 |
# File 'lib/projects/RepoManager.rb', line 33 def repos feature["repos"] end |
#sub_repo_names ⇒ Object
54 55 56 57 58 |
# File 'lib/projects/RepoManager.rb', line 54 def sub_repo_names sub_repos.map do |sub_repo| sub_repo["name"] end end |
#sub_repos ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/projects/RepoManager.rb', line 45 def sub_repos if repos.length > 1 sub_repos = repos.dup sub_repos.delete_at(0) return sub_repos end return [] end |