waff 0.0.6 → 0.0.7
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/Gemfile.lock +1 -1
- data/README.md +37 -0
- data/lib/waff/commander.rb +2 -0
- data/lib/waff/commands/list.rb +1 -2
- data/lib/waff/commands/open.rb +22 -0
- data/lib/waff/config.rb +12 -0
- data/lib/waff/issue.rb +4 -4
- data/lib/waff/os.rb +17 -0
- data/lib/waff/repository.rb +14 -5
- data/lib/waff/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fed6162bd8143677a6666794272da27f47d5de3213b47b7bfcd5c816aa3a2fc3
|
4
|
+
data.tar.gz: 51fcdc741473a3043d811fc86343e3c4b1169d469c37a9a20d2d09993a34f6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c19509871fd2a69b952ad3593e58077b1b1cc43cea83108a44878a642a358a5fde0245ad71eee02e696630be41da687d9ec4d8fcb66efa4491993141f2a3403
|
7
|
+
data.tar.gz: 5ebbf2d157631ecd5806bfe8c6d713c50beab73e3fef6de37e395581b50bf059b6c9cba2f4dd4db86e6e95238a04de0b36b5745750112c22097e1944c574b4ec
|
data/Gemfile.lock
CHANGED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
Welcome! `waff` is a tool that hopes to aid with github flow, specifically based on the style of Waffle.
|
2
|
+
|
3
|
+
The goal is to be able to see what you are working on, see what's ready to be taken, take tasks and submit them from the command line,
|
4
|
+
with as little work as possible.
|
5
|
+
|
6
|
+
### Installation
|
7
|
+
```
|
8
|
+
gem install waff
|
9
|
+
waff
|
10
|
+
```
|
11
|
+
It will prompt you for your github username and your personal access token. You can create one [here](https://github.com/settings/tokens/new). It just needs the `repo` access.
|
12
|
+
|
13
|
+
Optionally you can set up the remote name to be used, with `origin` as default. This will create the local config file .waff.yml
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
#### List ready and in-progress issues
|
18
|
+
`waff list`
|
19
|
+
|
20
|
+
#### Show the information of a given issue
|
21
|
+
`waff show` will try to infer the current issue from the current branch name (i.e 827-do-something => issue #827)
|
22
|
+
|
23
|
+
`waff show 123` will show info of issue 123.
|
24
|
+
|
25
|
+
#### Take an issue
|
26
|
+
`waff take 123` will do the following stuff:
|
27
|
+
* Set the issue with the `in progress` label, moving it to the progress column in waffle
|
28
|
+
* assign yourself as assignee
|
29
|
+
* create a branch named `123-issue-title-slug`, starting from the current branch. Normally you want to run this from master branch.
|
30
|
+
|
31
|
+
#### Open an issue in the browser
|
32
|
+
`waff open 123` will open the browser on issue 123
|
33
|
+
|
34
|
+
`waff open` will open the browser on current issue
|
35
|
+
|
36
|
+
#### Pause an issue
|
37
|
+
`waff pause 123` will put the issue back in the `ready` column, but won't unassign you from it.
|
data/lib/waff/commander.rb
CHANGED
data/lib/waff/commands/list.rb
CHANGED
@@ -4,8 +4,7 @@ module Waff
|
|
4
4
|
module Commands
|
5
5
|
class List < Command
|
6
6
|
def call params
|
7
|
-
ready_issues = github_repo.get_open_issues
|
8
|
-
ready_issues += github_repo.get_open_issues 'to do'
|
7
|
+
ready_issues = github_repo.get_open_issues Config.ready_label
|
9
8
|
puts "Ready: \n\n"
|
10
9
|
ready_issues.each do |issue|
|
11
10
|
puts "##{issue.number}\t #{issue.title}"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'command'
|
2
|
+
require_relative '../os'
|
3
|
+
|
4
|
+
module Waff
|
5
|
+
module Commands
|
6
|
+
class Open < Command
|
7
|
+
def call params
|
8
|
+
issue_number = params.shift || LocalRepository.current_issue_number
|
9
|
+
issue_number || raise('No issue number given as argument or found as current branch')
|
10
|
+
|
11
|
+
open_in_browser github_repo.issue_url(issue_number)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def open_in_browser url
|
17
|
+
`xdg-open #{url}` if OS.linux?
|
18
|
+
`open #{url}` if OS.mac?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/waff/config.rb
CHANGED
@@ -22,23 +22,35 @@ module Waff
|
|
22
22
|
url[/:(.*)\.git/, 1] || raise(REMOTE_NOT_FOUND)
|
23
23
|
end
|
24
24
|
|
25
|
+
def ready_label
|
26
|
+
config['ready_label'] || 'to do'
|
27
|
+
end
|
28
|
+
|
25
29
|
def init_config!
|
26
30
|
return if File.exist?(CONFIG_FILE)
|
27
31
|
|
28
32
|
puts "No config file detected (#{CONFIG_FILE}). Will generate one now in current directory."
|
33
|
+
|
29
34
|
print 'Github username: '
|
30
35
|
user = $stdin.gets
|
36
|
+
|
31
37
|
print 'Github password/personal token: '
|
32
38
|
token = $stdin.gets
|
39
|
+
|
33
40
|
print 'Git remote (leave empty for "origin"): '
|
34
41
|
remote = $stdin.gets.strip
|
35
42
|
remote = remote.empty? ? 'origin' : remote
|
36
43
|
|
44
|
+
print 'Ready label (leave empty for "to do"): '
|
45
|
+
ready_label = $stdin.gets.strip
|
46
|
+
ready_label = ready_label.empty? ? 'to do' : ready_label
|
47
|
+
|
37
48
|
# Write config file
|
38
49
|
File.open(CONFIG_FILE, 'w') do |file|
|
39
50
|
file.puts "user: #{user}"
|
40
51
|
file.puts "token: #{token}"
|
41
52
|
file.puts "remote: #{remote}"
|
53
|
+
file.puts "ready_label: #{ready_label}"
|
42
54
|
end
|
43
55
|
|
44
56
|
# Write exclude file
|
data/lib/waff/issue.rb
CHANGED
@@ -21,17 +21,17 @@ module Waff
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def mark_in_progress!
|
24
|
-
labels.delete
|
25
|
-
labels.delete 'to do'
|
24
|
+
labels.delete Config.ready_label
|
26
25
|
labels << 'in progress'
|
26
|
+
labels.uniq!
|
27
27
|
|
28
28
|
repository.export_labels self
|
29
29
|
end
|
30
30
|
|
31
31
|
def mark_ready!
|
32
|
-
labels <<
|
33
|
-
labels << 'to do'
|
32
|
+
labels << Config.ready_label
|
34
33
|
labels.delete 'in progress'
|
34
|
+
labels.uniq!
|
35
35
|
|
36
36
|
repository.export_labels self
|
37
37
|
end
|
data/lib/waff/os.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module OS
|
2
|
+
def OS.windows?
|
3
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
4
|
+
end
|
5
|
+
|
6
|
+
def OS.mac?
|
7
|
+
(/darwin/ =~ RUBY_PLATFORM) != nil
|
8
|
+
end
|
9
|
+
|
10
|
+
def OS.unix?
|
11
|
+
!OS.windows?
|
12
|
+
end
|
13
|
+
|
14
|
+
def OS.linux?
|
15
|
+
OS.unix? and not OS.mac?
|
16
|
+
end
|
17
|
+
end
|
data/lib/waff/repository.rb
CHANGED
@@ -11,7 +11,7 @@ module Waff
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def get_issue(number)
|
14
|
-
response = self.class.get
|
14
|
+
response = self.class.get(github_api_url ['issues', number])
|
15
15
|
|
16
16
|
if response.success?
|
17
17
|
Issue.new(self, response.parsed_response)
|
@@ -21,8 +21,12 @@ module Waff
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def issue_url(number)
|
25
|
+
github_url ['issues', number]
|
26
|
+
end
|
27
|
+
|
24
28
|
def assign_issue(number)
|
25
|
-
url =
|
29
|
+
url = github_api_url ['issues', number, 'assignees']
|
26
30
|
response = self.class.post url, body: { assignees: [@user] }.to_json
|
27
31
|
if response.success?
|
28
32
|
puts "Successfully assigned issue ##{number} to #{@user}."
|
@@ -33,7 +37,7 @@ module Waff
|
|
33
37
|
end
|
34
38
|
|
35
39
|
def export_labels issue
|
36
|
-
url =
|
40
|
+
url = github_api_url ['issues', issue.number, 'labels']
|
37
41
|
response = self.class.put url, body: issue.labels.to_json
|
38
42
|
if response.success?
|
39
43
|
puts "Successfully assigned #{issue.labels.inspect} labels to ##{issue.number}"
|
@@ -44,7 +48,7 @@ module Waff
|
|
44
48
|
end
|
45
49
|
|
46
50
|
def get_open_issues label
|
47
|
-
response = self.class.get
|
51
|
+
response = self.class.get github_api_url(['issues']), query: { labels: label }
|
48
52
|
|
49
53
|
if response.success?
|
50
54
|
issues_data = response.parsed_response
|
@@ -58,9 +62,14 @@ module Waff
|
|
58
62
|
|
59
63
|
private
|
60
64
|
|
61
|
-
def
|
65
|
+
def github_api_url(nodes)
|
62
66
|
subpath = nodes.join '/'
|
63
67
|
"https://api.github.com/repos/#{@owner_and_repo}/" + subpath
|
64
68
|
end
|
69
|
+
|
70
|
+
def github_url(nodes)
|
71
|
+
subpath = nodes.join '/'
|
72
|
+
"https://github.com/#{@owner_and_repo}/" + subpath
|
73
|
+
end
|
65
74
|
end
|
66
75
|
end
|
data/lib/waff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armando Andini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -34,17 +34,20 @@ extra_rdoc_files: []
|
|
34
34
|
files:
|
35
35
|
- Gemfile
|
36
36
|
- Gemfile.lock
|
37
|
+
- README.md
|
37
38
|
- bin/waff
|
38
39
|
- lib/waff.rb
|
39
40
|
- lib/waff/commander.rb
|
40
41
|
- lib/waff/commands/command.rb
|
41
42
|
- lib/waff/commands/list.rb
|
43
|
+
- lib/waff/commands/open.rb
|
42
44
|
- lib/waff/commands/pause.rb
|
43
45
|
- lib/waff/commands/show.rb
|
44
46
|
- lib/waff/commands/take.rb
|
45
47
|
- lib/waff/config.rb
|
46
48
|
- lib/waff/issue.rb
|
47
49
|
- lib/waff/local_repository.rb
|
50
|
+
- lib/waff/os.rb
|
48
51
|
- lib/waff/repository.rb
|
49
52
|
- lib/waff/version.rb
|
50
53
|
- waff.gemspec
|