backlogcp 0.2.0 → 0.3.0

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: 692c203029420cb10eddbbdc29732393a4dfd32b
4
- data.tar.gz: f581c630b95305d0d0a1d79f5975f04ff4b0b732
3
+ metadata.gz: ead9d73e7d8fca1e64cb29b7233964c9a303ab70
4
+ data.tar.gz: 6c2b913ba1242deb7a778a2fab30cfe1185e3c2d
5
5
  SHA512:
6
- metadata.gz: b9345472cf5336779f3543619e1fe1cbe3a5b49fc2423447620df4d62ce1d158e74db09ee76cfb1325f8f1ec2a832a933eee292eb209bbce70852a5c23224a12
7
- data.tar.gz: ffdf914a2c1d7731fb6bef994738d3f8e942fefd8320eaf762611425c721218cfdb79a0ffae890f078354e59ab028cbade012e8f586e2fd0fd9e5bf53422d881
6
+ metadata.gz: 76dc7898fc3bdc919a5db220e39d9338edd2d3ccee76634a6acfa7d987720e314c6a381aa36aa8cf58ce962e588bd1ffb5b52f6abffcea9f82a22a808021ebfe
7
+ data.tar.gz: 9a402defb50a44ea84c432b9941ffcc15b378fed7b4e26b040dbd9d45225e359e49526d45ee902c41823848f3b754eaa26552e2aa75609a0d04dd32954d75981
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # backlogcp
1
+ # backlogcp [![Gem](https://img.shields.io/gem/v/backlogcp.svg)](https://rubygems.org/gems/backlogcp)
2
2
 
3
3
  Backlog file copy command like `scp`.
4
4
 
@@ -7,7 +7,7 @@ Backlog file copy command like `scp`.
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'backlogcp', github: "k1LoW/backlogcp"
10
+ gem 'backlogcp'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -16,8 +16,7 @@ And then execute:
16
16
 
17
17
  Or install it yourself as:
18
18
 
19
- $ gem install specific_install
20
- $ gem specific_install https://github.com/k1LoW/backlogcp.git
19
+ $ gem install backlogcp
21
20
 
22
21
  ## Usage
23
22
 
@@ -36,7 +35,7 @@ Example:
36
35
  Use `backlogcp` command like `scp`.
37
36
 
38
37
  ```sh
39
- $ export BACKLOG_SPACE_ID=xxxxxxxxx BACKLOG_API_KEY=XXXXXxxxXXXXxxXXXXXxXXXXXXX
38
+ $ export BACKLOG_API_KEY=XXXXXxxxXXXXxxXXXXXxXXXXXXX
40
39
  $ backlogcp https://xxxxxxxxx.backlog.jp/file/XXXXX/path/to/file.png ./
41
40
  ```
42
41
 
data/lib/backlogcp/cli.rb CHANGED
@@ -12,7 +12,7 @@ module Backlogcp
12
12
  private
13
13
 
14
14
  def dl(from, to)
15
- if %r(^.+backlog.jp/file/) =~ URI.unescape(from)
15
+ if %r(^https://(?<space_id>.+)\.backlog.jp/file/) =~ URI.unescape(from)
16
16
  dl_from_shared_file(from, to)
17
17
  else
18
18
  dl_from_issue_attachment(from, to)
@@ -21,7 +21,7 @@ module Backlogcp
21
21
 
22
22
  # https://[space_id].backlog.jp/file/[project_key]/[dir][filename]
23
23
  def dl_from_shared_file(from, to)
24
- unless %r(^.+backlog.jp/file/(?<project_key>[^/]+)(?<dir>/?.*/)(?<filename>[^/]+)$) =~ URI.unescape(from)
24
+ unless %r(^https://(?<space_id>.+)\.backlog.jp/file/(?<project_key>[^/]+)(?<dir>/?.*/)(?<filename>[^/]+)$) =~ URI.unescape(from)
25
25
  usage '<from> option should be backlog.jp URI.'
26
26
  end
27
27
  local = File.expand_path(to)
@@ -30,7 +30,7 @@ module Backlogcp
30
30
  else
31
31
  local
32
32
  end
33
- client = BacklogKit::Client.new
33
+ client = BacklogKit::Client.new(space_id: space_id)
34
34
  files = client.get_shared_files(project_key, dir).body
35
35
  selected = files.find do |res|
36
36
  res.name == filename
@@ -42,13 +42,13 @@ module Backlogcp
42
42
 
43
43
  # https://[space_id].backlog.jp/ViewAttachment.action?attachmentId=[attachment_id]
44
44
  def dl_from_issue_attachment(from, to)
45
- if %r(^.+backlog.jp/.+attachmentId=(?<attachment_id>[^/]+)$) =~ URI.unescape(from)
46
- elsif %r(^.+backlog.jp/downloadAttachment/(?<attachment_id>[^/]+)) =~ URI.unescape(from)
45
+ if %r(^https://(?<space_id>.+)\.backlog.jp/.+attachmentId=(?<attachment_id>[^/]+)$) =~ URI.unescape(from)
46
+ elsif %r(^https://(?<space_id>.+)\.backlog.jp/downloadAttachment/(?<attachment_id>[^/]+)) =~ URI.unescape(from)
47
47
  else
48
48
  usage '<from> option should be backlog.jp URI.'
49
49
  end
50
50
 
51
- selected, attachment = get_issue_and_attachment(attachment_id)
51
+ selected, attachment = get_issue_and_attachment(space_id, attachment_id)
52
52
 
53
53
  filename = attachment.name
54
54
  local = File.expand_path(to)
@@ -58,7 +58,7 @@ module Backlogcp
58
58
  local
59
59
  end
60
60
  puts to_file_path
61
- client = BacklogKit::Client.new
61
+ client = BacklogKit::Client.new(space_id: space_id)
62
62
  res = client.download_issue_attachment(selected.issueKey, attachment.id)
63
63
  File.binwrite(to_file_path, res.body.content)
64
64
  end
@@ -90,8 +90,8 @@ module Backlogcp
90
90
  [opts, args]
91
91
  end
92
92
 
93
- def get_issue_and_attachment(attachment_id)
94
- client = BacklogKit::Client.new
93
+ def get_issue_and_attachment(space_id, attachment_id)
94
+ client = BacklogKit::Client.new(space_id: space_id)
95
95
 
96
96
  selected = nil
97
97
  attachment = nil
@@ -1,3 +1,3 @@
1
1
  module Backlogcp
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backlogcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-30 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backlog_kit