ground 0.0.0 → 0.0.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 +13 -5
- data/README.md +114 -0
- data/Rakefile +8 -0
- data/licenses.txt +21 -0
- metadata +45 -12
- data/lib/ground.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDU5YmZhOTU0YTdjMzIxOGNlNWY0MDliZDJiZTliNTE0YTQ5NDdkMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MzczMGFkMGZmYTY5YzgxYWNmOTU2M2E2MzMxYTgzMmUzNDBiZjc5NQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzgwZTg4YjE0ZDg1ODhhMzNkNGEzYzcyNDZmOGVhOTQwNjI4MmRiMTdkMDg1
|
10
|
+
MDUwNDk0ZGNmMWZhZTNiYTUzODVhYmI4OWNlMTE1ZjkxZmZkNTU5ODMyMzUw
|
11
|
+
NTUyODg5ZjMyMzM4MTc2YjRhMDdiOGRjNTU4MTUwNGQ5YTIwZTg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZWQwZWYyZDBiN2RmZjBiNWMyZmE3ODc2NDQ3NmNkNGNkNDMwZGUwMzc1NWVh
|
14
|
+
YmM4MmFlMWYwMTJmYWYyMmJiMDgxNDBiMGQ5OWU0MjZjZDlkNzNiNTUyMmYy
|
15
|
+
NDNiMzVhZTk3ODgxNWQ2MmVlNWJmMGE2MGViNjg2NDNhNjIzOTE=
|
data/README.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# Ground
|
2
|
+
Ground is a web framework, no controller, no model, no views and no mvc. Most of the ground codes are inherited from
|
3
|
+
[Dun::Activity](https://github.com/baya/dun/blob/master/lib/dun.rb). So ground is a high unified web framework.
|
4
|
+
|
5
|
+
## states
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
class SiteIndex < Ground::State
|
9
|
+
def call
|
10
|
+
text 'Site Index'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Book
|
15
|
+
State = Ground::State
|
16
|
+
|
17
|
+
class Index < State
|
18
|
+
def call
|
19
|
+
@books = Book.all
|
20
|
+
html erb('views/book/index.html.erb')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Show < State
|
25
|
+
def call
|
26
|
+
@book = Book.find(params[:id])
|
27
|
+
html erb('views/book/show.html.erb')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Create < State
|
32
|
+
def call
|
33
|
+
@book = Book.create(params[:book])
|
34
|
+
rediret '/books'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
## routes
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
Ground do
|
45
|
+
get '/', SiteIndex
|
46
|
+
get '/books', Book::Index
|
47
|
+
get '/book/:id', Book::Show
|
48
|
+
post '/book', Book::Create
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
## route helpers
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
SiteIndex.path # '/'
|
56
|
+
Book::Index.path # '/books'
|
57
|
+
Book::Show.path(2) # '/book/2'
|
58
|
+
Book::Create.path # '/book'
|
59
|
+
```
|
60
|
+
|
61
|
+
## sets
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
Ground do
|
65
|
+
set :env, (ENV['RACK_ENV'] || 'development').to_s
|
66
|
+
set :logger, ::Logger.new(STDOUT)
|
67
|
+
en
|
68
|
+
|
69
|
+
Ground.env #=> development
|
70
|
+
Ground.logger.info("debug+++")
|
71
|
+
```
|
72
|
+
|
73
|
+
## helpers
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
# Book::Index, Book::Show will hava instance method 'hello_ground'
|
77
|
+
Ground do
|
78
|
+
help Book::Index, Book::Show do
|
79
|
+
|
80
|
+
def hello_ground
|
81
|
+
'hello ground'
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
## create a ground app
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
module BookStore
|
92
|
+
App = Ground 'book store' do
|
93
|
+
use Rack::ShowExceptions
|
94
|
+
use Rack::Static, urls: ['/js', '/css', '/lib', '/partials'], :root => "lib/app"
|
95
|
+
...
|
96
|
+
end
|
97
|
+
end
|
98
|
+
```
|
99
|
+
|
100
|
+
## config.ru
|
101
|
+
|
102
|
+
``` ruby
|
103
|
+
$: << '.'
|
104
|
+
require 'app'
|
105
|
+
run BookStore::App
|
106
|
+
```
|
107
|
+
|
108
|
+
## Apps using ground
|
109
|
+
|
110
|
+
* [SceneMaster](https://github.com/baya/SceneMaster)
|
111
|
+
* [Description](https://github.com/baya/description)
|
112
|
+
* [Gstar](https://github.com/baya/Gstar)
|
113
|
+
|
114
|
+
|
data/Rakefile
ADDED
data/licenses.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) <year> <copyright holders>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
metadata
CHANGED
@@ -1,24 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ground
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- guimin jiang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dun
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ! ' A simple ruby web framework
|
42
|
+
|
43
|
+
'
|
44
|
+
email: 594359387@qq.com
|
15
45
|
executables: []
|
16
46
|
extensions: []
|
17
47
|
extra_rdoc_files: []
|
18
48
|
files:
|
19
|
-
-
|
20
|
-
|
21
|
-
licenses
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- licenses.txt
|
52
|
+
homepage: https://github.com/baya/ground
|
53
|
+
licenses:
|
54
|
+
- MIT
|
22
55
|
metadata: {}
|
23
56
|
post_install_message:
|
24
57
|
rdoc_options: []
|
@@ -26,17 +59,17 @@ require_paths:
|
|
26
59
|
- lib
|
27
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
28
61
|
requirements:
|
29
|
-
- - '>='
|
62
|
+
- - ! '>='
|
30
63
|
- !ruby/object:Gem::Version
|
31
64
|
version: '0'
|
32
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
66
|
requirements:
|
34
|
-
- - '>='
|
67
|
+
- - ! '>='
|
35
68
|
- !ruby/object:Gem::Version
|
36
69
|
version: '0'
|
37
70
|
requirements: []
|
38
71
|
rubyforge_project:
|
39
|
-
rubygems_version: 2.
|
72
|
+
rubygems_version: 2.2.2
|
40
73
|
signing_key:
|
41
74
|
specification_version: 4
|
42
75
|
summary: build stable back-end software from ground
|