ki 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +20 -0
- data/README.rdoc +2 -1
- data/VERSION +1 -1
- data/gfx/colors.xcf +0 -0
- data/gfx/ki3.eps +0 -0
- data/{logo.png → gfx/logo.png} +0 -0
- data/ki.gemspec +19 -17
- data/ki_wrap.rb +35 -0
- data/lib/extensions/mail.rb +23 -7
- data/lib/helpers.rb +27 -9
- data/lib/ki.rb +4 -0
- data/lib/model.rb +4 -0
- data/lib/resp.rb +5 -1
- data/lib/static_file.rb +33 -0
- data/lib/util.rb +22 -1
- data/lib/views/404.haml +1 -7
- data/lib/views/406.haml +1 -7
- data/lib/views/layout.haml +1 -0
- data/spec/extensions/mail_spec.rb +26 -0
- data/spec/performance/performance.sh +1 -0
- metadata +150 -44
- data/examples/northpole.ro/Gemfile +0 -3
- data/examples/northpole.ro/Gemfile.lock +0 -34
- data/examples/northpole.ro/app.rb +0 -40
- data/examples/northpole.ro/config.ru +0 -6
- data/examples/northpole.ro/config.yml +0 -3
- data/examples/northpole.ro/views/index.haml +0 -0
- data/examples/northpole/Gemfile +0 -1
- data/examples/northpole/Gemfile.lock +0 -33
- data/examples/northpole/app.rb +0 -22
- data/examples/northpole/config.ru +0 -6
- data/examples/northpole/config.yml +0 -3
- data/examples/northpole/views/index.haml +0 -1
- data/examples/northpole/views/website.haml +0 -1
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -5,9 +5,15 @@ GEM
|
|
5
5
|
bson_ext (1.8.2)
|
6
6
|
bson (~> 1.8.2)
|
7
7
|
coderay (1.0.8)
|
8
|
+
coffee-script (2.2.0)
|
9
|
+
coffee-script-source
|
10
|
+
execjs
|
11
|
+
coffee-script-source (1.4.0)
|
8
12
|
daemons (1.1.9)
|
9
13
|
diff-lcs (1.1.3)
|
10
14
|
eventmachine (1.0.0)
|
15
|
+
execjs (1.4.0)
|
16
|
+
multi_json (~> 1.0)
|
11
17
|
ffi (1.3.1)
|
12
18
|
git (1.2.5)
|
13
19
|
guard (1.6.2)
|
@@ -20,6 +26,7 @@ GEM
|
|
20
26
|
guard (>= 1.1)
|
21
27
|
rspec (~> 2.11)
|
22
28
|
haml (3.1.7)
|
29
|
+
i18n (0.6.1)
|
23
30
|
jeweler (1.8.4)
|
24
31
|
bundler (~> 1.0)
|
25
32
|
git (>= 1.2.5)
|
@@ -28,10 +35,16 @@ GEM
|
|
28
35
|
json (1.7.6)
|
29
36
|
listen (0.7.2)
|
30
37
|
lumberjack (1.0.2)
|
38
|
+
mail (2.5.3)
|
39
|
+
i18n (>= 0.4.0)
|
40
|
+
mime-types (~> 1.16)
|
41
|
+
treetop (~> 1.4.8)
|
31
42
|
method_source (0.8.1)
|
43
|
+
mime-types (1.21)
|
32
44
|
mongo (1.8.2)
|
33
45
|
bson (~> 1.8.2)
|
34
46
|
multi_json (1.5.0)
|
47
|
+
polyglot (0.3.3)
|
35
48
|
pry (0.9.11.4)
|
36
49
|
coderay (~> 1.0.5)
|
37
50
|
method_source (~> 0.8)
|
@@ -50,6 +63,7 @@ GEM
|
|
50
63
|
rspec-expectations (2.12.1)
|
51
64
|
diff-lcs (~> 1.1.3)
|
52
65
|
rspec-mocks (2.12.2)
|
66
|
+
sass (3.2.5)
|
53
67
|
simplecov (0.7.1)
|
54
68
|
multi_json (~> 1.0)
|
55
69
|
simplecov-html (~> 0.7.1)
|
@@ -61,6 +75,9 @@ GEM
|
|
61
75
|
eventmachine (>= 0.12.6)
|
62
76
|
rack (>= 1.0.0)
|
63
77
|
thor (0.17.0)
|
78
|
+
treetop (1.4.12)
|
79
|
+
polyglot
|
80
|
+
polyglot (>= 0.3.1)
|
64
81
|
|
65
82
|
PLATFORMS
|
66
83
|
ruby
|
@@ -68,14 +85,17 @@ PLATFORMS
|
|
68
85
|
DEPENDENCIES
|
69
86
|
bson_ext
|
70
87
|
bundler
|
88
|
+
coffee-script
|
71
89
|
guard-rspec
|
72
90
|
haml
|
73
91
|
jeweler
|
92
|
+
mail
|
74
93
|
mongo
|
75
94
|
rack
|
76
95
|
rb-inotify (~> 0.8.8)
|
77
96
|
rdoc
|
78
97
|
rspec
|
98
|
+
sass
|
79
99
|
simplecov
|
80
100
|
thin
|
81
101
|
thor
|
data/README.rdoc
CHANGED
@@ -12,8 +12,9 @@ Description goes here.
|
|
12
12
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
13
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
14
|
|
15
|
+
http://openclipart.org/detail/97081/polar-bear-by-aguasas
|
16
|
+
|
15
17
|
== Copyright
|
16
18
|
|
17
19
|
Copyright (c) 2013 Cristian Mircea Messel. See LICENSE.txt for
|
18
20
|
further details.
|
19
|
-
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/gfx/colors.xcf
ADDED
Binary file
|
data/gfx/ki3.eps
ADDED
Binary file
|
data/{logo.png → gfx/logo.png}
RENAMED
File without changes
|
data/ki.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ki"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cristian Mircea Messel"]
|
12
|
-
s.date = "2013-02-
|
12
|
+
s.date = "2013-02-18"
|
13
13
|
s.description = "Fuck setting up a database for your prototypes. Some call it an ORM with a RESTful interface. Some say its for prototyping."
|
14
14
|
s.email = "mess110@gmail.com"
|
15
15
|
s.executables = ["ki"]
|
@@ -33,20 +33,11 @@ Gem::Specification.new do |s|
|
|
33
33
|
"examples/base/Gemfile.lock",
|
34
34
|
"examples/base/app.rb",
|
35
35
|
"examples/base/config.ru",
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"examples/northpole.ro/config.ru",
|
40
|
-
"examples/northpole.ro/config.yml",
|
41
|
-
"examples/northpole.ro/views/index.haml",
|
42
|
-
"examples/northpole/Gemfile",
|
43
|
-
"examples/northpole/Gemfile.lock",
|
44
|
-
"examples/northpole/app.rb",
|
45
|
-
"examples/northpole/config.ru",
|
46
|
-
"examples/northpole/config.yml",
|
47
|
-
"examples/northpole/views/index.haml",
|
48
|
-
"examples/northpole/views/website.haml",
|
36
|
+
"gfx/colors.xcf",
|
37
|
+
"gfx/ki3.eps",
|
38
|
+
"gfx/logo.png",
|
49
39
|
"ki.gemspec",
|
40
|
+
"ki_wrap.rb",
|
50
41
|
"lib/db.rb",
|
51
42
|
"lib/extensions/mail.rb",
|
52
43
|
"lib/helpers.rb",
|
@@ -64,14 +55,16 @@ Gem::Specification.new do |s|
|
|
64
55
|
"lib/views/404.haml",
|
65
56
|
"lib/views/406.haml",
|
66
57
|
"lib/views/index.haml",
|
67
|
-
"
|
58
|
+
"lib/views/layout.haml",
|
68
59
|
"spec/db_spec.rb",
|
60
|
+
"spec/extensions/mail_spec.rb",
|
69
61
|
"spec/integration/integration_spec.rb",
|
70
62
|
"spec/ki_spec.rb",
|
71
63
|
"spec/model_spec.rb",
|
72
64
|
"spec/modules/callbacks_spec.rb",
|
73
65
|
"spec/modules/query_interface_spec.rb",
|
74
66
|
"spec/modules/restrictions_spec.rb",
|
67
|
+
"spec/performance/performance.sh",
|
75
68
|
"spec/req_spec.rb",
|
76
69
|
"spec/spec_helper.rb",
|
77
70
|
"spec/util_spec.rb"
|
@@ -79,7 +72,7 @@ Gem::Specification.new do |s|
|
|
79
72
|
s.homepage = "http://github.com/mess110/ki"
|
80
73
|
s.licenses = ["MIT"]
|
81
74
|
s.require_paths = ["lib"]
|
82
|
-
s.rubygems_version = "1.8.
|
75
|
+
s.rubygems_version = "1.8.24"
|
83
76
|
s.summary = "Prototyping noSQL RESTful API cloud database"
|
84
77
|
|
85
78
|
if s.respond_to? :specification_version then
|
@@ -91,7 +84,10 @@ Gem::Specification.new do |s|
|
|
91
84
|
s.add_runtime_dependency(%q<bson_ext>, [">= 0"])
|
92
85
|
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
93
86
|
s.add_runtime_dependency(%q<haml>, [">= 0"])
|
87
|
+
s.add_runtime_dependency(%q<sass>, [">= 0"])
|
88
|
+
s.add_runtime_dependency(%q<coffee-script>, [">= 0"])
|
94
89
|
s.add_runtime_dependency(%q<thin>, [">= 0"])
|
90
|
+
s.add_runtime_dependency(%q<mail>, [">= 0"])
|
95
91
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
96
92
|
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
97
93
|
s.add_development_dependency(%q<rb-inotify>, ["~> 0.8.8"])
|
@@ -105,7 +101,10 @@ Gem::Specification.new do |s|
|
|
105
101
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
106
102
|
s.add_dependency(%q<thor>, [">= 0"])
|
107
103
|
s.add_dependency(%q<haml>, [">= 0"])
|
104
|
+
s.add_dependency(%q<sass>, [">= 0"])
|
105
|
+
s.add_dependency(%q<coffee-script>, [">= 0"])
|
108
106
|
s.add_dependency(%q<thin>, [">= 0"])
|
107
|
+
s.add_dependency(%q<mail>, [">= 0"])
|
109
108
|
s.add_dependency(%q<rspec>, [">= 0"])
|
110
109
|
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
111
110
|
s.add_dependency(%q<rb-inotify>, ["~> 0.8.8"])
|
@@ -120,7 +119,10 @@ Gem::Specification.new do |s|
|
|
120
119
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
121
120
|
s.add_dependency(%q<thor>, [">= 0"])
|
122
121
|
s.add_dependency(%q<haml>, [">= 0"])
|
122
|
+
s.add_dependency(%q<sass>, [">= 0"])
|
123
|
+
s.add_dependency(%q<coffee-script>, [">= 0"])
|
123
124
|
s.add_dependency(%q<thin>, [">= 0"])
|
125
|
+
s.add_dependency(%q<mail>, [">= 0"])
|
124
126
|
s.add_dependency(%q<rspec>, [">= 0"])
|
125
127
|
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
126
128
|
s.add_dependency(%q<rb-inotify>, ["~> 0.8.8"])
|
data/ki_wrap.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
class Resource
|
4
|
+
include HTTParty
|
5
|
+
base_uri 'localhost:3000'
|
6
|
+
|
7
|
+
def self.create h
|
8
|
+
post("/#{klass}.json", h)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.find h
|
12
|
+
get("/#{klass}.json", h)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def self.klass
|
18
|
+
to_s.downcase
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Storage < Resource
|
23
|
+
end
|
24
|
+
|
25
|
+
class User < Resource
|
26
|
+
end
|
27
|
+
|
28
|
+
# user = 'mess121'
|
29
|
+
# pass = '123'
|
30
|
+
#
|
31
|
+
# p User.create({ :body => { 'mail' => user, 'password' => pass}})
|
32
|
+
# p User.find({ :query => { 'mail' => user, 'password' => pass}})
|
33
|
+
#
|
34
|
+
# p Storage.create({ :body => { 'mail' => user, 'password' => pass, 'cool' => true, 'vals' => [3,3.14,4.20]}})
|
35
|
+
# p Storage.find({ :query => { 'mail' => user, 'password' => pass}})
|
data/lib/extensions/mail.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'mail'
|
1
2
|
require 'net/smtp'
|
2
3
|
|
3
4
|
module Ki
|
@@ -6,9 +7,15 @@ module Ki
|
|
6
7
|
#
|
7
8
|
# === Example
|
8
9
|
# class Article < Ki::Model
|
9
|
-
# include Ki::
|
10
|
+
# include Ki::EMail
|
10
11
|
# end
|
11
|
-
module
|
12
|
+
module EMail
|
13
|
+
def valid_mail? s
|
14
|
+
return false if s == '' || s.nil?
|
15
|
+
r = /^[a-z0-9\+\-\.]+@[a-z0-9]+\.[a-z0-9\.\-]+$/i =~ s
|
16
|
+
!r.nil?
|
17
|
+
end
|
18
|
+
|
12
19
|
def send_mail *params
|
13
20
|
params = params[0] if params.class == Array
|
14
21
|
|
@@ -27,14 +34,23 @@ module Ki
|
|
27
34
|
subject = @req[params[2].to_s]
|
28
35
|
body = @req[params[3].to_s]
|
29
36
|
|
30
|
-
really_send
|
37
|
+
really_send from, to, subject, body
|
31
38
|
end
|
32
39
|
|
33
|
-
|
40
|
+
def really_send f, t, s, b
|
41
|
+
mail = Mail.new do
|
42
|
+
from f
|
43
|
+
to t
|
44
|
+
subject s
|
45
|
+
body b
|
46
|
+
end
|
47
|
+
mail.deliver
|
48
|
+
end
|
34
49
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
50
|
+
def really_send2 f, t, s, b
|
51
|
+
msgstr = "From: #{f}\nTo: #{t}\nSubject: #{s}\n\n#{b}\n"
|
52
|
+
Net::SMTP.start('localhost', 25) do |smtp|
|
53
|
+
smtp.send_message msgstr, f, t
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
data/lib/helpers.rb
CHANGED
@@ -1,16 +1,34 @@
|
|
1
1
|
module Ki
|
2
2
|
module Helpers
|
3
|
-
|
4
|
-
|
3
|
+
# Example usage from haml
|
4
|
+
# locals is the param variable
|
5
|
+
#
|
6
|
+
# = partial 'index', locals
|
7
|
+
def partial s, hash={}
|
8
|
+
Util.render_partial(s, hash)
|
5
9
|
end
|
6
10
|
|
7
|
-
def partial s
|
8
|
-
path = Util.root_view_path
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def partial? s
|
12
|
+
path = Util.root_view_path(s)
|
13
|
+
File.exists? path
|
14
|
+
end
|
15
|
+
|
16
|
+
def css url
|
17
|
+
render_haml "%link{:href => '#{url}', :rel => 'stylesheet'}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def js url
|
21
|
+
render_haml "%script{:src => '#{url}'}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def haml s
|
25
|
+
render_haml s
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def render_haml s
|
31
|
+
Haml::Engine.new(s).render
|
14
32
|
end
|
15
33
|
end
|
16
34
|
end
|
data/lib/ki.rb
CHANGED
data/lib/model.rb
CHANGED
data/lib/resp.rb
CHANGED
@@ -13,7 +13,7 @@ module Ki
|
|
13
13
|
}
|
14
14
|
|
15
15
|
klass = @req.klass
|
16
|
-
if klass.
|
16
|
+
if klass.responds_to_formats.include? @req.format
|
17
17
|
if @req.code == 404
|
18
18
|
body = @req.format == :html ? partial('404') : { :error => 404 }
|
19
19
|
else
|
@@ -43,6 +43,10 @@ module Ki
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
+
def partial s
|
47
|
+
Util.render_partial s, { 'env' => @req.env }
|
48
|
+
end
|
49
|
+
|
46
50
|
def respond_to resp
|
47
51
|
resp == :html ? 'text/html' : 'application/json'
|
48
52
|
end
|
data/lib/static_file.rb
CHANGED
@@ -5,10 +5,43 @@ module Ki
|
|
5
5
|
def initialize req
|
6
6
|
super Util.root
|
7
7
|
@env = req.env
|
8
|
+
|
9
|
+
if ENV['RACK_ENV'] == 'development'
|
10
|
+
StaticFile.compile_css(@env['REQUEST_PATH'])
|
11
|
+
StaticFile.compile_js(@env['REQUEST_PATH'])
|
12
|
+
end
|
13
|
+
|
14
|
+
@env
|
8
15
|
end
|
9
16
|
|
10
17
|
def finish
|
11
18
|
call(@env)
|
12
19
|
end
|
20
|
+
|
21
|
+
def self.compile_js filename
|
22
|
+
if filename.end_with? '.js'
|
23
|
+
path = File.join(Util.root, filename)
|
24
|
+
coffee_path = path.gsub('.js', '.coffee')
|
25
|
+
if File.exists? coffee_path
|
26
|
+
cont = CoffeeScript.compile File.read(coffee_path)
|
27
|
+
File.open(path, 'w') do |f|
|
28
|
+
f.puts cont
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.compile_css filename
|
35
|
+
if filename.end_with? '.css'
|
36
|
+
path = File.join(Util.root, filename)
|
37
|
+
sass_path = path.gsub('.css', '.sass')
|
38
|
+
if File.exists? sass_path
|
39
|
+
eng = Sass::Engine.new(File.read(sass_path), :syntax => :sass)
|
40
|
+
File.open(path, 'w') do |f|
|
41
|
+
f.puts eng.render
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
13
46
|
end
|
14
47
|
end
|
data/lib/util.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class NilClass
|
2
|
-
def
|
2
|
+
def responds_to_formats
|
3
3
|
[:json, :html]
|
4
4
|
end
|
5
5
|
end
|
@@ -70,5 +70,26 @@ module Ki
|
|
70
70
|
def self.app_name
|
71
71
|
File.basename(root)
|
72
72
|
end
|
73
|
+
|
74
|
+
def self.render_partial s, hash={}
|
75
|
+
contents = file_contents(s)
|
76
|
+
layout_contents = file_contents('layout')
|
77
|
+
|
78
|
+
haml(layout_contents).render do
|
79
|
+
haml(contents).render(Object.new(), hash)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.haml contents
|
84
|
+
Haml::Engine.new("- extend Ki::Helpers\n" + contents)
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.file_contents s
|
88
|
+
path = Util.root_view_path s
|
89
|
+
unless File.exists? path
|
90
|
+
path = File.join(Util.src_path, 'views', s) + '.haml'
|
91
|
+
end
|
92
|
+
File.read(path)
|
93
|
+
end
|
73
94
|
end
|
74
95
|
end
|
data/lib/views/404.haml
CHANGED
data/lib/views/406.haml
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
= yield
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Ki::EMail do
|
4
|
+
it "should validate emails" do
|
5
|
+
extend Ki::EMail
|
6
|
+
|
7
|
+
valid_mail?('asd').should be_false
|
8
|
+
valid_mail?('asd.asd').should be_false
|
9
|
+
valid_mail?('').should be_false
|
10
|
+
valid_mail?(nil).should be_false
|
11
|
+
valid_mail?('asda@asdasd').should be_false
|
12
|
+
valid_mail?('cool$#Q!@asd.com').should be_false
|
13
|
+
|
14
|
+
valid_mail?('cool1@gmail.com').should be_true
|
15
|
+
valid_mail?('cool@gmail.co').should be_true
|
16
|
+
valid_mail?('cool@gmail.co.uk').should be_true
|
17
|
+
valid_mail?('cool+beans@gmail.com').should be_true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should also work as instance method" do
|
21
|
+
class CoolMail
|
22
|
+
include Ki::EMail
|
23
|
+
end
|
24
|
+
CoolMail.new.valid_mail?('cool@gmail.com').should be_true
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ab -n 10000 -c 100 http://localhost:3000/
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: mongo
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bson_ext
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: thor
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,47 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: haml
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: sass
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: coffee-script
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
61
113
|
none: false
|
62
114
|
requirements:
|
63
115
|
- - ! '>='
|
@@ -65,10 +117,31 @@ dependencies:
|
|
65
117
|
version: '0'
|
66
118
|
type: :runtime
|
67
119
|
prerelease: false
|
68
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
69
126
|
- !ruby/object:Gem::Dependency
|
70
127
|
name: thin
|
71
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: mail
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
72
145
|
none: false
|
73
146
|
requirements:
|
74
147
|
- - ! '>='
|
@@ -76,10 +149,15 @@ dependencies:
|
|
76
149
|
version: '0'
|
77
150
|
type: :runtime
|
78
151
|
prerelease: false
|
79
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
80
158
|
- !ruby/object:Gem::Dependency
|
81
159
|
name: rspec
|
82
|
-
requirement:
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
83
161
|
none: false
|
84
162
|
requirements:
|
85
163
|
- - ! '>='
|
@@ -87,10 +165,15 @@ dependencies:
|
|
87
165
|
version: '0'
|
88
166
|
type: :development
|
89
167
|
prerelease: false
|
90
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
91
174
|
- !ruby/object:Gem::Dependency
|
92
175
|
name: guard-rspec
|
93
|
-
requirement:
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
94
177
|
none: false
|
95
178
|
requirements:
|
96
179
|
- - ! '>='
|
@@ -98,10 +181,15 @@ dependencies:
|
|
98
181
|
version: '0'
|
99
182
|
type: :development
|
100
183
|
prerelease: false
|
101
|
-
version_requirements:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
102
190
|
- !ruby/object:Gem::Dependency
|
103
191
|
name: rb-inotify
|
104
|
-
requirement:
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
105
193
|
none: false
|
106
194
|
requirements:
|
107
195
|
- - ~>
|
@@ -109,10 +197,15 @@ dependencies:
|
|
109
197
|
version: 0.8.8
|
110
198
|
type: :development
|
111
199
|
prerelease: false
|
112
|
-
version_requirements:
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ~>
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: 0.8.8
|
113
206
|
- !ruby/object:Gem::Dependency
|
114
207
|
name: rdoc
|
115
|
-
requirement:
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
116
209
|
none: false
|
117
210
|
requirements:
|
118
211
|
- - ! '>='
|
@@ -120,10 +213,15 @@ dependencies:
|
|
120
213
|
version: '0'
|
121
214
|
type: :development
|
122
215
|
prerelease: false
|
123
|
-
version_requirements:
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
124
222
|
- !ruby/object:Gem::Dependency
|
125
223
|
name: bundler
|
126
|
-
requirement:
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
127
225
|
none: false
|
128
226
|
requirements:
|
129
227
|
- - ! '>='
|
@@ -131,10 +229,15 @@ dependencies:
|
|
131
229
|
version: '0'
|
132
230
|
type: :development
|
133
231
|
prerelease: false
|
134
|
-
version_requirements:
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
135
238
|
- !ruby/object:Gem::Dependency
|
136
239
|
name: jeweler
|
137
|
-
requirement:
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
138
241
|
none: false
|
139
242
|
requirements:
|
140
243
|
- - ! '>='
|
@@ -142,10 +245,15 @@ dependencies:
|
|
142
245
|
version: '0'
|
143
246
|
type: :development
|
144
247
|
prerelease: false
|
145
|
-
version_requirements:
|
248
|
+
version_requirements: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
146
254
|
- !ruby/object:Gem::Dependency
|
147
255
|
name: simplecov
|
148
|
-
requirement:
|
256
|
+
requirement: !ruby/object:Gem::Requirement
|
149
257
|
none: false
|
150
258
|
requirements:
|
151
259
|
- - ! '>='
|
@@ -153,7 +261,12 @@ dependencies:
|
|
153
261
|
version: '0'
|
154
262
|
type: :development
|
155
263
|
prerelease: false
|
156
|
-
version_requirements:
|
264
|
+
version_requirements: !ruby/object:Gem::Requirement
|
265
|
+
none: false
|
266
|
+
requirements:
|
267
|
+
- - ! '>='
|
268
|
+
- !ruby/object:Gem::Version
|
269
|
+
version: '0'
|
157
270
|
description: Fuck setting up a database for your prototypes. Some call it an ORM with
|
158
271
|
a RESTful interface. Some say its for prototyping.
|
159
272
|
email: mess110@gmail.com
|
@@ -179,20 +292,11 @@ files:
|
|
179
292
|
- examples/base/Gemfile.lock
|
180
293
|
- examples/base/app.rb
|
181
294
|
- examples/base/config.ru
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
- examples/northpole.ro/config.ru
|
186
|
-
- examples/northpole.ro/config.yml
|
187
|
-
- examples/northpole.ro/views/index.haml
|
188
|
-
- examples/northpole/Gemfile
|
189
|
-
- examples/northpole/Gemfile.lock
|
190
|
-
- examples/northpole/app.rb
|
191
|
-
- examples/northpole/config.ru
|
192
|
-
- examples/northpole/config.yml
|
193
|
-
- examples/northpole/views/index.haml
|
194
|
-
- examples/northpole/views/website.haml
|
295
|
+
- gfx/colors.xcf
|
296
|
+
- gfx/ki3.eps
|
297
|
+
- gfx/logo.png
|
195
298
|
- ki.gemspec
|
299
|
+
- ki_wrap.rb
|
196
300
|
- lib/db.rb
|
197
301
|
- lib/extensions/mail.rb
|
198
302
|
- lib/helpers.rb
|
@@ -210,14 +314,16 @@ files:
|
|
210
314
|
- lib/views/404.haml
|
211
315
|
- lib/views/406.haml
|
212
316
|
- lib/views/index.haml
|
213
|
-
-
|
317
|
+
- lib/views/layout.haml
|
214
318
|
- spec/db_spec.rb
|
319
|
+
- spec/extensions/mail_spec.rb
|
215
320
|
- spec/integration/integration_spec.rb
|
216
321
|
- spec/ki_spec.rb
|
217
322
|
- spec/model_spec.rb
|
218
323
|
- spec/modules/callbacks_spec.rb
|
219
324
|
- spec/modules/query_interface_spec.rb
|
220
325
|
- spec/modules/restrictions_spec.rb
|
326
|
+
- spec/performance/performance.sh
|
221
327
|
- spec/req_spec.rb
|
222
328
|
- spec/spec_helper.rb
|
223
329
|
- spec/util_spec.rb
|
@@ -236,7 +342,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
342
|
version: '0'
|
237
343
|
segments:
|
238
344
|
- 0
|
239
|
-
hash: -
|
345
|
+
hash: -2680538544156376822
|
240
346
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
347
|
none: false
|
242
348
|
requirements:
|
@@ -245,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
351
|
version: '0'
|
246
352
|
requirements: []
|
247
353
|
rubyforge_project:
|
248
|
-
rubygems_version: 1.8.
|
354
|
+
rubygems_version: 1.8.24
|
249
355
|
signing_key:
|
250
356
|
specification_version: 3
|
251
357
|
summary: Prototyping noSQL RESTful API cloud database
|
@@ -1,34 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../../
|
3
|
-
specs:
|
4
|
-
ki (0.1.2)
|
5
|
-
bson_ext
|
6
|
-
haml
|
7
|
-
mongo
|
8
|
-
rack
|
9
|
-
thin
|
10
|
-
thor
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: https://rubygems.org/
|
14
|
-
specs:
|
15
|
-
bson (1.8.2)
|
16
|
-
bson_ext (1.8.2)
|
17
|
-
bson (~> 1.8.2)
|
18
|
-
daemons (1.1.9)
|
19
|
-
eventmachine (1.0.0)
|
20
|
-
haml (3.1.7)
|
21
|
-
mongo (1.8.2)
|
22
|
-
bson (~> 1.8.2)
|
23
|
-
rack (1.5.2)
|
24
|
-
thin (1.5.0)
|
25
|
-
daemons (>= 1.0.9)
|
26
|
-
eventmachine (>= 0.12.6)
|
27
|
-
rack (>= 1.0.0)
|
28
|
-
thor (0.17.0)
|
29
|
-
|
30
|
-
PLATFORMS
|
31
|
-
ruby
|
32
|
-
|
33
|
-
DEPENDENCIES
|
34
|
-
ki!
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'ki'
|
2
|
-
require 'digest/md5'
|
3
|
-
|
4
|
-
def encrypt s
|
5
|
-
Digest::MD5.hexdigest(s)
|
6
|
-
end
|
7
|
-
|
8
|
-
class User < Ki::Model
|
9
|
-
requires :mail, :password
|
10
|
-
respond_to :json
|
11
|
-
forbid :delete, :update
|
12
|
-
unique :mail
|
13
|
-
|
14
|
-
def before_all
|
15
|
-
params['password'] = encrypt(params['password'])
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Storage < Ki::Model
|
20
|
-
respond_to :json
|
21
|
-
requires :mail
|
22
|
-
|
23
|
-
def before_all
|
24
|
-
ensure_authorization
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def ensure_authorization
|
30
|
-
if params['mail'].nil? || params['password'].nil?
|
31
|
-
raise 'not authorized'
|
32
|
-
end
|
33
|
-
h = { 'mail' => params['mail'], 'password' => encrypt(params['password'])}
|
34
|
-
u = User.find(h)
|
35
|
-
if u.empty?
|
36
|
-
raise 'not authorized'
|
37
|
-
end
|
38
|
-
params.delete['password']
|
39
|
-
end
|
40
|
-
end
|
File without changes
|
data/examples/northpole/Gemfile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
gem 'ki', :path => '../../'
|
@@ -1,33 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../../
|
3
|
-
specs:
|
4
|
-
ki (0.1.1)
|
5
|
-
bson_ext
|
6
|
-
haml
|
7
|
-
mongo
|
8
|
-
rack
|
9
|
-
thin
|
10
|
-
thor
|
11
|
-
|
12
|
-
GEM
|
13
|
-
specs:
|
14
|
-
bson (1.8.2)
|
15
|
-
bson_ext (1.8.2)
|
16
|
-
bson (~> 1.8.2)
|
17
|
-
daemons (1.1.9)
|
18
|
-
eventmachine (1.0.0)
|
19
|
-
haml (3.1.7)
|
20
|
-
mongo (1.8.2)
|
21
|
-
bson (~> 1.8.2)
|
22
|
-
rack (1.5.1)
|
23
|
-
thin (1.5.0)
|
24
|
-
daemons (>= 1.0.9)
|
25
|
-
eventmachine (>= 0.12.6)
|
26
|
-
rack (>= 1.0.0)
|
27
|
-
thor (0.17.0)
|
28
|
-
|
29
|
-
PLATFORMS
|
30
|
-
ruby
|
31
|
-
|
32
|
-
DEPENDENCIES
|
33
|
-
ki!
|
data/examples/northpole/app.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'ki'
|
2
|
-
|
3
|
-
class Test < Ki::Model
|
4
|
-
end
|
5
|
-
|
6
|
-
class Email < Ki::Model
|
7
|
-
include Ki::Mail
|
8
|
-
|
9
|
-
forbid :find, :update, :delete
|
10
|
-
respond_to :json
|
11
|
-
requires :from, :to, :subject, :body
|
12
|
-
|
13
|
-
def after_create
|
14
|
-
send_mail required_attributes
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class Website < Ki::Model
|
19
|
-
forbid :delete, :create, :update
|
20
|
-
|
21
|
-
respond_to :html
|
22
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
.salut hello
|
@@ -1 +0,0 @@
|
|
1
|
-
.salut hello world
|