a_series_of_tubes 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +53 -6
- data/a_series_of_tubes.gemspec +1 -1
- data/lib/a_series_of_tubes/version.rb +1 -1
- data/pkg/a_series_of_tubes-1.0.0.gem +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dc91bfe720e392510cb64ea9ff4c83d7eaadf4c
|
4
|
+
data.tar.gz: 46d79a43419784a9ac5bddf15cdb44aee3c50421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1be9b67e8dc3639c7c029cd4f463e436fdc46957b7b887599e043d1f5781178a7adc5e83257b9096141d4bb331dd3075c8fc921da5b5fa59109c8446544a912e
|
7
|
+
data.tar.gz: d285cee2e1f6ebb30431b41f6a3c89193b6cec47c607d336d49003fd2c3933a3aabc4fe5a21654a77afa01e63f9240829d75017c0d37232f1c3ee026d0caad32
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# A Series Of Tubes
|
2
2
|
|
3
3
|
This is a simple web development framework built in Ruby! It is currently under development, so stay tuned for more updates!
|
4
4
|
|
5
|
+
[Sample Server](http://www.github.com/danmakenoise/a_series_of_tubes_demo) | [Live Link](http://aseriesoftubes-demo.herokuapp.com)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -20,17 +22,62 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
## Usage
|
22
24
|
|
23
|
-
|
25
|
+
**A Series of Tubes** is a toolset for creating simple RESTful websites in Ruby. If you are interested in learning how to use it in your project, check out the [Sample Server](http://www.github.com/danmakenoise/a_series_of_tubes_demo) for a suggested application structure.
|
26
|
+
|
27
|
+
There are four main components to **A Series of Tubes**:
|
28
|
+
|
29
|
+
### Tubes
|
30
|
+
|
31
|
+
Tubes are the individual routes users can navigate on your server. You can create a `Tube` via the `Tuber` class. An example set-up is as follows:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
tuber = ASeriesOfTubes::Tubes::Tuber.new
|
35
|
+
|
36
|
+
tuber.draw do
|
37
|
+
get Regexp.new('^/$'), CatsController, :index
|
38
|
+
get Regexp.new('^/cats$'), CatsController, :index
|
39
|
+
get Regexp.new('^/cats/new$'), CatsController, :new
|
40
|
+
post Regexp.new('^/cats$'), CatsController, :create
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
The `Tuber` itself is mainly useful as a means for creating the various instances of `Tube` using its `draw` function. Within `draw` you create a `Tube` with the following syntax:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
METHOD REGEX_FOR_PATH, TUBE_CONTROLLER_NAME, TUBE_CONTROLLER_ACTIONS
|
48
|
+
|
49
|
+
# METHOD can be get, post, put, or delete
|
50
|
+
```
|
51
|
+
|
52
|
+
### TubeController
|
53
|
+
|
54
|
+
The `TubeController` is the class that will actually render your HTML/ERB views. For example, in our sample server, the `CatsController#index` action looks like this:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
class CatsController < ASeriesOfTubes::TubeController
|
58
|
+
def index
|
59
|
+
@cats = get_cats_from_cookies
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_cats_from_cookies
|
63
|
+
session['cats'] ? session['cats'] : []
|
64
|
+
end
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
When a `Tube` gets matched to the `index` action, an instance variable `@cats` is created and is populated with any data in the session cookie under the key `cats`. This is another important feature of the `TubeController`! You can user `session[KEY]` to store data to the session cookies of the site. Similarly, there is `flash[KEY]` and `flash.now[KEY]`, which can be used to only store information for the next render or redirect.
|
69
|
+
|
70
|
+
### TubeSupport
|
24
71
|
|
25
|
-
|
72
|
+
This module just contains helper functions for the entire gem.
|
26
73
|
|
27
|
-
|
74
|
+
### TubeState
|
28
75
|
|
29
|
-
|
76
|
+
This module contains the internal workings of the `session` and `flash` abilities of the `TubeController` class.
|
30
77
|
|
31
78
|
## Contributing
|
32
79
|
|
33
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
80
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/danmakenoise/a_series_of_tubes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
34
81
|
|
35
82
|
|
36
83
|
## License
|
data/a_series_of_tubes.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dan@danphillips.io"]
|
11
11
|
|
12
12
|
spec.summary = "a web development framework"
|
13
|
-
spec.homepage = "http://www.github.com/
|
13
|
+
spec.homepage = "http://www.github.com/danmakenoise/a_series_of_tubes"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: a_series_of_tubes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Phillips
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,7 +113,8 @@ files:
|
|
113
113
|
- lib/a_series_of_tubes/tubes/tube.rb
|
114
114
|
- lib/a_series_of_tubes/tubes/tuber.rb
|
115
115
|
- lib/a_series_of_tubes/version.rb
|
116
|
-
|
116
|
+
- pkg/a_series_of_tubes-1.0.0.gem
|
117
|
+
homepage: http://www.github.com/danmakenoise/a_series_of_tubes
|
117
118
|
licenses:
|
118
119
|
- MIT
|
119
120
|
metadata: {}
|