tryruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/.gitignore +1 -6
- data/.rspec +1 -0
- data/.simplecov +9 -0
- data/.travis.yml +5 -1
- data/Gemfile +1 -1
- data/README.md +5 -2
- data/Rakefile +12 -0
- data/bin/tryruby +5 -2
- data/lib/tryruby.rb +1 -4
- data/lib/tryruby/challenge_builder.rb +2 -2
- data/lib/tryruby/default_levels.rb +1 -1
- data/lib/tryruby/level_builder.rb +2 -2
- data/lib/tryruby/runner.rb +2 -2
- data/lib/tryruby/shell.rb +2 -2
- data/lib/tryruby/tutorial.rb +1 -1
- data/lib/tryruby/version.rb +1 -1
- data/spec/challenge_buider_spec.rb +1 -2
- data/spec/challenge_spec.rb +1 -2
- data/spec/colors_spec.rb +1 -2
- data/spec/commands_spec.rb +2 -3
- data/spec/level_builder_spec.rb +1 -2
- data/spec/level_spec.rb +2 -3
- data/spec/next_fix_spec.rb +1 -2
- data/spec/shell_spec.rb +2 -3
- data/spec/spec_helper.rb +26 -33
- data/spec/support/matchers.rb +33 -0
- data/spec/tutorial_spec.rb +1 -2
- data/tryruby.gemspec +13 -9
- metadata +82 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1250842240f23f200b828c5d55c758506ace84e8
|
4
|
+
data.tar.gz: 233477652275c98d8bf041eaef255c0825540a9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 601f018b3b24847e2174181456a6ef2d6aee319e6cfef86d0691780cc5d73507aedbb9fc051d814f9edd24ce5c5aa4318a4dd7c2ecbafdc426b3e639febd7370
|
7
|
+
data.tar.gz: a621e8232e4d40fc824c789c04ea484b5809d679254291e449db63d8a0de6e0cb42d792e49fee54387e5b9240b50d3424fa8d7d3beea8caea9d2e17221f2489e
|
data/.editorconfig
ADDED
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.simplecov
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'codeclimate-test-reporter'
|
2
|
+
|
3
|
+
formatters = [SimpleCov::Formatter::HTMLFormatter]
|
4
|
+
formatters << CodeClimate::TestReporter::Formatter if ENV['CODECLIMATE_REPO_TOKEN']
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter '/spec/'
|
9
|
+
end
|
data/.travis.yml
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
rvm:
|
4
|
-
- 2.0.0
|
5
4
|
- 2.1.5
|
5
|
+
- 2.2.0
|
6
|
+
addons:
|
7
|
+
code_climate:
|
8
|
+
repo_token:
|
9
|
+
secure: h49J5f0V0KFDjhpKl/lXLSHlh62zazNFJi+76Sa0OYnHTF18uMaiuBqIqXlfFVC9lNQ9FXSp2DTCEqotcQFcI6aPXH/PtPs5nOUStcgANkNCLjV+BnF5EOIiDt3pswuh4ec/HNZ4yP53Tc/6w87JmdQF36iq6js71MZbZ1CWqVI=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Try Ruby!
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://img.shields.io/travis/cvut/tryruby/master.svg?style=flat)](https://travis-ci.org/cvut/tryruby)
|
4
|
+
[![Test Coverage](https://img.shields.io/codeclimate/coverage/github/cvut/tryruby.svg?style=flat)](https://codeclimate.com/github/cvut/tryruby)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/cvut/tryruby.svg?style=flat)](https://codeclimate.com/github/cvut/tryruby)
|
6
|
+
[![Gem Version](https://img.shields.io/gem/v/tryruby.svg?style=flat)](https://rubygems.org/gems/tryruby)
|
4
7
|
|
5
8
|
A command line version of [tryruby.org](http://tryruby.org/) in case that the website goes down or is having troubles with too many simultaneous connections you can use this REPL shell to try ruby!
|
6
9
|
|
@@ -22,4 +25,4 @@ A command line version of [tryruby.org](http://tryruby.org/) in case that the we
|
|
22
25
|
|
23
26
|
## TODO
|
24
27
|
|
25
|
-
* convert Why's drawings to ASCII art
|
28
|
+
* convert Why's drawings to ASCII art
|
data/Rakefile
CHANGED
data/bin/tryruby
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# coding: utf-8
|
3
|
-
|
3
|
+
LIB_DIR = File.expand_path('../lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift LIB_DIR unless $LOAD_PATH.include? LIB_DIR
|
5
|
+
|
6
|
+
require 'tryruby/runner'
|
4
7
|
|
5
8
|
ARGV << 'Tryruby::DefaultLevels' unless ARGV.length > 0
|
6
9
|
tutorials = ARGV.map do |tutorial|
|
@@ -12,7 +15,7 @@ tutorials = ARGV.map do |tutorial|
|
|
12
15
|
begin
|
13
16
|
require snake_case
|
14
17
|
rescue LoadError
|
15
|
-
|
18
|
+
abort "Tutorial #{tutorial} not found!"
|
16
19
|
end
|
17
20
|
Object.const_get(tutorial).new
|
18
21
|
end
|
data/lib/tryruby.rb
CHANGED
data/lib/tryruby/runner.rb
CHANGED
data/lib/tryruby/shell.rb
CHANGED
data/lib/tryruby/tutorial.rb
CHANGED
data/lib/tryruby/version.rb
CHANGED
data/spec/challenge_spec.rb
CHANGED
data/spec/colors_spec.rb
CHANGED
data/spec/commands_spec.rb
CHANGED
data/spec/level_builder_spec.rb
CHANGED
data/spec/level_spec.rb
CHANGED
data/spec/next_fix_spec.rb
CHANGED
data/spec/shell_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,42 +1,35 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'stringio'
|
4
|
-
|
2
|
+
require 'simplecov'
|
3
|
+
require 'tryruby'
|
4
|
+
|
5
|
+
Dir['./spec/support/**/*.rb'].each { |file| require file }
|
5
6
|
|
6
7
|
RSpec.configure do |c|
|
7
|
-
c.color = true
|
8
|
-
c.formatter = :documentation
|
9
|
-
c.tty = true
|
10
|
-
end
|
11
8
|
|
12
|
-
#
|
13
|
-
|
14
|
-
@capture = nil
|
15
|
-
|
16
|
-
match do |block|
|
17
|
-
begin
|
18
|
-
stdout_saved = $stdout
|
19
|
-
$stdout = StringIO.new
|
20
|
-
block.call
|
21
|
-
ensure
|
22
|
-
@capture = $stdout
|
23
|
-
$stdout = stdout_saved
|
24
|
-
end
|
25
|
-
|
26
|
-
@capture.string.match check
|
27
|
-
end
|
9
|
+
# rspec-expectations config
|
10
|
+
c.expect_with :rspec do |expects|
|
28
11
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
12
|
+
# This option disables deprecated 'should' syntax.
|
13
|
+
expects.syntax = :expect
|
14
|
+
|
15
|
+
# This option makes the +description+ and +failure_message+ of custom
|
16
|
+
# matchers include text for helper methods defined using +chain+, e.g.:
|
17
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
18
|
+
# # => "be bigger than 2 and smaller than 4"
|
19
|
+
# ...rather than:
|
20
|
+
# # => "be bigger than 2"
|
21
|
+
expects.include_chain_clauses_in_custom_matcher_descriptions = true
|
37
22
|
end
|
38
23
|
|
39
|
-
|
40
|
-
|
24
|
+
# rspec-mocks config
|
25
|
+
c.mock_with :rspec do |mocks|
|
26
|
+
|
27
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
28
|
+
# a real object.
|
29
|
+
mocks.verify_partial_doubles = true
|
41
30
|
end
|
31
|
+
|
32
|
+
c.color = true
|
33
|
+
c.formatter = :documentation
|
34
|
+
c.tty = true
|
42
35
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
# mtm @ http://stackoverflow.com/questions/6372763/rspec-how-do-i-write-a-test-that-expects-certain-output-but-doesnt-care-about
|
4
|
+
RSpec::Matchers.define :match_stdout do |check|
|
5
|
+
@capture = nil
|
6
|
+
|
7
|
+
match do |block|
|
8
|
+
begin
|
9
|
+
stdout_saved = $stdout
|
10
|
+
$stdout = StringIO.new
|
11
|
+
block.call
|
12
|
+
ensure
|
13
|
+
@capture = $stdout
|
14
|
+
$stdout = stdout_saved
|
15
|
+
end
|
16
|
+
|
17
|
+
@capture.string.match check
|
18
|
+
end
|
19
|
+
|
20
|
+
failure_message do
|
21
|
+
"expected to #{description}"
|
22
|
+
end
|
23
|
+
failure_message_when_negated do
|
24
|
+
"expected not to #{description}"
|
25
|
+
end
|
26
|
+
description do
|
27
|
+
"match [#{check}] on stdout [#{@capture.string}]"
|
28
|
+
end
|
29
|
+
|
30
|
+
def supports_block_expectations?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
data/spec/tutorial_spec.rb
CHANGED
data/tryruby.gemspec
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'tryruby/version'
|
2
|
+
require File.expand_path('../lib/tryruby/version', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |spec|
|
7
5
|
spec.name = 'tryruby'
|
8
6
|
spec.version = Tryruby::VERSION
|
9
|
-
spec.authors = ['Jakub Červenka', 'Tomas Barton']
|
10
|
-
spec.email = ['cervej19@fit.cvut.cz', 'tomas.barton@fit.cvut.cz']
|
7
|
+
spec.authors = ['Jakub Červenka', 'Tomas Barton', 'Jakub Jirutka']
|
8
|
+
spec.email = ['cervej19@fit.cvut.cz', 'tomas.barton@fit.cvut.cz', 'jirutjak@fit.cvut.cz']
|
11
9
|
spec.summary = 'Console version of tryruby.org'
|
12
10
|
spec.description = 'Console tutorial tool for Ruby.'
|
13
11
|
spec.homepage = 'https://github.com/cvut/tryruby'
|
@@ -18,10 +16,16 @@ Gem::Specification.new do |spec|
|
|
18
16
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
17
|
spec.require_paths = ['lib']
|
20
18
|
|
19
|
+
spec.required_ruby_version = '>= 2.1'
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'ripl', '~> 0.7'
|
22
|
+
spec.add_runtime_dependency 'ripl-multi_line', '~> 0.3'
|
23
|
+
spec.add_runtime_dependency 'sourcify', '~> 0.5'
|
24
|
+
spec.add_runtime_dependency 'paint', '~> 0.9'
|
25
|
+
|
21
26
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
27
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
|
22
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
-
spec.
|
24
|
-
spec.
|
25
|
-
spec.add_dependency 'sourcify'
|
26
|
-
spec.add_dependency 'paint'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
30
|
+
spec.add_development_dependency 'simplecov', '~> 0.9'
|
27
31
|
end
|
metadata
CHANGED
@@ -1,111 +1,158 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tryruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Červenka
|
8
8
|
- Tomas Barton
|
9
|
+
- Jakub Jirutka
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
13
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
+
name: ripl
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
18
|
requirements:
|
18
19
|
- - "~>"
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
21
|
-
type: :
|
21
|
+
version: '0.7'
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
23
24
|
version_requirements: !ruby/object:Gem::Requirement
|
24
25
|
requirements:
|
25
26
|
- - "~>"
|
26
27
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
28
|
+
version: '0.7'
|
28
29
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
30
|
+
name: ripl-multi_line
|
30
31
|
requirement: !ruby/object:Gem::Requirement
|
31
32
|
requirements:
|
32
33
|
- - "~>"
|
33
34
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
35
|
-
type: :
|
35
|
+
version: '0.3'
|
36
|
+
type: :runtime
|
36
37
|
prerelease: false
|
37
38
|
version_requirements: !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
40
|
- - "~>"
|
40
41
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
42
|
+
version: '0.3'
|
42
43
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
44
|
+
name: sourcify
|
44
45
|
requirement: !ruby/object:Gem::Requirement
|
45
46
|
requirements:
|
46
|
-
- - "
|
47
|
+
- - "~>"
|
47
48
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
+
version: '0.5'
|
49
50
|
type: :runtime
|
50
51
|
prerelease: false
|
51
52
|
version_requirements: !ruby/object:Gem::Requirement
|
52
53
|
requirements:
|
53
|
-
- - "
|
54
|
+
- - "~>"
|
54
55
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
+
version: '0.5'
|
56
57
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
58
|
+
name: paint
|
58
59
|
requirement: !ruby/object:Gem::Requirement
|
59
60
|
requirements:
|
60
|
-
- - "
|
61
|
+
- - "~>"
|
61
62
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
+
version: '0.9'
|
63
64
|
type: :runtime
|
64
65
|
prerelease: false
|
65
66
|
version_requirements: !ruby/object:Gem::Requirement
|
66
67
|
requirements:
|
67
|
-
- - "
|
68
|
+
- - "~>"
|
68
69
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
+
version: '0.9'
|
70
71
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
72
|
+
name: bundler
|
72
73
|
requirement: !ruby/object:Gem::Requirement
|
73
74
|
requirements:
|
74
|
-
- - "
|
75
|
+
- - "~>"
|
75
76
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
77
|
-
type: :
|
77
|
+
version: '1.7'
|
78
|
+
type: :development
|
78
79
|
prerelease: false
|
79
80
|
version_requirements: !ruby/object:Gem::Requirement
|
80
81
|
requirements:
|
81
|
-
- - "
|
82
|
+
- - "~>"
|
82
83
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
84
|
+
version: '1.7'
|
84
85
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
86
|
+
name: codeclimate-test-reporter
|
86
87
|
requirement: !ruby/object:Gem::Requirement
|
87
88
|
requirements:
|
88
|
-
- - "
|
89
|
+
- - "~>"
|
89
90
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :
|
91
|
+
version: '0.4'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0.4'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: rake
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '10.0'
|
106
|
+
type: :development
|
92
107
|
prerelease: false
|
93
108
|
version_requirements: !ruby/object:Gem::Requirement
|
94
109
|
requirements:
|
95
|
-
- - "
|
110
|
+
- - "~>"
|
96
111
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
112
|
+
version: '10.0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rspec
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.1'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '3.1'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: simplecov
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0.9'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - "~>"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0.9'
|
98
141
|
description: Console tutorial tool for Ruby.
|
99
142
|
email:
|
100
143
|
- cervej19@fit.cvut.cz
|
101
144
|
- tomas.barton@fit.cvut.cz
|
145
|
+
- jirutjak@fit.cvut.cz
|
102
146
|
executables:
|
103
147
|
- tryruby
|
104
148
|
extensions: []
|
105
149
|
extra_rdoc_files: []
|
106
150
|
files:
|
151
|
+
- ".editorconfig"
|
107
152
|
- ".gitignore"
|
153
|
+
- ".rspec"
|
108
154
|
- ".rubocop.yml"
|
155
|
+
- ".simplecov"
|
109
156
|
- ".travis.yml"
|
110
157
|
- Gemfile
|
111
158
|
- LICENSE.txt
|
@@ -134,6 +181,7 @@ files:
|
|
134
181
|
- spec/next_fix_spec.rb
|
135
182
|
- spec/shell_spec.rb
|
136
183
|
- spec/spec_helper.rb
|
184
|
+
- spec/support/matchers.rb
|
137
185
|
- spec/tutorial_spec.rb
|
138
186
|
- tryruby.gemspec
|
139
187
|
homepage: https://github.com/cvut/tryruby
|
@@ -148,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
196
|
requirements:
|
149
197
|
- - ">="
|
150
198
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
199
|
+
version: '2.1'
|
152
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
201
|
requirements:
|
154
202
|
- - ">="
|
@@ -170,4 +218,5 @@ test_files:
|
|
170
218
|
- spec/next_fix_spec.rb
|
171
219
|
- spec/shell_spec.rb
|
172
220
|
- spec/spec_helper.rb
|
221
|
+
- spec/support/matchers.rb
|
173
222
|
- spec/tutorial_spec.rb
|