learn-status 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/learn-status +5 -0
- data/learn-status.gemspec +27 -0
- data/lib/learn_status.rb +9 -0
- data/lib/learn_status/report.rb +34 -0
- data/lib/learn_status/report/formatter.rb +76 -0
- data/lib/learn_status/version.rb +3 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7fa1b5a5f78a9c86f096e93e41619ba64fbcd10d
|
4
|
+
data.tar.gz: e7ff53169a66fea55c3ec52a8391194e4cb22f78
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e4187be9a26f7d2714d24f8831250f4dc2254dc21a71ede9dbee361fcf0a30166e4fafce22992cd577bd0c6a60e3940b0c077b8ca98f1842571ba0e37a1f084
|
7
|
+
data.tar.gz: 92acce8efee30574d7bba067fd3fbc8adb3ebce12e4ab0094fbbddf9bf000064f5540da8ca9fd9139f63815cbfeb955c75a085f9a79c3f065e5d0978f07b79d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Flatiron School
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# learn-status
|
2
|
+
|
3
|
+
Gets your current lesson status from Learn.co.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install with:
|
8
|
+
|
9
|
+
```
|
10
|
+
$ gem install learn-status
|
11
|
+
```
|
12
|
+
|
13
|
+
Alternatively, add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'learn-status'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
In your code:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'learn_status'
|
29
|
+
```
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it ( https://github.com/flatiron-labs/learn-status/fork )
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "learn/status"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/learn-status
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'learn_status/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "learn-status"
|
8
|
+
spec.version = LearnStatus::VERSION
|
9
|
+
spec.authors = ["Flatiron School"]
|
10
|
+
spec.email = ["learn@flatironschool.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Gets your current status from Learn.co}
|
13
|
+
spec.homepage = "https://learn.co"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib", "exe"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "netrc"
|
25
|
+
spec.add_runtime_dependency "colorize"
|
26
|
+
spec.add_runtime_dependency "learn-web", ">= 1.2.0"
|
27
|
+
end
|
data/lib/learn_status.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'learn_status/report/formatter'
|
2
|
+
|
3
|
+
module LearnStatus
|
4
|
+
class Report
|
5
|
+
attr_reader :client
|
6
|
+
attr_accessor :status
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
_login, token = Netrc.read['learn-config']
|
10
|
+
@client = LearnWeb::Client.new(token: token)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.generate
|
14
|
+
new.generate
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate
|
18
|
+
get_status
|
19
|
+
generate_report
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def get_status
|
25
|
+
puts 'Getting current status...'
|
26
|
+
self.status = client.current_status
|
27
|
+
end
|
28
|
+
|
29
|
+
def generate_report
|
30
|
+
formatted_report = LearnStatus::Report::Formatter.new(status).execute
|
31
|
+
puts formatted_report.printable_output
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module LearnStatus
|
2
|
+
class Report
|
3
|
+
class Formatter
|
4
|
+
attr_reader :status
|
5
|
+
attr_accessor :lights
|
6
|
+
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
def_delegators :status, :title, :started, :students_working,
|
10
|
+
:median_completion_time
|
11
|
+
|
12
|
+
def initialize(status)
|
13
|
+
@status = status
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute
|
17
|
+
build_lights_status
|
18
|
+
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def printable_output
|
23
|
+
<<-OUTPUT
|
24
|
+
|
25
|
+
Current Lesson: #{title}
|
26
|
+
Started: #{started}
|
27
|
+
Students Working: #{students_working}
|
28
|
+
Median Completion Time: #{median_completion_time}
|
29
|
+
|
30
|
+
#{lights_output}
|
31
|
+
OUTPUT
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def lights_output
|
37
|
+
output = ''
|
38
|
+
|
39
|
+
self.lights.each do |light|
|
40
|
+
output << "#{light[:title]}: "
|
41
|
+
|
42
|
+
if light[:color]
|
43
|
+
output << '●'.send(light[:color])
|
44
|
+
else
|
45
|
+
output << 'x'
|
46
|
+
end
|
47
|
+
|
48
|
+
if light[:tests]
|
49
|
+
output << " (Passing: #{light[:tests][:passing]} / Failing: #{light[:tests][:passing]})"
|
50
|
+
end
|
51
|
+
|
52
|
+
output << "\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
output
|
56
|
+
end
|
57
|
+
|
58
|
+
def build_lights_status
|
59
|
+
self.lights = status.lights.map do |light|
|
60
|
+
{
|
61
|
+
title: light[:type].split('_').map(&:capitalize).join(' '),
|
62
|
+
color: if light[:started]
|
63
|
+
light[:passing] ? :green : :red
|
64
|
+
end,
|
65
|
+
tests: if light[:tests_passing]
|
66
|
+
{
|
67
|
+
passing: light[:tests_passing],
|
68
|
+
failing: light[:tests_failing]
|
69
|
+
}
|
70
|
+
end
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: learn-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Flatiron School
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: netrc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: learn-web
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.2.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.2.0
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- learn@flatironschool.com
|
86
|
+
executables:
|
87
|
+
- learn-status
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
97
|
+
- bin/setup
|
98
|
+
- exe/learn-status
|
99
|
+
- learn-status.gemspec
|
100
|
+
- lib/learn_status.rb
|
101
|
+
- lib/learn_status/report.rb
|
102
|
+
- lib/learn_status/report/formatter.rb
|
103
|
+
- lib/learn_status/version.rb
|
104
|
+
homepage: https://learn.co
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
- exe
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.4.8
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Gets your current status from Learn.co
|
129
|
+
test_files: []
|