gorp 0.8.2 → 0.9.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.
- data/gorp.gemspec +2 -2
- data/lib/gorp.rb +25 -9
- data/lib/gorp/test.rb +1 -0
- data/lib/version.rb +2 -2
- metadata +2 -2
data/gorp.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gorp}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.9.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sam Ruby"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-12-02}
|
10
10
|
s.description = %q{ Enables the creation of scenarios that involve creating a rails project,
|
11
11
|
starting and stoppping of servers, generating projects, editing files,
|
12
12
|
issuing http requests, running of commands, etc. Output is captured as
|
data/lib/gorp.rb
CHANGED
@@ -13,6 +13,17 @@ require 'gorp/env'
|
|
13
13
|
require 'rbconfig'
|
14
14
|
$ruby = File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])
|
15
15
|
|
16
|
+
# indicate that a given step should be omitted
|
17
|
+
def omit *sections
|
18
|
+
sections.each do |section|
|
19
|
+
STDERR.puts section.inspect
|
20
|
+
section = [section] unless section.respond_to? :include?
|
21
|
+
STDERR.puts section.inspect
|
22
|
+
$omit << Range.new(secsplit(section.first), secsplit(section.last))
|
23
|
+
end
|
24
|
+
STDERR.puts $omit.inspect
|
25
|
+
end
|
26
|
+
|
16
27
|
# Micro DSL for declaring an ordered set of book sections
|
17
28
|
$sections = []
|
18
29
|
def section number, title, &steps
|
@@ -31,6 +42,7 @@ $toc = Builder::XmlMarkup.new(:indent => 2)
|
|
31
42
|
$todos = Builder::XmlMarkup.new(:indent => 2)
|
32
43
|
$issue = 0
|
33
44
|
$style = Builder::XmlMarkup.new(:indent => 2)
|
45
|
+
$omit = []
|
34
46
|
|
35
47
|
FileUtils.mkdir_p $WORK
|
36
48
|
|
@@ -312,7 +324,7 @@ rescue LoadError
|
|
312
324
|
self.parent.insert_before(self, node)
|
313
325
|
end
|
314
326
|
|
315
|
-
def
|
327
|
+
def to_xml
|
316
328
|
self.to_s
|
317
329
|
end
|
318
330
|
end
|
@@ -397,7 +409,7 @@ def snap response, form={}
|
|
397
409
|
attrs[:id] = body['id'] if body['id']
|
398
410
|
$x.div(attrs) do
|
399
411
|
body.children.each do |child|
|
400
|
-
$x << child.
|
412
|
+
$x << child.to_xml unless child.instance_of?(Comment)
|
401
413
|
end
|
402
414
|
end
|
403
415
|
$x.div :style => "clear: both"
|
@@ -562,6 +574,14 @@ def secsplit section
|
|
562
574
|
section.to_s.split('.').map {|n| n.to_i}
|
563
575
|
end
|
564
576
|
|
577
|
+
def secinclude ranges, section
|
578
|
+
# was (in Ruby 1.8): range.include?(secsplit(section))
|
579
|
+
ranges.any? do |range|
|
580
|
+
ss = secsplit(section)
|
581
|
+
(range.first <=> ss) <= 0 and (range.last <=> ss) >= 0
|
582
|
+
end
|
583
|
+
end
|
584
|
+
|
565
585
|
at_exit do
|
566
586
|
$x.html :xmlns => 'http://www.w3.org/1999/xhtml' do
|
567
587
|
$x.header do
|
@@ -609,7 +629,7 @@ at_exit do
|
|
609
629
|
bounds = arg.split(/-|\.\./)
|
610
630
|
Range.new(secsplit(bounds.first), secsplit(bounds.last))
|
611
631
|
end
|
612
|
-
ARGV.push 'partial' unless ranges.empty?
|
632
|
+
ARGV.push 'partial' unless ranges.empty? and $omit.empty?
|
613
633
|
|
614
634
|
# optionally save a snapshot
|
615
635
|
if ARGV.include? 'restore'
|
@@ -628,12 +648,8 @@ at_exit do
|
|
628
648
|
e = nil
|
629
649
|
begin
|
630
650
|
$sections.each do |section, title, steps|
|
631
|
-
next if !ranges.empty? and
|
632
|
-
|
633
|
-
# was (in Ruby 1.8): range.include?(secsplit(section))
|
634
|
-
ss = secsplit(section)
|
635
|
-
(range.first <=> ss) <= 0 and (range.last <=> ss) >= 0
|
636
|
-
end
|
651
|
+
next if !ranges.empty? and !secinclude(ranges, section)
|
652
|
+
next if secinclude($omit, section)
|
637
653
|
head section, title
|
638
654
|
steps.call
|
639
655
|
end
|
data/lib/gorp/test.rb
CHANGED
@@ -53,6 +53,7 @@ class Book::TestCase < ActiveSupport::TestCase
|
|
53
53
|
def self.input filename
|
54
54
|
# read $input output; remove front matter and footer
|
55
55
|
input = open(File.join($WORK, "#{filename}.html")).read
|
56
|
+
input.force_encoding('utf-8') if input.respond_to? :force_encoding
|
56
57
|
head, body, tail = input.split /<body>\s+|\s+<\/body>/m
|
57
58
|
|
58
59
|
# split into sections
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gorp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|