holoserve 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +46 -62
- data/Rakefile +5 -57
- data/bin/holoserve +8 -7
- data/lib/holoserve/interface/control/bucket.rb +24 -0
- data/lib/holoserve/interface/control/history.rb +24 -0
- data/lib/holoserve/interface/control/pair.rb +24 -0
- data/lib/holoserve/interface/control/state.rb +38 -0
- data/lib/holoserve/interface/control.rb +25 -157
- data/lib/holoserve/interface/fake.rb +35 -27
- data/lib/holoserve/interface.rb +17 -1
- data/lib/holoserve/pair/finder.rb +5 -15
- data/lib/holoserve/pair/loader.rb +70 -0
- data/lib/holoserve/pair.rb +1 -0
- data/lib/holoserve/request/decomposer.rb +27 -17
- data/lib/holoserve/request/matcher.rb +16 -4
- data/lib/holoserve/response/combiner.rb +5 -25
- data/lib/holoserve/response/selector.rb +43 -0
- data/lib/holoserve/response.rb +1 -0
- data/lib/holoserve/state/updater.rb +14 -0
- data/lib/holoserve/state.rb +6 -0
- data/lib/holoserve/tool/data_path.rb +6 -2
- data/lib/holoserve.rb +65 -24
- data/spec/lib/holoserve/fixture/importer_spec.rb +17 -2
- data/spec/lib/holoserve/tool/data_path_spec.rb +6 -0
- data/spec/lib/holoserve_spec.rb +45 -0
- metadata +33 -35
- data/lib/holoserve/runner.rb +0 -82
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holoserve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: goliath
|
16
|
+
requirement: &70166500305240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,43 +21,32 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70166500305240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: rake
|
27
|
+
requirement: &70166500304380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
|
-
type: :
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70159532629620
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: unicorn
|
38
|
-
requirement: &70159532627220 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :runtime
|
33
|
+
type: :development
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *70166500304380
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
37
|
+
name: rdoc
|
38
|
+
requirement: &70166500303920 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
41
|
- - ! '>='
|
53
42
|
- !ruby/object:Gem::Version
|
54
43
|
version: '0'
|
55
|
-
type: :
|
44
|
+
type: :development
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *70166500303920
|
58
47
|
- !ruby/object:Gem::Dependency
|
59
48
|
name: cucumber
|
60
|
-
requirement: &
|
49
|
+
requirement: &70166500303360 !ruby/object:Gem::Requirement
|
61
50
|
none: false
|
62
51
|
requirements:
|
63
52
|
- - ! '>='
|
@@ -65,10 +54,10 @@ dependencies:
|
|
65
54
|
version: '0'
|
66
55
|
type: :development
|
67
56
|
prerelease: false
|
68
|
-
version_requirements: *
|
57
|
+
version_requirements: *70166500303360
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: rspec
|
71
|
-
requirement: &
|
60
|
+
requirement: &70166500302680 !ruby/object:Gem::Requirement
|
72
61
|
none: false
|
73
62
|
requirements:
|
74
63
|
- - ! '>='
|
@@ -76,10 +65,10 @@ dependencies:
|
|
76
65
|
version: '0'
|
77
66
|
type: :development
|
78
67
|
prerelease: false
|
79
|
-
version_requirements: *
|
68
|
+
version_requirements: *70166500302680
|
80
69
|
- !ruby/object:Gem::Dependency
|
81
70
|
name: transport
|
82
|
-
requirement: &
|
71
|
+
requirement: &70166500294600 !ruby/object:Gem::Requirement
|
83
72
|
none: false
|
84
73
|
requirements:
|
85
74
|
- - ! '>='
|
@@ -87,10 +76,10 @@ dependencies:
|
|
87
76
|
version: '0'
|
88
77
|
type: :development
|
89
78
|
prerelease: false
|
90
|
-
version_requirements: *
|
79
|
+
version_requirements: *70166500294600
|
91
80
|
- !ruby/object:Gem::Dependency
|
92
81
|
name: oauth
|
93
|
-
requirement: &
|
82
|
+
requirement: &70166500293740 !ruby/object:Gem::Requirement
|
94
83
|
none: false
|
95
84
|
requirements:
|
96
85
|
- - ! '>='
|
@@ -98,7 +87,7 @@ dependencies:
|
|
98
87
|
version: '0'
|
99
88
|
type: :development
|
100
89
|
prerelease: false
|
101
|
-
version_requirements: *
|
90
|
+
version_requirements: *70166500293740
|
102
91
|
description: This tool can be used to fake webservice APIs for testing proposals.
|
103
92
|
email: philipp.bruell@skrill.com
|
104
93
|
executables:
|
@@ -113,18 +102,25 @@ files:
|
|
113
102
|
- bin/holoserve
|
114
103
|
- lib/holoserve/fixture/importer.rb
|
115
104
|
- lib/holoserve/fixture.rb
|
105
|
+
- lib/holoserve/interface/control/bucket.rb
|
106
|
+
- lib/holoserve/interface/control/history.rb
|
107
|
+
- lib/holoserve/interface/control/pair.rb
|
108
|
+
- lib/holoserve/interface/control/state.rb
|
116
109
|
- lib/holoserve/interface/control.rb
|
117
110
|
- lib/holoserve/interface/fake.rb
|
118
111
|
- lib/holoserve/interface.rb
|
119
112
|
- lib/holoserve/pair/finder.rb
|
113
|
+
- lib/holoserve/pair/loader.rb
|
120
114
|
- lib/holoserve/pair.rb
|
121
115
|
- lib/holoserve/request/decomposer.rb
|
122
116
|
- lib/holoserve/request/matcher.rb
|
123
117
|
- lib/holoserve/request.rb
|
124
118
|
- lib/holoserve/response/combiner.rb
|
125
119
|
- lib/holoserve/response/composer.rb
|
120
|
+
- lib/holoserve/response/selector.rb
|
126
121
|
- lib/holoserve/response.rb
|
127
|
-
- lib/holoserve/
|
122
|
+
- lib/holoserve/state/updater.rb
|
123
|
+
- lib/holoserve/state.rb
|
128
124
|
- lib/holoserve/tool/data_path.rb
|
129
125
|
- lib/holoserve/tool/hash/key_symbolizer.rb
|
130
126
|
- lib/holoserve/tool/hash.rb
|
@@ -136,6 +132,7 @@ files:
|
|
136
132
|
- spec/lib/holoserve/fixture/importer_spec.rb
|
137
133
|
- spec/lib/holoserve/tool/data_path_spec.rb
|
138
134
|
- spec/lib/holoserve/tool/merger_spec.rb
|
135
|
+
- spec/lib/holoserve_spec.rb
|
139
136
|
homepage: http://github.com/skrill/holoserve
|
140
137
|
licenses: []
|
141
138
|
post_install_message:
|
@@ -150,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
147
|
version: '0'
|
151
148
|
segments:
|
152
149
|
- 0
|
153
|
-
hash: -
|
150
|
+
hash: -1981031091455740716
|
154
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
152
|
none: false
|
156
153
|
requirements:
|
@@ -159,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
156
|
version: '0'
|
160
157
|
requirements: []
|
161
158
|
rubyforge_project: holoserve
|
162
|
-
rubygems_version: 1.8.
|
159
|
+
rubygems_version: 1.8.15
|
163
160
|
signing_key:
|
164
161
|
specification_version: 3
|
165
162
|
summary: Tool to fake HTTP APIs.
|
@@ -167,3 +164,4 @@ test_files:
|
|
167
164
|
- spec/lib/holoserve/fixture/importer_spec.rb
|
168
165
|
- spec/lib/holoserve/tool/data_path_spec.rb
|
169
166
|
- spec/lib/holoserve/tool/merger_spec.rb
|
167
|
+
- spec/lib/holoserve_spec.rb
|
data/lib/holoserve/runner.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'unicorn'
|
2
|
-
require 'transport'
|
3
|
-
|
4
|
-
class Holoserve::Runner
|
5
|
-
|
6
|
-
attr_reader :port
|
7
|
-
|
8
|
-
def initialize(options = { })
|
9
|
-
@port = options[:port] || 4250
|
10
|
-
@fixture_file_pattern = options[:fixture_file_pattern]
|
11
|
-
@pair_file_pattern = options[:pair_file_pattern]
|
12
|
-
@situation = options[:situation]
|
13
|
-
|
14
|
-
@rackup_options = Unicorn::Configurator::RACKUP
|
15
|
-
@rackup_options[:port] = @port
|
16
|
-
@rackup_options[:set_listener] = true
|
17
|
-
@options = @rackup_options[:options]
|
18
|
-
|
19
|
-
@unicorn = Unicorn::HttpServer.new rack, @options
|
20
|
-
end
|
21
|
-
|
22
|
-
def start
|
23
|
-
@unicorn.start
|
24
|
-
upload_fixtures if @fixture_file_pattern
|
25
|
-
upload_pairs if @pair_file_pattern
|
26
|
-
set_situation if @situation
|
27
|
-
end
|
28
|
-
|
29
|
-
def join
|
30
|
-
return unless @unicorn
|
31
|
-
@unicorn.join
|
32
|
-
end
|
33
|
-
|
34
|
-
def stop
|
35
|
-
return unless @unicorn
|
36
|
-
@unicorn.stop
|
37
|
-
@unicorn = nil
|
38
|
-
end
|
39
|
-
|
40
|
-
def run
|
41
|
-
self.start
|
42
|
-
self.join
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def upload_fixtures
|
48
|
-
Dir[ @fixture_file_pattern ].each do |filename|
|
49
|
-
upload_file "http://localhost:#{port}/_control/fixtures", filename
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def upload_pairs
|
54
|
-
Dir[ @pair_file_pattern ].each do |filename|
|
55
|
-
upload_file "http://localhost:#{port}/_control/pairs", filename
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def upload_file(url, filename)
|
60
|
-
format = File.extname(filename).sub(/^\./, "")
|
61
|
-
raise ArgumentError, "file extension indicates wrong format '#{format}' (choose yaml or json)" unless [ "yaml", "json" ].include?(format)
|
62
|
-
Holoserve::Tool::Uploader.new(filename, :post, url, :expected_status_code => 200).upload
|
63
|
-
nil
|
64
|
-
end
|
65
|
-
|
66
|
-
def set_situation
|
67
|
-
Transport::JSON.request :put,
|
68
|
-
"http://localhost:#{port}/_control/situation",
|
69
|
-
:parameters => { :name => @situation },
|
70
|
-
:expected_status_code => 200
|
71
|
-
nil
|
72
|
-
end
|
73
|
-
|
74
|
-
def rack
|
75
|
-
instance.rack
|
76
|
-
end
|
77
|
-
|
78
|
-
def instance
|
79
|
-
Holoserve.instance
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|