yaframework 0.4.5 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb7911725bae2b9c6c1a8e575f35c32002950733011474ef711ecfbb486349f7
4
- data.tar.gz: 3aebe5de332841aa193423f2796415e9b5f7842a6f28f4d71f56d9d6f1fa6ff9
3
+ metadata.gz: 4b91dd4a4391f3f01d24edba73230b3831874bb2449c321e7ae795b47334ef68
4
+ data.tar.gz: 8e3f1e8c24751c1591aad3c9d6602a51d270ab21ec574621dedc3a8a1a9c6df4
5
5
  SHA512:
6
- metadata.gz: 1155c9b2c1989b62ffa01d56134fa40e1c61babaed7a570b489db0c2b1e385b5c17158818fa1a61f23f7a94585a483ba897fb91ede42f1ce1948204c5566abf2
7
- data.tar.gz: c14ad19ffb1e5504bac06a64534cabd590b2531798444d44773557e55111208f115b3d7a11b99df3fbf7c1583c5f7021274fdbe9063c5d3b54d454a864941c1a
6
+ metadata.gz: adfc2c9f9cc37361d5be76853ff5d42435748fbe3e2816f47d4163303c013f428f793a26dd080a7e7fd65119e1f5910ab50f49aee735fdb57a5d3fed49f7fdd5
7
+ data.tar.gz: 77677d979203ecda92b147618823084b0e054f2aec87feeb322624529415ac6bad573e739eaa09a1b2946c8903fe27fa205f6ac4521e7c5d86778cff32155457
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.gem
14
14
  *.rbc
15
15
  /examples/**/Gemfile.lock
16
+ /lib/app.rb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.4.6] - 2021-07-25
2
+
3
+ - Content duplication fixed
4
+
1
5
  ## [0.4.5] - 2021-07-25
2
6
 
3
7
  - Error handling added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yaframework (0.4.5)
4
+ yaframework (0.4.6)
5
5
  rack (~> 2.2, >= 2.2.3)
6
6
 
7
7
  GEM
@@ -10,29 +10,29 @@ GEM
10
10
  ast (2.4.2)
11
11
  minitest (5.14.4)
12
12
  parallel (1.20.1)
13
- parser (3.0.2.0)
13
+ parser (3.0.1.1)
14
14
  ast (~> 2.4.1)
15
15
  rack (2.2.3)
16
16
  rainbow (3.0.0)
17
- rake (13.0.6)
17
+ rake (13.0.3)
18
18
  regexp_parser (2.1.1)
19
19
  rexml (3.2.5)
20
- rubocop (1.18.4)
20
+ rubocop (1.18.2)
21
21
  parallel (~> 1.10)
22
22
  parser (>= 3.0.0.0)
23
23
  rainbow (>= 2.2.2, < 4.0)
24
24
  regexp_parser (>= 1.8, < 3.0)
25
25
  rexml
26
- rubocop-ast (>= 1.8.0, < 2.0)
26
+ rubocop-ast (>= 1.7.0, < 2.0)
27
27
  ruby-progressbar (~> 1.7)
28
28
  unicode-display_width (>= 1.4.0, < 3.0)
29
- rubocop-ast (1.8.0)
29
+ rubocop-ast (1.7.0)
30
30
  parser (>= 3.0.1.1)
31
31
  ruby-progressbar (1.11.0)
32
32
  unicode-display_width (2.0.0)
33
33
 
34
34
  PLATFORMS
35
- ruby
35
+ x86_64-linux
36
36
 
37
37
  DEPENDENCIES
38
38
  bundler (>= 2.2.10)
File without changes
data/examples/README.md CHANGED
@@ -2,16 +2,27 @@
2
2
 
3
3
  Here are some examples of applications created with Yaframework:
4
4
 
5
- 1. ###[Hello World](https://github.com/maxbarsukov/yaframework/tree/master/examples/hello-world)
5
+ 1. [**Hello World**](https://github.com/maxbarsukov/yaframework/tree/master/examples/hello_world.rb)
6
6
 
7
- A simple application that displays "Hello world" to you.
7
+ A simple application that displays "Hello world" to you. Go to `http://localhost:4567/` and see `Hello World`!
8
8
 
9
9
 
10
- 2. ###[Params](https://github.com/maxbarsukov/yaframework/tree/master/examples/params)
10
+ 2. [**Params**](https://github.com/maxbarsukov/yaframework/tree/master/examples/params.rb)
11
11
 
12
12
  Shows how the application parameters can be used
13
13
 
14
14
 
15
- 3. ###[Halts and Redirects](https://github.com/maxbarsukov/yaframework/tree/master/examples/halts-and-redirects)
15
+ 3. [**Halts and Redirects**](https://github.com/maxbarsukov/yaframework/tree/master/examples/halts_and_redirects.rb)
16
16
 
17
17
  Shows how to use halts and redirects
18
+
19
+
20
+ ## Installation
21
+
22
+ Clone this repo and go to this folder.
23
+ Then, run `bundle install` to install this gem.
24
+
25
+ ## Run
26
+
27
+ Run with `ruby hello-world.rb` or any other file and view at http://localhost:4567
28
+
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaframework"
4
+ app = Yaframework::Application
5
+
6
+ app.get "/" do
7
+ response.redirect "/html"
8
+ end
9
+
10
+ app.get "/html" do
11
+ response.html "This is <b>HTML</b>, where you cat use some <small>tags</small>.<br/>JSON <a href=\"/json\">here</a>,
12
+ <br/>Plain text <a href=\"/text\">here</a>"
13
+ end
14
+
15
+ app.get "/text" do
16
+ response.text "Just plain text.<br/>Boring, even tags don't work..."
17
+ end
18
+
19
+ app.get "/json" do
20
+ response.json "{ \"The awesomeness of this framework\": \"100/100\" }"
21
+ end
22
+
23
+ app.listen(4567)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaframework"
4
+ app = Yaframework::Application
5
+
6
+ app.get "/" do
7
+ response.set_cookie("foo", "bar")
8
+
9
+ end
10
+
11
+
12
+ app.listen(4567)
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaframework"
4
+ app = Yaframework::Application
5
+
6
+ app.get "/" do
7
+ "This is the root, go somewhere else"
8
+ end
9
+
10
+ app.handle 404 do
11
+ "Hey, I just handled a 404 error!"
12
+ end
13
+
14
+ app.handle 500 do
15
+ "Error 500, this shouldn't have happened..."
16
+ end
17
+
18
+ app.listen(4567)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaframework"
4
+ app = Yaframework::Application
5
+
6
+ app.get "/" do
7
+ request[:username] = "IVAN!"
8
+ "Now 'request[:username]': #{request[:username]} contains in 'request.params': #{request.params}"
9
+ end
10
+
11
+ app.listen(4567)
@@ -3,6 +3,7 @@
3
3
  require "yaframework"
4
4
  app = Yaframework::Application
5
5
 
6
+ # Just go to the root page and say hello
6
7
  app.get "/" do
7
8
  "Hello world!"
8
9
  end
@@ -3,11 +3,13 @@
3
3
  require "yaframework"
4
4
  app = Yaframework::Application
5
5
 
6
+ # Any route, like /max or /ivan
6
7
  app.get "/:name" do
7
8
  "Hello #{request.params[:name]}!"
8
9
  end
9
10
 
10
- app.get "/:name/foo/:bar" do
11
+ # You can try /max/from/rnd and see it with your own eyes
12
+ app.get "/:name/from/:bar" do
11
13
  "Hello #{request.params[:name]} from #{request.params[:bar]}!"
12
14
  end
13
15
 
@@ -42,6 +42,7 @@ module Yaframework
42
42
  s = string.to_s
43
43
  @length += s.bytesize
44
44
  @body << s
45
+ nil
45
46
  end
46
47
 
47
48
  def [](key)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yaframework
4
- VERSION = "0.4.5"
4
+ VERSION = "0.4.6"
5
5
  end
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.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxbarsukov
@@ -105,19 +105,15 @@ files:
105
105
  - Rakefile
106
106
  - bin/console
107
107
  - bin/setup
108
+ - examples/Gemfile
108
109
  - examples/README.md
109
- - examples/halts-and-redirects/Gemfile
110
- - examples/halts-and-redirects/README.md
111
- - examples/halts-and-redirects/app.rb
112
- - examples/halts-and-redirects/config.ru
113
- - examples/hello-world/Gemfile
114
- - examples/hello-world/README.md
115
- - examples/hello-world/app.rb
116
- - examples/hello-world/config.ru
117
- - examples/params/Gemfile
118
- - examples/params/README.md
119
- - examples/params/app.rb
120
- - examples/params/config.ru
110
+ - examples/content_types.rb
111
+ - examples/cookies.rb
112
+ - examples/error_handling.rb
113
+ - examples/halts_and_redirects.rb
114
+ - examples/headers.rb
115
+ - examples/hello_world.rb
116
+ - examples/params.rb
121
117
  - lib/yaframework.rb
122
118
  - lib/yaframework/base.rb
123
119
  - lib/yaframework/request.rb
@@ -1,12 +0,0 @@
1
- # Params
2
-
3
- Shows how to use halts and redirects
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
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "yaframework"
4
- require "./app"
5
-
6
- run app
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "yaframework"
@@ -1,12 +0,0 @@
1
- # Hello world
2
-
3
- A simple application that displays "Hello world" to you.
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
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "yaframework"
4
- require "./app"
5
-
6
- run app
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "yaframework"
@@ -1,12 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "yaframework"
4
- require "./app"
5
-
6
- run app