ora-cli 0.2.0 → 0.2.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: fd1423dfdf8ebad26c10086faa352d0026fc5632
4
- data.tar.gz: e1ff3475dde5cdbebc6e1ab7ca08836ba04d0dfd
3
+ metadata.gz: 37f2683d7437533d89260be6e9e6bc4c58835886
4
+ data.tar.gz: ca4045ee65cfffa7e5a213417fb06110baeac40e
5
5
  SHA512:
6
- metadata.gz: 2223e7f94692339f66ddbea3ca552e14c370bdf51af3cb71d6f4e4f38c6d5ab2ec287b2839e00886ab5ffa46105723bb57fb6310039369b35fede7b1e1049faf
7
- data.tar.gz: 7adbde3472b70c8302442c311ff2427b753f3011f13c7d90122f745d3f5942d17f85b5054154d68ddfea74104525a7326b8323f4dd01b6285120cea696280509
6
+ metadata.gz: d7831147f18cb4bf23daa857b9a36f59fabaa0ed9fccfa9ee3cc1f4c8cc1f5a4811243c96b8841ee5c5a64597ead5fbaea56a1d4596ab44d8b38bef5f038dfad
7
+ data.tar.gz: 90fc6a50ed74e3d084d1ba108d16899e03152ef2174fd26709029328dddf0cda400b03cc9415697c82c9a0d330b6018dac4cc6260d5b2977b1e0b8aec8009f2b
data/README.md CHANGED
@@ -29,9 +29,9 @@ A command line tool to automate development workflow in ORA
29
29
 
30
30
  `push_to_uat`: Help to push your feature branch to uat
31
31
 
32
- `push_to_master`: Help to push your feature branch to develop and master branches with a version tag
32
+ `push_to_master`: Help to push develop to master with a version tag with a message including all new pull requests from the previous tag
33
33
 
34
- `switch_branch`: Help to switch branch without thinking about dirty files`
34
+ `switch_branch`: Help to switch branch without thinking about dirty files
35
35
 
36
36
  ## Contributing
37
37
 
@@ -6,9 +6,8 @@ module Ora::Cli
6
6
 
7
7
  def commands
8
8
  '
9
- :feature_branch!
10
- :clean_branch!
11
- :pull_branch
9
+ :clean_on_main_branch!
10
+ git stash save -u "OraCli"
12
11
  git checkout develop
13
12
  git pull origin develop
14
13
  git merge #{branch}
@@ -20,21 +19,27 @@ module Ora::Cli
20
19
  git fetch --tags
21
20
  :set_version
22
21
  git checkout #{branch}
23
- git tag -a "#{version}" -m "#{branch}"
24
- git push --tags
22
+ :apply_stash
25
23
  :slack_message_to_paste
26
24
  '
27
25
  end
28
26
 
29
27
  private
30
28
  def set_version
29
+ return '' if tag_message.empty?
30
+
31
31
  print.plain "Latest versions:"
32
32
  print.plain latest_versions
33
+ print.plain tag_message
33
34
  print.plain "Enter to use #{recommend_version} or type new version:"
34
35
  print.inline "New Version: "
35
36
  @version = stdin.gets(/^(v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)?$/)
36
37
  @version = recommend_version if @version.empty?
37
- ''
38
+
39
+ '
40
+ git tag -a "#{version}" -m "#{tag_message}"
41
+ git push --tags
42
+ '
38
43
  end
39
44
  def latest_versions
40
45
  @latest_versions ||=
@@ -43,15 +48,45 @@ module Ora::Cli
43
48
  map {|tag| Gem::Version.create(tag.sub(/^v/, ''))}.sort.last(5).
44
49
  map {|ver| "v#{ver}"}.join("\n")
45
50
  end
51
+ def latest_version
52
+ @latest_version ||= latest_versions.split("\n").last.to_s
53
+ end
46
54
  def recommend_version
47
- @recommend_version ||=
48
- latest_versions.split("\n").last.to_s.
49
- sub(/\.(\d+)$/, '.') + ($1.to_i + 1).to_s
55
+ @recommend_version ||= latest_version.sub(/\.(\d+)$/, '.') + ($1.to_i + 1).to_s
50
56
  end
51
57
 
52
58
  def slack_message_to_paste
53
59
  print.plain ":merge: #{branch} => develop\n:merge: develop => master\n:monorail: production"
54
60
  ''
55
61
  end
62
+
63
+ def apply_stash
64
+ return '' if target_stash_revision.empty?
65
+
66
+ "git stash pop #{target_stash_revision}"
67
+ end
68
+ def target_stash_revision
69
+ @target_stash_revision ||=
70
+ @bash.silent("git stash list | grep '#{target_stash_name}' | sed s/:.*//").
71
+ split("\n").first.to_s.strip
72
+ end
73
+ def target_stash_name
74
+ "On #{branch}: OraCli"
75
+ end
76
+
77
+ def tag_message
78
+ return @tag_message if @tag_message
79
+ messages = []
80
+ @bash.silent("git log --merges --pretty=oneline #{latest_version}..HEAD").split("\n").each do |commit|
81
+ match = commit.match(/^[0-9a-z]+ Merge pull request #(\d+) from (.*)$/)
82
+ next if match.nil?
83
+
84
+ pull_request = match[1]
85
+ branch_name = match[2]
86
+
87
+ messages << "#{pull_request} #{branch_name}"
88
+ end
89
+ @tag_message = messages.join("\n")
90
+ end
56
91
  end
57
92
  end
@@ -1,5 +1,5 @@
1
1
  module Ora
2
2
  module Cli
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ora-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ducksan Cho