has_defaults 0.4.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.5.2.pg ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Runtime dependencies
4
+ gem 'activerecord'
5
+ gem 'activesupport'
6
+ gem 'pg', '~>0.18.4'
7
+
8
+ # Development dependencies
9
+ gem 'rake'
10
+ gem 'database_cleaner'
11
+ gem 'rspec', '~>3.5'
12
+ gem 'gemika', '>= 0.2.0'
13
+ gem 'pry-byebug'
14
+
15
+ # Gem under test
16
+ gem 'has_defaults', path: '.'
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ has_defaults (1.0.0)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.2.6)
11
+ activesupport (= 5.2.6)
12
+ activerecord (5.2.6)
13
+ activemodel (= 5.2.6)
14
+ activesupport (= 5.2.6)
15
+ arel (>= 9.0)
16
+ activesupport (5.2.6)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ arel (9.0.0)
22
+ byebug (11.1.3)
23
+ coderay (1.1.3)
24
+ concurrent-ruby (1.1.9)
25
+ database_cleaner (2.0.1)
26
+ database_cleaner-active_record (~> 2.0.0)
27
+ database_cleaner-active_record (2.0.1)
28
+ activerecord (>= 5.a)
29
+ database_cleaner-core (~> 2.0.0)
30
+ database_cleaner-core (2.0.1)
31
+ diff-lcs (1.2.5)
32
+ gemika (0.6.1)
33
+ i18n (1.8.10)
34
+ concurrent-ruby (~> 1.0)
35
+ method_source (1.0.0)
36
+ minitest (5.14.4)
37
+ pg (0.18.4)
38
+ pry (0.13.1)
39
+ coderay (~> 1.1)
40
+ method_source (~> 1.0)
41
+ pry-byebug (3.9.0)
42
+ byebug (~> 11.0)
43
+ pry (~> 0.13.0)
44
+ rake (11.3.0)
45
+ rspec (3.5.0)
46
+ rspec-core (~> 3.5.0)
47
+ rspec-expectations (~> 3.5.0)
48
+ rspec-mocks (~> 3.5.0)
49
+ rspec-core (3.5.3)
50
+ rspec-support (~> 3.5.0)
51
+ rspec-expectations (3.5.0)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.5.0)
54
+ rspec-mocks (3.5.0)
55
+ diff-lcs (>= 1.2.0, < 2.0)
56
+ rspec-support (~> 3.5.0)
57
+ rspec-support (3.5.0)
58
+ thread_safe (0.3.6)
59
+ tzinfo (1.2.9)
60
+ thread_safe (~> 0.1)
61
+
62
+ PLATFORMS
63
+ ruby
64
+
65
+ DEPENDENCIES
66
+ activerecord
67
+ activesupport
68
+ database_cleaner
69
+ gemika (>= 0.2.0)
70
+ has_defaults!
71
+ pg (~> 0.18.4)
72
+ pry-byebug
73
+ rake
74
+ rspec (~> 3.5)
75
+
76
+ BUNDLED WITH
77
+ 2.2.26
data/Gemfile.6.1.pg ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Runtime dependencies
4
+ gem 'activerecord', '~>6.1.3'
5
+ gem 'pg', '~>1.1'
6
+
7
+ # Development dependencies
8
+ gem 'rake'
9
+ gem 'database_cleaner'
10
+ gem 'rspec', '~>3.5'
11
+ gem 'gemika', '>= 0.2.0'
12
+ gem 'pry-byebug'
13
+
14
+ # Gem under test
15
+ gem 'has_defaults', path: '.'
@@ -0,0 +1,75 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ has_defaults (1.0.0)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (6.1.3)
11
+ activesupport (= 6.1.3)
12
+ activerecord (6.1.3)
13
+ activemodel (= 6.1.3)
14
+ activesupport (= 6.1.3)
15
+ activesupport (6.1.3)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ byebug (11.1.3)
22
+ coderay (1.1.3)
23
+ concurrent-ruby (1.1.8)
24
+ database_cleaner (2.0.1)
25
+ database_cleaner-active_record (~> 2.0.0)
26
+ database_cleaner-active_record (2.0.0)
27
+ activerecord (>= 5.a)
28
+ database_cleaner-core (~> 2.0.0)
29
+ database_cleaner-core (2.0.1)
30
+ diff-lcs (1.4.4)
31
+ gemika (0.5.0)
32
+ i18n (1.8.9)
33
+ concurrent-ruby (~> 1.0)
34
+ method_source (1.0.0)
35
+ minitest (5.14.4)
36
+ pg (1.2.3)
37
+ pry (0.13.1)
38
+ coderay (~> 1.1)
39
+ method_source (~> 1.0)
40
+ pry-byebug (3.9.0)
41
+ byebug (~> 11.0)
42
+ pry (~> 0.13.0)
43
+ rake (13.0.3)
44
+ rspec (3.10.0)
45
+ rspec-core (~> 3.10.0)
46
+ rspec-expectations (~> 3.10.0)
47
+ rspec-mocks (~> 3.10.0)
48
+ rspec-core (3.10.1)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-expectations (3.10.1)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-mocks (3.10.2)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-support (3.10.2)
57
+ tzinfo (2.0.4)
58
+ concurrent-ruby (~> 1.0)
59
+ zeitwerk (2.4.2)
60
+
61
+ PLATFORMS
62
+ ruby
63
+
64
+ DEPENDENCIES
65
+ activerecord (~> 6.1.3)
66
+ database_cleaner
67
+ gemika (>= 0.2.0)
68
+ has_defaults!
69
+ pg (~> 1.1)
70
+ pry-byebug
71
+ rake
72
+ rspec (~> 3.5)
73
+
74
+ BUNDLED WITH
75
+ 2.2.26
data/Gemfile.lock ADDED
@@ -0,0 +1 @@
1
+ Gemfile.4.2.mysql2.lock
data/README.md CHANGED
@@ -1,65 +1,70 @@
1
- has_defaults [![Build Status](https://travis-ci.org/makandra/has_defaults.svg?branch=master)](https://travis-ci.org/makandra/has_defaults)
2
- ============
1
+ # has_defaults [![Build Status](https://travis-ci.org/makandra/has_defaults.svg?branch=master)](https://travis-ci.org/makandra/has_defaults)
3
2
 
4
3
  Default values for ActiveRecord models.
5
4
 
6
- Installation
7
- ------------
5
+ ## Installation
8
6
 
9
7
  In your `Gemfile`
10
8
 
11
- gem 'has_defaults'
9
+ ```
10
+ gem 'has_defaults'
11
+ ```
12
12
 
13
13
  Now run
14
14
 
15
- bundle install
15
+ ```
16
+ bundle install
17
+ ```
16
18
 
17
-
18
- Usage
19
- -----
19
+ ## Usage
20
20
 
21
21
  Add the method call `has_defaults` to your model.
22
22
 
23
- class Page < ActiveRecord::Base
24
- has_defaults :title => "New page", :body => "Put your text here"
25
- end
23
+ ```
24
+ class Page < ActiveRecord::Base
25
+ has_defaults :title => "New page", :body => "Put your text here"
26
+ end
27
+ ```
26
28
 
27
29
  Attributes will be set only if it's a new record and the attribute is blank.
28
30
 
29
31
  Retrieve the default attribute with the `default_for` instance method:
30
32
 
31
- @page.default_for(:title)
33
+ ```
34
+ @page.default_for(:title)
35
+ ```
32
36
 
33
37
  You can pass Proc as attribute:
34
38
 
35
- has_defaults :expires_at => proc { Time.now }
39
+ ```
40
+ has_defaults :expires_at => proc { Time.now }
41
+ ```
36
42
 
37
43
  You can override the default attributes as follow:
38
44
 
39
- Page.has_defaults_options = {:title => "Here's your new page", :body => "Write your page text"}
40
-
45
+ ```
46
+ Page.has_defaults_options = {:title => "Here's your new page", :body => "Write your page text"}
47
+ ```
41
48
 
42
- Development
43
- -----------
49
+ ## Development
44
50
 
45
51
  There are tests in `spec`. We only accept PRs with tests. To run tests:
46
52
 
47
- - Install Ruby 2.2.4
53
+ - Install Ruby 2.5.7
48
54
  - Create a local test database `has_defaults_test` in both MySQL and PostgreSQL
49
55
  - Copy `spec/support/database.sample.yml` to `spec/support/database.yml` and enter your local credentials for the test databases
50
56
  - Install development dependencies using `bundle install`
51
57
  - Run tests using `bundle exec rspec`
52
58
 
53
- We recommend to test large changes against multiple versions of Ruby and multiple dependency sets. Supported combinations are configured in `.travis.yml`. We provide some rake tasks to help with this:
59
+ We recommend to test large changes against multiple versions of Ruby and multiple dependency sets. We provide some rake tasks to help with this:
54
60
 
55
- - Install development dependencies using `bundle matrix:install`
56
- - Run tests using `bundle matrix:spec`
61
+ - Install development dependencies using `rake matrix:install`
62
+ - Run tests using `rake matrix:spec`
57
63
 
58
- Note that we have configured Travis CI to automatically run tests in all supported Ruby versions and dependency sets after each push. We will only merge pull requests after a green Travis build.
64
+ Note that we have configured Github Actions to automatically run tests in all supported Ruby versions and dependency sets after each push. We will only merge pull requests with successful test runs.
59
65
 
60
66
 
61
- Credits
62
- -------
67
+ ## Credits
63
68
 
64
69
  * Original version by Nando Vieira (<http://simplesideias.com.br>)
65
70
  * Patches in this fork by makandra (<http://makandra.com/>)
data/has_defaults.gemspec CHANGED
@@ -1,20 +1,29 @@
1
- $:.push File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2
3
  require "has_defaults/version"
3
4
 
4
- Gem::Specification.new do |s|
5
- s.name = 'has_defaults'
6
- s.version = HasDefaults::VERSION
7
- s.authors = ["Henning Koch"]
8
- s.licenses = ["MIT"]
9
- s.email = 'henning.koch@makandra.de'
10
- s.homepage = 'https://github.com/makandra/has_defaults'
11
- s.summary = 'Default values for ActiveRecord models.'
12
- s.description = s.summary
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'has_defaults'
7
+ spec.version = HasDefaults::VERSION
8
+ spec.required_ruby_version = '>= 2.3.0'
9
+ spec.authors = ['Henning Koch']
10
+ spec.email = ['henning.koch@makandra.de']
13
11
 
14
- s.files = `git ls-files`.split("\n")
15
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
- s.require_paths = ["lib"]
12
+ spec.summary = 'Default values for ActiveRecord models'
13
+ spec.description = 'Default values for ActiveRecord models'
14
+ spec.homepage = 'https://github.com/makandra/has_defaults'
15
+ spec.license = 'MIT'
18
16
 
19
- s.add_dependency('activerecord')
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r(^exe/)) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_dependency('activerecord')
27
+
28
+ # Development dependencies are defined in the Gemfile (therefore no `spec.add_development_dependency` directives)
20
29
  end
@@ -1,5 +1,5 @@
1
1
  module HasDefaults
2
2
 
3
- VERSION = '0.4.4'
3
+ VERSION = '1.0.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,107 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: has_defaults
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 4
10
- version: 0.4.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Henning Koch
14
8
  autorequire:
15
- bindir: bin
9
+ bindir: exe
16
10
  cert_chain: []
17
-
18
- date: 2016-09-27 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: activerecord
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
32
20
  type: :runtime
33
- version_requirements: *id001
34
- description: Default values for ActiveRecord models.
35
- email: henning.koch@makandra.de
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Default values for ActiveRecord models
28
+ email:
29
+ - henning.koch@makandra.de
36
30
  executables: []
37
-
38
31
  extensions: []
39
-
40
32
  extra_rdoc_files: []
41
-
42
- files:
43
- - .gitignore
44
- - .ruby-version
45
- - .travis.yml
33
+ files:
34
+ - ".github/workflows/test.yml"
35
+ - ".gitignore"
36
+ - ".ruby-version"
37
+ - CHANGELOG.md
38
+ - Gemfile
39
+ - Gemfile.3.2.mysql2
40
+ - Gemfile.3.2.mysql2.lock
41
+ - Gemfile.4.2.mysql2
42
+ - Gemfile.4.2.mysql2.lock
43
+ - Gemfile.4.2.pg
44
+ - Gemfile.4.2.pg.lock
45
+ - Gemfile.5.2.mysql2
46
+ - Gemfile.5.2.mysql2.lock
47
+ - Gemfile.5.2.pg
48
+ - Gemfile.5.2.pg.lock
49
+ - Gemfile.6.1.pg
50
+ - Gemfile.6.1.pg.lock
51
+ - Gemfile.lock
46
52
  - LICENSE
47
53
  - README.md
48
54
  - Rakefile
49
- - gemfiles/Gemfile.2.3.mysql2
50
- - gemfiles/Gemfile.2.3.mysql2.lock
51
- - gemfiles/Gemfile.3.2.mysql2
52
- - gemfiles/Gemfile.3.2.mysql2.lock
53
- - gemfiles/Gemfile.4.2.mysql2
54
- - gemfiles/Gemfile.4.2.mysql2.lock
55
- - gemfiles/Gemfile.4.2.pg
56
- - gemfiles/Gemfile.4.2.pg.lock
57
- - gemfiles/Gemfile.5.0.mysql2
58
- - gemfiles/Gemfile.5.0.mysql2.lock
59
- - gemfiles/Gemfile.5.0.pg
60
- - gemfiles/Gemfile.5.0.pg.lock
61
55
  - has_defaults.gemspec
62
56
  - lib/has_defaults.rb
63
57
  - lib/has_defaults/active_record_ext.rb
64
58
  - lib/has_defaults/version.rb
65
- - spec/has_defaults/active_record_ext_spec.rb
66
- - spec/spec_helper.rb
67
- - spec/support/database.rb
68
- - spec/support/database.sample.yml
69
- - spec/support/database.travis.yml
70
- - spec/support/database.yml
71
- - spec/support/models.rb
72
59
  homepage: https://github.com/makandra/has_defaults
73
- licenses:
60
+ licenses:
74
61
  - MIT
62
+ metadata: {}
75
63
  post_install_message:
76
64
  rdoc_options: []
77
-
78
- require_paths:
65
+ require_paths:
79
66
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
83
69
  - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
70
+ - !ruby/object:Gem::Version
71
+ version: 2.3.0
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
92
74
  - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
- version: "0"
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
98
77
  requirements: []
99
-
100
- rubyforge_project:
101
- rubygems_version: 1.8.29
78
+ rubygems_version: 3.2.26
102
79
  signing_key:
103
- specification_version: 3
104
- summary: Default values for ActiveRecord models.
80
+ specification_version: 4
81
+ summary: Default values for ActiveRecord models
105
82
  test_files: []
106
-
107
- has_rdoc: