rapid_runty 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.hound.yml +8 -0
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/lib/rapid_runty/application.rb +18 -4
- data/lib/rapid_runty/controller.rb +12 -0
- data/lib/rapid_runty/routing.rb +17 -0
- data/lib/rapid_runty/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80540cdbd978fc8cfceeb6f123a03039219b87a2
|
4
|
+
data.tar.gz: 6e71cafc92d36bf244237b8c2fdbbc48f75820e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb430ffbd7c1275e14664159401c419bfbf7f8d13a2b7f308d6e9bdbe1a822a0f697b86b954478da049480877d4fc7109bd3646f7b71e55b8179f1d21582608b
|
7
|
+
data.tar.gz: f614b09cf5e9e29574ed912ef2688352981f4c2e787c9f2467223954baf18f7f4b713ddb21f99fd99df83d2fa2fd35198118a3bdbefce74071e313d5e819812b
|
data/.hound.yml
ADDED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Rapid Runty
|
7
7
|
|
8
|
-
[](https://badge.fury.io/rb/rapid_runty) [](https://gemnasium.com/github.com/andela-hkagumba/rapid_runty) [ ](https://codeship.com/projects/167383) [](https://coveralls.io/github/andela-hkagumba/rapid_runty?branch=master) [](https://codebeat.co/projects/github-com-andela-hkagumba-rapid_runty)
|
9
9
|
|
10
10
|
**Rapid Runty** is a minimal web framework to get your web project up and running in seconds.
|
11
11
|
|
data/Rakefile
CHANGED
@@ -1,15 +1,29 @@
|
|
1
|
+
require "rapid_runty/routing"
|
2
|
+
require "rapid_runty/controller"
|
3
|
+
|
1
4
|
module RapidRunty
|
2
5
|
# Main framework Application class. Entry point for all requests.
|
6
|
+
#
|
7
|
+
# Example:
|
8
|
+
#
|
9
|
+
# class Application < RapidRunty::Application
|
10
|
+
# end
|
3
11
|
class Application
|
4
12
|
##
|
5
13
|
# Returns a rack compatible response.
|
6
14
|
#
|
15
|
+
# Retrieves the controller and action from request URL making a new
|
16
|
+
# controller and send it to the action.
|
17
|
+
#
|
18
|
+
# @param env [Hash] Rack environment Hash that includes CGI-like headers
|
19
|
+
#
|
7
20
|
# @return [status, {headers}, [response]] array
|
8
21
|
def call(env)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
22
|
+
return [500, {}, []] if env["PATH_INFO"] == "/favicon.ico"
|
23
|
+
controller_class, action = get_controller_action(env)
|
24
|
+
controller = controller_class.new(env)
|
25
|
+
response = controller.send(action)
|
26
|
+
[200, { "Content-Type" => "text/html" }, [response]]
|
13
27
|
end
|
14
28
|
end
|
15
29
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RapidRunty
|
2
|
+
class Application
|
3
|
+
# Retrieve the controller and action method from the URL
|
4
|
+
#
|
5
|
+
# @param env [Hash] Rack environment Hash that includes CGI-like headers
|
6
|
+
#
|
7
|
+
# @return [Controller, Action] array
|
8
|
+
def get_controller_action(env)
|
9
|
+
_, controller, action, _other = env["PATH_INFO"].split("/", 4)
|
10
|
+
controller = controller.capitalize
|
11
|
+
controller += "Controller"
|
12
|
+
|
13
|
+
# Lookup controller constant name and return [controller, action]
|
14
|
+
[Object.const_get(controller), action]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rapid_runty/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapid_runty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herbert Kagumba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -243,6 +243,7 @@ extra_rdoc_files: []
|
|
243
243
|
files:
|
244
244
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
245
245
|
- ".gitignore"
|
246
|
+
- ".hound.yml"
|
246
247
|
- ".rspec"
|
247
248
|
- ".rubocop.yml"
|
248
249
|
- ".simplecov"
|
@@ -257,6 +258,8 @@ files:
|
|
257
258
|
- gemify.sh
|
258
259
|
- lib/rapid_runty.rb
|
259
260
|
- lib/rapid_runty/application.rb
|
261
|
+
- lib/rapid_runty/controller.rb
|
262
|
+
- lib/rapid_runty/routing.rb
|
260
263
|
- lib/rapid_runty/version.rb
|
261
264
|
- rapid_runty.gemspec
|
262
265
|
homepage: https://github.com/andela-hkagumba/rapid_runty
|