mirage 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/HISTORY +2 -0
- data/VERSION +1 -1
- data/bin/mirage +10 -4
- data/features/support/env.rb +2 -0
- data/lib/mirage/client.rb +1 -2
- data/lib/mirage/{web.rb → client/web.rb} +0 -0
- data/mirage.gemspec +11 -8
- data/mirage_server.rb +19 -15
- data/{lib/mirage → server/extensions}/object.rb +0 -0
- data/{lib/mirage → server}/mock_response.rb +0 -0
- data/{lib/mirage/mock_responses_collection.rb → server/mock_responses.rb} +1 -0
- data/{lib/mirage → server}/util.rb +0 -9
- metadata +20 -9
- data/test.rb +0 -9
data/Gemfile
CHANGED
data/HISTORY
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.3
|
data/bin/mirage
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")
|
4
|
-
require 'mirage/client'
|
5
3
|
require 'childprocess'
|
4
|
+
ROOT_DIR = File.dirname(__FILE__)
|
5
|
+
$LOAD_PATH.unshift("#{ROOT_DIR}/../lib")
|
6
|
+
$LOAD_PATH.unshift("#{ROOT_DIR}/../server")
|
7
|
+
|
8
|
+
require 'mirage/client'
|
9
|
+
require 'waitforit'
|
10
|
+
require 'util'
|
11
|
+
|
12
|
+
|
6
13
|
include Mirage::Util
|
7
14
|
RUBY_CMD = RUBY_PLATFORM == 'java' ? 'jruby' : 'ruby'
|
8
15
|
|
9
|
-
|
10
16
|
def start_mirage(args)
|
11
17
|
puts "Starting Mirage"
|
12
18
|
|
@@ -52,7 +58,7 @@ if ARGV.include?('start')
|
|
52
58
|
rescue Mirage::InternalServerException => e
|
53
59
|
puts "WARN: #{e.message}"
|
54
60
|
end
|
55
|
-
|
61
|
+
|
56
62
|
elsif ARGV.include?('stop')
|
57
63
|
puts "Stopping Mirage"
|
58
64
|
stop_mirage
|
data/features/support/env.rb
CHANGED
data/lib/mirage/client.rb
CHANGED
File without changes
|
data/mirage.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mirage}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Leon Davis"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-21}
|
13
13
|
s.default_executable = %q{mirage}
|
14
14
|
s.description = %q{Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface.}
|
15
15
|
s.executables = ["mirage"]
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".rvmrc",
|
21
21
|
"Gemfile",
|
22
|
+
"HISTORY",
|
22
23
|
"README.md",
|
23
24
|
"VERSION",
|
24
25
|
"bin/mirage",
|
@@ -46,15 +47,14 @@ Gem::Specification.new do |s|
|
|
46
47
|
"features/support/env.rb",
|
47
48
|
"full_build.sh",
|
48
49
|
"lib/mirage/client.rb",
|
49
|
-
"lib/mirage/
|
50
|
-
"lib/mirage/mock_responses_collection.rb",
|
51
|
-
"lib/mirage/object.rb",
|
52
|
-
"lib/mirage/util.rb",
|
53
|
-
"lib/mirage/web.rb",
|
50
|
+
"lib/mirage/client/web.rb",
|
54
51
|
"mirage.gemspec",
|
55
52
|
"mirage_server.rb",
|
56
53
|
"rakefile",
|
57
|
-
"
|
54
|
+
"server/extensions/object.rb",
|
55
|
+
"server/mock_response.rb",
|
56
|
+
"server/mock_responses.rb",
|
57
|
+
"server/util.rb",
|
58
58
|
"views/index.erb"
|
59
59
|
]
|
60
60
|
s.homepage = %q{https://github.com/lashd/mirage}
|
@@ -88,6 +88,7 @@ For more information go to: https://github.com/lashd/mirage/wiki
|
|
88
88
|
s.add_development_dependency(%q<mechanize>, ["= 1.0.0"])
|
89
89
|
s.add_development_dependency(%q<gemcutter>, [">= 0"])
|
90
90
|
s.add_development_dependency(%q<nokogiri>, ["= 1.4.7"])
|
91
|
+
s.add_development_dependency(%q<waitforit>, ["= 0.0.1.pre8"])
|
91
92
|
else
|
92
93
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
93
94
|
s.add_dependency(%q<childprocess>, ["~> 0.1"])
|
@@ -99,6 +100,7 @@ For more information go to: https://github.com/lashd/mirage/wiki
|
|
99
100
|
s.add_dependency(%q<mechanize>, ["= 1.0.0"])
|
100
101
|
s.add_dependency(%q<gemcutter>, [">= 0"])
|
101
102
|
s.add_dependency(%q<nokogiri>, ["= 1.4.7"])
|
103
|
+
s.add_dependency(%q<waitforit>, ["= 0.0.1.pre8"])
|
102
104
|
end
|
103
105
|
else
|
104
106
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
@@ -111,6 +113,7 @@ For more information go to: https://github.com/lashd/mirage/wiki
|
|
111
113
|
s.add_dependency(%q<mechanize>, ["= 1.0.0"])
|
112
114
|
s.add_dependency(%q<gemcutter>, [">= 0"])
|
113
115
|
s.add_dependency(%q<nokogiri>, ["= 1.4.7"])
|
116
|
+
s.add_dependency(%q<waitforit>, ["= 0.0.1.pre8"])
|
114
117
|
end
|
115
118
|
end
|
116
119
|
|
data/mirage_server.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
$0='Mirage Server'
|
3
3
|
ROOT_DIR = File.dirname(__FILE__)
|
4
|
-
$LOAD_PATH.unshift("#{ROOT_DIR}/lib
|
4
|
+
$LOAD_PATH.unshift("#{ROOT_DIR}/lib")
|
5
|
+
$LOAD_PATH.unshift("#{ROOT_DIR}/server")
|
5
6
|
|
6
|
-
require 'client'
|
7
7
|
require 'sinatra/base'
|
8
|
-
|
8
|
+
|
9
|
+
require 'extensions/object'
|
9
10
|
require 'mock_response'
|
10
|
-
require '
|
11
|
+
require 'mock_responses'
|
12
|
+
require 'util'
|
13
|
+
|
14
|
+
require 'mirage/client'
|
11
15
|
|
12
16
|
include Mirage::Util
|
13
|
-
|
14
17
|
|
15
18
|
module Mirage
|
16
19
|
|
17
20
|
class Server < Sinatra::Base
|
18
|
-
|
21
|
+
|
19
22
|
configure do
|
20
23
|
options = parse_options(ARGV)
|
21
24
|
set :defaults_directory, options[:defaults_directory]
|
@@ -58,7 +61,6 @@ module Mirage
|
|
58
61
|
end
|
59
62
|
|
60
63
|
delete '/mirage/templates/:id' do
|
61
|
-
response_id = params[:id].to_i
|
62
64
|
MockResponses.delete(response_id)
|
63
65
|
REQUESTS.delete(response_id)
|
64
66
|
end
|
@@ -68,7 +70,7 @@ module Mirage
|
|
68
70
|
end
|
69
71
|
|
70
72
|
delete '/mirage/requests/:id' do
|
71
|
-
REQUESTS.delete(
|
73
|
+
REQUESTS.delete(response_id)
|
72
74
|
end
|
73
75
|
|
74
76
|
|
@@ -79,13 +81,13 @@ module Mirage
|
|
79
81
|
end
|
80
82
|
|
81
83
|
get '/mirage/templates/:id' do
|
82
|
-
response = MockResponses.find(
|
84
|
+
response = MockResponses.find(response_id)
|
83
85
|
return 404 if response.is_a? Array
|
84
86
|
send_response(response)
|
85
87
|
end
|
86
88
|
|
87
89
|
get '/mirage/requests/:id' do
|
88
|
-
REQUESTS[
|
90
|
+
REQUESTS[response_id] || 404
|
89
91
|
end
|
90
92
|
|
91
93
|
|
@@ -120,22 +122,24 @@ module Mirage
|
|
120
122
|
#
|
121
123
|
put '/mirage/backup' do
|
122
124
|
MockResponses.backup
|
125
|
+
""
|
123
126
|
end
|
124
127
|
|
125
128
|
|
126
129
|
put '/mirage' do
|
127
130
|
MockResponses.revert
|
131
|
+
""
|
128
132
|
end
|
129
133
|
|
130
134
|
|
131
135
|
helpers do
|
132
|
-
|
133
|
-
def
|
134
|
-
|
136
|
+
|
137
|
+
def response_id
|
138
|
+
params[:id].to_i
|
135
139
|
end
|
136
140
|
|
137
|
-
def
|
138
|
-
|
141
|
+
def prime &block
|
142
|
+
yield Mirage::Client.new "http://localhost:#{settings.port}/mirage"
|
139
143
|
end
|
140
144
|
|
141
145
|
def send_response(response, body='', request={}, query_string='')
|
File without changes
|
File without changes
|
@@ -2,15 +2,6 @@ require 'optparse'
|
|
2
2
|
module Mirage
|
3
3
|
module Util
|
4
4
|
|
5
|
-
def wait_until time=45
|
6
|
-
start_time = Time.now
|
7
|
-
until Time.now >= start_time + time
|
8
|
-
sleep 0.1
|
9
|
-
return if yield
|
10
|
-
end
|
11
|
-
raise 'timeout waiting'
|
12
|
-
end
|
13
|
-
|
14
5
|
def parse_options args
|
15
6
|
options = {:port => 7001, :defaults_directory => 'responses', :root_directory => '.'}
|
16
7
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mirage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Leon Davis
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-21 00:00:00 +01:00
|
14
14
|
default_executable: mirage
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -123,6 +123,17 @@ dependencies:
|
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: waitforit
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - "="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 0.0.1.pre8
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *id011
|
126
137
|
description: Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface.
|
127
138
|
email:
|
128
139
|
executables:
|
@@ -134,6 +145,7 @@ extra_rdoc_files:
|
|
134
145
|
files:
|
135
146
|
- .rvmrc
|
136
147
|
- Gemfile
|
148
|
+
- HISTORY
|
137
149
|
- README.md
|
138
150
|
- VERSION
|
139
151
|
- bin/mirage
|
@@ -161,15 +173,14 @@ files:
|
|
161
173
|
- features/support/env.rb
|
162
174
|
- full_build.sh
|
163
175
|
- lib/mirage/client.rb
|
164
|
-
- lib/mirage/
|
165
|
-
- lib/mirage/mock_responses_collection.rb
|
166
|
-
- lib/mirage/object.rb
|
167
|
-
- lib/mirage/util.rb
|
168
|
-
- lib/mirage/web.rb
|
176
|
+
- lib/mirage/client/web.rb
|
169
177
|
- mirage.gemspec
|
170
178
|
- mirage_server.rb
|
171
179
|
- rakefile
|
172
|
-
-
|
180
|
+
- server/extensions/object.rb
|
181
|
+
- server/mock_response.rb
|
182
|
+
- server/mock_responses.rb
|
183
|
+
- server/util.rb
|
173
184
|
- views/index.erb
|
174
185
|
has_rdoc: true
|
175
186
|
homepage: https://github.com/lashd/mirage
|
@@ -191,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
202
|
requirements:
|
192
203
|
- - ">="
|
193
204
|
- !ruby/object:Gem::Version
|
194
|
-
hash:
|
205
|
+
hash: 2910117652361580997
|
195
206
|
segments:
|
196
207
|
- 0
|
197
208
|
version: "0"
|