diy_rails 0.1.3 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c727c698f21390b3a70a7254fb270efc843eeb4ac6c94e609a3ba1192fd9f317
4
- data.tar.gz: 2e76f14981c08a7601186449fbcb0ddfc0a1fd1ac166a95b191b7494f0346bc6
3
+ metadata.gz: 8234e8d7fe2fab99f2972a254f8bbfdf62b516df7f35b50f31a1b9ef2318a47e
4
+ data.tar.gz: fe9da478e79e08401a0ec1887f7eb8fb4871bcc7737f1d74e5863dda5b770d7e
5
5
  SHA512:
6
- metadata.gz: b6bd31a640c68293234c92cc364059eab8345be71270254ddd535d3a4f0214fbc0c35b43ff3830fbcefdff4192a02fd792bc07bdb0e7e487ba1fee96ec9dde76
7
- data.tar.gz: ad9e04a3112d732171295f5403c019b33a81844d73dc346253f0449437eabf89736e271e9933e60e8986f137428b270354734d7897b02248c65e9bee58cfae95
6
+ metadata.gz: e6fd465f5cfba9a9c92601060b3495835dd10cb1f1c64aef89eded818e1ddb4d27afe9a03b87e717dd99eb9a3ae8cdd09187298f5d9ca9d0fd9df20015041e3e
7
+ data.tar.gz: af52768760666e16c56e446cec8c56b474ef2b63d9a24d23c602859df32183ee5bb0e388d4a8ee042fbe0e93ec3e44f74a2e6e1d0ef4a9f3054b7054a9248d24
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diy_rails (0.1.3)
4
+ diy_rails (0.2.2)
5
5
  rack (~> 2.2, >= 2.2.2)
6
6
 
7
7
  GEM
@@ -0,0 +1,10 @@
1
+ module Rulers
2
+ class Application
3
+ def get_controller_and_action(env)
4
+ _, cont, action, after = env["PATH_INFO"].split('/', 4)
5
+ cont = cont.capitalize # "People"
6
+ cont += "Controller" # "PeopleController"
7
+ [Object.const_get(cont), action]
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiyRails
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.2"
5
5
  end
data/lib/diy_rails.rb CHANGED
@@ -2,13 +2,34 @@
2
2
 
3
3
  require_relative "diy_rails/version"
4
4
  require_relative "diy_rails/array"
5
+ require_relative "diy_rails/routing"
5
6
 
6
7
  module DiyRails
7
8
  class Application
8
9
  `echo debug > debug.txt`;
9
10
  def call(env)
10
- [200, {'Content-Type' => 'text/html'},
11
- ["Hello from DIY RoR"]]
11
+ if env['PATH_INFO'] == '/favicon.ico'
12
+ return [404, {'Content-Type' => 'text/html'},
13
+ []]
14
+ end
15
+
16
+ klass, act = get_controller_and_action(env)
17
+ controller = klass.new(env)
18
+ text = controller.send(act)
19
+
20
+ [200, {'Content-Type' => 'text/html'},
21
+ ["Hello from DIY RoR"]]
22
+ end
23
+ end
24
+
25
+ class Controller
26
+ def initialize(env)
27
+ @env = env
28
+ end
29
+
30
+ def env
31
+ @env
12
32
  end
33
+
13
34
  end
14
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diy_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sahil Kapoor
@@ -58,6 +58,7 @@ files:
58
58
  - Rakefile
59
59
  - lib/diy_rails.rb
60
60
  - lib/diy_rails/array.rb
61
+ - lib/diy_rails/routing.rb
61
62
  - lib/diy_rails/version.rb
62
63
  - sig/diy_rails.rbs
63
64
  homepage: https://rubygems.org/gems/diy_rails