acts_as_defaultable 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWNiNGRlOTY1YzZhMzEzMzE4NTg0Y2RjYTRiZmQxMzYxNTA5ZWMzOA==
5
+ data.tar.gz: !binary |-
6
+ MmNjN2QzMzRjN2Q5ZjhlOTVlNDc3YTQ4NDdiOWI2ZmVkNjY3YjkzNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MGVjMzEzNzk0ZmE5MjM3MDE3MTdmZTk5NzAxY2U0ZmY4ZDE2ZjY5MWViMWI3
10
+ NTgyZTFjMTIyZGE3NjI1NzNmZTMwNzkzOWJhNDZiNTQ1NmNhMDUxZGY5M2Q3
11
+ ZmZmZmQ3MDVlMzI0MjRlN2RmZjAzZmFkMTMzYWI1OTI2MDc3MWM=
12
+ data.tar.gz: !binary |-
13
+ MTNkZTVhYzMwZTJjOTk5NmVhMGMzM2IzMWU2YWM4YjY4YmJmZDk1MTBhOWE3
14
+ NzJjYjZiZDUyOWFkZTE1OTk4OTkxZTFmNGEwMTE0ZDM1Y2QwNTNlOTU3ZDBk
15
+ NDdhOGU2MGIwM2NlOGFjODczOTBlYmM4NzYwYjVhYWMwY2RkNzM=
data/.gitignore CHANGED
@@ -5,3 +5,6 @@ spec/dummy/db/*.sqlite3
5
5
  spec/dummy/log/*.log
6
6
  spec/dummy/tmp/
7
7
  spec/dummy/.sass-cache
8
+ .rvmrc
9
+ .ruby-version
10
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+
6
+ before_script: ./scripts/build_db.sh
7
+ script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -1,19 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- # Declare your gem's dependencies in acts_as_defaultable.gemspec.
4
- # Bundler will treat runtime dependencies like base dependencies, and
5
- # development dependencies will be added by default to the :development group.
6
3
  gemspec
7
4
 
8
- # jquery-rails is used by the dummy application
9
- #gem "jquery-rails"
10
-
11
- # Declare any dependencies that are still in development here instead of in
12
- # your gemspec. These might include edge Rails or gems from your path or
13
- # Git. Remember to move these dependencies to your gemspec before releasing
14
- # your gem to rubygems.org.
15
-
16
- # To use debugger
17
- # gem 'ruby-debug19', :require => 'ruby-debug'
18
- gem 'rspec-rails', :git => "git://github.com/rspec/rspec-rails.git"
19
- gem 'database_cleaner', :git => "git://github.com/asanghi/database_cleaner.git"
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # ActsAsDefaultable
2
+
3
+ [![Build Status](https://travis-ci.org/chief/acts_as_defaultable.png?branch=master)](https://travis-ci.org/chief/acts_as_defaultable)
4
+ [![Code Climate](https://codeclimate.com/github/chief/acts_as_defaultable.png)](https://codeclimate.com/github/chief/acts_as_defaultable)
5
+
6
+ ## Description
7
+
8
+ This ``acts_as`` extension provides the capability for having a default object.
9
+ The class that has this specified needs to have a default column defined as an integer,
10
+ string or boolean on the mapped database table.
11
+
12
+ ## Install
13
+
14
+ In your Gemfile
15
+
16
+ ```ruby
17
+ gem 'acts_as_defaultable'
18
+ ```
19
+
20
+ Currently is tested on rails3.2, ruby 1.9.3 and mysql
21
+
22
+ ## Example
23
+
24
+ ```ruby
25
+ class Country < ActiveRecord::Base
26
+ acts_as_defaultable :default
27
+ end
28
+
29
+ gr = Country.new
30
+ gr.default = true
31
+ gr.save
32
+ Country.default == gr # => true
33
+ uk = Country.new
34
+ uk.default = true
35
+ uk.save
36
+ Country.default == gr # => false
37
+ ```
38
+
39
+ If no options provided `default` column is assumed.
40
+
41
+ ## Notes
42
+
43
+ The option to acts_as_defaultable is the `column` of the Model that defines default
44
+ behaviour. This column can be a string, a boolean or an integer with default
45
+ positive values 'on', true, 1 and default negative values 'off', false, 0 respectively.
46
+
47
+
48
+ ## License
49
+
50
+ acts_as_defaultable is released under the [MIT License](http://opensource.org/licenses/MIT)
51
+
52
+
53
+
54
+
55
+
@@ -20,15 +20,15 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ['lib']
21
21
  #s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
22
22
 
23
- s.add_dependency "rails", "~> 3.2.1"
23
+ s.add_dependency 'activesupport', ['>= 3.0.0']
24
+ s.add_dependency 'activerecord', ['>= 3.0.0']
24
25
 
25
26
  s.add_development_dependency 'mysql2'
26
- s.add_development_dependency 'rspec-rails'
27
+ s.add_development_dependency 'rails', ['= 3.2.16']
28
+ s.add_development_dependency "rspec"
29
+ s.add_development_dependency "rspec-rails"
27
30
  s.add_development_dependency 'factory_girl_rails'
28
- s.add_development_dependency 'spork', '0.9.0.rc9'
29
- s.add_development_dependency 'rb-fsevent'
30
- s.add_development_dependency 'guard-rspec'
31
- s.add_development_dependency 'libnotify'
31
+ s.add_development_dependency 'spork'
32
32
  s.add_development_dependency 'database_cleaner'
33
-
33
+ s.add_development_dependency 'guard-rspec'
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsDefaultable
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+
3
+ cd spec/dummy
4
+ bundle exec rake db:create RAILS_ENV=test
5
+ bundle exec rake db:schema:load RAILS_ENV=test
6
+ bundle exec rake db:test:prepare
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe TestDefault do
4
4
 
5
- let(:one) { Factory.build(:td_one) }
6
- let(:two) { Factory.build(:td_two) }
5
+ let(:one) { FactoryGirl.build(:td_one) }
6
+ let(:two) { FactoryGirl.build(:td_two) }
7
7
 
8
8
  it 'should have a class method named default' do
9
9
  TestDefault.respond_to?('default').should be_true
metadata CHANGED
@@ -1,115 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_defaultable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Giorgos Tsiftsis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-02-06 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &19459700 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 3.2.1
19
+ version: 3.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *19459700
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
25
41
  - !ruby/object:Gem::Dependency
26
42
  name: mysql2
27
- requirement: &19459260 !ruby/object:Gem::Requirement
28
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
29
44
  requirements:
30
45
  - - ! '>='
31
46
  - !ruby/object:Gem::Version
32
47
  version: '0'
33
48
  type: :development
34
49
  prerelease: false
35
- version_requirements: *19459260
36
- - !ruby/object:Gem::Dependency
37
- name: rspec-rails
38
- requirement: &19458620 !ruby/object:Gem::Requirement
39
- none: false
50
+ version_requirements: !ruby/object:Gem::Requirement
40
51
  requirements:
41
52
  - - ! '>='
42
53
  - !ruby/object:Gem::Version
43
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.16
44
62
  type: :development
45
63
  prerelease: false
46
- version_requirements: *19458620
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 3.2.16
47
69
  - !ruby/object:Gem::Dependency
48
- name: factory_girl_rails
49
- requirement: &19458080 !ruby/object:Gem::Requirement
50
- none: false
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
51
72
  requirements:
52
73
  - - ! '>='
53
74
  - !ruby/object:Gem::Version
54
75
  version: '0'
55
76
  type: :development
56
77
  prerelease: false
57
- version_requirements: *19458080
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
58
83
  - !ruby/object:Gem::Dependency
59
- name: spork
60
- requirement: &19457520 !ruby/object:Gem::Requirement
61
- none: false
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
62
86
  requirements:
63
- - - =
87
+ - - ! '>='
64
88
  - !ruby/object:Gem::Version
65
- version: 0.9.0.rc9
89
+ version: '0'
66
90
  type: :development
67
91
  prerelease: false
68
- version_requirements: *19457520
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
- name: rb-fsevent
71
- requirement: &19234080 !ruby/object:Gem::Requirement
72
- none: false
98
+ name: factory_girl_rails
99
+ requirement: !ruby/object:Gem::Requirement
73
100
  requirements:
74
101
  - - ! '>='
75
102
  - !ruby/object:Gem::Version
76
103
  version: '0'
77
104
  type: :development
78
105
  prerelease: false
79
- version_requirements: *19234080
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
80
111
  - !ruby/object:Gem::Dependency
81
- name: guard-rspec
82
- requirement: &19233360 !ruby/object:Gem::Requirement
83
- none: false
112
+ name: spork
113
+ requirement: !ruby/object:Gem::Requirement
84
114
  requirements:
85
115
  - - ! '>='
86
116
  - !ruby/object:Gem::Version
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *19233360
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
91
125
  - !ruby/object:Gem::Dependency
92
- name: libnotify
93
- requirement: &19232580 !ruby/object:Gem::Requirement
94
- none: false
126
+ name: database_cleaner
127
+ requirement: !ruby/object:Gem::Requirement
95
128
  requirements:
96
129
  - - ! '>='
97
130
  - !ruby/object:Gem::Version
98
131
  version: '0'
99
132
  type: :development
100
133
  prerelease: false
101
- version_requirements: *19232580
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
102
139
  - !ruby/object:Gem::Dependency
103
- name: database_cleaner
104
- requirement: &19232060 !ruby/object:Gem::Requirement
105
- none: false
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
106
142
  requirements:
107
143
  - - ! '>='
108
144
  - !ruby/object:Gem::Version
109
145
  version: '0'
110
146
  type: :development
111
147
  prerelease: false
112
- version_requirements: *19232060
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
113
153
  description: This 'acts_as' extension provides the capability for having a default
114
154
  object. The class that has this specified needs to have a default column defined
115
155
  as an integer, string or boolean on the mapped database table
@@ -121,16 +161,15 @@ extra_rdoc_files: []
121
161
  files:
122
162
  - .gitignore
123
163
  - .rspec
164
+ - .travis.yml
124
165
  - Gemfile
125
- - Gemfile.lock
126
166
  - Guardfile
127
- - MIT-LICENSE
128
- - README.rdoc
167
+ - README.md
129
168
  - Rakefile
130
169
  - acts_as_defaultable.gemspec
131
170
  - lib/acts_as_defaultable.rb
132
171
  - lib/acts_as_defaultable/version.rb
133
- - lib/tasks/acts_as_defaultable_tasks.rake
172
+ - scripts/build_db.sh
134
173
  - spec/dummy/README.rdoc
135
174
  - spec/dummy/Rakefile
136
175
  - spec/dummy/app/assets/javascripts/application.js
@@ -187,33 +226,27 @@ files:
187
226
  - spec/spec_helper.rb
188
227
  homepage: https://github.com/chief/acts_as_defaultable
189
228
  licenses: []
229
+ metadata: {}
190
230
  post_install_message:
191
231
  rdoc_options: []
192
232
  require_paths:
193
233
  - lib
194
234
  required_ruby_version: !ruby/object:Gem::Requirement
195
- none: false
196
235
  requirements:
197
236
  - - ! '>='
198
237
  - !ruby/object:Gem::Version
199
238
  version: '0'
200
- segments:
201
- - 0
202
- hash: 2672945827084935828
203
239
  required_rubygems_version: !ruby/object:Gem::Requirement
204
- none: false
205
240
  requirements:
206
241
  - - ! '>='
207
242
  - !ruby/object:Gem::Version
208
243
  version: '0'
209
- segments:
210
- - 0
211
- hash: 2672945827084935828
212
244
  requirements: []
213
245
  rubyforge_project:
214
- rubygems_version: 1.8.10
246
+ rubygems_version: 2.1.11
215
247
  signing_key:
216
- specification_version: 3
248
+ specification_version: 4
217
249
  summary: A gem allowing an active_record model to be default(unique) based on a specified
218
250
  column
219
251
  test_files: []
252
+ has_rdoc:
data/Gemfile.lock DELETED
@@ -1,139 +0,0 @@
1
- GIT
2
- remote: git://github.com/asanghi/database_cleaner.git
3
- revision: b2d2ce7ff782542b23c2f45e6c0ea9ef0c25c0cd
4
- specs:
5
- database_cleaner (0.7.0)
6
-
7
- GIT
8
- remote: git://github.com/rspec/rspec-rails.git
9
- revision: 320ea0f5c051bcb4e7cb7ef677c69a30a80c7c0d
10
- specs:
11
- rspec-rails (2.8.0.rc2)
12
- actionpack (>= 3.0)
13
- activesupport (>= 3.0)
14
- railties (>= 3.0)
15
- rspec (= 2.8.0.rc2)
16
-
17
- PATH
18
- remote: .
19
- specs:
20
- acts_as_defaultable (0.0.4)
21
- rails (~> 3.2.1)
22
-
23
- GEM
24
- remote: http://rubygems.org/
25
- specs:
26
- actionmailer (3.2.1)
27
- actionpack (= 3.2.1)
28
- mail (~> 2.4.0)
29
- actionpack (3.2.1)
30
- activemodel (= 3.2.1)
31
- activesupport (= 3.2.1)
32
- builder (~> 3.0.0)
33
- erubis (~> 2.7.0)
34
- journey (~> 1.0.1)
35
- rack (~> 1.4.0)
36
- rack-cache (~> 1.1)
37
- rack-test (~> 0.6.1)
38
- sprockets (~> 2.1.2)
39
- activemodel (3.2.1)
40
- activesupport (= 3.2.1)
41
- builder (~> 3.0.0)
42
- activerecord (3.2.1)
43
- activemodel (= 3.2.1)
44
- activesupport (= 3.2.1)
45
- arel (~> 3.0.0)
46
- tzinfo (~> 0.3.29)
47
- activeresource (3.2.1)
48
- activemodel (= 3.2.1)
49
- activesupport (= 3.2.1)
50
- activesupport (3.2.1)
51
- i18n (~> 0.6)
52
- multi_json (~> 1.0)
53
- arel (3.0.0)
54
- builder (3.0.0)
55
- diff-lcs (1.1.3)
56
- erubis (2.7.0)
57
- factory_girl (2.3.2)
58
- activesupport
59
- factory_girl_rails (1.4.0)
60
- factory_girl (~> 2.3.0)
61
- railties (>= 3.0.0)
62
- ffi (1.0.11)
63
- guard (0.10.0)
64
- ffi (>= 0.5.0)
65
- thor (~> 0.14.6)
66
- guard-rspec (0.6.0)
67
- guard (>= 0.10.0)
68
- hike (1.2.1)
69
- i18n (0.6.0)
70
- journey (1.0.1)
71
- json (1.6.5)
72
- libnotify (0.7.0)
73
- mail (2.4.1)
74
- i18n (>= 0.4.0)
75
- mime-types (~> 1.16)
76
- treetop (~> 1.4.8)
77
- mime-types (1.17.2)
78
- multi_json (1.0.4)
79
- mysql2 (0.3.11)
80
- polyglot (0.3.3)
81
- rack (1.4.1)
82
- rack-cache (1.1)
83
- rack (>= 0.4)
84
- rack-ssl (1.3.2)
85
- rack
86
- rack-test (0.6.1)
87
- rack (>= 1.0)
88
- rails (3.2.1)
89
- actionmailer (= 3.2.1)
90
- actionpack (= 3.2.1)
91
- activerecord (= 3.2.1)
92
- activeresource (= 3.2.1)
93
- activesupport (= 3.2.1)
94
- bundler (~> 1.0)
95
- railties (= 3.2.1)
96
- railties (3.2.1)
97
- actionpack (= 3.2.1)
98
- activesupport (= 3.2.1)
99
- rack-ssl (~> 1.3.2)
100
- rake (>= 0.8.7)
101
- rdoc (~> 3.4)
102
- thor (~> 0.14.6)
103
- rake (0.9.2.2)
104
- rb-fsevent (0.4.3.1)
105
- rdoc (3.12)
106
- json (~> 1.4)
107
- rspec (2.8.0.rc2)
108
- rspec-core (= 2.8.0.rc2)
109
- rspec-expectations (= 2.8.0.rc2)
110
- rspec-mocks (= 2.8.0.rc2)
111
- rspec-core (2.8.0.rc2)
112
- rspec-expectations (2.8.0.rc2)
113
- diff-lcs (~> 1.1.2)
114
- rspec-mocks (2.8.0.rc2)
115
- spork (0.9.0.rc9)
116
- sprockets (2.1.2)
117
- hike (~> 1.2)
118
- rack (~> 1.0)
119
- tilt (~> 1.1, != 1.3.0)
120
- thor (0.14.6)
121
- tilt (1.3.3)
122
- treetop (1.4.10)
123
- polyglot
124
- polyglot (>= 0.3.1)
125
- tzinfo (0.3.31)
126
-
127
- PLATFORMS
128
- ruby
129
-
130
- DEPENDENCIES
131
- acts_as_defaultable!
132
- database_cleaner!
133
- factory_girl_rails
134
- guard-rspec
135
- libnotify
136
- mysql2
137
- rb-fsevent
138
- rspec-rails!
139
- spork (= 0.9.0.rc9)
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2012 YOURNAME
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,40 +0,0 @@
1
- = ActsAsDefaultable
2
-
3
- == Description
4
-
5
- This 'acts_as' extension provides the capability for having a default object. The class that has this
6
- specified needs to have a default column defined as an integer, string or boolean on the mapped
7
- database table.
8
-
9
- == Install
10
-
11
- In your Gemfile
12
-
13
- gem 'acts_as_defaultable'
14
-
15
- Currently is tested on rails3.2.0.rc1, rails3.2.0.rc2, ruby 1.9.3 and mysql
16
-
17
- == Example
18
-
19
- class Country < ActiveRecord::Base
20
- acts_as_defaultable :default
21
- end
22
-
23
- gr = Country.new
24
- gr.default = true
25
- gr.save
26
- Country.default == gr # => true
27
- uk = Country.new
28
- uk.default = true
29
- uk.save
30
- Country.default == gr # => false
31
-
32
- If no options provived +default+ column is assumed.
33
-
34
- == Notes
35
-
36
- The option to acts_as_defaultable is the +column+ of the Model that defines default behaviour.
37
- This column can be a string, a boolean or an integer with default positive values 'on', true, 1
38
- and default negative values 'off', false, 0 respectively.
39
-
40
-
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :acts_as_defaultable do
3
- # # Task goes here
4
- # end