moonrope 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moonrope/rack_middleware.rb +1 -1
- data/lib/moonrope/railtie.rb +6 -1
- data/lib/moonrope/request.rb +10 -5
- data/lib/moonrope/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2c07e3a6cf5bed85f04b415aba7c0a93eaac01c
|
4
|
+
data.tar.gz: 54224342f109ced1f812419c23453d63538b3af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d10f3add6366036c7ed1355d9b03ad53629019a16bbb3689b0e70b0cc01e9740bcee698dcd0fc26a386609676bbff9e7852a4a4da5a81c89d26a0099e56bd96
|
7
|
+
data.tar.gz: 38d91c152c7208dcda97cf6e3ddb5ee95a5146c3790c4739b43da8513e45cfddd1951620379d7597a6eb1898716a0bcb74167f358043f3e463de4c7dbe4696a1
|
data/lib/moonrope/railtie.rb
CHANGED
@@ -9,12 +9,17 @@ module Moonrope
|
|
9
9
|
if File.directory?(moonrope_directory)
|
10
10
|
app.config.moonrope = Moonrope::Base.load(moonrope_directory)
|
11
11
|
else
|
12
|
-
$stderr.puts "Moonrope is installed but there is no API directory at ROOT/
|
12
|
+
$stderr.puts "Moonrope is installed but there is no API directory at ROOT/api."
|
13
13
|
next
|
14
14
|
end
|
15
15
|
|
16
16
|
# Set the logger
|
17
17
|
Moonrope.logger = Rails.logger
|
18
|
+
|
19
|
+
# Set the request regex if one has been set
|
20
|
+
if app.config.respond_to?(:moonrope_request_path_regex) && app.config.moonrope_request_path_regex.is_a?(Regexp)
|
21
|
+
Moonrope::Request.path_regex = app.config.moonrope_request_path_regex
|
22
|
+
end
|
18
23
|
|
19
24
|
# Insert the Moonrope middleware into the application's middleware
|
20
25
|
# stack (at the bottom).
|
data/lib/moonrope/request.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
module Moonrope
|
2
2
|
class Request
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
|
4
|
+
class << self
|
5
|
+
attr_accessor :path_regex
|
6
|
+
|
7
|
+
# @return [Regex] the regex which should be matched for all API requests
|
8
|
+
def path_regex
|
9
|
+
@path_regex ||= /\A\/api\/([\w\/\-\.]+)?/
|
10
|
+
end
|
11
|
+
end
|
7
12
|
|
8
13
|
# @return [Hash] the rack environment
|
9
14
|
attr_reader :env
|
@@ -24,7 +29,7 @@ module Moonrope
|
|
24
29
|
def initialize(base, env, path = nil)
|
25
30
|
@base = base
|
26
31
|
@env = env
|
27
|
-
if path.nil? && env['PATH_INFO'] =~
|
32
|
+
if path.nil? && env['PATH_INFO'] =~ self.class.path_regex
|
28
33
|
path = $1
|
29
34
|
end
|
30
35
|
@version, @controller_name, @action_name = path ? path.split("/") : [nil, nil, nil]
|
data/lib/moonrope/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moonrope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|