seeing_is_believing 2.1.4 → 2.2.0

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: 1952064fe97bbd42814728d8562a23f401b11ccc
4
- data.tar.gz: 41ebff3b5b92e9003ef4e587d25367a610ea45e3
3
+ metadata.gz: 9a2d2874d2ed6cf8165af907b62ecee8e271b5f6
4
+ data.tar.gz: b84abdaafa69646c8a71fabf979cfb334beaa197
5
5
  SHA512:
6
- metadata.gz: d40b823e70ff45521c324895cde5d0d76195ef26339ba0dc431d6009ec901bcc1e0e9ad509eb752477a3973035b88667ab6e0ef3ca97e354a2c8c90369a3dc2e
7
- data.tar.gz: c766a89c201e945347575eed23044fd1635628bfb1b6857bfa4d62bc4641dfe809e15fe91322f7590d344db752e562a533e7d56ce926649befe5e4aa1353b31a
6
+ metadata.gz: fb5fe068ff82a068246a81865807c2aa9acd711f29dd93223b4950968a7c2d3e394df146e99832b655f73d8abe44c00acb5e34ccc8105c527d97065e61cd8799
7
+ data.tar.gz: 31c4079565ae48e1fe9c15b81dcbbf775f21588afe4b6372ee818ef06ab333cac5da3670013c41b5496e36a9f68c808cc235961f94212954f60e1a5ed326e108
data/Readme.md CHANGED
@@ -1,22 +1,32 @@
1
+ [![Stories in Ready](https://badge.waffle.io/JoshCheek/seeing_is_believing.png?label=ready&title=Ready)](https://waffle.io/JoshCheek/seeing_is_believing)
1
2
  [![Build Status](https://secure.travis-ci.org/JoshCheek/seeing_is_believing.png?branch=master)](http://travis-ci.org/JoshCheek/seeing_is_believing)
2
3
 
3
4
  Seeing Is Believing
4
5
  ===================
5
6
 
6
7
  Evaluates a file, recording the results of each line of code.
7
- You can then use this to display output values like Bret Victor does with JavaScript in his talk [Inventing on Principle](http://vimeo.com/36579366).
8
- Except, obviously, his is like a million times better.
8
+ Integrates with any extensible editor (I've integrated it with many already, see [the list](https://github.com/JoshCheek/seeing_is_believing#editor-integration).
9
9
 
10
- Also comes with a binary to show how it might be used.
10
+ ![example](https://s3.amazonaws.com/josh.cheek/images/scratch/sib-example1.gif)
11
11
 
12
- For whatever reason, I can't embed videos, but **here's a [video](http://vimeo.com/73866851)** showing it off.
12
+ Watch a [longer video](http://vimeo.com/73866851).
13
13
 
14
- Works in Ruby 1.9 and 2.0
14
+ Works in Ruby 1.9, 2.0, 2.1, rubinius (I **think**, need to make better tests), still trying to get it working with Jruby.
15
15
 
16
16
  Use The Binary
17
17
  ==============
18
18
 
19
- ```ruby
19
+ * Show every line of code (last expression)
20
+ * Show only marked lines (xmpfilter style, except better b/c it understands expressions)
21
+ * Clear annotations when they get in your way (even if code is invalid)
22
+ * Smart enough to show
23
+ * method arguments
24
+ * if statement clauses
25
+ * values in a hash
26
+ * methods that are chained together across lines
27
+ * multiline string/symbol/regex
28
+
29
+ ```sh
20
30
  $ cat simple_example.rb
21
31
  5.times do |i|
22
32
  i * 2
@@ -25,7 +35,7 @@ end
25
35
 
26
36
  $ seeing_is_believing simple_example.rb
27
37
  5.times do |i| # => 5
28
- i * 2 # => 0, 2, 4, 6, 8
38
+ i * 2 # => 0, 2, 4, 6, 8
29
39
  end # => 5
30
40
  ```
31
41
 
@@ -54,8 +64,7 @@ result.exception # => nil
54
64
  Install
55
65
  =======
56
66
 
57
- Currently requires Ruby 1.9 or 2.0. I don't have specific plans to make it available on 1.8,
58
- but it could happen.
67
+ Currently requires Ruby 1.9 or 2.0.
59
68
 
60
69
  $ gem install seeing_is_believing
61
70
 
@@ -100,25 +109,20 @@ Shit that will probably never get done (or if it does, won't be until after 2.0)
100
109
  ================================================================================
101
110
 
102
111
  * How about if begin/rescue/end was able to record the result on the rescue section
112
+ * How about if you could configure which kinds of results ou were interested in (e.g. turn on/off recording of method definitions, and other results)
103
113
  * What about recording the result of a line inside of a string interpolation, e.g. "a#{\n1\n}b" could record line 2 is 1 and line 3 is "a\n1\nb"
104
114
  * If given a file with a Unicode character, but not set Unicode, inform the user
105
115
 
106
116
  License
107
117
  =======
108
118
 
109
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
110
- Version 2, December 2004
111
-
112
- Copyright (C) 2012 Josh Cheek <josh.cheek@gmail.com>
113
-
114
- Everyone is permitted to copy and distribute verbatim or modified
115
- copies of this license document, and changing it is allowed as long
116
- as the name is changed.
117
-
118
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
119
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
120
-
121
- 0. You just DO WHAT THE FUCK YOU WANT TO.
122
-
119
+ <a href="http://www.wtfpl.net/"><img src="http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl.svg" height="20" alt="WTFPL" /></a>
123
120
 
121
+ Copyright (C) 2014 Josh Cheek <josh.cheek@gmail.com>
124
122
 
123
+ This program is free software. It comes without any warranty,
124
+ to the extent permitted by applicable law.
125
+ You can redistribute it and/or modify it under the terms of the
126
+ Do What The Fuck You Want To Public License,
127
+ Version 2, as published by Sam Hocevar.
128
+ See http://www.wtfpl.net/ for more details.
Binary file
@@ -111,7 +111,7 @@ class SeeingIsBelieving
111
111
  end
112
112
 
113
113
  def evaluate_program
114
- self.interpolated_program = printer.call
114
+ self.interpolated_program = annotator.call
115
115
  rescue Timeout::Error
116
116
  self.timeout_error = true
117
117
  rescue Exception
@@ -150,12 +150,12 @@ class SeeingIsBelieving
150
150
  @body ||= (flags[:program] || (file_is_on_stdin? && stdin.read) || File.read(flags[:filename]))
151
151
  end
152
152
 
153
- def printer
154
- @printer ||= AddAnnotations.new body, flags.merge(stdin: (file_is_on_stdin? ? '' : stdin))
153
+ def annotator
154
+ @annotator ||= AddAnnotations.new body, flags.merge(stdin: (file_is_on_stdin? ? '' : stdin))
155
155
  end
156
156
 
157
157
  def results
158
- printer.results
158
+ annotator.results
159
159
  end
160
160
 
161
161
  def file_is_on_stdin?
@@ -182,7 +182,7 @@ class SeeingIsBelieving
182
182
  end
183
183
 
184
184
  def result_as_data_structure
185
- results = printer.results
185
+ results = annotator.results
186
186
  { stdout: results.stdout,
187
187
  stderr: results.stderr,
188
188
  exit_status: results.exitstatus,
@@ -101,7 +101,7 @@ class SeeingIsBelieving
101
101
  end
102
102
 
103
103
  def evaluate_file
104
- Open3.popen3 *popen_args do |process_stdin, process_stdout, process_stderr, thread|
104
+ Open3.popen3 ENV, *popen_args do |process_stdin, process_stdout, process_stderr, thread|
105
105
  out_reader = Thread.new { process_stdout.read }
106
106
  err_reader = Thread.new { process_stderr.read }
107
107
  Thread.new do
@@ -54,12 +54,14 @@ class SeeingIsBelieving
54
54
  array.each { |element| record_result element }
55
55
  end
56
56
 
57
+ StackErrors = [SystemStackError]
58
+ StackErrors << Java::JavaLang::StackOverflowError if defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java'
57
59
  def record_result(value)
58
60
  begin
59
61
  inspected = value.inspect.to_str # only invoke inspect once, b/c the inspection may be recorded
60
62
  rescue NoMethodError
61
63
  inspected = "#<no inspect available>"
62
- rescue SystemStackError
64
+ rescue *StackErrors
63
65
  # this is necessary because SystemStackError won't show the backtrace of the method we tried to call
64
66
  # which means there won't be anything showing the user where this came from
65
67
  # so we need to re-raise the error to get a backtrace that shows where we came from
@@ -1,4 +1,14 @@
1
- require 'parser/current'
1
+ module Parser
2
+ class << self
3
+ # With new versioning, there's lots of small versions
4
+ # we don't need it to complain that we're on 2.1.1 and its parsing 2.1.5
5
+ # https://github.com/whitequark/parser/blob/e2249d7051b1adb6979139928e14a81bc62f566e/lib/parser/current.rb#L3
6
+ def warn(*) end
7
+ require 'parser/current'
8
+ remove_method :warn
9
+ end
10
+ end
11
+
2
12
  class SeeingIsBelieving
3
13
  module ParserHelpers
4
14
 
@@ -1,3 +1,3 @@
1
1
  class SeeingIsBelieving
2
- VERSION = '2.1.4'
2
+ VERSION = '2.2.0'
3
3
  end
@@ -1,4 +1,3 @@
1
- require 'parser/current'
2
1
  require 'seeing_is_believing/parser_helpers'
3
2
 
4
3
  # comprehensive list of syntaxes that can come up
@@ -19,15 +19,15 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency "parser", "~> 2.1.4"
22
+ s.add_dependency "parser", ">= 2.2", "< 3.0"
23
23
  s.add_dependency "psych", "~> 2.0"
24
24
 
25
25
  s.add_development_dependency "pry", "~> 0.10.0"
26
26
  s.add_development_dependency "haiti", "~> 0.1.0"
27
- s.add_development_dependency "rake", "~> 10.0.3"
28
- s.add_development_dependency "rspec", "~> 3.0.0"
29
- s.add_development_dependency "cucumber", "~> 1.2.1"
30
- s.add_development_dependency "ichannel", "~> 5.1.1"
27
+ s.add_development_dependency "rake", "~> 10.0"
28
+ s.add_development_dependency "rspec", "~> 3.0"
29
+ s.add_development_dependency "cucumber", "~> 1.2"
30
+ s.add_development_dependency "ichannel", "~> 5.1"
31
31
 
32
32
  s.post_install_message = <<'Omg, frogs <3'.gsub(/(gg+)/) { |capture| "\e[32m#{capture.gsub 'g', '.'}\e[0m" }.gsub("brown", "\e[33m").gsub("off", "\e[0m")
33
33
  .7
@@ -83,6 +83,7 @@ describe SeeingIsBelieving::HardCoreEnsure do
83
83
 
84
84
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
85
85
  pending "Skipping this test on jruby b/c the JVM doesn't have a fork"
86
+ raise # new rspec will keep executing code and fail b/c nothing is raised
86
87
  elsif (!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby') && (RUBY_VERSION == '2.1.1' || RUBY_VERSION == '2.1.2')
87
88
  pending 'This test can\'t run on MRI (2.1.1 or 2.1.2) b/c of bug, see https://github.com/JoshCheek/seeing_is_believing/issues/26'
88
89
  raise # new rspec will keep executing code and fail b/c nothing is raised
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seeing_is_believing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Cheek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 2.1.4
22
+ version: '3.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '2.2'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 2.1.4
32
+ version: '3.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: psych
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -72,56 +78,56 @@ dependencies:
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: 10.0.3
81
+ version: '10.0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: 10.0.3
88
+ version: '10.0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: rspec
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: 3.0.0
95
+ version: '3.0'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: 3.0.0
102
+ version: '3.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: cucumber
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: 1.2.1
109
+ version: '1.2'
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
- version: 1.2.1
116
+ version: '1.2'
111
117
  - !ruby/object:Gem::Dependency
112
118
  name: ichannel
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
115
121
  - - "~>"
116
122
  - !ruby/object:Gem::Version
117
- version: 5.1.1
123
+ version: '5.1'
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - "~>"
123
129
  - !ruby/object:Gem::Version
124
- version: 5.1.1
130
+ version: '5.1'
125
131
  description: Records the results of every line of code in your file (intended to be
126
132
  like xmpfilter), inspired by Bret Victor's JavaScript example in his talk "Inventing
127
133
  on Principle"
@@ -138,6 +144,7 @@ files:
138
144
  - Rakefile
139
145
  - Readme.md
140
146
  - bin/seeing_is_believing
147
+ - docs/example.gif
141
148
  - docs/for-presentations
142
149
  - docs/frog-brown.png
143
150
  - features/errors.feature
@@ -241,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
248
  version: '0'
242
249
  requirements: []
243
250
  rubyforge_project: seeing_is_believing
244
- rubygems_version: 2.2.2
251
+ rubygems_version: 2.4.1
245
252
  signing_key:
246
253
  specification_version: 4
247
254
  summary: Records results of every line of code in your file