CiHelper 2.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 962fdd3ea07e2d9a2530b2f40d9f43adadfb34d6
4
- data.tar.gz: 626d889374f8ea6da9583dc95c5eab5856da5dc8
3
+ metadata.gz: 73d51eac14784319039deefb54c51d159a437f9a
4
+ data.tar.gz: 6836e4a0bcb44526b874db4532dba84c0f0889df
5
5
  SHA512:
6
- metadata.gz: 5aeebe913fe7012d7c34e10986e9e349d86ce6331f844e0dbec7715fe269758f3976a2bdebf3a7e7c555accf6cbf57bae304bc6a06f688cac47fa10b03eb1a2e
7
- data.tar.gz: e9c3edf5026ba8f1e3ef84ba522eb2c5e08fa6b0c1e272984f20b44db41dcf214dbbb0b5feb21e948b2058c2dca5e56d9a81a8f18fb559cf6bc68c4e1f4b9217
6
+ metadata.gz: 352cf44afcf21ebf26d63bd533cb248a2a90c1914d2421eb367aaa5539599917f13efca306be4db9c908dfd4f01a1a5e1bbfa461b127c4008504008170b8789e
7
+ data.tar.gz: 70f0311cabca23c0e2b234d7ecaa3e6428966ea3ff993a65d46fcd892913b52486c4af1e313a2af80504f59c7e6eb4f7bf5be6695d695aab1feb0b9463185952
@@ -64,7 +64,7 @@ module CiHelper
64
64
  end
65
65
 
66
66
  def issue_numbers
67
- branch_name.split('_').each { |name| name.delete!('t') }
67
+ branch_name.split('_').each { |name| name.delete!('t') }.delete_if { |name| name.to_i.zero?}
68
68
  end
69
69
 
70
70
  def branch_name=(name)
@@ -10,8 +10,6 @@ module CiHelper
10
10
  @user_cli = CiHelper::UserCommandLineInterface.new
11
11
 
12
12
 
13
-
14
- # @config = YAML.load_file("#{target}/#{CiHelper::CONFIG_FILE_NAME}")
15
13
  @issue_monitor = IssueMonitor.new(config.ci_ac, config.ci_pass)
16
14
  @bit_bucket_client = BitBucketProcedure.new(config.bit_ac, config.bit_pass)
17
15
  @redmine_client = RedmineProcedure.new(config.redmine_ac, config.redmine_pass)
@@ -18,17 +18,14 @@ module CiHelper
18
18
 
19
19
  if issue_monitor.success?
20
20
  print_console_link
21
- get_redmine_info
22
- ask_user_pull_request_information
21
+ start_pull_request_function
23
22
  # TODO: need to implement the updater_issue class, and then try auto update the issue status
24
23
  # update_issue
25
24
  else
26
25
  print_fails
27
26
  print_console_link
28
27
  if user_cli.force_create_pull_request?
29
- redmine_client.issue_no = result.issue_number
30
- get_redmine_info
31
- ask_user_pull_request_information
28
+ start_pull_request_function
32
29
  # update_issue
33
30
  end
34
31
  end
@@ -44,19 +41,10 @@ module CiHelper
44
41
  end
45
42
  end
46
43
 
47
- def ask_user_pull_request_information
48
- bit_bucket_client.pf_title = redmine_client.issue.description
49
- user_cli.print_target(redmine_client.target)
50
- bit_bucket_client.add_destination(user_cli.get_destination)
51
- bit_bucket_client.add_user_description(user_cli.get_more_info)
52
- bit_bucket_client.reviewers = user_cli.get_reviewers
53
- bit_bucket_client.result = result
54
- user_cli.waiting_for_creation
55
- bit_bucket_client.create_pull_request(result)
56
- sleep(0.5)
57
- bit_bucket_client.go_to_pull_request_page
58
- sleep(0.5)
59
- puts "this is your pull request page : #{CiHelper::BITBUCKET_DOMAIN}#{bit_bucket_client.pull_request_page.link_with(class: 'execute').href}"
44
+ def start_pull_request_function
45
+ pull_request = CiHelper::Functions::PullRequest.new(config)
46
+ pull_request.branch_name = result.branch_name
47
+ pull_request.run
60
48
  end
61
49
 
62
50
  def print_console_link
@@ -2,22 +2,25 @@ module CiHelper
2
2
  module Functions
3
3
  class PullRequest < Base
4
4
 
5
+ attr_reader :branch_name
6
+
5
7
  def run
6
- bit_bucket_client.branch_name = user_cli.get_branch_name
8
+ bit_bucket_client.branch_name = branch_name || user_cli.get_branch_name
7
9
 
8
10
  if bit_bucket_client.multiple_issues?
9
11
  bit_bucket_client.pf_title = user_cli.customize_title
10
12
  else
11
- get_redmine_info
13
+ redmine_client.issue_no = bit_bucket_client.issue_numbers.first
12
14
  bit_bucket_client.pf_title = redmine_client.issue.description
15
+ user_cli.print_target(redmine_client.issue.target_version)
13
16
  end
14
17
 
15
18
  bit_bucket_client.add_destination(user_cli.get_destination)
16
19
  bit_bucket_client.add_user_description(user_cli.get_more_info)
17
20
  bit_bucket_client.reviewers = user_cli.get_reviewers
18
21
  user_cli.waiting_for_creation
19
-
20
22
  bit_bucket_client.create_pull_request
23
+
21
24
  sleep(0.5)
22
25
  bit_bucket_client.go_to_pull_request_page
23
26
  sleep(0.5)
@@ -25,13 +28,10 @@ module CiHelper
25
28
  puts "this is your pull request page : #{CiHelper::BITBUCKET_DOMAIN}#{bit_bucket_client.pull_request_page.link_with(class: 'execute').href}"
26
29
  end
27
30
 
28
- private
29
-
30
- def get_redmine_info
31
- redmine_client.issue_no = bit_bucket_client.issue_numbers.first
32
- redmine_client.login
33
- redmine_client.set_issue_form
31
+ def branch_name=(name)
32
+ @branch_name = name
34
33
  end
34
+
35
35
  end
36
36
  end
37
37
  end
@@ -11,7 +11,6 @@ module CiHelper
11
11
  :redmine_ac, :redmine_pass)
12
12
 
13
13
  attr_accessor :config, :user_cli
14
- attr_reader :issue_monitor, :bit_bucket_client, :redmine_client
15
14
 
16
15
  def initialize(target)
17
16
  @config = YAML.load_file("#{target}/#{CiHelper::CONFIG_FILE_NAME}")
@@ -50,7 +50,7 @@ module CiHelper
50
50
  end
51
51
 
52
52
  def target_version
53
- target_version_select_list.options.select{ |option| option.value == target_version_select_list.value }
53
+ target_version_select_list.options.select{ |option| option.value == target_version_select_list.value }.first.text
54
54
  end
55
55
 
56
56
  def submit
@@ -1,3 +1,3 @@
1
1
  module CiHelper
2
- VERSION = '2.0'
2
+ VERSION = '2.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CiHelper
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Yu