rdx 0.9.0.pre → 0.9.0.pre.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README +186 -12
  3. data/TODO +18 -0
  4. data/examples/minimal/.rdx +1 -0
  5. data/examples/minimal/rakefile +5 -2
  6. data/examples/ruby-2.0.0-p0/install/core/BUGS +70 -0
  7. data/examples/ruby-2.0.0-p0/install/core/HALL_OF_SHAME +53 -0
  8. data/examples/ruby-2.0.0-p0/install/core/README +14 -4
  9. data/examples/ruby-2.0.0-p0/install/core/Rakefile +9 -4
  10. data/examples/ruby-2.0.0-p0/install/core/TODO +5 -0
  11. data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +8 -7
  12. data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +1 -1
  13. data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +4 -12
  14. data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +3 -5
  15. data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +2 -2
  16. data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +5 -4
  17. data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +4 -3
  18. data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +5 -4
  19. data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +7 -6
  20. data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +3 -3
  21. data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +21 -18
  22. data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +1 -1
  23. data/examples/ruby-2.0.0-p0/install/stdlib/DOCUMENTATION +22 -0
  24. data/examples/ruby-2.0.0-p0/install/stdlib/README +12 -4
  25. data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +10 -5
  26. data/examples/ruby-2.0.0-p0/install/stdlib/TODO +6 -0
  27. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +31 -11
  28. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +8 -7
  29. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +2 -2
  30. data/lib/rdx.rb +42 -92
  31. data/lib/rdx/assertions.rb +8 -9
  32. data/lib/rdx/binding.rb +2 -2
  33. data/lib/rdx/comment.rb +7 -5
  34. data/lib/rdx/convention.rb +10 -9
  35. data/lib/rdx/directive.rb +51 -26
  36. data/lib/rdx/example.rb +94 -68
  37. data/lib/rdx/generator.rb +1 -1
  38. data/lib/rdx/generator/rdoc.rb +5 -6
  39. data/lib/rdx/options.rb +7 -3
  40. data/lib/rdx/reporter.rb +17 -0
  41. data/lib/rdx/ruby_lex.rb +3 -3
  42. data/lib/rdx/runner.rb +1 -1
  43. data/lib/rdx/statement.rb +1 -1
  44. data/lib/rdx/store.rb +1 -1
  45. data/lib/rdx/task.rb +1 -1
  46. data/lib/rdx/text.rb +1 -1
  47. data/lib/rdx/version.rb +1 -1
  48. data/rakefile +43 -14
  49. metadata +23 -3
@@ -55,7 +55,7 @@ module RDX
55
55
 
56
56
  #
57
57
  # Merges the given _argv_ and _files_ (along with #custom_options)
58
- # into a ingle +Array+ of options.
58
+ # into a single +Array+ of options.
59
59
  #
60
60
  def merge_argv_and_files argv, files
61
61
  custom_options + argv + ['--'] + files
@@ -4,7 +4,7 @@ require 'rdoc'
4
4
  #
5
5
  # :rdx: off
6
6
  #
7
- # This patch handles specific issues and comunication of RDoc with RDX, allowing it to work properly.
7
+ # This patch handles specific issues and communication of RDoc with RDX, allowing it to work properly.
8
8
  # There are a few important thing to notify.
9
9
  #
10
10
  # == Private RDX sections
@@ -23,7 +23,7 @@ require 'rdoc'
23
23
  # /*
24
24
  # * [...]
25
25
  # *-- rdx
26
- # * It's clear from the examples that x and y are generical...
26
+ # * It's clear from the examples that x and y are generics...
27
27
  # * x = (-1)**rand(2) * (1+rand(10)*1.5)
28
28
  # * y = (-1)**rand(2) * (1+rand(10)*1.5)
29
29
  # *++
@@ -158,8 +158,7 @@ module RDoc # :nodoc: all
158
158
  end
159
159
 
160
160
  def absolute_location
161
- root = RDoc.current.options.root
162
- File.expand_path(location.absolute_name,root.dirname)
161
+ File.expand_path location.relative_name, RDoc.current.options.root
163
162
  end
164
163
 
165
164
  alias initialize_wo_rdx initialize
@@ -938,7 +937,7 @@ module RDoc # :nodoc: all
938
937
 
939
938
  alias parse_file_wo_rdx parse_file
940
939
  private :parse_file_wo_rdx
941
- # SIGNAL INSERTION: Signal RDX the succesful end of parsing a file.
940
+ # SIGNAL INSERTION: Signal RDX the successful end of parsing a file.
942
941
  def parse_file rel_fname
943
942
  return parse_file_wo_rdx(rel_fname) unless RDX.active?
944
943
  abs_fname = File.expand_path(rel_fname,options.root)
@@ -989,7 +988,7 @@ module RDX
989
988
  end
990
989
 
991
990
  def customize_template tmpl
992
- # The \z exposed at the end of regexp ensure that optimizations will occurr.
991
+ # The \z exposed at the end of regexp ensure that optimizations will occur.
993
992
  # This can be very important with big html files
994
993
  tmpl.sub /<\/footer>\s*\z/, '<p>' + RDX::SIGNATURE + ".\n\\&"
995
994
  end
@@ -237,12 +237,12 @@ module RDX
237
237
  # * +docquiet+: nothing is produced by the documentation generator;
238
238
  # * +rdxfocused+ (default): writes to <tt>$stderr</tt> the output of the generator tool;
239
239
  # * +essential+: writes to <tt>$stderr</tt> even the RDX messages: only the report will be sent to <tt>$stdout</tt>;
240
- # * +summary+: <tt>$stdout</tt> contains only the headers of the report without messages, one per line.
240
+ # * +summary+: <tt>$stdout</tt> contains only the headers of the report without messages, one per line (unix-style).
241
241
  #
242
242
  define_option :reporter do
243
243
  @reporter = 'rdxfocused'
244
244
  @parser.on '-R', '--reporter REPORTER', String,
245
- "Use REPORTER as the reporter" do |reporter|
245
+ "Use REPORTER as the reporter (see RDX::Options#reporter)" do |reporter|
246
246
  @reporter = reporter
247
247
  end
248
248
  end
@@ -350,7 +350,11 @@ module RDX
350
350
  end
351
351
 
352
352
  def finalize_argv argv
353
- @files.concat argv
353
+ if argv.empty? # For security...
354
+ @dry_run = true
355
+ warn "No file specified. Processing the current directory with dry_run mode on for security"
356
+ end
357
+ files.concat argv
354
358
  argv.clear
355
359
  end
356
360
 
@@ -95,6 +95,9 @@ module RDX
95
95
  def result_code
96
96
  ''
97
97
  end
98
+ def type_of? arg
99
+ arg == :Detection
100
+ end
98
101
  end
99
102
 
100
103
  class Warning < Reportable
@@ -414,6 +417,20 @@ module RDX
414
417
  def reportable_content reportable
415
418
  reportable.report_header[/.+/]
416
419
  end
420
+ def self.split_report output
421
+ result = []
422
+ output.split("\n").each do |line|
423
+ md = line.match %r%^
424
+ (?> \s*\d+\)\s+ )
425
+ (?> (.*):(\d+):\s* ) # \1: filename \2: lineno
426
+ (?> ([A-Z][a-z]*) \s* ) # \3: reportable
427
+ (?: \[ (\w+) \] )? # \4: type
428
+ %x
429
+ raise "Invalid report line:\n#{line}" unless md
430
+ result << [md[1], md[2].to_i, md[3], md[4]]
431
+ end
432
+ return result
433
+ end
417
434
  end
418
435
 
419
436
  end
@@ -54,7 +54,7 @@ module RDX
54
54
  private :new_rdoc_scanner
55
55
 
56
56
  # Through <tt>RDoc::RubyLex.tokenize</tt> tokenizes the _ruby_ string and
57
- # retunrs an array of +RDoc::RubyToken+.
57
+ # returns an array of +RDoc::RubyToken+.
58
58
  # These are processed with #adjust_tokens if _adjust_tokens_ is +true+ (default).
59
59
  # May raise a +ParseError+ if the input is invalid enough.
60
60
  def tokenize ruby, adjust_tokens=true
@@ -75,7 +75,7 @@ module RDX
75
75
  private :tokenize
76
76
 
77
77
  # The comments also include the trailing newline and any comment on
78
- # successives lines until a blank one.
78
+ # successive lines until a blank one.
79
79
  def adjust_tokens orig_tokens
80
80
  tokens = []
81
81
  current_tkcomment = comment_on_current_line = nil
@@ -146,7 +146,7 @@ module RDX
146
146
  # Extracts the comments in _ruby_ string and returns an
147
147
  # array of arrays <tt>[ [comment,line_no],... ]</tt>.
148
148
  # The comments also include the trailing newline and any comment
149
- # on successives lines until a blank one.
149
+ # on successive lines until a blank one.
150
150
  #
151
151
  # RDX::RubyLex.extract_comments <<EOS
152
152
  # # This is Ruby!
@@ -134,7 +134,7 @@ module RDX
134
134
  public :run
135
135
 
136
136
  #
137
- # === Singal and Hooks ===
137
+ # === Signal and Hooks ===
138
138
  #
139
139
  # Must be called elsewhere -> public -> checks @status
140
140
  #
@@ -38,7 +38,7 @@ module RDX
38
38
  self
39
39
  end
40
40
 
41
- # The Expectation of this stetement (may be +nil+ if invalid).
41
+ # The Expectation of this statement (may be +nil+ if invalid).
42
42
  attr_reader :expectation
43
43
 
44
44
  # Contains only the expectation.
@@ -2,7 +2,7 @@
2
2
  module RDX
3
3
 
4
4
  #
5
- # Stores RDX data and handles acccess to it.
5
+ # Stores RDX data and handles access to it.
6
6
  #
7
7
  class Store
8
8
 
@@ -46,7 +46,7 @@ module RDX
46
46
 
47
47
  # :startdoc:
48
48
 
49
- # Name of the taks.
49
+ # Name of the task.
50
50
  attr_accessor :name
51
51
 
52
52
  # Description of the task.
@@ -466,7 +466,7 @@ module RDX
466
466
  # * a +Regexp+
467
467
  # * a +String+, which is interpreted literally
468
468
  # * a +Symbol+, which represent a REGEXP constant
469
- # (if begins with <tt>CAPTURE_</tt> the pattern is surrounded capturing parhentesis)
469
+ # (if begins with <tt>CAPTURE_</tt> the pattern is surrounded capturing parenthesis)
470
470
  #
471
471
  # str = "=> Float::MIN"
472
472
  # re = RDX::Text.build_pattern '=>', :CLASS
@@ -5,7 +5,7 @@ module RDX
5
5
  MAJOR = 0
6
6
  MINOR = 9
7
7
  PATCH = 0
8
- BUILD = 'pre'
8
+ BUILD = 'pre.1'
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.').freeze
11
11
  end
data/rakefile CHANGED
@@ -1,14 +1,17 @@
1
1
 
2
2
  require 'rubygems'
3
- require 'rake'
4
3
  require 'rubygems/package_task'
5
- require 'rdoc/task'
4
+ require 'rake'
6
5
 
7
6
  $LOAD_PATH.unshift File.expand_path('lib',File.dirname(__FILE__))
8
7
  # Use this version without considering installation
9
8
  require 'rdx'
10
9
 
10
+ RUBY_EX_DIR = 'examples/ruby-2.0.0-p0'.freeze
11
+ CORE = 'core'.freeze
12
+ STDLIB = 'stdlib'.freeze
11
13
 
14
+ require 'rdoc/task' # after rdx!!
12
15
  rdoc_task = RDoc::Task.new do |task|
13
16
  task.title = 'RDX'
14
17
  task.rdoc_files.add "lib/**/*.rb"
@@ -18,6 +21,33 @@ rdoc_task = RDoc::Task.new do |task|
18
21
  task.options << '--line-numbers' << '--tab-width=2'
19
22
  end
20
23
 
24
+ RDX::Task.new do |task|
25
+ task.rdoc_task = rdoc_task
26
+ task.debug = true
27
+ task.reporter = 'docquiet'
28
+ # task.fast = true
29
+ end
30
+
31
+ task :rdx_example_core do
32
+ cd "#{RUBY_EX_DIR}/#{CORE}" do
33
+ sh 'rake rdx'
34
+ end
35
+ end
36
+ task :rdx_example_stdlib do
37
+ cd "#{RUBY_EX_DIR}/#{STDLIB}" do
38
+ sh 'rake rdx'
39
+ end
40
+ end
41
+ task :rdx_example => [ :rdx_example_core, :rdx_example_stdlib ]
42
+ task :rdx_all => [ :rdx, :rdx_example ]
43
+
44
+ task :mk_example_install do
45
+ cd RUBY_EX_DIR do
46
+ sh 'rake mk_install'
47
+ end
48
+ end
49
+
50
+
21
51
  spec = Gem::Specification.new do |s|
22
52
  s.name = 'rdx'
23
53
  s.version = RDX::VERSION
@@ -33,18 +63,21 @@ By running those tests, RDX gives formalism to documentation examples, greatly i
33
63
  s.email = 'maurizio.destefanis@hotmail.it'
34
64
 
35
65
  s.required_ruby_version = '>= 2.0'
66
+
36
67
  s.add_runtime_dependency 'minitest'
37
68
  s.add_runtime_dependency 'rdoc', '= 4.0.0'
69
+
70
+ s.add_development_dependency 'rake'
38
71
 
39
72
  s.rdoc_options = rdoc_task.option_list
40
- s.files = %w(README rakefile .rdx) +
41
- Dir.glob("lib/**/*") +
73
+ s.files = %w(README TODO rakefile .rdx) +
74
+ Dir.glob("{lib}/**/*") +
42
75
  Dir.glob("examples/minimal/{lib/*,.rdx,rakefile,README}") +
43
- Dir.glob("examples/ruby-2.0.0-p0/install/**/*") + [
44
- "examples/ruby-2.0.0-p0/install/core/.rdx",
45
- "examples/ruby-2.0.0-p0/install/stdlib/.rdx"
76
+ Dir.glob("#{RUBY_EX_DIR}/install/**/*") + [
77
+ "#{RUBY_EX_DIR}/install/core/.rdx",
78
+ "#{RUBY_EX_DIR}/install/stdlib/.rdx"
46
79
  ] +
47
- Dir.glob("examples/ruby-2.0.0-p0/{rakefile,README}")
80
+ Dir.glob("#{RUBY_EX_DIR}/{rakefile,README}")
48
81
  s.extra_rdoc_files = %w[ README ]
49
82
  s.require_path = 'lib'
50
83
  s.bindir = 'bin'
@@ -56,9 +89,5 @@ Gem::PackageTask.new(spec) do |task|
56
89
  task.need_zip = false
57
90
  end
58
91
 
59
- RDX::Task.new do |task|
60
- task.rdoc_task = rdoc_task
61
- task.debug = true
62
- task.reporter = 'docquiet'
63
- # task.fast = true
64
- end
92
+ desc "Build the gem for the release"
93
+ task :gem_release => [ :clobber_package, :rdx_all, :mk_example_install, :gem ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.pre
4
+ version: 0.9.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maurizio Destefanis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 4.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: |
42
56
  The aim of RDX is to join the worlds of documentation and testing, which overlap in examples.
43
57
  Tests are built from the sources according to conventions and directives (built-in or defined by the user).
@@ -50,6 +64,7 @@ extra_rdoc_files:
50
64
  - README
51
65
  files:
52
66
  - README
67
+ - TODO
53
68
  - rakefile
54
69
  - .rdx
55
70
  - lib/rdx/assertions.rb
@@ -80,6 +95,7 @@ files:
80
95
  - examples/minimal/.rdx
81
96
  - examples/minimal/rakefile
82
97
  - examples/minimal/README
98
+ - examples/ruby-2.0.0-p0/install/core/BUGS
83
99
  - examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff
84
100
  - examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff
85
101
  - examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff
@@ -135,8 +151,10 @@ files:
135
151
  - examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff
136
152
  - examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff
137
153
  - examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff
154
+ - examples/ruby-2.0.0-p0/install/core/HALL_OF_SHAME
138
155
  - examples/ruby-2.0.0-p0/install/core/Rakefile
139
156
  - examples/ruby-2.0.0-p0/install/core/README
157
+ - examples/ruby-2.0.0-p0/install/core/TODO
140
158
  - examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff
141
159
  - examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff
142
160
  - examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff
@@ -162,8 +180,10 @@ files:
162
180
  - examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff
163
181
  - examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff
164
182
  - examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff
183
+ - examples/ruby-2.0.0-p0/install/stdlib/DOCUMENTATION
165
184
  - examples/ruby-2.0.0-p0/install/stdlib/Rakefile
166
185
  - examples/ruby-2.0.0-p0/install/stdlib/README
186
+ - examples/ruby-2.0.0-p0/install/stdlib/TODO
167
187
  - examples/ruby-2.0.0-p0/install/core/.rdx
168
188
  - examples/ruby-2.0.0-p0/install/stdlib/.rdx
169
189
  - examples/ruby-2.0.0-p0/rakefile
@@ -196,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
216
  version: 1.3.1
197
217
  requirements: []
198
218
  rubyforge_project:
199
- rubygems_version: 2.0.14
219
+ rubygems_version: 2.0.0
200
220
  signing_key:
201
221
  specification_version: 4
202
222
  summary: Ruby Documentation example eXecutor