daigaku 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/README.md +6 -6
- data/lib/daigaku/markdown/ruby_doc.rb +9 -7
- data/lib/daigaku/test_result.rb +1 -1
- data/lib/daigaku/version.rb +1 -1
- data/lib/daigaku/views/task_view.rb +18 -2
- data/spec/daigaku/markdown/ruby_doc_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4318ff789d428a55ecc01cefa1d55267a2193503
|
4
|
+
data.tar.gz: a3b3744b1bffe6a4ac11f25bbfe202d977ce3022
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b6c10e541c8e38af57ef69f25535c87d358a9ae3e895d6a07d9efc873f938299a642e603d2371eecc0fb6cd8495ff57a6f0bd7a0da698d751a7bb9768a7113
|
7
|
+
data.tar.gz: 05b555e1144e5d6c1fda261463445484dcb1d32bf0ab9d873d6ee52e8974dcd9d575b083e558d41329c45a7c512b2dc5bf55f3aaf21fabed08d38d604af0ffab
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,7 @@ Daigaku will lead you through the setup and some important commands.
|
|
32
32
|
|
33
33
|
## Command line interface
|
34
34
|
|
35
|
-
Daigaku
|
35
|
+
Daigaku’s command line interface provides several commands which you
|
36
36
|
can use in your terminal to setup the system, download new courses,
|
37
37
|
and navigate through your solutions.
|
38
38
|
|
@@ -42,7 +42,7 @@ Please visit the [Daigaku Wiki](https://github.com/daigaku-ruby/daigaku/wiki/How
|
|
42
42
|
|
43
43
|
## Daigaku screen
|
44
44
|
|
45
|
-
Daigaku
|
45
|
+
Daigaku’s text based interface—the Daigaku screen—shows your installed courses and allows you to navigate through their chapters and units. In the task view you can read the unit’s task and validate your solution code.
|
46
46
|
|
47
47
|
Please visit the [Diagaku Wiki](https://github.com/daigaku-ruby/daigaku/wiki/How-to-learn-Ruby-in-the-Daigaku-screen) to learn how to use the Daigaku screen.
|
48
48
|
|
@@ -56,10 +56,10 @@ This project is intended to be a safe, welcoming space for collaboration, and co
|
|
56
56
|
|
57
57
|
### Creating Daigaku courses
|
58
58
|
|
59
|
-
Daigaku is a great tool, but it
|
59
|
+
Daigaku is a great tool, but it’s nothing without courses to learn from.
|
60
60
|
Go ahead and help with making Daigaku a worthwile and fun resource for learning Ruby!
|
61
61
|
|
62
|
-
Daigaku uses the course
|
62
|
+
Daigaku uses the course “Get started with Ruby” by default.
|
63
63
|
Any contributions to the basic Daigaku course are more than welcome.
|
64
64
|
To add chapters to the course fork it from https://github.com/daigaku-ruby/Get_started_with_Ruby
|
65
65
|
and follow its guidelines for adding chapters or units.
|
@@ -72,7 +72,7 @@ Learn how to create a Daigaku course in the [Daigaku Wiki](https://github.com/da
|
|
72
72
|
Any ideas, feature proposals, filing and feedback on issues are very welcome.
|
73
73
|
We use the [git branching model](http://nvie.com/posts/a-successful-git-branching-model/) described by [nvie](https://github.com/nvie).
|
74
74
|
|
75
|
-
Here
|
75
|
+
Here’s how to contribute:
|
76
76
|
|
77
77
|
1. Fork it ( https://github.com/daigaku-ruby/daigaku/fork )
|
78
78
|
2. Create your feature branch (`git checkout -b feature/my-new-feature develop`)
|
@@ -82,7 +82,7 @@ Here's how to contribute:
|
|
82
82
|
|
83
83
|
Please try to add RSpec tests with your new features. This will ensure that your code does not break existing functionality and that your feature is working as expected.
|
84
84
|
|
85
|
-
Ah, don
|
85
|
+
Ah, don’t forget step 6: Celebrate that you made Daigaku a better tool after your code was merged in! :octocat: :tada:
|
86
86
|
|
87
87
|
### License
|
88
88
|
|
@@ -43,19 +43,19 @@ module Daigaku
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def doc_regex(type, capture)
|
46
|
-
|
46
|
+
Regexp.new(Regexp.escape("(ruby-doc #{type}: #{capture})"))
|
47
47
|
end
|
48
48
|
|
49
49
|
def core_link(text)
|
50
50
|
constants = ruby_constants(text).join('/')
|
51
|
-
method
|
51
|
+
method = ruby_method(text)
|
52
52
|
|
53
53
|
"#{CORE_BASE_URL}/#{constants}.html#{method}"
|
54
54
|
end
|
55
55
|
|
56
56
|
def stdlib_link(text)
|
57
|
-
constants
|
58
|
-
method
|
57
|
+
constants = ruby_constants(text).join('/')
|
58
|
+
method = ruby_method(text)
|
59
59
|
libdoc_part = "libdoc/#{ruby_stdlib(text)}/rdoc"
|
60
60
|
|
61
61
|
"#{STDLIB_BASE_URL}/#{libdoc_part}/#{constants}.html#{method}"
|
@@ -68,7 +68,7 @@ module Daigaku
|
|
68
68
|
# Else the lib is created from the constants, e.g.
|
69
69
|
# (ruby-doc stdlib: Time) => 'time'
|
70
70
|
def ruby_stdlib(text)
|
71
|
-
parts = text.split
|
71
|
+
parts = text.split
|
72
72
|
|
73
73
|
if parts.length > 1
|
74
74
|
parts.first.strip.downcase
|
@@ -78,7 +78,7 @@ module Daigaku
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def ruby_constants(text)
|
81
|
-
parts = text.split
|
81
|
+
parts = text.split.last.split(/::|#/)
|
82
82
|
select_capitalized(parts)
|
83
83
|
end
|
84
84
|
|
@@ -92,7 +92,9 @@ module Daigaku
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def select_capitalized(parts)
|
95
|
-
parts.select
|
95
|
+
parts.select do |part|
|
96
|
+
part[0].match(/\w/) && part[0] == part[0].upcase
|
97
|
+
end
|
96
98
|
end
|
97
99
|
|
98
100
|
def downcased?(text)
|
data/lib/daigaku/test_result.rb
CHANGED
data/lib/daigaku/version.rb
CHANGED
@@ -186,7 +186,7 @@ module Daigaku
|
|
186
186
|
|
187
187
|
def print_test_results(window)
|
188
188
|
result = @unit.solution.verify!
|
189
|
-
@test_result_lines = result
|
189
|
+
@test_result_lines = test_result_lines(result)
|
190
190
|
|
191
191
|
if result.passed?
|
192
192
|
code_lines = @unit.reference_solution.code_lines
|
@@ -213,6 +213,22 @@ module Daigaku
|
|
213
213
|
initialize_window(height)
|
214
214
|
end
|
215
215
|
|
216
|
+
def test_result_lines(result)
|
217
|
+
lines = result.summary_lines
|
218
|
+
lines += code_error_lines(@unit.solution.code) unless result.passed?
|
219
|
+
lines
|
220
|
+
end
|
221
|
+
|
222
|
+
def code_error_lines(code)
|
223
|
+
begin
|
224
|
+
eval(code)
|
225
|
+
rescue Exception => e
|
226
|
+
return e.inspect.gsub(/(^.*#<|>.*$)/, '').lines.map(&:rstrip)
|
227
|
+
end
|
228
|
+
|
229
|
+
[]
|
230
|
+
end
|
231
|
+
|
216
232
|
def reset_screen(window)
|
217
233
|
@test_result_lines = nil
|
218
234
|
@lines = @unit.task.markdown.lines
|
@@ -228,7 +244,7 @@ module Daigaku
|
|
228
244
|
end
|
229
245
|
|
230
246
|
def example_index(heights, index)
|
231
|
-
heights.values.index { |range| range.include?(index) }
|
247
|
+
heights.values.index { |range| range.include?(index) }.to_i
|
232
248
|
end
|
233
249
|
end
|
234
250
|
|
@@ -56,6 +56,15 @@ describe Daigaku::Markdown::RubyDoc do
|
|
56
56
|
expect(parse(markdown)).to eq "#{base_url}/Enumerator/Lazy.html#method-i-flat_map"
|
57
57
|
end
|
58
58
|
|
59
|
+
it 'returns the right link for an instance method not starting with word characters' do
|
60
|
+
markdown = '(ruby-doc core: Array#<<)'
|
61
|
+
expect(parse(markdown)).to eq "#{base_url}/Array.html#method-i-3C-3C"
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'returns the right link for an instance method with regex characters' do
|
65
|
+
markdown = '(ruby-doc core: Array#any?)'
|
66
|
+
expect(parse(markdown)).to eq "#{base_url}/Array.html#method-i-any-3F"
|
67
|
+
end
|
59
68
|
end
|
60
69
|
|
61
70
|
context 'for a text containing a stdlib doc markup' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daigaku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Götze
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
329
|
version: '0'
|
330
330
|
requirements: []
|
331
331
|
rubyforge_project:
|
332
|
-
rubygems_version: 2.
|
332
|
+
rubygems_version: 2.5.1
|
333
333
|
signing_key:
|
334
334
|
specification_version: 4
|
335
335
|
summary: Learning Ruby on the command line.
|