ground 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +114 -0
  3. data/Rakefile +8 -0
  4. data/licenses.txt +21 -0
  5. metadata +45 -12
  6. data/lib/ground.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6dafd37448efdc71289db4e20c428c454055534a
4
- data.tar.gz: 961f092b8dad516a1f8b00cdedb2ad94a7bdc455
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDU5YmZhOTU0YTdjMzIxOGNlNWY0MDliZDJiZTliNTE0YTQ5NDdkMA==
5
+ data.tar.gz: !binary |-
6
+ MzczMGFkMGZmYTY5YzgxYWNmOTU2M2E2MzMxYTgzMmUzNDBiZjc5NQ==
5
7
  SHA512:
6
- metadata.gz: 7c1179e0d1f4a4eae1c718650b928ae54f75d3bafa79f5e8f044293bb3fdbafca0859ad764df5666c49b9e0f05d4b3d53c6e6507e9e009444de113cfc90fb955
7
- data.tar.gz: 40208491b230e926de61595bf9ebdea390faebe42ca12c127084676db1e8a4eea7dba056c1e8b8129f2358148b91f3ca75f5ef67328d18249c39fd0aa29aaba1
8
+ metadata.gz: !binary |-
9
+ NzgwZTg4YjE0ZDg1ODhhMzNkNGEzYzcyNDZmOGVhOTQwNjI4MmRiMTdkMDg1
10
+ MDUwNDk0ZGNmMWZhZTNiYTUzODVhYmI4OWNlMTE1ZjkxZmZkNTU5ODMyMzUw
11
+ NTUyODg5ZjMyMzM4MTc2YjRhMDdiOGRjNTU4MTUwNGQ5YTIwZTg=
12
+ data.tar.gz: !binary |-
13
+ ZWQwZWYyZDBiN2RmZjBiNWMyZmE3ODc2NDQ3NmNkNGNkNDMwZGUwMzc1NWVh
14
+ YmM4MmFlMWYwMTJmYWYyMmJiMDgxNDBiMGQ5OWU0MjZjZDlkNzNiNTUyMmYy
15
+ NDNiMzVhZTk3ODgxNWQ2MmVlNWJmMGE2MGViNjg2NDNhNjIzOTE=
@@ -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
+
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+ Rake::TestTask.new do |t|
3
+ t.libs << 'test'
4
+ t.test_files = FileList['test/*_test.rb']
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -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.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - kayakjiang
7
+ - guimin jiang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-26 00:00:00.000000000 Z
12
- dependencies: []
13
- description: build stable back-end software from ground
14
- email: kayak.jiang@gmail.com
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
- - lib/ground.rb
20
- homepage: http://rubygems.org/gems/ground
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.0.3
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
@@ -1,6 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # 构建像大地一样稳健的程序
3
- module Ground
4
- class Activity
5
- end
6
- end