fakerest 0.0.4 → 0.0.6

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/bin/fakerest CHANGED
File without changes
data/lib/fakerest.rb CHANGED
@@ -9,6 +9,7 @@ options = FakeRest::ArgumentsParser.new.parse(ARGV)
9
9
  require 'sinatra'
10
10
 
11
11
  set :port, options[:port]
12
+ set :bind, options[:bind]
12
13
  set :views, options[:views]
13
14
  set :public_folder, options[:uploads]
14
15
  set :static, true
@@ -15,6 +15,7 @@ module FakeRest
15
15
  options[:config] = nil
16
16
  options[:views] = 'views'
17
17
  options[:uploads] = 'uploads'
18
+ options[:bind] = 'localhost'
18
19
 
19
20
  opts.on("-c","--config CONFIG_FILE","Confilg file to load request mappings (required)") do |cfg|
20
21
  options[:config] = cfg
@@ -24,11 +25,15 @@ module FakeRest
24
25
  options[:port] = prt
25
26
  end
26
27
 
27
- opts.on("-w","--views VIEWS_FOLDER","Folder path that contains the views (required)") do |views|
28
+ opts.on("-o","--bind HOSTNAME/IP_ADDR","String specifying the hostname or IP address of the interface to listen on . Default = localhost") do |prt|
29
+ options[:bind] = prt
30
+ end
31
+
32
+ opts.on("-w","--views VIEWS_FOLDER","Folder path that contains the views. Default = <WORKING_DIR>/views") do |views|
28
33
  options[:views] = views
29
34
  end
30
35
 
31
- opts.on("-u","--uploads UPLOADS_FOLDER","Folder to which any file uploads to be stored (required)") do |uploads|
36
+ opts.on("-u","--uploads UPLOADS_FOLDER","Folder to which any file uploads to be stored. Default = <WORKING_DIR>/uploads") do |uploads|
32
37
  options[:uploads] = uploads
33
38
  end
34
39
 
@@ -1,6 +1,7 @@
1
1
  require 'fakerest/userrequests'
2
+ require 'sinatra'
2
3
 
3
- module FakeRest
4
+ module FakeRest
4
5
 
5
6
  class RequestMapping
6
7
  attr_reader :status_code, :response_file, :content_type, :method, :path
@@ -51,7 +52,7 @@ module FakeRest
51
52
  erb request_mapping.response_file.to_sym, params
52
53
  }
53
54
 
54
- send request_mapping.method, request_mapping.path, &block
55
+ Sinatra::Base.send request_mapping.method, request_mapping.path, &block
55
56
  end
56
57
  end
57
58
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakerest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -69,6 +69,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
69
  - - ! '>='
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
+ segments:
73
+ - 0
74
+ hash: 3863224738504212216
72
75
  required_rubygems_version: !ruby/object:Gem::Requirement
73
76
  none: false
74
77
  requirements:
@@ -77,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
80
  version: '0'
78
81
  requirements: []
79
82
  rubyforge_project:
80
- rubygems_version: 1.8.24
83
+ rubygems_version: 1.8.25
81
84
  signing_key:
82
85
  specification_version: 3
83
86
  summary: Fake rest