groovy 0.6.6 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc2a1c85a6d482813b6ec9de3616e2c369206a419008b55600194f930bc56416
4
- data.tar.gz: 968d357fb616dcfa9761f1ba93843678263d69ff38af2ec342ee9430bbf7ccc6
3
+ metadata.gz: dc2f1ef55cf22504bc95fd3a143108b0d7097816274606cb557851c588c7ba02
4
+ data.tar.gz: 8881018c1036dab4257291bde59c8797317ba1568cafcb7d87ac12f8b7cf9499
5
5
  SHA512:
6
- metadata.gz: 7df3be7e3c43b5d48be0b563bb156da21a8992c97be9392b91b939a1943920f0587ee01ff4521c983b8524beb27b0ecd0eede630aff7c16e42e80e004ec42a46
7
- data.tar.gz: e9a7fd6abc2dda7d902cd07d091f1fafbfe053e229a730754f0170dc04aa3326fbbef4a9646f3d6788cf896b7b72e9c0c10f0c010a4d17bd1e99aa97222fcda9
6
+ metadata.gz: 63e936c9c4920be9e27d3567acc575cf75900fcd5be9786b55f171f068dec19ab4b618ce22367ae7856c30d602517574a61fbc2fef37e36dfc62a9f9d2b7bbf6
7
+ data.tar.gz: ee9f1292bb74220dd40acc1058151d4ca6f390e94b4f1b6e9c13561d6dfb1aa9a5df774d858a66695906478a70a8ba49c9ce368585496223287ad67a8276f563
data/example/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
+
2
3
  gem 'rack'
4
+ gem 'puma'
3
5
  gem 'groovy', path: '..'
data/example/Gemfile.lock CHANGED
@@ -1,43 +1,47 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- groovy (0.4.6)
5
- rroonga (= 9.0.3)
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.3)
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
- groonga-command (1.5.0)
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 (4.1.0)
24
- io-like (0.3.1)
25
- json (2.3.1)
22
+ hashie (5.0.0)
23
+ json (2.6.3)
26
24
  json-stream (0.2.1)
27
- pkg-config (1.4.4)
28
- rack (2.0.6)
29
- rroonga (9.0.3)
30
- archive-zip
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
- ruby
39
+ x86_64-linux
37
40
 
38
41
  DEPENDENCIES
39
42
  groovy!
43
+ puma
40
44
  rack
41
45
 
42
46
  BUNDLED WITH
43
- 1.17.3
47
+ 2.4.10
data/example/config.ru CHANGED
@@ -11,7 +11,7 @@ Place.last.delete
11
11
 
12
12
  app = Proc.new do |env|
13
13
  body = Place.all.collect(&:as_json).inspect
14
- [200, { 'Content-Type' => 'text/plain' }, [body]]
14
+ [200, { 'Content-Type' => 'application/json' }, [body]]
15
15
  end
16
16
 
17
17
  use Groovy::MemoryPoolMiddleware
data/example/relations.rb CHANGED
@@ -2,7 +2,7 @@ require 'bundler/setup'
2
2
  require 'groovy'
3
3
 
4
4
  Groovy.open('./db/2020', :current)
5
- # Groovy.open('./db/2021', :next)
5
+ Groovy.open('./db/2021', :next)
6
6
 
7
7
  module Groovy::Model::ClassMethods
8
8
  def context_name
@@ -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
- code, headers, body = @app.call(env)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Groovy
2
4
 
3
5
  class Query
@@ -1,3 +1,3 @@
1
1
  module Groovy
2
- VERSION = '0.6.6'.freeze
2
+ VERSION = '0.6.8'.freeze
3
3
  end
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.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-02 00:00:00.000000000 Z
11
+ date: 2023-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rroonga