stubb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/lib/stubb/counter.rb +1 -1
- data/lib/stubb/finder.rb +4 -0
- data/lib/stubb/match_finder.rb +2 -2
- data/lib/stubb/sequence_finder.rb +1 -1
- data/lib/stubb/sequence_match_finder.rb +3 -3
- data/lib/stubb.rb +2 -2
- metadata +38 -20
data/README.markdown
CHANGED
data/lib/stubb/counter.rb
CHANGED
data/lib/stubb/finder.rb
CHANGED
data/lib/stubb/match_finder.rb
CHANGED
@@ -42,7 +42,7 @@ module Stubb
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def matching_directory(current_path)
|
45
|
-
matches =
|
45
|
+
matches = glob local_path_for(current_path + [Stubb.matcher_pattern])
|
46
46
|
for match in matches
|
47
47
|
continue unless File.directory? match
|
48
48
|
return File.split(match).last
|
@@ -51,7 +51,7 @@ module Stubb
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def matching_file(current_path)
|
54
|
-
matches =
|
54
|
+
matches = glob local_path_for(current_path + ["#{Stubb.matcher_pattern}.#{request_options_as_file_ending}"])
|
55
55
|
|
56
56
|
matches.empty? ? nil : File.split(matches.first).last
|
57
57
|
end
|
@@ -5,7 +5,7 @@ module Stubb
|
|
5
5
|
class SequenceFinder < Finder
|
6
6
|
private
|
7
7
|
def projected_path
|
8
|
-
sequence_members =
|
8
|
+
sequence_members = glob local_path_for(sequenced_path_pattern)
|
9
9
|
raise NoSuchSequence.new("Nothing found for sequence pattern `#{sequenced_path_pattern}`.") if sequence_members.empty?
|
10
10
|
|
11
11
|
loop? ? pick_loop_member(sequence_members) : pick_stall_member(sequence_members)
|
@@ -34,12 +34,12 @@ module Stubb
|
|
34
34
|
|
35
35
|
def literal_file(current_path, level, index)
|
36
36
|
filename = "#{level}.#{request_options_as_file_ending(index)}"
|
37
|
-
sequence_members =
|
37
|
+
sequence_members = glob local_path_for(current_path + [filename])
|
38
38
|
sequence_members.empty? ? nil : filename
|
39
39
|
end
|
40
40
|
|
41
41
|
def matching_directory(current_path)
|
42
|
-
matches =
|
42
|
+
matches = glob local_path_for(current_path + [Stubb.matcher_pattern])
|
43
43
|
for match in matches
|
44
44
|
continue unless File.directory? match
|
45
45
|
return File.split(match).last
|
@@ -48,7 +48,7 @@ module Stubb
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def matching_file(current_path, index)
|
51
|
-
matches =
|
51
|
+
matches = glob local_path_for(current_path + ["#{Stubb.matcher_pattern}.#{request_options_as_file_ending(index)}"])
|
52
52
|
|
53
53
|
matches.empty? ? nil : File.split(matches.first).last
|
54
54
|
end
|
data/lib/stubb.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rack'
|
|
2
2
|
|
3
3
|
module Stubb
|
4
4
|
|
5
|
-
VERSION = '0.1.
|
5
|
+
VERSION = '0.1.1'
|
6
6
|
|
7
7
|
class ResponseNotFound < Exception
|
8
8
|
end
|
@@ -26,7 +26,7 @@ module Stubb
|
|
26
26
|
Rack::Builder.new {
|
27
27
|
use CombinedLogger
|
28
28
|
use Counter
|
29
|
-
|
29
|
+
|
30
30
|
run Rack::Cascade.new([SequenceFinder.new(options), NaiveFinder.new(options), SequenceMatchFinder.new(options), MatchFinder.new(options)])
|
31
31
|
}.to_app
|
32
32
|
end
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stubb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Johannes Emerich
|
@@ -10,41 +15,53 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2012-
|
18
|
+
date: 2012-12-13 00:00:00 +01:00
|
19
|
+
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
|
17
|
-
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
18
25
|
none: false
|
19
26
|
requirements:
|
20
27
|
- - ">="
|
21
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
22
32
|
version: "0"
|
23
|
-
|
24
|
-
|
25
|
-
version_requirements: *id001
|
33
|
+
name: rake
|
34
|
+
requirement: *id001
|
26
35
|
- !ruby/object:Gem::Dependency
|
27
|
-
|
28
|
-
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
29
39
|
none: false
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 31
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 2
|
47
|
+
- 0
|
33
48
|
version: 1.2.0
|
49
|
+
name: rack
|
50
|
+
requirement: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
34
52
|
type: :runtime
|
35
53
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: thor
|
39
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
55
|
none: false
|
41
56
|
requirements:
|
42
57
|
- - ">="
|
43
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
44
62
|
version: "0"
|
45
|
-
|
46
|
-
|
47
|
-
version_requirements: *id003
|
63
|
+
name: thor
|
64
|
+
requirement: *id003
|
48
65
|
description: Stubb is the second mate.
|
49
66
|
email: johannes@emerich.de
|
50
67
|
executables:
|
@@ -67,6 +84,7 @@ files:
|
|
67
84
|
- bin/stubb
|
68
85
|
- LICENSE
|
69
86
|
- README.markdown
|
87
|
+
has_rdoc: true
|
70
88
|
homepage: http://github.com/knuton/stubb
|
71
89
|
licenses: []
|
72
90
|
|
@@ -80,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
98
|
requirements:
|
81
99
|
- - ">="
|
82
100
|
- !ruby/object:Gem::Version
|
83
|
-
hash:
|
101
|
+
hash: 3
|
84
102
|
segments:
|
85
103
|
- 0
|
86
104
|
version: "0"
|
@@ -89,14 +107,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
107
|
requirements:
|
90
108
|
- - ">="
|
91
109
|
- !ruby/object:Gem::Version
|
92
|
-
hash:
|
110
|
+
hash: 3
|
93
111
|
segments:
|
94
112
|
- 0
|
95
113
|
version: "0"
|
96
114
|
requirements: []
|
97
115
|
|
98
116
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.3.7
|
100
118
|
signing_key:
|
101
119
|
specification_version: 3
|
102
120
|
summary: Specify REST API stubs using your file system
|