Class: CiHelper::MainProcess
- Inherits:
-
Object
- Object
- CiHelper::MainProcess
- Defined in:
- lib/ci_helper/main_process.rb
Defined Under Namespace
Classes: USER_CONFIG
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#user_cli ⇒ Object
Returns the value of attribute user_cli.
Instance Method Summary collapse
- #ci_monitor? ⇒ Boolean
- #create_pull_request? ⇒ Boolean
-
#initialize(target) ⇒ MainProcess
constructor
A new instance of MainProcess.
- #run ⇒ Object
- #structlize_config ⇒ Object
- #update_issue? ⇒ Boolean
Constructor Details
#initialize(target) ⇒ MainProcess
Returns a new instance of MainProcess.
15 16 17 18 19 20 21 |
# File 'lib/ci_helper/main_process.rb', line 15 def initialize(target) @config = YAML.load_file("#{target}/#{CiHelper::CONFIG_FILE_NAME}") @user_cli = UserCommandLineInterface.new fail CiHelper::ConfigError, 'Please install to set your account first ' unless config structlize_config end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
13 14 15 |
# File 'lib/ci_helper/main_process.rb', line 13 def config @config end |
#user_cli ⇒ Object
Returns the value of attribute user_cli.
13 14 15 |
# File 'lib/ci_helper/main_process.rb', line 13 def user_cli @user_cli end |
Instance Method Details
#ci_monitor? ⇒ Boolean
55 56 57 |
# File 'lib/ci_helper/main_process.rb', line 55 def ci_monitor? @option == '1' end |
#create_pull_request? ⇒ Boolean
63 64 65 |
# File 'lib/ci_helper/main_process.rb', line 63 def create_pull_request? @option == '2' end |
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ci_helper/main_process.rb', line 23 def run while true begin @option = user_cli.get_user_choose if ci_monitor? CiHelper::Functions::Jenkin.new(config).run elsif update_issue? CiHelper::Functions::Redmine.new(config).run elsif create_pull_request? CiHelper::Functions::PullRequest.new(config).run else puts 'Please dont act like a monkey' end rescue => e puts 'You may enter wrong ticket, branch name or face a internet problem' puts e. puts "If you think is a bug please go to create a issue for me #{CiHelper::BUG_REPORT_URL}" end end end |
#structlize_config ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/ci_helper/main_process.rb', line 46 def structlize_config self.config = USER_CONFIG.new(config[:ci][:account], config[:ci][:password], config[:bitbucket][:account], config[:bitbucket][:password], config[:redmine][:account], config[:redmine][:password]) end |
#update_issue? ⇒ Boolean
59 60 61 |
# File 'lib/ci_helper/main_process.rb', line 59 def update_issue? @option == '3' end |