bitbucket-pr-post 0.0.3 → 0.0.4

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: 4f007cd6b37ff304ff37f6712db30c370d96b85d
4
- data.tar.gz: 1e4acd1cf3bc85d5ffbb1493145703f21fe9b4b1
3
+ metadata.gz: e8ef01f033c2f913b2749bfc3223255355f9b2bb
4
+ data.tar.gz: 3efa94e41b45eefce0d8d14d3ea796b6e1270f17
5
5
  SHA512:
6
- metadata.gz: 878573f347f416136d6fe3e87e4dd52d60f94011ce5c6a30e74b1c63be82342d0558b9303b777cba3b5a840f1599dde25fcbc68de3746456156d67b358953573
7
- data.tar.gz: 5dce84076a7149e17f14e6dbac1920f1a2febfa7f140a8a230a1aa2270f0565cfc187864553956fbcf775eb5f45814e36d61720725ad15c177b37e802a9866b2
6
+ metadata.gz: 6bd2284a6ba2fb438d31c61bea16b3dffee864c2a1d8661bd9be87ce1b9921d4897ed1bfac481a3b511891dce1f7950fe588536549c9182b43fad24c62085b27
7
+ data.tar.gz: 57275eb28a7325306e9eb819ece761602e1e061c9086ee35a4764330adf4cea93f61d9c9892c54453046403eaf5e94e4a76d9533a18fd4b833d9fe4b9e55971f
@@ -24,11 +24,12 @@ module Bitbucket
24
24
  o.on('-ps', '--public-slug=SLUG(Public Repository Name)'){|v| @opts[:public_slug] = v }
25
25
  o.on('-ms', '--master-slug=SLUG(MasterRepository Name)'){|v| @opts[:master_slug] = v }
26
26
  o.on('-u', '--user=Bitbucket User'){|v| @opts[:user] = v }
27
- o.on('-d', '--debug'){|v| @opts[:debug] = v }
27
+ o.on('-D', '--debug'){|v| @opts[:debug] = v }
28
28
  o.on('-y', '--yes'){|v| @opts[:yes] = v }
29
29
  o.on('-o', '--open-diff-url'){|v| @opts[:open_diff_url] = v}
30
30
  o.on('-b', '--dst-branch=Destination Branch'){|v| @opts[:dst_branch] = v}
31
31
  o.on('-U', '--update'){|v| @opts[:update] = v}
32
+ o.on('-d', '--description'){|v| @opts[:description] = v }
32
33
 
33
34
  o.parse!(argv)
34
35
 
@@ -75,17 +76,23 @@ module Bitbucket
75
76
  @notice = ''
76
77
  else
77
78
  @title = `git log --summary --shortstat -1 --format="%s" --no-color --no-notes | head -1`.strip
78
- @notice = "\n ^ This is Last Commit Mesasge. Use Option `--title` If You Want Change."
79
+ @title_notice = "\n ^ This is Last Commit Mesasge. Use Option `--title` If You Want Change."
80
+ end
81
+
82
+ if @opts[:description]
83
+ @description = @opts[:description]
84
+ else
85
+ @description = `git log --summary -1 --format="%b" --no-color --no-notes`.strip
86
+ @description_notice = "\n ^ This is Last Commit Mesasge. Use Option `--description` If You Want Change."
79
87
  end
80
- @description = @opts[:description] || ''
81
88
 
82
89
  debug_print @opts
83
90
  end
84
91
 
85
92
  def confirm
86
93
  puts <<-CONFIRM
87
- title: #{@title}#{@notice}
88
- description: #{@description}
94
+ title: #{@title}#{@title_notice}
95
+ description: #{@description.gsub("\n", "\n ")}#{@description_notice}
89
96
  src: #{@user}/#{@public_slug}/#{@branch}
90
97
  v v v
91
98
  v v v
@@ -105,15 +112,16 @@ description: #{@description}
105
112
 
106
113
  def request_data
107
114
  data = {
108
- title: @title.gsub("'", "\'"),
109
- description: @description,
115
+ title: @title,
116
+ description: "#{@description}",
110
117
  source: {
111
118
  branch: { name: @branch },
112
119
  repository: { full_name: "#{@user}/#{@public_slug}" }
113
120
  },
114
121
  destination: {
115
122
  branch: { name: "master" },
116
- }
123
+ },
124
+ "close_source_branch": true
117
125
  }
118
126
 
119
127
  debug_print(JSON.pretty_generate data)
@@ -132,7 +140,7 @@ description: #{@description}
132
140
  -H "Content-Type: application/json"
133
141
  -u #{@user}:#{@pass}
134
142
  https://api.bitbucket.org/2.0/repositories/#{@dst_user}/#{@master_slug}/pullrequests/
135
- -d '#{request_data}'
143
+ -d '#{request_data.gsub("'"){"\\'"}}'
136
144
  }
137
145
  cmd = curl.join " "
138
146
  debug_print cmd
@@ -1,7 +1,7 @@
1
1
  module Bitbucket
2
2
  module Pr
3
3
  class Post
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitbucket-pr-post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiroshi kobayashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler