mothra 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +5 -0
- data/lib/mothra/cli.rb +59 -1
- data/lib/mothra/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed30be80e982f100a9719eebc8ef7b726aaed6e3
|
4
|
+
data.tar.gz: 4f8acf764f989e8f76c5cbc1642f8a0e61650804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d82c1d96733eda074e18fc10b8027e51a0e0ac434bde3b85c7be0f80315656dd426a428e0ecf8522c64c5a2147f9d3e5fcb46b944926bab787768b5f1abddc45
|
7
|
+
data.tar.gz: 142d39c5a6df5c20a792be5c51be51a53fe09f784ddbbce8c8e088115c344e3fe0c1cca870ec502ddd4c0afa0d78412eabb9178eadd1bb56568096c555af9197
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
## 0.0.2 (2015-01-08)
|
2
|
+
|
3
|
+
- NEW:
|
4
|
+
- `get <bug_id>`
|
5
|
+
- `browse <bug_id>`
|
6
|
+
|
7
|
+
# 0.0.1 (2015-01-06)
|
8
|
+
- Base system with following commands
|
9
|
+
- `search <keyword> <days_ago=180>`
|
10
|
+
- `create <summary>`
|
11
|
+
- `submit <summary> <file_path>`
|
12
|
+
- `attach <bug_id> <file_path>`
|
data/README.md
CHANGED
@@ -25,7 +25,9 @@ or create manually:
|
|
25
25
|
## Usage
|
26
26
|
Commands:
|
27
27
|
mothra attach <bug_id>, <file_path> # add attachment to <bug_id>
|
28
|
+
mothra browse <bug_id> # open <bug_id> at your browser
|
28
29
|
mothra create <summary> # set PR summary only, no attachments
|
30
|
+
mothra get <bug_id> # get info of <bug_id>
|
29
31
|
mothra help [COMMAND] # Describe available commands or one specific command
|
30
32
|
mothra search <keyword>, <days_ago=180> # search keyword from bugzilla summary for last 180 days or you want
|
31
33
|
mothra submit <summary>, <file_path> # send-pr to bugs.freebsd.org
|
@@ -67,3 +69,6 @@ or create manually:
|
|
67
69
|
4. Push to the branch (`git push origin my-new-feature`)
|
68
70
|
5. Create a new Pull Request
|
69
71
|
|
72
|
+
## TODO (0.0.3)
|
73
|
+
|
74
|
+
`mothra setup` #copy settings to ~/.mothra.yml
|
data/lib/mothra/cli.rb
CHANGED
@@ -8,6 +8,19 @@ require 'rodzilla'
|
|
8
8
|
|
9
9
|
require 'base64'
|
10
10
|
require 'pathname'
|
11
|
+
require 'mkmf'
|
12
|
+
|
13
|
+
def clean_bz_url(url)
|
14
|
+
if url.end_with? '/'
|
15
|
+
url = url[0..-2]
|
16
|
+
end
|
17
|
+
|
18
|
+
url
|
19
|
+
end
|
20
|
+
|
21
|
+
def is_numeric?(obj)
|
22
|
+
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
|
23
|
+
end
|
11
24
|
|
12
25
|
def get_file_name(file_path)
|
13
26
|
Pathname.new(file_path).basename
|
@@ -32,6 +45,7 @@ class CLI < Thor
|
|
32
45
|
def initialize(*args)
|
33
46
|
super
|
34
47
|
@config = YAML.load_file "#{Dir.home}/.mothra.yml"
|
48
|
+
@config['BZ_URL'] = clean_bz_url(@config['BZ_URL'])
|
35
49
|
@bz = Rodzilla::Resource::Bug.new(@config['BZ_URL'], @config['BZ_USER'], @config['BZ_PASSWD'], :json)
|
36
50
|
end
|
37
51
|
|
@@ -57,6 +71,50 @@ class CLI < Thor
|
|
57
71
|
end
|
58
72
|
end
|
59
73
|
|
74
|
+
desc 'get <bug_id>', 'get info of <bug_id>'
|
75
|
+
def get(bug_id)
|
76
|
+
if not is_numeric?bug_id
|
77
|
+
puts 'No such bug id'
|
78
|
+
exit
|
79
|
+
end
|
80
|
+
|
81
|
+
ret = @bz.get(ids: bug_id)
|
82
|
+
|
83
|
+
begin
|
84
|
+
r = ret['bugs'][0]
|
85
|
+
print "[#{r['id']}] ".yellow
|
86
|
+
print "[#{r['status']}] ".cyan
|
87
|
+
print "#{r['summary']} ".white
|
88
|
+
puts "[#{r['last_change_time']}] ".light_black
|
89
|
+
puts "#{@config['BZ_URL']}/show_bug.cgi?id=#{bug_id}".cyan
|
90
|
+
rescue
|
91
|
+
puts 'No such bug_id'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
desc 'browse <bug_id>', 'open <bug_id> at your browser'
|
96
|
+
def browse(bug_id)
|
97
|
+
if not is_numeric?bug_id
|
98
|
+
puts 'No such bug id'
|
99
|
+
exit
|
100
|
+
end
|
101
|
+
|
102
|
+
url = "#{@config['BZ_URL']}/show_bug.cgi?id=#{bug_id}"
|
103
|
+
|
104
|
+
if RbConfig::CONFIG['host_os'] =~ /darwin/
|
105
|
+
system "open #{url}"
|
106
|
+
elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
|
107
|
+
if find_executable 'xdg-open'
|
108
|
+
system "xdg-open #{url}"
|
109
|
+
else
|
110
|
+
puts 'You have no xdg-open command, please browse it manually!'
|
111
|
+
puts url.cyan
|
112
|
+
end
|
113
|
+
else
|
114
|
+
puts 'Could not open url at your platform, sorry.'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
60
118
|
desc 'create <summary>', 'set PR summary only, no attachments'
|
61
119
|
def create(summary)
|
62
120
|
bug_id = _create(summary)
|
@@ -138,7 +196,7 @@ class CLI < Thor
|
|
138
196
|
ret = @bz.add_attachment!(ids: [bug_id],
|
139
197
|
data: file_base64,
|
140
198
|
file_name: file_name,
|
141
|
-
summary:
|
199
|
+
summary: file_name,
|
142
200
|
content_type: 'text/plain',
|
143
201
|
)
|
144
202
|
|
data/lib/mothra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mothra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jin-Sih Lin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -118,6 +118,7 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- ".gitignore"
|
120
120
|
- ".mothra.yml"
|
121
|
+
- CHANGELOG.md
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE.txt
|
123
124
|
- README.md
|