lita-git-branch-switcher 0.2.0 → 0.2.1

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: 57ec954c4ece5e46069bbd89a5f31c8fb005c542
4
- data.tar.gz: 9df44ac8bc4fcac35b8b80e0650bb7882aeff288
3
+ metadata.gz: 785d4826373b99873b0977f7c98b5d4f8842cb0e
4
+ data.tar.gz: eefaff5eac2e84befe180095f891f09bc94b671c
5
5
  SHA512:
6
- metadata.gz: b81157d093fdc8e960b8e14df600c854ea932f1fae9acc3508016c2a6a1577519db3a6e6319639823806937439f1c35be9804897cc314efaaed9e7265cfb5e6f
7
- data.tar.gz: c6d12a69abe1a9fd8cacd01c279c8dfbab754a83b5641718e6d06341a257dd505bde4d1f7599fc9bb43a4eacfcf029db8c98f52488b8290d6fc8be4bb0940df7
6
+ metadata.gz: aa274c1789d64c94d50fc7bd73478c36ce9e905e85b824836da1b973f82492598ca4281f9e235f637a666837af2b97b5ba2d4bb858fc76acb91d4a369368286f
7
+ data.tar.gz: a49fe772ee6658b7c1000fe76d06fa09b6d79241d9d7d91b4940bf5d4ca3856536deb661d71f808679cedd92499fad90ccfed3299322e3d95f641a487e0d67c2
@@ -21,21 +21,37 @@ module Lita
21
21
  end
22
22
 
23
23
  route(/^current$/, command: true) do |response|
24
- response.reply(current_branch)
24
+ response.reply("@%{user} %{branch}" % {
25
+ user: response.user.mention_name,
26
+ branch: current_branch,
27
+ })
25
28
  end
26
29
 
27
30
  route(/^switch\s+(.+)/, command: true) do |response|
28
- branch_name = response.matches[0][0]
31
+ begin
32
+ branch_name = response.matches[0][0]
29
33
 
30
- g = Git.open(config.repository_path)
31
- g.fetch
32
- if g.is_branch?(branch_name)
33
- g.checkout(branch_name)
34
- g.pull(config.remote, branch_name) if config.pull_after_switch == true
35
- systemu(config.command_after_switch) unless config.command_after_switch.nil?
36
- response.reply(current_branch)
37
- else
38
- response.reply('[%{branch}] is not found.' % {branch: branch_name } )
34
+ g = Git.open(config.repository_path)
35
+ g.fetch unless config.remote.nil?
36
+ if g.is_branch?(branch_name)
37
+ g.checkout(branch_name)
38
+ g.pull(config.remote, branch_name) if !config.remote.nil? && config.pull_after_switch == true
39
+ systemu(config.command_after_switch) unless config.command_after_switch.nil?
40
+ response.reply("@%{user} %{branch}" % {
41
+ user: response.user.mention_name,
42
+ branch: current_branch,
43
+ })
44
+ else
45
+ response.reply("@%{user} [%{branch}] is not found." % {
46
+ user: response.user.mention_name,
47
+ branch: branch_name
48
+ })
49
+ end
50
+ rescue => e
51
+ response.reply("@%{user} I was not able to do it. \n```\n%{message}\n```" % {
52
+ user: response.user.mention_name,
53
+ message: e.message,
54
+ })
39
55
  end
40
56
  end
41
57
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-git-branch-switcher"
3
- spec.version = "0.2.0"
3
+ spec.version = "0.2.1"
4
4
  spec.authors = ["violetyk"]
5
5
  spec.email = ["yuhei.kagaya@gmail.com"]
6
6
  spec.description = "git branch switcher"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-git-branch-switcher
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
  - violetyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.5.1
164
+ rubygems_version: 2.4.5.1
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: git branch switcher