goodread 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dd0cac02f1796fe0b626e32cc6cc6f4c85424f59457fde0db95a70e8cb8b26a
4
- data.tar.gz: 55e79251fd7b7dc19aa6f7534b21778697ee53036f0d66283d641b5db894352b
3
+ metadata.gz: fb27bc18b4fe2e29af124c9c4324defb0988601d8e6a54e5559f9f9788d6cdaf
4
+ data.tar.gz: f622623d0403189714baec7153b9290bd9317bbc0e32a1585bd4f7cdde88ce0b
5
5
  SHA512:
6
- metadata.gz: 30d152a2f6868a1a50a2c9620680e0c3bba6b0294d0783b4e1e5a30d29a996693bc2c91c849ef3f720a56f76289b0adf687c8f9fc9b6aba64e17be76cf119e23
7
- data.tar.gz: 73c5aa278a4480f2599ad6038b46689d5589286b5d8c09343c3dfaf26b56f888d8d27f3e0edd4f34920adb5239ae489ffb4aaa661f8631c9bf7028806130c871
6
+ metadata.gz: c59c4cfa3b2ac1224e2c27568f49fb1ac3721a54f3779958e270b3bb62b7a950c7bc0e96e9a59748356dabe582e5f5393624bde1f320c95a6f2f834eb4e33540
7
+ data.tar.gz: beb9be00315c242a99155ca2efd3bf356eb092e3b7cd30b4626695877b2a14647c59e9f676ba62ff0df19585bd2a6a1eadac13f3e874c129b10890aa199c4a00
data/README.md CHANGED
@@ -1,41 +1,9 @@
1
- # Goodread::Rb
1
+ # goodread-rb
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/goodread/rb`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Travis](https://img.shields.io/travis/goodread/goodread-rb/master.svg)](https://travis-ci.org/goodread/goodread-rb)
4
+ [![Coveralls](http://img.shields.io/coveralls/goodread/goodread-rb.svg?branch=master)](https://coveralls.io/r/goodread/goodread-rb?branch=master)
5
+ [![Gem Version](http://img.shields.io/gem/v/goodread.svg)](https://rubygems.org/gems/goodread)
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'goodread'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install goodread
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/goodread-rb.
36
-
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
7
+ Test runner for README.md. Support for Python/JavaScript/Ruby/PHP code blocks. Integration with hackmd.io. Read more about the project:
41
8
 
9
+ - https://github.com/goodread/goodread
data/goodread.gemspec CHANGED
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "goodread"
7
- spec.version = "0.2.1"
7
+ spec.version = "0.3.0"
8
8
  spec.authors = ["Evgeny Karev\n"]
9
9
  spec.email = ["eskarev@gmail.com"]
10
10
 
11
- spec.summary = %q{goodread}
12
- spec.description = %q{goodread}
11
+ spec.summary = "Test runner for README.md. Support for Python/JavaScript/Ruby/PHP code blocks. Integration with hackmd.io."
12
+ spec.description = "Test runner for README.md. Support for Python/JavaScript/Ruby/PHP code blocks. Integration with hackmd.io."
13
13
  spec.homepage = "https://github.com/goodread/goodread-rb"
14
14
  spec.license = "MIT"
15
15
 
data/lib/document.rb CHANGED
@@ -90,13 +90,13 @@ class Document
90
90
  end
91
91
 
92
92
  # Remote document
93
- # TODO: supress commands output
94
- if !@edit_path.start_with?('http')
95
- Kernel.system('editor', @edit_path)
93
+ if @edit_path.start_with?('http')
94
+ Kernel.system('xdg-open', @edit_path)
96
95
 
97
96
  # Local document
97
+ # TODO: supress commands output
98
98
  else
99
- Kernel.system('xdg-open', @edit_path)
99
+ Kernel.system('editor', @edit_path)
100
100
  end
101
101
 
102
102
  end
@@ -222,14 +222,7 @@ def _validate_document(elements, exit_first:false)
222
222
 
223
223
  # Codeblock
224
224
  elsif element['type'] == 'codeblock'
225
- exception_line = 1000 # infinity
226
- begin
227
- eval(instrument_codeblock(element['value']), scope)
228
- rescue Exception => exc
229
- exception = exc
230
- # TODO: get a real exception line
231
- exception_line = 1
232
- end
225
+ exception, exception_line = run_codeblock(element['value'], scope)
233
226
  lines = element['value'].strip().split("\n")
234
227
  for line, index in lines.each_with_index
235
228
  line_number = index + 1
data/lib/helpers.rb CHANGED
@@ -25,7 +25,7 @@ def read_config()
25
25
  end
26
26
 
27
27
 
28
- def instrument_codeblock(codeblock)
28
+ def run_codeblock(codeblock, scope)
29
29
  lines = []
30
30
  for line in codeblock.strip().split("\n")
31
31
  if line.include?(' # ')
@@ -39,7 +39,15 @@ def instrument_codeblock(codeblock)
39
39
  end
40
40
  lines.push(line)
41
41
  end
42
- return lines.join("\n")
42
+ exception_line = 1000 # infiinity
43
+ exception = nil
44
+ begin
45
+ eval(lines.join("\n"), scope)
46
+ rescue Exception => exc
47
+ exception = exc
48
+ exception_line = 1
49
+ end
50
+ return [exception, exception_line]
43
51
  end
44
52
 
45
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - |
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-07 00:00:00.000000000 Z
12
+ date: 2017-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -81,7 +81,8 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '3.0'
84
- description: goodread
84
+ description: Test runner for README.md. Support for Python/JavaScript/Ruby/PHP code
85
+ blocks. Integration with hackmd.io.
85
86
  email:
86
87
  - eskarev@gmail.com
87
88
  executables:
@@ -123,8 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
- rubygems_version: 2.7.1
127
+ rubygems_version: 2.7.2
127
128
  signing_key:
128
129
  specification_version: 4
129
- summary: goodread
130
+ summary: Test runner for README.md. Support for Python/JavaScript/Ruby/PHP code blocks.
131
+ Integration with hackmd.io.
130
132
  test_files: []