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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b4cc48e47a9d65df21ad93130190174011d3fdd
4
- data.tar.gz: df7553c3ae34839e4102efd03c2af1acce62d92a
3
+ metadata.gz: 1250842240f23f200b828c5d55c758506ace84e8
4
+ data.tar.gz: 233477652275c98d8bf041eaef255c0825540a9c
5
5
  SHA512:
6
- metadata.gz: d5dbef89b29e262fe4afa77e16e44e43c84a2ad5725fba3bfdc1459ed1d803bfcf060a338e5dc2d851b2a0d9c40315bda9dc8d7db68b9395579c38482a481e08
7
- data.tar.gz: 450ee857525876adfebf6fa40fcc5733194cf48a4ae1e372b8c27a1d54673bcf9e2f2312808a6281decb49602a415f1d60731073ce5741b8828c73ace5b12e6b
6
+ metadata.gz: 601f018b3b24847e2174181456a6ef2d6aee319e6cfef86d0691780cc5d73507aedbb9fc051d814f9edd24ce5c5aa4318a4dd7c2ecbafdc426b3e639febd7370
7
+ data.tar.gz: a621e8232e4d40fc824c789c04ea484b5809d679254291e449db63d8a0de6e0cb42d792e49fee54387e5b9240b50d3424fa8d7d3beea8caea9d2e17221f2489e
@@ -0,0 +1,10 @@
1
+ # top-most editorconfig file
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+ indent_style = space
10
+ indent_size = 2
data/.gitignore CHANGED
@@ -1,14 +1,9 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
- /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
- /spec/reports/
9
7
  /tmp/
10
8
  *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
9
+ *.gem
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -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
@@ -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
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in try_ruby_cli.gemspec
3
+ # Specify your gem's dependencies in tryruby.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Try Ruby!
2
2
 
3
- [![Build Status](https://travis-ci.org/cvut/tryruby.svg?branch=master)](https://travis-ci.org/cvut/tryruby)
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
@@ -1 +1,13 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :test => :spec
9
+ task :default => :spec
10
+
11
+ rescue LoadError => e
12
+ warn "#{e.path} is not available"
13
+ end
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # coding: utf-8
3
- require_relative File.expand_path('../lib/tryruby/runner', File.dirname(__FILE__))
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
- require_relative File.expand_path("../lib/#{snake_case}", File.dirname(__FILE__))
18
+ abort "Tutorial #{tutorial} not found!"
16
19
  end
17
20
  Object.const_get(tutorial).new
18
21
  end
@@ -1,5 +1,2 @@
1
1
  require 'tryruby/version'
2
-
3
- # CLI version of tryruby.org
4
- module Tryruby
5
- end
2
+ require 'tryruby/runner'
@@ -1,5 +1,5 @@
1
- require_relative 'challenge'
2
- require_relative 'colors'
1
+ require 'tryruby/challenge'
2
+ require 'tryruby/colors'
3
3
 
4
4
  module Tryruby
5
5
  # Single challenge level builder
@@ -1,5 +1,5 @@
1
- require_relative 'tutorial'
2
1
  require 'fileutils'
2
+ require 'tryruby/tutorial'
3
3
 
4
4
  module Tryruby
5
5
  # Levels and challenges form tryruby.org
@@ -1,5 +1,5 @@
1
- require_relative 'level'
2
- require_relative 'challenge_builder'
1
+ require 'tryruby/level'
2
+ require 'tryruby/challenge_builder'
3
3
 
4
4
  module Tryruby
5
5
  # Single tutorial level builder
@@ -1,7 +1,7 @@
1
1
  require 'ripl'
2
2
  require 'ripl/multi_line'
3
- require_relative 'shell'
4
- require_relative 'commands'
3
+ require 'tryruby/commands'
4
+ require 'tryruby/shell'
5
5
 
6
6
  module Tryruby
7
7
  # Startup class of the shell
@@ -1,6 +1,6 @@
1
1
  require 'stringio'
2
- require_relative 'colors'
3
- require_relative 'next_fix'
2
+ require 'tryruby/colors'
3
+ require 'tryruby/next_fix'
4
4
 
5
5
  module Tryruby
6
6
  # Shell extension
@@ -1,4 +1,4 @@
1
- require_relative 'level_builder'
1
+ require 'tryruby/level_builder'
2
2
 
3
3
  module Tryruby
4
4
  # Base module for level DSL
@@ -1,4 +1,4 @@
1
1
  # Version
2
2
  module Tryruby
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
@@ -1,5 +1,4 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/challenge_builder'
1
+ require 'tryruby/challenge_builder'
3
2
 
4
3
  describe Tryruby::ChallengeBuilder do
5
4
  subject { described_class.new }
@@ -1,5 +1,4 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/challenge'
1
+ require 'tryruby/challenge'
3
2
 
4
3
  describe Tryruby::Challenge do
5
4
  let(:help) { '' }
@@ -1,6 +1,5 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/colors'
3
1
  require 'paint'
2
+ require 'tryruby/colors'
4
3
 
5
4
  describe Tryruby::Colors do
6
5
  let(:string) { 'test' }
@@ -1,7 +1,6 @@
1
- require_relative 'spec_helper'
2
1
  require 'ripl'
3
- require_relative '../lib/tryruby/commands'
4
- require_relative '../lib/tryruby/next_fix'
2
+ require 'tryruby/commands'
3
+ require 'tryruby/next_fix'
5
4
 
6
5
  # mocking shell
7
6
  module TestShellModule
@@ -1,5 +1,4 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/level_builder'
1
+ require 'tryruby/level_builder'
3
2
 
4
3
  describe Tryruby::LevelBuilder do
5
4
  subject { described_class.new }
@@ -1,6 +1,5 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/level'
3
- require_relative '../lib/tryruby/challenge'
1
+ require 'tryruby/challenge'
2
+ require 'tryruby/level'
4
3
 
5
4
  describe Tryruby::Level do
6
5
  let(:a) { Tryruby::Challenge.new('a') }
@@ -1,5 +1,4 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/next_fix'
1
+ require 'tryruby/next_fix'
3
2
 
4
3
  describe Tryruby::NextFix do
5
4
  # mocking module to properly inherit
@@ -1,6 +1,5 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/shell'
3
- require_relative '../lib/tryruby/challenge'
1
+ require 'tryruby/challenge'
2
+ require 'tryruby/shell'
4
3
 
5
4
  # mocking shell
6
5
  class TestShell
@@ -1,42 +1,35 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  require 'stringio'
4
- $LOAD_PATH << '../lib/tryruby'
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
- # mtm @ http://stackoverflow.com/questions/6372763/rspec-how-do-i-write-a-test-that-expects-certain-output-but-doesnt-care-about
13
- RSpec::Matchers.define :match_stdout do |check|
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
- failure_message do
30
- "expected to #{description}"
31
- end
32
- failure_message_when_negated do
33
- "expected not to #{description}"
34
- end
35
- description do
36
- "match [#{check}] on stdout [#{@capture.string}]"
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
- def supports_block_expectations?
40
- true
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
@@ -1,5 +1,4 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/tryruby/tutorial'
1
+ require 'tryruby/tutorial'
3
2
 
4
3
  describe Tryruby::Tutorial do
5
4
  subject { described_class.new }
@@ -1,13 +1,11 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
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.add_dependency 'ripl'
24
- spec.add_dependency 'ripl-multi_line'
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.1
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-21 00:00:00.000000000 Z
13
+ date: 2015-02-24 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: bundler
16
+ name: ripl
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
19
  - - "~>"
19
20
  - !ruby/object:Gem::Version
20
- version: '1.7'
21
- type: :development
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: '1.7'
28
+ version: '0.7'
28
29
  - !ruby/object:Gem::Dependency
29
- name: rake
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: '10.0'
35
- type: :development
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: '10.0'
42
+ version: '0.3'
42
43
  - !ruby/object:Gem::Dependency
43
- name: ripl
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: ripl-multi_line
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: sourcify
72
+ name: bundler
72
73
  requirement: !ruby/object:Gem::Requirement
73
74
  requirements:
74
- - - ">="
75
+ - - "~>"
75
76
  - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :runtime
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: '0'
84
+ version: '1.7'
84
85
  - !ruby/object:Gem::Dependency
85
- name: paint
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: :runtime
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: '0'
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