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 +4 -4
- data/README.md +4 -5
- data/lib/backlogcp/cli.rb +9 -9
- data/lib/backlogcp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead9d73e7d8fca1e64cb29b7233964c9a303ab70
|
4
|
+
data.tar.gz: 6c2b913ba1242deb7a778a2fab30cfe1185e3c2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76dc7898fc3bdc919a5db220e39d9338edd2d3ccee76634a6acfa7d987720e314c6a381aa36aa8cf58ce962e588bd1ffb5b52f6abffcea9f82a22a808021ebfe
|
7
|
+
data.tar.gz: 9a402defb50a44ea84c432b9941ffcc15b378fed7b4e26b040dbd9d45225e359e49526d45ee902c41823848f3b754eaa26552e2aa75609a0d04dd32954d75981
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# backlogcp
|
1
|
+
# backlogcp [](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'
|
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
|
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
|
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(
|
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(
|
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(
|
46
|
-
elsif %r(
|
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
|
data/lib/backlogcp/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backlog_kit
|