rack-core-data 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e63796f36c85eb8917cbf7668f9ef07fc2b4491
4
+ data.tar.gz: 0e44e5b7d07f2b8c9496b123db5a31923d8c4c8a
5
+ SHA512:
6
+ metadata.gz: 1d8c67013fa9b53007926de894ad7506169a481692367448029098a2c3903111f473119739792b2e76f8e4717fbf17d1628c7c999876e5995ca275f962d2a7aa
7
+ data.tar.gz: f74a6f031ba2cb8aa97dea8c434b7c586331ae536a7157f2c108d8eeee2d8e56d7b5876ab0f393a829eca3607260390706964137ced89c6c9d5044c5d690eabf
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,44 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-core-data (0.2.0)
5
- activesupport (~> 3.2.6)
4
+ rack-core-data (0.3.0)
5
+ activesupport (~> 3.2)
6
6
  nokogiri (~> 1.4)
7
7
  rack (~> 1.4)
8
- rack-contrib (~> 1.1.0)
9
- sequel (~> 3.37.0)
10
- sinatra (~> 1.3.2)
11
- sinatra-param (~> 0.1.1)
8
+ rack-contrib (~> 1.1)
9
+ sequel (~> 3.37)
10
+ sinatra (~> 1.3)
11
+ sinatra-param (~> 0.1)
12
12
 
13
13
  GEM
14
- remote: http://rubygems.org/
14
+ remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (3.2.12)
17
- i18n (~> 0.6)
16
+ activesupport (3.2.13)
17
+ i18n (= 0.6.1)
18
18
  multi_json (~> 1.0)
19
19
  i18n (0.6.1)
20
- multi_json (1.6.1)
21
- nokogiri (1.5.6)
20
+ multi_json (1.7.2)
21
+ nokogiri (1.5.9)
22
22
  rack (1.5.2)
23
23
  rack-contrib (1.1.0)
24
24
  rack (>= 0.9.1)
25
- rack-protection (1.4.0)
25
+ rack-protection (1.5.0)
26
26
  rack
27
- rake (0.9.2.2)
28
- rspec (0.6.4)
29
- sequel (3.37.0)
30
- sinatra (1.3.5)
31
- rack (~> 1.4)
32
- rack-protection (~> 1.3)
33
- tilt (~> 1.3, >= 1.3.3)
27
+ rake (0.9.6)
28
+ rspec (0.9.4)
29
+ sequel (3.45.0)
30
+ sinatra (1.4.2)
31
+ rack (~> 1.5, >= 1.5.2)
32
+ rack-protection (~> 1.4)
33
+ tilt (~> 1.3, >= 1.3.4)
34
34
  sinatra-param (0.1.2)
35
35
  sinatra (~> 1.3)
36
- tilt (1.3.4)
36
+ tilt (1.3.6)
37
37
 
38
38
  PLATFORMS
39
39
  ruby
40
40
 
41
41
  DEPENDENCIES
42
42
  rack-core-data!
43
- rake (~> 0.9.2)
44
- rspec (~> 0.6.1)
43
+ rake (~> 0.9)
44
+ rspec (~> 0.6)
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module CoreData
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -29,23 +29,6 @@ module Rack
29
29
  end
30
30
 
31
31
  helpers Sinatra::Param
32
-
33
- options '/' do
34
- links = []
35
- model.entities.each do |entity|
36
- links << %{</#{entity.name.downcase.pluralize}>; rel="resource"}
37
- end
38
-
39
- response['Link'] = links.join("\n")
40
-
41
- model.entities.collect{ |entity|
42
- {
43
- name: entity.name,
44
- url: "/#{entity.name.downcase.pluralize}",
45
- columns: entity.attributes.collect(&:name)
46
- }
47
- }.to_json
48
- end
49
32
  end
50
33
 
51
34
  model.entities.each do |entity|
@@ -114,7 +97,16 @@ module Rack
114
97
  end
115
98
  end
116
99
 
117
- create_table unless table_exists?
100
+ if table_exists?
101
+ missing_columns = schema.columns.reject{|c| columns.include?(c[:name])}
102
+ db.alter_table table_name do
103
+ missing_columns.each do |options|
104
+ add_column options.delete(:name), options.delete(:type), options
105
+ end
106
+ end
107
+ else
108
+ create_table
109
+ end
118
110
  end
119
111
 
120
112
  klass.send :define_method, :validate do
@@ -167,7 +159,7 @@ module Rack
167
159
  {errors: record.errors}.to_json
168
160
  end
169
161
  end
170
-
162
+
171
163
  get "/#{klass.table_name}/:id/?" do
172
164
  record = klass[params[:id]] or halt 404
173
165
  {entity.name.downcase => record}.to_json
@@ -183,7 +175,7 @@ module Rack
183
175
  {errors: record.errors}.to_json
184
176
  end
185
177
  end
186
-
178
+
187
179
  delete "/#{klass.table_name}/:id/?" do
188
180
  record = klass[params[:id]] or halt 404
189
181
  if record.destroy
@@ -12,16 +12,16 @@ Gem::Specification.new do |s|
12
12
  s.summary = "Rack::CoreData"
13
13
  s.description = "Automatically generate REST APIs for Core Data models."
14
14
 
15
- s.add_development_dependency "rspec", "~> 0.6.1"
16
- s.add_development_dependency "rake", "~> 0.9.2"
15
+ s.add_development_dependency "rspec", "~> 0.6"
16
+ s.add_development_dependency "rake", "~> 0.9"
17
17
 
18
18
  s.add_dependency "rack", "~> 1.4"
19
- s.add_dependency "rack-contrib", "~> 1.1.0"
19
+ s.add_dependency "rack-contrib", "~> 1.1"
20
20
  s.add_dependency "nokogiri", "~> 1.4"
21
- s.add_dependency "sinatra", "~> 1.3.2"
22
- s.add_dependency "sinatra-param", "~> 0.1.1"
23
- s.add_dependency "sequel", "~> 3.37.0"
24
- s.add_dependency "activesupport", "~> 3.2.6"
21
+ s.add_dependency "sinatra", "~> 1.3"
22
+ s.add_dependency "sinatra-param", "~> 0.1"
23
+ s.add_dependency "sequel", "~> 3.37"
24
+ s.add_dependency "activesupport", "~> 3.2"
25
25
 
26
26
  s.files = Dir["./**/*"].reject { |file| file =~ /\.\/(bin|example|log|pkg|script|spec|test|vendor)/ }
27
27
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,115 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-core-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mattt Thompson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
11
+ date: 2013-03-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &70164102486760 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.6.1
19
+ version: '0.6'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70164102486760
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rake
27
- requirement: &70164102486160 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
- version: 0.9.2
33
+ version: '0.9'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70164102486160
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.9'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: rack
38
- requirement: &70164102485660 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ~>
42
46
  - !ruby/object:Gem::Version
43
47
  version: '1.4'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *70164102485660
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.4'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rack-contrib
49
- requirement: &70164102485160 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
54
- version: 1.1.0
61
+ version: '1.1'
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *70164102485160
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.1'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: nokogiri
60
- requirement: &70164102484640 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
73
  - - ~>
64
74
  - !ruby/object:Gem::Version
65
75
  version: '1.4'
66
76
  type: :runtime
67
77
  prerelease: false
68
- version_requirements: *70164102484640
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.4'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: sinatra
71
- requirement: &70164102484160 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
87
  - - ~>
75
88
  - !ruby/object:Gem::Version
76
- version: 1.3.2
89
+ version: '1.3'
77
90
  type: :runtime
78
91
  prerelease: false
79
- version_requirements: *70164102484160
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: sinatra-param
82
- requirement: &70164102483660 !ruby/object:Gem::Requirement
83
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
84
100
  requirements:
85
101
  - - ~>
86
102
  - !ruby/object:Gem::Version
87
- version: 0.1.1
103
+ version: '0.1'
88
104
  type: :runtime
89
105
  prerelease: false
90
- version_requirements: *70164102483660
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.1'
91
111
  - !ruby/object:Gem::Dependency
92
112
  name: sequel
93
- requirement: &70164102483100 !ruby/object:Gem::Requirement
94
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
95
114
  requirements:
96
115
  - - ~>
97
116
  - !ruby/object:Gem::Version
98
- version: 3.37.0
117
+ version: '3.37'
99
118
  type: :runtime
100
119
  prerelease: false
101
- version_requirements: *70164102483100
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '3.37'
102
125
  - !ruby/object:Gem::Dependency
103
126
  name: activesupport
104
- requirement: &70164102482580 !ruby/object:Gem::Requirement
105
- none: false
127
+ requirement: !ruby/object:Gem::Requirement
106
128
  requirements:
107
129
  - - ~>
108
130
  - !ruby/object:Gem::Version
109
- version: 3.2.6
131
+ version: '3.2'
110
132
  type: :runtime
111
133
  prerelease: false
112
- version_requirements: *70164102482580
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: '3.2'
113
139
  description: Automatically generate REST APIs for Core Data models.
114
140
  email: m@mattt.me
115
141
  executables: []
@@ -130,32 +156,25 @@ files:
130
156
  - ./README.md
131
157
  homepage: http://mattt.me
132
158
  licenses: []
159
+ metadata: {}
133
160
  post_install_message:
134
161
  rdoc_options: []
135
162
  require_paths:
136
163
  - lib
137
164
  required_ruby_version: !ruby/object:Gem::Requirement
138
- none: false
139
165
  requirements:
140
166
  - - ! '>='
141
167
  - !ruby/object:Gem::Version
142
168
  version: '0'
143
- segments:
144
- - 0
145
- hash: 454791044675933494
146
169
  required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
170
  requirements:
149
171
  - - ! '>='
150
172
  - !ruby/object:Gem::Version
151
173
  version: '0'
152
- segments:
153
- - 0
154
- hash: 454791044675933494
155
174
  requirements: []
156
175
  rubyforge_project:
157
- rubygems_version: 1.8.15
176
+ rubygems_version: 2.0.3
158
177
  signing_key:
159
- specification_version: 3
178
+ specification_version: 4
160
179
  summary: Rack::CoreData
161
180
  test_files: []