rails_dictionary 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3cc435df2a7cdf214af4e1843755b3c56b56edc2680fe644a8f38a991236567
4
- data.tar.gz: 573815dc3115fc14232cbf0cca60c2fd3721f4676ff68a87541abf465a68f1f1
3
+ metadata.gz: dcf4185af21ff1e6ebe6ed0e6073f2ac8fb8a9caa884c988ef1910a53a30cdbe
4
+ data.tar.gz: 23bb42965b174ca7320f789e681ec33007cbd4e2091d6db4275cbf6a8b6fdff8
5
5
  SHA512:
6
- metadata.gz: cb51afd93704440a426dee3e366ca80912c578be74836466afe7d3d567fd5880fff2fa99de4d9dd0f9fc988566e96b34be0e0ef2498ac173ae85232fa71f835f
7
- data.tar.gz: 04c1f6992583f8b9d76675d912a4fb9cc5068b1254d928fc07ad92bb77df616d212d8d4041fc3563b313da1abbe6a9f52a2343e411992e3d595987525d9f560b
6
+ metadata.gz: ce8dbd37b0f3b2316bba612c9a9a5decc627a1038e08c2d03237713c277135c2c5221a56b3e0e0f286310a4891521d7f3667c6f2b1450f8e36b9061b349ad226
7
+ data.tar.gz: a283f4abc71b97719b3d5bb5549f2956e6d1f6dad774d220501d1e60162edb46881c0dbd254bcf8e549114f4fd5f13229ee0ef106a770ef7f57cc097221f05d2
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
1
  pkg/
2
2
  .git/
3
- .gitignore
4
- Gemfile.lock
5
3
  tmp/*
6
- .idea/
4
+ .idea/
5
+ .byebug_history
6
+ log/
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 0.2.4
2
+ Support Rails7
1
3
  0.2
2
4
  Add Support For Rails4
3
5
 
data/Gemfile CHANGED
@@ -4,8 +4,8 @@ source "http://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  group :development,:test do
7
- gem 'rspec'
8
- gem 'byebug'
9
- gem "rspec-rails"
7
+ gem 'rails', '~> 7.0'
8
+ gem 'pry-byebug'
9
+ gem "rspec-rails", '5.1.0'
10
10
  gem 'sqlite3'
11
11
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,193 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_dictionary (0.2.3)
5
+ rails (> 4.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actioncable (7.0.2.2)
11
+ actionpack (= 7.0.2.2)
12
+ activesupport (= 7.0.2.2)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (7.0.2.2)
16
+ actionpack (= 7.0.2.2)
17
+ activejob (= 7.0.2.2)
18
+ activerecord (= 7.0.2.2)
19
+ activestorage (= 7.0.2.2)
20
+ activesupport (= 7.0.2.2)
21
+ mail (>= 2.7.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.2.2)
26
+ actionpack (= 7.0.2.2)
27
+ actionview (= 7.0.2.2)
28
+ activejob (= 7.0.2.2)
29
+ activesupport (= 7.0.2.2)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ rails-dom-testing (~> 2.0)
35
+ actionpack (7.0.2.2)
36
+ actionview (= 7.0.2.2)
37
+ activesupport (= 7.0.2.2)
38
+ rack (~> 2.0, >= 2.2.0)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (7.0.2.2)
43
+ actionpack (= 7.0.2.2)
44
+ activerecord (= 7.0.2.2)
45
+ activestorage (= 7.0.2.2)
46
+ activesupport (= 7.0.2.2)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.0.2.2)
50
+ activesupport (= 7.0.2.2)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.4)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
+ activejob (7.0.2.2)
56
+ activesupport (= 7.0.2.2)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.0.2.2)
59
+ activesupport (= 7.0.2.2)
60
+ activerecord (7.0.2.2)
61
+ activemodel (= 7.0.2.2)
62
+ activesupport (= 7.0.2.2)
63
+ activestorage (7.0.2.2)
64
+ actionpack (= 7.0.2.2)
65
+ activejob (= 7.0.2.2)
66
+ activerecord (= 7.0.2.2)
67
+ activesupport (= 7.0.2.2)
68
+ marcel (~> 1.0)
69
+ mini_mime (>= 1.1.0)
70
+ activesupport (7.0.2.2)
71
+ concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ i18n (>= 1.6, < 2)
73
+ minitest (>= 5.1)
74
+ tzinfo (~> 2.0)
75
+ builder (3.2.4)
76
+ byebug (11.0.1)
77
+ coderay (1.1.2)
78
+ concurrent-ruby (1.1.9)
79
+ crass (1.0.6)
80
+ diff-lcs (1.5.0)
81
+ digest (3.1.0)
82
+ erubi (1.10.0)
83
+ globalid (1.0.0)
84
+ activesupport (>= 5.0)
85
+ i18n (1.10.0)
86
+ concurrent-ruby (~> 1.0)
87
+ io-wait (0.2.1)
88
+ loofah (2.14.0)
89
+ crass (~> 1.0.2)
90
+ nokogiri (>= 1.5.9)
91
+ mail (2.7.1)
92
+ mini_mime (>= 0.1.1)
93
+ marcel (1.0.2)
94
+ method_source (0.9.2)
95
+ mini_mime (1.1.2)
96
+ mini_portile2 (2.8.0)
97
+ minitest (5.15.0)
98
+ net-imap (0.2.3)
99
+ digest
100
+ net-protocol
101
+ strscan
102
+ net-pop (0.1.1)
103
+ digest
104
+ net-protocol
105
+ timeout
106
+ net-protocol (0.1.2)
107
+ io-wait
108
+ timeout
109
+ net-smtp (0.3.1)
110
+ digest
111
+ net-protocol
112
+ timeout
113
+ nio4r (2.5.8)
114
+ nokogiri (1.13.3)
115
+ mini_portile2 (~> 2.8.0)
116
+ racc (~> 1.4)
117
+ pry (0.12.2)
118
+ coderay (~> 1.1.0)
119
+ method_source (~> 0.9.0)
120
+ pry-byebug (3.7.0)
121
+ byebug (~> 11.0)
122
+ pry (~> 0.10)
123
+ racc (1.6.0)
124
+ rack (2.2.3)
125
+ rack-test (1.1.0)
126
+ rack (>= 1.0, < 3)
127
+ rails (7.0.2.2)
128
+ actioncable (= 7.0.2.2)
129
+ actionmailbox (= 7.0.2.2)
130
+ actionmailer (= 7.0.2.2)
131
+ actionpack (= 7.0.2.2)
132
+ actiontext (= 7.0.2.2)
133
+ actionview (= 7.0.2.2)
134
+ activejob (= 7.0.2.2)
135
+ activemodel (= 7.0.2.2)
136
+ activerecord (= 7.0.2.2)
137
+ activestorage (= 7.0.2.2)
138
+ activesupport (= 7.0.2.2)
139
+ bundler (>= 1.15.0)
140
+ railties (= 7.0.2.2)
141
+ rails-dom-testing (2.0.3)
142
+ activesupport (>= 4.2.0)
143
+ nokogiri (>= 1.6)
144
+ rails-html-sanitizer (1.4.2)
145
+ loofah (~> 2.3)
146
+ railties (7.0.2.2)
147
+ actionpack (= 7.0.2.2)
148
+ activesupport (= 7.0.2.2)
149
+ method_source
150
+ rake (>= 12.2)
151
+ thor (~> 1.0)
152
+ zeitwerk (~> 2.5)
153
+ rake (13.0.6)
154
+ rspec-core (3.11.0)
155
+ rspec-support (~> 3.11.0)
156
+ rspec-expectations (3.11.0)
157
+ diff-lcs (>= 1.2.0, < 2.0)
158
+ rspec-support (~> 3.11.0)
159
+ rspec-mocks (3.11.0)
160
+ diff-lcs (>= 1.2.0, < 2.0)
161
+ rspec-support (~> 3.11.0)
162
+ rspec-rails (5.1.0)
163
+ actionpack (>= 5.2)
164
+ activesupport (>= 5.2)
165
+ railties (>= 5.2)
166
+ rspec-core (~> 3.10)
167
+ rspec-expectations (~> 3.10)
168
+ rspec-mocks (~> 3.10)
169
+ rspec-support (~> 3.10)
170
+ rspec-support (3.11.0)
171
+ sqlite3 (1.4.2)
172
+ strscan (3.0.1)
173
+ thor (1.2.1)
174
+ timeout (0.2.0)
175
+ tzinfo (2.0.4)
176
+ concurrent-ruby (~> 1.0)
177
+ websocket-driver (0.7.5)
178
+ websocket-extensions (>= 0.1.0)
179
+ websocket-extensions (0.1.5)
180
+ zeitwerk (2.5.4)
181
+
182
+ PLATFORMS
183
+ ruby
184
+
185
+ DEPENDENCIES
186
+ pry-byebug
187
+ rails (~> 7.0)
188
+ rails_dictionary!
189
+ rspec-rails (= 5.1.0)
190
+ sqlite3
191
+
192
+ BUNDLED WITH
193
+ 2.2.32
@@ -22,7 +22,7 @@ module RailsDictionary
22
22
  belongs_to :dict_type
23
23
  after_save :delete_dicts_cache
24
24
  after_destroy :delete_dicts_cache
25
- scope :dict_type_name_eq, lambda { |name| joins(:dict_type).where("dict_types.name" => name) }
25
+ scope :dict_type_name_eq, ->(name) { joins(:dict_type).where({ "dict_types.name" => name }) }
26
26
 
27
27
  include RailsDictionary::ActsAsDictionary
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module RailsDictionary
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -1,8 +1,8 @@
1
1
  require File.join(File.dirname(__FILE__), "rails_dictionary/array_core_ext")
2
- require File.join(File.dirname(__FILE__), "rails_dictionary/models/active_record_extension")
3
- require File.join(File.dirname(__FILE__), "rails_dictionary/models/acts_as_dict_type")
4
- require File.join(File.dirname(__FILE__), "rails_dictionary/models/acts_as_dictionary")
5
- require File.join(File.dirname(__FILE__), "rails_dictionary/models/acts_as_dict_slave")
2
+ require File.join(File.dirname(__FILE__), "rails_dictionary/active_record_extension")
3
+ require File.join(File.dirname(__FILE__), "rails_dictionary/acts_as_dict_type")
4
+ require File.join(File.dirname(__FILE__), "rails_dictionary/acts_as_dictionary")
5
+ require File.join(File.dirname(__FILE__), "rails_dictionary/acts_as_dict_slave")
6
6
 
7
7
  # rake tasks not autoload in Rails4
8
8
  Dir[File.expand_path('../tasks/**/*.rake',__FILE__)].each { |ext| load ext } if defined?(Rake)
Binary file
Binary file
@@ -7,13 +7,12 @@ Gem::Specification.new do |s|
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Raykin Lee"]
9
9
  s.email = ["raykincoldxiao@campus.com"]
10
+ s.licenses = ['MIT']
10
11
  s.homepage = "https://github.com/raykin/rails_dictionary"
11
12
  s.summary = %q{dictionary data for web application}
12
13
  s.description = %q{Rails plugin for mapping static data of web application to Dictionary class}
13
14
 
14
- s.rubyforge_project = "rails_dictionary"
15
-
16
- s.add_runtime_dependency 'rails', '> 4.0'
15
+ s.add_runtime_dependency 'rails', '> 6.0', '< 7.1'
17
16
 
18
17
  s.files = `git ls-files`.split("\n")
19
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,4 +1,4 @@
1
- # -*- coding: utf-8 -*-
1
+ # coding: utf-8
2
2
  require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe RailsDictionary::ActiveRecordExtension do
@@ -86,14 +86,14 @@ describe RailsDictionary do
86
86
  end
87
87
 
88
88
  it "update city by set city_name to a value" do
89
- stu_shanghai.update_attributes city_name: "wuhan"
89
+ stu_shanghai.update city_name: "wuhan"
90
90
  stu_shanghai.reload.city_name.should == "wuhan"
91
91
  Dictionary.student_city.map(&:name_en).include?("wuhan").should be_truthy
92
92
  end
93
93
 
94
94
  it "update city by set city_name to an exist dictionary name" do
95
95
  Dictionary.where(name_en: "beijing").count.should eq(1)
96
- stu_shanghai.update_attributes city_name: "beijing"
96
+ stu_shanghai.update city_name: "beijing"
97
97
  stu_shanghai.reload.city_name.should eq('beijing')
98
98
  Dictionary.where(name_en: "beijing").count.should eq(1)
99
99
  end
@@ -108,6 +108,14 @@ describe RailsDictionary do
108
108
  Student.acts_as_dict_slave :locale => :fr
109
109
  stu_beijing.named_city.should == "Pékin"
110
110
  end
111
+
112
+ it "create a student with new city(reproduce conflict error with Rails5.2.0)" do
113
+ s = Student.new
114
+ s.city_name = 'Sedan'
115
+ s.save
116
+ s.reload
117
+ s.city_name.should == 'Sedan'
118
+ end
111
119
  end
112
120
  end
113
121
 
data/spec/spec_helper.rb CHANGED
@@ -12,13 +12,12 @@ require File.join(File.dirname(__FILE__), 'fake_app')
12
12
 
13
13
  require 'rspec/rails'
14
14
 
15
- $stdout = StringIO.new # remove the noise output
15
+ require 'pry-byebug'
16
+
17
+ # $stdout = StringIO.new # remove the noise output. It can also disable pry debugger. Weird
16
18
 
17
19
  RSpec.configure do |config|
18
20
  config.use_transactional_fixtures = true
19
- # not work, must syntax error
20
- # config.expect_with(:rspec) { |c| c.syntax = :should }
21
+ config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
21
22
  CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'dict_types'
22
23
  end
23
-
24
- require 'byebug'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_dictionary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raykin Lee
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-24 00:00:00.000000000 Z
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '6.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">"
25
28
  - !ruby/object:Gem::Version
26
- version: '4.0'
29
+ version: '6.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.1'
27
33
  description: Rails plugin for mapping static data of web application to Dictionary
28
34
  class
29
35
  email:
@@ -35,24 +41,28 @@ files:
35
41
  - ".gitignore"
36
42
  - CHANGELOG
37
43
  - Gemfile
44
+ - Gemfile.lock
38
45
  - README.rdoc
39
46
  - Rakefile
40
47
  - lib/rails_dictionary.rb
48
+ - lib/rails_dictionary/active_record_extension.rb
49
+ - lib/rails_dictionary/acts_as_dict_slave.rb
50
+ - lib/rails_dictionary/acts_as_dict_type.rb
51
+ - lib/rails_dictionary/acts_as_dictionary.rb
41
52
  - lib/rails_dictionary/array_core_ext.rb
42
- - lib/rails_dictionary/models/active_record_extension.rb
43
- - lib/rails_dictionary/models/acts_as_dict_slave.rb
44
- - lib/rails_dictionary/models/acts_as_dict_type.rb
45
- - lib/rails_dictionary/models/acts_as_dictionary.rb
46
53
  - lib/rails_dictionary/version.rb
47
54
  - lib/tasks/dicts.rake
55
+ - pkg/rails_dictionary-0.2.2.gem
56
+ - pkg/rails_dictionary-0.2.3.gem
48
57
  - rails_dictionary.gemspec
49
58
  - spec/fake_app.rb
50
59
  - spec/rails_dictionary_spec.rb
51
60
  - spec/spec_helper.rb
52
61
  homepage: https://github.com/raykin/rails_dictionary
53
- licenses: []
62
+ licenses:
63
+ - MIT
54
64
  metadata: {}
55
- post_install_message:
65
+ post_install_message:
56
66
  rdoc_options: []
57
67
  require_paths:
58
68
  - lib
@@ -67,8 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
77
  - !ruby/object:Gem::Version
68
78
  version: '0'
69
79
  requirements: []
70
- rubygems_version: 3.0.1
71
- signing_key:
80
+ rubygems_version: 3.2.32
81
+ signing_key:
72
82
  specification_version: 4
73
83
  summary: dictionary data for web application
74
84
  test_files: