learn-co 2.5.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/learn-co.gemspec +1 -1
- data/lib/learn.rb +1 -0
- data/lib/learn/cli.rb +13 -3
- data/lib/learn/team_members/parser.rb +71 -0
- data/lib/learn/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6004d385cb67eb2766777f6bc0a1d6da7cdaa3b3
|
4
|
+
data.tar.gz: 4b8556abc9643c2c73d9ef9b9cc8f90dc98a7f30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb45b4f663f8c78be64d561c523b54469f1c07077d2dc099043c2bdd373bad5427088bbe056952808a40c8d24e95f123919bdf1fe5d2fec23048666223ae7294
|
7
|
+
data.tar.gz: 2da3e2838819f1922520e2ffdbd83dee8b637143bc953d829abe3ea2a9947b68288925bf1ab896176018a5e2aa26f9bf906d70de89f4218181e34840814ed912
|
data/learn-co.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "learn-test", ">= 1.2.23"
|
25
25
|
spec.add_runtime_dependency "learn-config", ">= 1.0.74"
|
26
26
|
spec.add_runtime_dependency "learn-open", ">= 1.1.52"
|
27
|
-
spec.add_runtime_dependency "learn-submit", ">= 1.0
|
27
|
+
spec.add_runtime_dependency "learn-submit", ">= 1.1.0"
|
28
28
|
spec.add_runtime_dependency "learn-doctor", ">= 1.0.3"
|
29
29
|
spec.add_runtime_dependency "learn-generate", ">= 1.0.14"
|
30
30
|
spec.add_runtime_dependency "learn-status", ">= 1.0.1"
|
data/lib/learn.rb
CHANGED
data/lib/learn/cli.rb
CHANGED
@@ -24,14 +24,24 @@ module Learn
|
|
24
24
|
puts Learn::VERSION
|
25
25
|
end
|
26
26
|
|
27
|
-
desc 'submit ["message"]', 'Submit your completed lesson'
|
27
|
+
desc 'submit [-m|--message "message"] [-t|--team @username @username2]', 'Submit your completed lesson'
|
28
|
+
option :message, required: false, type: :string, aliases: ['m']
|
29
|
+
option :team, required: false, type: :string, aliases: ['t']
|
28
30
|
long_desc <<-LONGDESC
|
29
|
-
`learn submit ["message"]` will submit your lesson to Learn.
|
31
|
+
`learn submit [-m|--message "message"] [-t|--team @username, @username2]` will submit your lesson to Learn.
|
32
|
+
|
33
|
+
If you provide the -t|--team flag, specified team memebers will also get credit.
|
30
34
|
|
31
35
|
It will add your changes, commit them, push to GitHub, and issue a pull request.
|
32
36
|
LONGDESC
|
33
37
|
def submit(*opts)
|
34
|
-
|
38
|
+
commit_message = if options['team']
|
39
|
+
Learn::TeamMembers::Parser.new(ARGV).execute
|
40
|
+
else
|
41
|
+
options['message']
|
42
|
+
end
|
43
|
+
|
44
|
+
system("learn-submit #{commit_message}")
|
35
45
|
end
|
36
46
|
|
37
47
|
desc "open [lesson-name] [--editor=editor-binary]", "Open your current lesson [or the given lesson] [with your editor]"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Learn
|
2
|
+
module TeamMembers
|
3
|
+
class Parser
|
4
|
+
attr_reader :full_args
|
5
|
+
attr_accessor :members_list
|
6
|
+
|
7
|
+
def initialize(full_args)
|
8
|
+
@full_args = full_args
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
parse_full_args
|
13
|
+
sanitize_members
|
14
|
+
return_message
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def parse_full_args
|
20
|
+
index = (full_args.index('-t') || full_args.index('--t') || full_args.index('--team') || full_args.index('-team')) + 1
|
21
|
+
message_index = full_args.index('-m') || full_args.index('--message')
|
22
|
+
|
23
|
+
self.members_list = if !message_index || (message_index && (index > message_index))
|
24
|
+
full_args[index..-1]
|
25
|
+
else
|
26
|
+
full_args[index...message_index]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def sanitize_members
|
31
|
+
remove_trailing_commas!
|
32
|
+
|
33
|
+
if members_list.any? {|m| m.include?(',')}
|
34
|
+
split_members_list!
|
35
|
+
end
|
36
|
+
|
37
|
+
if !every_member_starts_with_at_symbol?
|
38
|
+
prepend_at_symbols!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def split_members_list!
|
43
|
+
members_list.map! do |m|
|
44
|
+
if m.include?(',')
|
45
|
+
m.split(',')
|
46
|
+
else
|
47
|
+
m
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
members_list.flatten!
|
52
|
+
end
|
53
|
+
|
54
|
+
def remove_trailing_commas!
|
55
|
+
members_list.map! {|m| m.chomp(',').strip}
|
56
|
+
end
|
57
|
+
|
58
|
+
def every_member_starts_with_at_symbol?
|
59
|
+
members_list.all? {|m| m.start_with?('@')}
|
60
|
+
end
|
61
|
+
|
62
|
+
def prepend_at_symbols!
|
63
|
+
members_list.each {|m| m.prepend('@') if !m.start_with?('@')}
|
64
|
+
end
|
65
|
+
|
66
|
+
def return_message
|
67
|
+
"team: #{self.members_list.join(' ')}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/learn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-co
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0
|
103
|
+
version: 1.1.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0
|
110
|
+
version: 1.1.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: learn-doctor
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/learn/internet_connection.rb
|
185
185
|
- lib/learn/lab/parser.rb
|
186
186
|
- lib/learn/options_sanitizer.rb
|
187
|
+
- lib/learn/team_members/parser.rb
|
187
188
|
- lib/learn/version.rb
|
188
189
|
homepage: https://learn.co
|
189
190
|
licenses:
|