yequel 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/yequel.rb +404 -0
- data/lib/yequel/version.rb +3 -0
- data/yequel.gemspec +35 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2511fbb2588d2ac3bcb27a3673b3544622ce6405
|
4
|
+
data.tar.gz: c101bd2566510430fd1c5613fdeb2356a2035fb6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ec47543474ac52b2c65eb8e7cadb835ce877d0914e36bee6d185641f572857a1679375ad55a03057224a59819e20644251f8e10a93e2fc70c250eb2f78cf14f3
|
7
|
+
data.tar.gz: 72eb89062430d69f1bc98b96f387af3431220aa5d08e9130db34f35d15414eb90e492c7ab44cf27f87b32a1d7b038f7c2ebd60286178eefa6f996d9e2fbfa2c7
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at TODO: Write your email address. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 TODO: Write your name
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Yequel
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yequel`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'yequel'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install yequel
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development / Testing
|
28
|
+
|
29
|
+
This project depends YAML::Store files to act as relational tables. There will be one YAML::Store file for each table. The key requirement is that there is a database sub-directory in your target application environment:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ mkdir /db
|
33
|
+
```
|
34
|
+
|
35
|
+
In order to test the gem, refer to the file called '/test/test_helpers.rb' and select a set of commands to test. Here is a sample set of commands:
|
36
|
+
```
|
37
|
+
Artist = Yequel::Model.new('test')
|
38
|
+
|
39
|
+
Artist.insert(:id=>1, :name=>"YJ")
|
40
|
+
Artist.insert(:id=>2, :name=>"AS")
|
41
|
+
Artist.insert(:id=>3, :name=>"AS")
|
42
|
+
|
43
|
+
Artist[1]
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yequel. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
50
|
+
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
55
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "yequel"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/yequel.rb
ADDED
@@ -0,0 +1,404 @@
|
|
1
|
+
require "yequel/version"
|
2
|
+
|
3
|
+
module Yequel
|
4
|
+
|
5
|
+
require 'yaml/store'
|
6
|
+
|
7
|
+
require 'hash_dot'
|
8
|
+
require 'will_paginate/array'
|
9
|
+
|
10
|
+
class Model
|
11
|
+
attr_accessor :name, :rarray #, :rkeys
|
12
|
+
|
13
|
+
Hash.use_dot_syntax = true
|
14
|
+
|
15
|
+
# Initialize the model object. Provides a wrapper around the dataset
|
16
|
+
# Each table is created as unique class, and an instance is created
|
17
|
+
#
|
18
|
+
# Example:
|
19
|
+
# class Artists < Yequel::Model
|
20
|
+
# end
|
21
|
+
# Artist=Artists.new
|
22
|
+
#
|
23
|
+
def initialize(name)
|
24
|
+
@name = name
|
25
|
+
load
|
26
|
+
end
|
27
|
+
|
28
|
+
# Loads the dataset with the name provided from initialization
|
29
|
+
# Method is also used to refresh data after a dataset action
|
30
|
+
# YAML::Store data will be loaded into a hash image (:dshash) that
|
31
|
+
# is accessible using the :id number as a key
|
32
|
+
# Hash will be converted to a Array of hashed records to support
|
33
|
+
# querying of the dataset
|
34
|
+
#
|
35
|
+
# Example:
|
36
|
+
# load
|
37
|
+
def load
|
38
|
+
#p 'loading ...'
|
39
|
+
#p @name
|
40
|
+
@rarray = Array.new
|
41
|
+
begin
|
42
|
+
dshash = YAML.load_file('db/'+@name+'.store')
|
43
|
+
#p dshash
|
44
|
+
#@rkeys = Array.new
|
45
|
+
#p 'loading ...'
|
46
|
+
dshash.each {|k,v| # converts strings into symbols
|
47
|
+
cid = dshash[k]["id"]
|
48
|
+
next if cid < 1 # do not transform if id < 1
|
49
|
+
#@rkeys << k
|
50
|
+
rhash = Hash.new
|
51
|
+
v.each {|k2,v2|
|
52
|
+
#p k2
|
53
|
+
#p v2
|
54
|
+
rhash[k2.to_sym] = v2
|
55
|
+
}
|
56
|
+
@rarray << rhash
|
57
|
+
}
|
58
|
+
rescue
|
59
|
+
p 'no file now'
|
60
|
+
self.insert({:id=>0})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def store
|
65
|
+
dshash = Hash.new
|
66
|
+
@rarray.each { |item|
|
67
|
+
outhash = Hash.new
|
68
|
+
item.each { |k,v| outhash[k.to_s] = v}
|
69
|
+
dshash[item[:id]]=outhash
|
70
|
+
}
|
71
|
+
File.open('db/'+@name+'.store', 'w') do |out| # To file
|
72
|
+
YAML.dump(dshash, out)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Insert is an action command and adds new records to the dataset
|
77
|
+
# All data is stored in string format
|
78
|
+
# An argument error is thrown if the record key is already used
|
79
|
+
#
|
80
|
+
# Examples:
|
81
|
+
# Artist.insert(:id=>1, :name=>"YJ")
|
82
|
+
def insert (args)
|
83
|
+
#p @name
|
84
|
+
#p '.......'
|
85
|
+
p args
|
86
|
+
p self.rarray
|
87
|
+
if self.rarray.get(args[:id]).nil?
|
88
|
+
model={:mod_name=>@name}
|
89
|
+
p self
|
90
|
+
#self.rarray << args.merge(model)
|
91
|
+
self.rarray << args
|
92
|
+
self.store
|
93
|
+
else
|
94
|
+
raise ArgumentError, 'Cannot insert - id already exists', caller
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Update is an action command and updates existing records
|
99
|
+
# An argument error is thrown if the record key does not exist
|
100
|
+
#
|
101
|
+
# Examples:
|
102
|
+
# Artist.update(:id=>1, :name=>"YJM")
|
103
|
+
def update (args)
|
104
|
+
p 'updating ...'
|
105
|
+
if self.rarray.get(args[:id])
|
106
|
+
key = args[:id] - 1
|
107
|
+
@rarray[key].merge!(args)
|
108
|
+
else
|
109
|
+
raise ArgumentError, 'Cannot update - id not found', caller
|
110
|
+
end
|
111
|
+
self.store
|
112
|
+
end
|
113
|
+
|
114
|
+
# Delete is an action command that deletes a single record
|
115
|
+
# An argument error is thrown if the record key does not exist
|
116
|
+
#
|
117
|
+
# Examples:
|
118
|
+
# Artist.delete(4)
|
119
|
+
def delete(key)
|
120
|
+
result = @rarray.get(key)
|
121
|
+
if result
|
122
|
+
@rarray.delete(result)
|
123
|
+
store
|
124
|
+
else
|
125
|
+
raise ArgumentError,'Cannot delete - no matching id', caller
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# First is query command that shows the first record in the dataset
|
130
|
+
#
|
131
|
+
# Examples:
|
132
|
+
# Artist.first
|
133
|
+
# Artist.first(:name=>'AS')
|
134
|
+
|
135
|
+
def first(options ={})
|
136
|
+
if options.length > 0
|
137
|
+
@rarray.where(options).first.merge!({:mod_name=>self.name})
|
138
|
+
else
|
139
|
+
@rarray.first.merge!({:mod_name=>self.name})
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Last is query command that shows the last record in the dataset
|
144
|
+
#
|
145
|
+
# Examples:
|
146
|
+
# Artist.last
|
147
|
+
def last
|
148
|
+
@rarray.reverse.first
|
149
|
+
end
|
150
|
+
|
151
|
+
# All is query command that shows all records in the dataset
|
152
|
+
#
|
153
|
+
# Examples:
|
154
|
+
# Artist.all
|
155
|
+
def all
|
156
|
+
@rarray
|
157
|
+
end
|
158
|
+
|
159
|
+
# Count is query command that counts the records in the dataset
|
160
|
+
#
|
161
|
+
# Examples:
|
162
|
+
# Artist.count
|
163
|
+
def count
|
164
|
+
@rarray.length
|
165
|
+
end
|
166
|
+
|
167
|
+
# [] is query command that shows a record base on the :id key
|
168
|
+
#
|
169
|
+
# Examples:
|
170
|
+
# Artist[1]
|
171
|
+
def[](key)
|
172
|
+
#k = @rkeys.index(key)
|
173
|
+
#@rarray[k]
|
174
|
+
p key
|
175
|
+
#p self.rarray
|
176
|
+
self.rarray.get(key).merge!({:mod_name=>self.name})
|
177
|
+
end
|
178
|
+
|
179
|
+
# Order is a query command that orders an array based on a key
|
180
|
+
# This command is chainable
|
181
|
+
def order(key)
|
182
|
+
#newarray=Array.new
|
183
|
+
#@dataset.values.each { |item| newarray << item.varray}
|
184
|
+
#newarray.order(key)
|
185
|
+
@rarray.order(key)
|
186
|
+
end
|
187
|
+
|
188
|
+
# Where is a query command that filters the array
|
189
|
+
# This command is chainable
|
190
|
+
def where(*args)
|
191
|
+
@rarray.where(*args)
|
192
|
+
end
|
193
|
+
|
194
|
+
#end
|
195
|
+
|
196
|
+
#class Array < Array
|
197
|
+
#end
|
198
|
+
|
199
|
+
class Hash < Hash
|
200
|
+
Hash.use_dot_syntax = true
|
201
|
+
include ObjectSpace
|
202
|
+
|
203
|
+
def save
|
204
|
+
p self
|
205
|
+
p self[:mod_name]
|
206
|
+
p 'saving ...'
|
207
|
+
object = nil
|
208
|
+
ObjectSpace.each_object(Model) {|obj| object=obj if object.nil? and obj.name==self[:mod_name]}
|
209
|
+
p object
|
210
|
+
p object.name
|
211
|
+
p '++++++++'
|
212
|
+
object.update(self)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
class Array < Array
|
217
|
+
|
218
|
+
def method_missing(method, *args)
|
219
|
+
p 'refactoring'
|
220
|
+
puts "Method: #{method} Args: (#{args.join(', ')})"
|
221
|
+
p self
|
222
|
+
end
|
223
|
+
|
224
|
+
def get(key)
|
225
|
+
#self.each { |item| p item}
|
226
|
+
#p 'getting'
|
227
|
+
#p key
|
228
|
+
#p self
|
229
|
+
result = Array.new
|
230
|
+
#self.each { |item| p item[:id]}
|
231
|
+
self.each { |item| result<<item if key.to_i==item[:id]}
|
232
|
+
result[0]
|
233
|
+
end
|
234
|
+
|
235
|
+
# Order is a query command that orders an array based on a key
|
236
|
+
# This command is chainable
|
237
|
+
def order(key)
|
238
|
+
newkeys=Hash.new
|
239
|
+
self.each { |item| newkeys[item[key].to_s+"|"+item[:id].to_s]=item[:id]}
|
240
|
+
#newkeys=newkeys.sort
|
241
|
+
#p newkeys.sort
|
242
|
+
newarray=Array.new
|
243
|
+
#newkeys.sort.each { |ary| p ary}
|
244
|
+
newkeys.sort.each { |ary| newarray << self.get(ary[1])}
|
245
|
+
newarray
|
246
|
+
end
|
247
|
+
|
248
|
+
# Where is a query command that filters the array
|
249
|
+
# This command is chainable
|
250
|
+
# There are many variations in the selection criteria
|
251
|
+
#
|
252
|
+
# Examples:
|
253
|
+
# Artist.where(:name => 'AS')
|
254
|
+
# Artist.where('id > 0')
|
255
|
+
# Artist.where('id <= 2')
|
256
|
+
# Artist.where('id >= 2')
|
257
|
+
# Artist.where('id != 1')
|
258
|
+
# Artist.where('id = ?', 1)
|
259
|
+
# Artist.where(:id => 2).where(:name => 'AS')
|
260
|
+
def where(*args)
|
261
|
+
#p 'in where'
|
262
|
+
#p args.length
|
263
|
+
|
264
|
+
flatargs = args[0]
|
265
|
+
if flatargs.class != String # operations are identities
|
266
|
+
#p 'hshing ....'
|
267
|
+
hsh = flatargs
|
268
|
+
#p hsh
|
269
|
+
key = hsh.keys[0] # required key
|
270
|
+
val = hsh.values[0] # required value
|
271
|
+
atype = 1
|
272
|
+
atype = 4 if val.class == Array
|
273
|
+
else
|
274
|
+
if flatargs.index(" ")
|
275
|
+
#p 'splitting ...'
|
276
|
+
atype = 2
|
277
|
+
phrase = flatargs.split(' ')
|
278
|
+
key = phrase[0].to_sym
|
279
|
+
oper = phrase[1]
|
280
|
+
val = phrase[2]
|
281
|
+
atype = 3 if oper == '!='
|
282
|
+
if args.length == 2
|
283
|
+
val = args[1]
|
284
|
+
atype = 1
|
285
|
+
end
|
286
|
+
val = val.to_i # if val.match(/\A[+-]?\d+?(\.\d+)?\Z/)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
#p ':::::::::::::::::'
|
291
|
+
#p flatargs
|
292
|
+
#p phrase
|
293
|
+
#p key
|
294
|
+
#p oper
|
295
|
+
#p val
|
296
|
+
|
297
|
+
selected = Array.new # now run the query
|
298
|
+
|
299
|
+
# original = self.dsarray # this is different
|
300
|
+
original = self
|
301
|
+
|
302
|
+
original.each { |item|
|
303
|
+
item.each {|k, v|
|
304
|
+
#p 'querying ...'
|
305
|
+
#item[:super_name] = self.name
|
306
|
+
selected << item if atype == 1 and key == k and val == v
|
307
|
+
selected << item if atype == 3 and key == k and val != v
|
308
|
+
if atype == 2 and key == k # handle quoted expression
|
309
|
+
if oper == '>' and v > val
|
310
|
+
selected << item
|
311
|
+
end
|
312
|
+
if oper == '<' and v < val
|
313
|
+
selected << item
|
314
|
+
end
|
315
|
+
if oper == '<=' and v <= val
|
316
|
+
selected << item
|
317
|
+
end
|
318
|
+
if oper == '>=' and v >= val
|
319
|
+
selected << item
|
320
|
+
end
|
321
|
+
end
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
325
|
+
#p selected
|
326
|
+
#p selected.class
|
327
|
+
#p '+++++++++++++++++++++'
|
328
|
+
selected
|
329
|
+
|
330
|
+
end
|
331
|
+
|
332
|
+
def reverse
|
333
|
+
if self.length > 0
|
334
|
+
result = Array.new
|
335
|
+
i = self.length-1
|
336
|
+
while i > -1
|
337
|
+
result << self[i]
|
338
|
+
i = i - 1
|
339
|
+
end
|
340
|
+
result
|
341
|
+
else
|
342
|
+
self
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
# Page is a query command that is used to support will_paginate
|
347
|
+
# This command is used at the end of query chain
|
348
|
+
#
|
349
|
+
# Examples:
|
350
|
+
# Artist.where('id > 0').page(1, 15)
|
351
|
+
def page(page, per_page=10)
|
352
|
+
page = (page || 1).to_i
|
353
|
+
self.paginate(:page => page, :per_page => per_page)
|
354
|
+
end
|
355
|
+
|
356
|
+
# select_map is a method that extracts the values from the array
|
357
|
+
# The result is an array for the argument (i.e., hash key)
|
358
|
+
# Result is returned in the order of the source array
|
359
|
+
#
|
360
|
+
# Examples:
|
361
|
+
# Artist.where('id > 0').select_map(:name)
|
362
|
+
def select_map(arg)
|
363
|
+
mapped = Array.new
|
364
|
+
if self.length > 0
|
365
|
+
self.each{ |k| # the each object changes
|
366
|
+
if k[arg]
|
367
|
+
mapped << k[arg]
|
368
|
+
else
|
369
|
+
mapped = [] # key is not valid
|
370
|
+
end
|
371
|
+
}
|
372
|
+
end
|
373
|
+
mapped
|
374
|
+
end
|
375
|
+
|
376
|
+
end # end of Array
|
377
|
+
|
378
|
+
end # end of Model
|
379
|
+
|
380
|
+
#-----------------------------------------------------------------------
|
381
|
+
end # end of module
|
382
|
+
|
383
|
+
|
384
|
+
#Artist = Model.new
|
385
|
+
#Artist = Yequel::Model.new('artists')
|
386
|
+
|
387
|
+
#p Artist
|
388
|
+
#Artist.insert(:id=>1, :name=>"YJ", :level=>1)
|
389
|
+
#p Artist.count
|
390
|
+
#Artist.insert(:id=>2, :name=>"AS", :level=>1)
|
391
|
+
#p Artist.count
|
392
|
+
#Artist.insert(:id=>3, :name=>"AS", :level=>3)
|
393
|
+
#p Artist
|
394
|
+
#p Artist.count
|
395
|
+
#p Artist.all
|
396
|
+
#p Artist.first
|
397
|
+
#p Artist.last
|
398
|
+
#p Artist[2]
|
399
|
+
#p Artist[2][:name]='xxx'
|
400
|
+
#p Artist[2]
|
401
|
+
#Artist.update(:id=>2, :name=>"XXXXX")
|
402
|
+
#p Artist
|
403
|
+
#p Artist.order(:name)
|
404
|
+
#Artist.where(:id=>1)
|
data/yequel.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'yequel/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "yequel"
|
8
|
+
spec.version = Yequel::VERSION
|
9
|
+
spec.authors = ["Al Kivi"]
|
10
|
+
spec.email = ["al.kivi@vizi.ca"]
|
11
|
+
|
12
|
+
spec.summary = %q{Provides a sequel style ORM layer for YAML::Store}
|
13
|
+
spec.description = %q{Yequel provides a sequel style with basic features to access YAML::Store tables. Its target audience is application developers who require light weight alternative to SQL databases.}
|
14
|
+
spec.homepage = "https://rubygems.org/profiles/vizi_master"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
#spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
#raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_dependency "hash_dot"
|
33
|
+
spec.add_dependency "will_paginate"
|
34
|
+
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yequel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Al Kivi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hash_dot
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: will_paginate
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Yequel provides a sequel style with basic features to access YAML::Store
|
70
|
+
tables. Its target audience is application developers who require light weight
|
71
|
+
alternative to SQL databases.
|
72
|
+
email:
|
73
|
+
- al.kivi@vizi.ca
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".travis.yml"
|
80
|
+
- CODE_OF_CONDUCT.md
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/yequel.rb
|
88
|
+
- lib/yequel/version.rb
|
89
|
+
- yequel.gemspec
|
90
|
+
homepage: https://rubygems.org/profiles/vizi_master
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.2.3
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Provides a sequel style ORM layer for YAML::Store
|
114
|
+
test_files: []
|