mirage 2.0.0.alpha1 → 2.0.0.alpha2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.alpha1
1
+ 2.0.0.alpha2
@@ -6,8 +6,9 @@ Feature: Mirage is started from the command line.
6
6
  Background: Mirage usage
7
7
  Given usage information:
8
8
  | Usage: mirage start\|stop [options] |
9
- | -p, --port PORT |
10
- | -d, --defaults DIR |
9
+ | -p, --port PORT |
10
+ | -d, --defaults DIR |
11
+ | --debug |
11
12
 
12
13
 
13
14
  Scenario: Starting with help option
@@ -37,9 +38,9 @@ Feature: Mirage is started from the command line.
37
38
  Given Mirage is not running
38
39
  When I run 'mirage start -p 9001'
39
40
  Then mirage should be running on 'http://localhost:9001/mirage'
40
-
41
- Scenario: Starting Mirage when it is already running
42
- Given Mirage is running
43
- When I run 'mirage start -p 9001'
44
- Then I should see 'Mirage is already running' on the command line
45
- Then Connection should be refused to 'http://localhost:9001/mirage'
41
+
42
+ Scenario: Starting Mirage when it is already running
43
+ Given Mirage is running
44
+ When I run 'mirage start -p 9001'
45
+ Then I should see 'Mirage is already running' on the command line
46
+ Then Connection should be refused to 'http://localhost:9001/mirage'
data/lib/mirage/util.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'optparse'
2
2
  module Mirage
3
3
  module Util
4
-
4
+
5
5
  def wait_until time=45
6
6
  start_time = Time.now
7
7
  until Time.now >= start_time + time
@@ -23,6 +23,10 @@ module Mirage
23
23
  opts.on("-d", "--defaults DIR", "location to load default responses from") do |directory|
24
24
  options[:defaults_directory] = directory
25
25
  end
26
+
27
+ opts.on('--debug', 'run in debug mode') do
28
+ options[:debug] = true
29
+ end
26
30
  end
27
31
 
28
32
  begin
data/lib/start_mirage.rb CHANGED
@@ -5,8 +5,12 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
5
 
6
6
  require 'sinatra'
7
7
  require 'sinatra/base'
8
- require 'sinatra/reloader'
9
8
 
9
+ require 'mirage/util'
10
+ include Mirage::Util
11
+ options = parse_options(ARGV)
12
+
13
+ $debug = options[:debug]
10
14
 
11
15
  module Mirage
12
16
  class MirageServer < Sinatra::Base
@@ -16,16 +20,19 @@ module Mirage
16
20
  log_file = File.open('mirage.log', 'a')
17
21
  log_file.sync=true
18
22
  use Rack::CommonLogger, log_file
19
- register Sinatra::Reloader
20
- also_reload "**/*.rb"
23
+
24
+ if $debug
25
+ require 'sinatra/reloader'
26
+ register Sinatra::Reloader
27
+ also_reload "**/*.rb"
28
+ end
21
29
  set :views, File.dirname(__FILE__) + '/views'
22
30
  end
23
31
  end
24
32
  end
33
+
34
+
25
35
  require 'mirage'
26
- include Mirage::Util
27
- #
28
- options = parse_options(ARGV)
29
36
 
30
37
 
31
38
  DEFAULT_RESPONSES_DIR = "#{options[:defaults_directory]}"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mirage
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 2.0.0.alpha1
5
+ version: 2.0.0.alpha2
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-06-07 00:00:00 +01:00
13
+ date: 2011-06-08 00:00:00 +01:00
14
14
  default_executable: mirage
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -181,7 +181,6 @@ files:
181
181
  - features/step_definitions/my_steps.rb
182
182
  - features/support/env.rb
183
183
  - full_build.sh
184
- - lib/config.ru
185
184
  - lib/mirage.rb
186
185
  - lib/mirage/client.rb
187
186
  - lib/mirage/core.rb
@@ -214,7 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
213
  requirements:
215
214
  - - ">="
216
215
  - !ruby/object:Gem::Version
217
- hash: 122609927051635249
216
+ hash: 3094995407678883381
218
217
  segments:
219
218
  - 0
220
219
  version: "0"
data/lib/config.ru DELETED
@@ -1,5 +0,0 @@
1
- require 'rubygems'
2
- require "#{::File.expand_path("#{::File.dirname(__FILE__)}/mirage/core")}"
3
- Ramaze.start(:root => __DIR__, :started => true)
4
- run Ramaze
5
-