allegro_release 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46db88aa057e9f57a49449d05d2b62fca123f5b1
4
- data.tar.gz: 6807e8cdec58babbd6d4a79933b3f02e4da9de49
3
+ metadata.gz: 21cd14882704d7d59db9e50860adadb65c617268
4
+ data.tar.gz: 634e64b48221019aab86036997a29910cc68922f
5
5
  SHA512:
6
- metadata.gz: 4bd37a4783fe439c8cf6807b21780d02604350b98f44931a31af3141d2525db0bdbe519799ceb126e11826f336d6c7ca59405a1a4d2a14022ba1b22345d7d257
7
- data.tar.gz: 3b33250f736cb388eabde4b11b6044acd8b5da34dd3e1b9fb4663085bbbfaaa761e6c8f13a06872986a80c6bc2ead5cecdee15953fcdebb18eef0f820941942b
6
+ metadata.gz: e1c730b3051c8a4094a4ae384472b4e4bb15cc67bf4cb94b0f958a0724f60f7a05cfe62628bc0dbdb5162de52c28210da668bd0b7784c9abc1d72033d78d30b7
7
+ data.tar.gz: 4fd502a9e25f6db3d808c9058335753ba156e8ec83535e6a61d34249d72c985db757ff54687fb8a585bfbb29f1ce5f8770df63f1e0c4c3de038b25615d7d7a4f
data/README.md CHANGED
@@ -1,9 +1,102 @@
1
- # Release
1
+ ### `allegro_release` tool
2
2
 
3
- ## Installation
3
+ `allegro_release` is a dedicated tool that helps in releasing a pod.
4
4
 
5
- ## Usage
5
+ #### Prerequests
6
6
 
7
- ## Development
7
+ In order to properly use `allegro_release` you need to install [`atlassian-stash`](http://blogs.atlassian.com/2012/11/stash-pull-requests-from-the-command-line/) gem:
8
8
 
9
- ## Contributing
9
+ ```sh
10
+ gem install atlassian-stash
11
+ ```
12
+
13
+ After installation, run `stash configure` to configure Stash instance (you will have to run `stash configure` every time you change your password, which currently is once per month). The following prompts should appear:
14
+
15
+ ```sh
16
+ Bitbucket Server Username: <your_username> (go to "View Profile" in upper-right corner of Stash)
17
+ Bitbucket Server Password (optional): <your_password>
18
+ Bitbucket Server URL: https://stash.allegrogroup.com/
19
+ Remote (optional): <leave_empty>
20
+ Create a git alias 'git create-pull-request'? n
21
+ ```
22
+
23
+ #### Installation of `allegro_release`
24
+
25
+ Run:
26
+
27
+ ```sh
28
+ gem install allegro_release
29
+ ```
30
+
31
+
32
+ ### Procedure flow
33
+
34
+ If you don't want to use `allegro_release` just follow the steps in **What it does?** sections.
35
+
36
+ #### Step 1
37
+
38
+ Run command in root of repository where `.podspec` is.
39
+
40
+ ```sh
41
+ allegro_release (major|minor|patch)
42
+ ```
43
+
44
+ * `major` increases major (X.0.0) version of pod.
45
+ * `minor` increases minor (0.X.0) version of pod.
46
+ * `patch` increases patch (0.0.X) version of pod.
47
+
48
+ **What it does?**
49
+
50
+ 1. Checkouts `develop` branch and pulls changes from repository.
51
+ 2. Creates new branch named `release_<version>`.
52
+ 3. Bumps the version in `.podspec` accordingly to chosen option.
53
+ 4. Updates `CHANGELOG.md` if available in the repository. Precisely, the tool is updating release date of release version and adds placeholders for next version on top of the file. `CHANGELOG.md` must follow the convention (explained below) used in repositories in order for this step to work.
54
+ 5. Checks if `.podspec` file is valid via `pod lib lint`.
55
+ 6. Commits all the changes. During this step `allegro_release` is asking the user for release issue JIRA ID.
56
+ 7. Pushes the branch to the remote repository.
57
+ 8. Creates pull request from `release_<version>` to `develop`.
58
+
59
+ ##### CHANGELOG.md convention
60
+
61
+ File line numbers are on the left.
62
+
63
+ ```
64
+ 1. # CHANEGLOG
65
+ 2.
66
+ 3. ## Version X.X.X
67
+ 4. #### Unreleased
68
+ 5.
69
+ 6. - (added) # Some unreleased changes
70
+ 7.
71
+ 8. ## Version 2.2.2
72
+ 9. ### Released 01.01.2016
73
+ 10.
74
+ 11. - (modified) # Some released changes and the rest of CHANGELOG.md.
75
+ ```
76
+
77
+ #### Step 2
78
+
79
+ After merging pull request that was created automatically in step 1, run command in root of repository where `.podspec` is.
80
+
81
+ ```sh
82
+ allegro_release to_master
83
+ ```
84
+
85
+ **What it does?**
86
+
87
+ 1. Checkouts `release_<version>` branch and pulls changes from repository.
88
+ 2. Creates pull requests from `release_<version>` to `master`.
89
+
90
+ #### Step 3
91
+
92
+ After merging pull request that was created automatically in step 2, run command in root of repository where `.podspec` is.
93
+
94
+ ```sh
95
+ allegro_release finish
96
+ ```
97
+
98
+ **What it does?**
99
+
100
+ 1. Checkouts `master` branch and pulls changes from repository.
101
+ 2. Adds tag to `master` with updated version.
102
+ 3. Pushes `.podspec` to spec repository (this repository).
@@ -22,4 +22,6 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency "colorize", '~> 0'
24
24
  spec.add_dependency "highline", '~> 1.0'
25
+ spec.add_dependency "cocoapods", '~> 0.39'
26
+ spec.add_dependency "atlassian-stash", '~> 0.7'
25
27
  end
@@ -59,35 +59,51 @@ module AllegroRelease
59
59
  end
60
60
 
61
61
  def self.to_master
62
- checkout_develop
62
+ checkout_release
63
63
  create_pull_request_to_master
64
64
  puts "Second step is done! Now head to HipChat and paste the content of clipboard that contains link to pull request. After manual merge perform `allegro_release finish`.".colorize(:green)
65
65
  end
66
66
 
67
67
  def self.create_pull_request_to_master
68
68
  puts "Creating pull request to master on Stash.".colorize(:green)
69
- link = `stash pull-request master -T \"Release #{version_from_file}.\" -d \"Release #{version_from_file}.\"`
69
+ pull_request_command = "stash pull-request master -T \"Release #{version_from_file}.\" -d \"Release #{version_from_file}.\""
70
+ link = perform_pull_request(pull_request_command)
70
71
  pbcopy "(kotek) (kotek) (successful) (successful) #{link}"
71
72
  end
72
73
 
73
74
  def self.bump(current, next_version, options)
74
75
  checkout_develop
75
- create_branch(next_version)
76
+ create_release_branch(next_version)
76
77
  replace(current, next_version)
77
78
  update_changelog(next_version)
78
79
  check_podspec
79
80
  commit_release(next_version)
80
81
  push_changes_to_remote_branch(next_version)
81
82
  create_pull_request_to_develop(next_version)
82
- puts "First step is done! Now head to HipChat and paste the content of clipboard that contains link to pull request. After manual merge perform `allegro_release to_master`.".colorize(:green)
83
+ puts "First step is done! Now head to HipChat and paste the content of clipboard that contains link to pull request. After manual merge perform `allegro_release to_master`.\n".colorize(:green) + "Do not delete local release_#{version_from_file} branch, because it will be used to merge to master branch.".colorize(:red)
83
84
  end
84
85
 
85
86
  def self.create_pull_request_to_develop(version)
86
87
  puts "Creating pull request to develop on Stash.".colorize(:green)
87
- link = `stash pull-request develop -T \"Release #{version_from_file}.\" -d \"Release #{version_from_file}.\"`
88
+ pull_request_command = "stash pull-request develop -T \"Release #{version_from_file}.\" -d \"Release #{version_from_file}.\""
89
+ link = perform_pull_request(pull_request_command)
88
90
  pbcopy "(kotek) (kotek) (successful) (successful) #{link}"
89
91
  end
90
92
 
93
+ def self.perform_pull_request(pull_request_command)
94
+ link = `#{pull_request_command}`
95
+ if link.include? 'Authentication failed. Please check your credentials and try again.'
96
+ expired_credentials = "Your Stash credentials expired (probably due to monthly password change). Below you can find instruction what values to enter. Authorizing again. \n".colorize(:red)
97
+ tip_one = "Bitbucket Server Username: <your_username> (go to \"View Profile\" in upper-right corner of Stash)\n".colorize(:green)
98
+ tip_two = "Bitbucket Server Password (optional): <your_password>\n".colorize(:green)
99
+ tip_three = "Bitbucket Server URL: https://stash.allegrogroup.com/\n".colorize(:green)
100
+ puts expired_credentials + tip_one + tip_two + tip_three
101
+ system_cmd("stash configure")
102
+ link = `#{pull_request_command}`
103
+ end
104
+ return link
105
+ end
106
+
91
107
  def self.push_changes_to_remote_branch(version)
92
108
  puts "Pushing branch to upstream.".colorize(:green)
93
109
  system_cmd("git push -u origin release_#{version}")
@@ -143,6 +159,14 @@ module AllegroRelease
143
159
  system_cmd("git pull")
144
160
  end
145
161
 
162
+ def self.checkout_release
163
+ return unless File.directory?(".git")
164
+ puts "Pulling release_#{version_from_file} branch.".colorize(:green)
165
+ system_cmd("git checkout release_#{version_from_file}")
166
+ system_cmd("git pull")
167
+ puts "Checking out release_#{version_from_file} branch.".colorize(:green)
168
+ end
169
+
146
170
  def self.commit(jira_id, version)
147
171
  return unless File.directory?(".git")
148
172
  commit_message = "'[#{jira_id}] Release #{version}.'"
@@ -151,7 +175,7 @@ module AllegroRelease
151
175
  system_cmd("git commit -m #{commit_message}")
152
176
  end
153
177
 
154
- def self.create_branch(version)
178
+ def self.create_release_branch(version)
155
179
  return unless File.directory?(".git")
156
180
  puts "Creating release branch.".colorize(:green)
157
181
  system_cmd("git checkout -b release_#{version}")
@@ -1,3 +1,3 @@
1
1
  module AllegroRelease
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allegro_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksander Grzyb
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cocoapods
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.39'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.39'
83
+ - !ruby/object:Gem::Dependency
84
+ name: atlassian-stash
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.7'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.7'
69
97
  description: A command line tools to release module easily.
70
98
  email:
71
99
  - aleksander.grzyb@allegrogroup.com
@@ -103,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
131
  version: '0'
104
132
  requirements: []
105
133
  rubyforge_project:
106
- rubygems_version: 2.6.2
134
+ rubygems_version: 2.4.8
107
135
  signing_key:
108
136
  specification_version: 4
109
137
  summary: A command line tools to release module.