groovy 0.6.6 → 0.6.8
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 +4 -4
- data/example/Gemfile +2 -0
- data/example/Gemfile.lock +19 -15
- data/example/config.ru +1 -1
- data/example/relations.rb +1 -1
- data/lib/groovy/middleware.rb +2 -2
- data/lib/groovy/model.rb +7 -3
- data/lib/groovy/query.rb +2 -0
- data/lib/groovy/version.rb +1 -1
- data/spec/model_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc2f1ef55cf22504bc95fd3a143108b0d7097816274606cb557851c588c7ba02
|
4
|
+
data.tar.gz: 8881018c1036dab4257291bde59c8797317ba1568cafcb7d87ac12f8b7cf9499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e936c9c4920be9e27d3567acc575cf75900fcd5be9786b55f171f068dec19ab4b618ce22367ae7856c30d602517574a61fbc2fef37e36dfc62a9f9d2b7bbf6
|
7
|
+
data.tar.gz: ee9f1292bb74220dd40acc1058151d4ca6f390e94b4f1b6e9c13561d6dfb1aa9a5df774d858a66695906478a70a8ba49c9ce368585496223287ad67a8276f563
|
data/example/Gemfile
CHANGED
data/example/Gemfile.lock
CHANGED
@@ -1,43 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
groovy (0.
|
5
|
-
rroonga (=
|
4
|
+
groovy (0.6.7)
|
5
|
+
rroonga (= 12.1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
archive-zip (0.12.0)
|
11
|
-
io-like (~> 0.3.0)
|
12
10
|
gqtp (1.0.7)
|
13
|
-
groonga-client (0.6.
|
11
|
+
groonga-client (0.6.8)
|
14
12
|
gqtp (>= 1.0.4)
|
15
13
|
groonga-command (>= 1.4.7)
|
16
14
|
groonga-command-parser (>= 1.1.0)
|
17
15
|
hashie
|
18
|
-
|
16
|
+
rexml
|
17
|
+
groonga-command (1.5.3)
|
19
18
|
json
|
20
19
|
groonga-command-parser (1.1.4)
|
21
20
|
groonga-command (>= 1.4.0)
|
22
21
|
json-stream
|
23
|
-
hashie (
|
24
|
-
|
25
|
-
json (2.3.1)
|
22
|
+
hashie (5.0.0)
|
23
|
+
json (2.6.3)
|
26
24
|
json-stream (0.2.1)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
native-package-installer (1.1.8)
|
26
|
+
nio4r (2.5.9)
|
27
|
+
pkg-config (1.5.6)
|
28
|
+
puma (6.4.0)
|
29
|
+
nio4r (~> 2.0)
|
30
|
+
rack (2.2.8)
|
31
|
+
rexml (3.2.6)
|
32
|
+
rroonga (12.1.0)
|
31
33
|
groonga-client (>= 0.0.3)
|
32
34
|
json
|
35
|
+
native-package-installer
|
33
36
|
pkg-config
|
34
37
|
|
35
38
|
PLATFORMS
|
36
|
-
|
39
|
+
x86_64-linux
|
37
40
|
|
38
41
|
DEPENDENCIES
|
39
42
|
groovy!
|
43
|
+
puma
|
40
44
|
rack
|
41
45
|
|
42
46
|
BUNDLED WITH
|
43
|
-
|
47
|
+
2.4.10
|
data/example/config.ru
CHANGED
data/example/relations.rb
CHANGED
data/lib/groovy/middleware.rb
CHANGED
@@ -6,9 +6,9 @@ module Groovy
|
|
6
6
|
|
7
7
|
def call(env)
|
8
8
|
Groovy.contexts.each { |name, ctx| ctx.push_memory_pool }
|
9
|
-
|
9
|
+
@app.call(env)
|
10
|
+
ensure
|
10
11
|
Groovy.contexts.each { |name, ctx| ctx.pop_memory_pool }
|
11
|
-
[code, headers, body]
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/lib/groovy/model.rb
CHANGED
@@ -353,10 +353,16 @@ module Groovy
|
|
353
353
|
@attributes
|
354
354
|
end
|
355
355
|
|
356
|
+
alias_method :attrs, :attributes
|
357
|
+
|
356
358
|
def inspect
|
357
359
|
"#<#{self.class.name} id:#{id.inspect} attributes:[#{self.class.attribute_names.join(', ')}]>"
|
358
360
|
end
|
359
361
|
|
362
|
+
def dump
|
363
|
+
pp attributes; nil
|
364
|
+
end
|
365
|
+
|
360
366
|
def new_record?
|
361
367
|
id.nil?
|
362
368
|
# _key.nil?
|
@@ -474,7 +480,6 @@ module Groovy
|
|
474
480
|
|
475
481
|
private
|
476
482
|
|
477
|
-
|
478
483
|
def get_record_attribute(key)
|
479
484
|
return if record.nil?
|
480
485
|
val = record[key]
|
@@ -511,7 +516,6 @@ module Groovy
|
|
511
516
|
end
|
512
517
|
end
|
513
518
|
|
514
|
-
|
515
519
|
def set_ref(name, obj, from_foreign = false)
|
516
520
|
# puts "Setting ref #{name} -> #{obj} (#{obj.class})"
|
517
521
|
|
@@ -569,7 +573,7 @@ module Groovy
|
|
569
573
|
# puts "Updating #{key} from #{values[0]} to #{values[1]}"
|
570
574
|
record[key] = values.last
|
571
575
|
end
|
572
|
-
self.class.set_timestamp(record, :updated_at)
|
576
|
+
self.class.set_timestamp(record, :updated_at) unless changes[:updated_at]
|
573
577
|
changes = {}
|
574
578
|
update_foreign_refs
|
575
579
|
fire_callbacks(:after_update)
|
data/lib/groovy/query.rb
CHANGED
data/lib/groovy/version.rb
CHANGED
data/spec/model_spec.rb
CHANGED
@@ -123,6 +123,21 @@ describe Groovy::Model do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
describe '#save' do
|
126
|
+
|
127
|
+
it 'sets created_at/updated_at timestamps when necesssary' do
|
128
|
+
time = Time.parse('2012-12-12')
|
129
|
+
allow(Time).to receive(:now).and_return(time)
|
130
|
+
prod = TestProduct.create!(name: 'A product', price: 100)
|
131
|
+
expect(prod.created_at).to eq(time)
|
132
|
+
expect(prod.updated_at).to eq(time)
|
133
|
+
|
134
|
+
another_time = Time.parse('2024-12-12')
|
135
|
+
prod.updated_at = another_time
|
136
|
+
prod.save
|
137
|
+
|
138
|
+
expect(prod.reload.created_at).to eq(time)
|
139
|
+
expect(prod.updated_at).to eq(another_time)
|
140
|
+
end
|
126
141
|
end
|
127
142
|
|
128
143
|
describe '#delete' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groovy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rroonga
|