jira-cli 0.3.5 → 0.3.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: 83f34562705e57afd8e9b3b3879f478b57d36b39
4
- data.tar.gz: c7ae7bec14a6ee79ec7f6798e19801795859fa32
3
+ metadata.gz: 69ec92a6c464ef57118383cdfec850349c3c6e7b
4
+ data.tar.gz: 072db85dd22418e94121e28294448643e8b06da6
5
5
  SHA512:
6
- metadata.gz: e1e5a4314e3407e153bdf55408bf48fc49a5124972b6b5c4dc9117ec33d1b57287d95936b9fa4f686a23b8d443c7e1d4ef7522d902cd8804cb5dc8c0451ddefa
7
- data.tar.gz: d85dc1edfdf870f8b789446001326f961f17c1f14ade7a84e181ae670da7229972996e4a922abfda7e2a47702f34e87518cc997545f5e19926c36107fce7dac7
6
+ metadata.gz: 0cd9b78698d419d394fb3e3945f3293e10155a1aa0c5f572f49af8dbfda892b2302d9fcba57c7215a797940051dd29c35728cc2f9d543d3e2d76a948b3096abf
7
+ data.tar.gz: 2c100f048e3991ee5b5be9252a42c14e0011b655a639ca3bb8496420cf2652bf3d10efe264e3ebd5940881b3feec5f02d6ceb30b4a50ab38d5390fe3fa04b7cd
data/bin/jira CHANGED
@@ -1,10 +1,22 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'jira'
4
4
  begin
5
5
  Jira::CLI.start
6
+ File.delete(Jira::Core.rescue_cookie_path) if File.exist?(Jira::Core.rescue_cookie_path)
6
7
  rescue Faraday::Error, UnauthorizedException
7
- puts "JIRA failed connect, you may need to rerun 'jira install'" unless Jira::CLI.new.try_install_cookie
8
+ if Jira::CLI.new.try_install_cookie
9
+ if File.read(Jira::Core.rescue_cookie_path).count('r') < 3
10
+ puts "Re-running: jira #{ARGV.join(' ')}"
11
+ Process.waitpid(
12
+ Process.fork do
13
+ Process.exec("jira #{ARGV.join(' ')}")
14
+ end
15
+ )
16
+ exit
17
+ end
18
+ end
19
+ puts "JIRA failed connect, you may need to rerun 'jira install'"
8
20
  rescue GitException
9
21
  puts "JIRA commands can only be run within a git repository."
10
22
  rescue InstallationException
@@ -6,12 +6,16 @@ module Jira
6
6
  Command::Install.new.run
7
7
  end
8
8
 
9
- no_commands do
9
+ no_tasks do
10
10
  def try_install_cookie
11
11
  return false if Jira::Core.cookie.empty?
12
12
  puts " ... cookie expired, renewing your cookie"
13
13
  Command::Install.new.run_rescue_cookie
14
- puts "Cookie renewed, please retry your last command."
14
+ puts "Cookie renewed, updating .jira-rescue-cookie"
15
+ File.open(Jira::Core.rescue_cookie_path, "a") do |f|
16
+ f << "r"
17
+ end
18
+ puts " ... updated .jira-rescue-cookie"
15
19
  return true
16
20
  rescue Interrupt, StandardError
17
21
  false
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jira
4
4
 
5
- VERSION = '0.3.5'.freeze
5
+ VERSION = '0.3.6'.freeze
6
6
 
7
7
  end
@@ -72,6 +72,13 @@ module Jira
72
72
  @cli_path ||= root_path + "/.jira-cli"
73
73
  end
74
74
 
75
+ #
76
+ # @return [String] path to .jira-rescue-cookie file
77
+ #
78
+ def rescue_cookie_path
79
+ @rescue_cookie_path ||= root_path + "/.jira-rescue-cookie"
80
+ end
81
+
75
82
  def config
76
83
  @config ||= (
77
84
  raise InstallationException unless File.exist?(cli_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cheng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor