rdv 0.0.1 → 0.0.2
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 -3
- data/bin/rdv +6 -1
- data/lib/rdv.rb +1 -0
- data/lib/rdv/cli.rb +22 -11
- data/lib/rdv/object/item.rb +6 -6
- data/lib/rdv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae30eb908dd0bf34431fdf388f33ea7395520a96
|
4
|
+
data.tar.gz: 97ea4cb0bdb73c0ac1ce0607e754628679c38546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98513f600a3cf184f7ed083d3eeba2f65b57b09630bd03fd5e550e155a510de392204fb8fba234b6b0eada82f45f2c93eeb38020b2c0b642984293bd3a384d1f
|
7
|
+
data.tar.gz: 6c086e5beda3b7a7654ef9bc0765bc1473b987339652b48fb8df1c9aa169bdaacb3230a2a550ada01452f66cc58caff2c9ff3a17592e1c9b0552e773f9fe1704
|
data/README.md
CHANGED
@@ -29,19 +29,20 @@ Newsletter :
|
|
29
29
|
* etc.
|
30
30
|
- Other issue with labels
|
31
31
|
Do something not being in a list ...
|
32
|
+
|
32
33
|
blah...
|
33
|
-
tags | at | the | end
|
34
|
+
| tags | at | the | end
|
34
35
|
|
35
36
|
Other Theme :
|
36
37
|
-> Issue with a preceding arrow
|
37
38
|
Issue content, can be anything ...
|
38
|
-
tag it | here
|
39
|
+
| tag it | here
|
39
40
|
```
|
40
41
|
|
41
42
|
What matters :
|
42
43
|
* Structure depends on indentation, so Theme / Issue / Content should be respected
|
43
44
|
* Collaborator assignment should be at the end of the issue title
|
44
|
-
* Labels should be at the end of the issue content,
|
45
|
+
* Labels list should be at the end of the issue content, beginning with a pipe (|) and each label separated by a pipe too
|
45
46
|
|
46
47
|
What is optional :
|
47
48
|
* Collaborator assignment is optional
|
data/bin/rdv
CHANGED
data/lib/rdv.rb
CHANGED
data/lib/rdv/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "io/console"
|
3
|
-
require "rdv/core_ext/string"
|
4
3
|
require "octokit"
|
5
4
|
|
6
5
|
module Rdv
|
@@ -11,28 +10,40 @@ module Rdv
|
|
11
10
|
repo = repo
|
12
11
|
# Parse themes and issues from input file
|
13
12
|
themes = Parser.parse File.read(file)
|
13
|
+
|
14
|
+
puts "Please enter your Github credentials.".green
|
15
|
+
# Next actions need to be retriable, so we wrap them to be able to
|
16
|
+
# call it back if authorization fails
|
17
|
+
remote_actions = lambda do
|
18
|
+
client = build_github_client
|
19
|
+
# Convert themes to issues and count them
|
20
|
+
issues = Issues.create_from(client, repo, themes)
|
21
|
+
puts "Created #{ issues.length } issues".yellow
|
22
|
+
end
|
14
23
|
# Request user's Github credentials to connect to API and build client
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
remote_actions.call
|
25
|
+
rescue Octokit::Unauthorized, Octokit::Forbidden => e
|
26
|
+
case e.class.name
|
27
|
+
# When user fails to log in, let him try again
|
28
|
+
when "Octokit::Unauthorized"
|
29
|
+
puts "Bad credentials ... please try again.".red
|
30
|
+
remote_actions.call
|
31
|
+
# When user fails too many times, exit
|
32
|
+
when "Octokit::Forbidden"
|
33
|
+
puts "Too many attempts ... please try again later.".red
|
34
|
+
exit 1
|
35
|
+
end
|
19
36
|
end
|
20
37
|
|
21
38
|
protected
|
22
39
|
|
23
40
|
def build_github_client
|
24
|
-
puts "Please enter your Github credentials.".green
|
25
41
|
print "Username : ".green
|
26
42
|
username = STDIN.gets.chop
|
27
43
|
print "Password : ".green
|
28
44
|
password = STDIN.noecho(&:gets).chop
|
29
45
|
puts ""
|
30
|
-
|
31
46
|
Octokit::Client.new(login: username, password: password)
|
32
47
|
end
|
33
|
-
|
34
|
-
def create_issues themes
|
35
|
-
|
36
|
-
end
|
37
48
|
end
|
38
49
|
end
|
data/lib/rdv/object/item.rb
CHANGED
@@ -19,17 +19,17 @@ module Rdv
|
|
19
19
|
# Fetch contents
|
20
20
|
contents = @raw_content.reduce([]) do |list, line|
|
21
21
|
line = trim_indentation(line)
|
22
|
-
list << line
|
22
|
+
list << line
|
23
23
|
list
|
24
|
-
end.
|
24
|
+
end.join("").strip.lines
|
25
25
|
|
26
|
-
if contents.last.
|
27
|
-
@tags = contents.pop.split("|").map do |tag|
|
26
|
+
if contents.last.match(/^\|/)
|
27
|
+
@tags = contents.pop.split("|")[1..-1].map do |tag|
|
28
28
|
capitalize(tag)
|
29
|
-
end
|
29
|
+
end.compact
|
30
30
|
end
|
31
31
|
|
32
|
-
@content = contents.join
|
32
|
+
@content = contents.join
|
33
33
|
|
34
34
|
# If a @user tag is found in the issue name, strip it and store it as
|
35
35
|
# the assignee user login
|
data/lib/rdv/version.rb
CHANGED