yaframework 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/examples/halts-and-redirects/Gemfile +5 -0
- data/examples/halts-and-redirects/README.md +12 -0
- data/examples/halts-and-redirects/app.rb +19 -0
- data/examples/halts-and-redirects/config.ru +6 -0
- data/examples/hello-world/app.rb +1 -1
- data/examples/params/Gemfile +5 -0
- data/examples/params/README.md +12 -0
- data/examples/params/app.rb +14 -0
- data/examples/params/config.ru +6 -0
- data/lib/yaframework.rb +0 -1
- data/lib/yaframework/version.rb +1 -1
- data/yaframework.gemspec +1 -1
- metadata +13 -6
- data/lib/yaframework/database.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8009597e2e41965f0ad078918d629c4b88eaf2536d9c001053079cdfd24705a
|
4
|
+
data.tar.gz: 44386071847fd8a44299d967a8d8605b615a3fc865afd21a4f555410c10b3cba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 505e79eee033484f4ecd2eb08daca91521e2d93f5b780051fe82968d9a5510b0ac5152d4cc61aee77827e85d1e40d053451881e623e9f0f713fc1e0f0e03b1fa
|
7
|
+
data.tar.gz: 842210c79e38f9c984018c38377f704d235bd4f795ce3753cd89fdcddceb9c2d93db654c94d68dec23a4de818ade9719a08d382f5b6abb4fed5d29b5259cf8a1
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaframework"
|
4
|
+
app = Yaframework::Application
|
5
|
+
|
6
|
+
app.get "/" do
|
7
|
+
response.redirect "/hello"
|
8
|
+
end
|
9
|
+
|
10
|
+
app.get "/hello" do
|
11
|
+
"Hello world!"
|
12
|
+
end
|
13
|
+
|
14
|
+
app.get "/error" do
|
15
|
+
response.status = 401
|
16
|
+
halt response.finish
|
17
|
+
end
|
18
|
+
|
19
|
+
app.listen(4567)
|
data/examples/hello-world/app.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Params
|
2
|
+
|
3
|
+
Shows how the application parameters can be used
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Clone this repo and go to this folder.
|
8
|
+
Then, run `bundle install` to install this gem.
|
9
|
+
|
10
|
+
## Run
|
11
|
+
|
12
|
+
Run with `ruby app.rb` or `rackup` and view at http://localhost:4567
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaframework"
|
4
|
+
app = Yaframework::Application
|
5
|
+
|
6
|
+
app.get "/:name" do
|
7
|
+
"Hello #{request.params[:name]}!"
|
8
|
+
end
|
9
|
+
|
10
|
+
app.get "/:name/foo/:bar" do
|
11
|
+
"Hello #{request.params[:name]} from #{request.params[:bar]}!"
|
12
|
+
end
|
13
|
+
|
14
|
+
app.listen(4567)
|
data/lib/yaframework.rb
CHANGED
data/lib/yaframework/version.rb
CHANGED
data/yaframework.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.bindir = "exe"
|
29
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
30
|
|
31
|
-
spec.add_development_dependency "bundler", "
|
31
|
+
spec.add_development_dependency "bundler", ">= 2.2.10"
|
32
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
33
33
|
spec.add_development_dependency "rubocop", "~> 1.7"
|
34
34
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaframework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maxbarsukov
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.2.10
|
20
20
|
type: :development
|
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: 2.
|
26
|
+
version: 2.2.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,13 +86,20 @@ files:
|
|
86
86
|
- bin/console
|
87
87
|
- bin/setup
|
88
88
|
- examples/README.md
|
89
|
+
- examples/halts-and-redirects/Gemfile
|
90
|
+
- examples/halts-and-redirects/README.md
|
91
|
+
- examples/halts-and-redirects/app.rb
|
92
|
+
- examples/halts-and-redirects/config.ru
|
89
93
|
- examples/hello-world/Gemfile
|
90
94
|
- examples/hello-world/README.md
|
91
95
|
- examples/hello-world/app.rb
|
92
96
|
- examples/hello-world/config.ru
|
97
|
+
- examples/params/Gemfile
|
98
|
+
- examples/params/README.md
|
99
|
+
- examples/params/app.rb
|
100
|
+
- examples/params/config.ru
|
93
101
|
- lib/yaframework.rb
|
94
102
|
- lib/yaframework/base.rb
|
95
|
-
- lib/yaframework/database.rb
|
96
103
|
- lib/yaframework/request.rb
|
97
104
|
- lib/yaframework/response.rb
|
98
105
|
- lib/yaframework/version.rb
|
data/lib/yaframework/database.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "pg"
|
4
|
-
|
5
|
-
class Database
|
6
|
-
def self.connect(db_name)
|
7
|
-
pg_conn = PG.connect(dbname: db_name)
|
8
|
-
new(pg_conn)
|
9
|
-
end
|
10
|
-
|
11
|
-
def initialize(pg_conn)
|
12
|
-
@pg_conn = pg_conn
|
13
|
-
end
|
14
|
-
|
15
|
-
def exec(sql)
|
16
|
-
@pg_conn.exec(sql).to_a
|
17
|
-
end
|
18
|
-
end
|