publishable 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -4
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -2
- data/LICENSE.txt +3 -2
- data/README.rdoc +5 -3
- data/Rakefile +1 -6
- data/lib/publishable.rb +5 -4
- data/lib/publishable/version.rb +1 -1
- data/publishable.gemspec +3 -7
- data/spec/publishable_spec.rb +14 -0
- data/spec/spec_helper.rb +0 -5
- metadata +98 -69
- checksums.yaml +0 -7
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -29,7 +29,6 @@ GEM
|
|
29
29
|
json (1.7.7)
|
30
30
|
multi_json (1.6.1)
|
31
31
|
rake (10.0.3)
|
32
|
-
rcov (1.0.0)
|
33
32
|
rdoc (3.12.1)
|
34
33
|
json (~> 1.4)
|
35
34
|
rspec (2.8.0)
|
@@ -53,7 +52,6 @@ DEPENDENCIES
|
|
53
52
|
bundler (~> 1.0)
|
54
53
|
ffaker
|
55
54
|
jeweler (~> 1.8.4)
|
56
|
-
rcov
|
57
55
|
rdoc (~> 3.12)
|
58
56
|
rspec (~> 2.8.0)
|
59
57
|
timecop
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
Copyright (c) 2010 Martin Linkhorst
|
2
|
-
Copyright (c) 2013 тιηуηυмвєяѕ
|
1
|
+
Copyright (c) 2010-2014 Martin Linkhorst
|
2
|
+
Copyright (c) 2013-2014 тιηуηυмвєяѕ
|
3
|
+
Copyright (c) 2013-2014 Andrew Janssen
|
3
4
|
|
4
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
6
|
a copy of this software and associated documentation files (the
|
data/README.rdoc
CHANGED
@@ -52,7 +52,8 @@ Or install it yourself as:
|
|
52
52
|
end
|
53
53
|
|
54
54
|
The column name used by *publishable* can be specified via the +:on+ option. The default used (if +:on+
|
55
|
-
is not specified) is +:published+.
|
55
|
+
is not specified) is +:published+. If publishing via a Boolean column, be sure to add a default value to
|
56
|
+
the column in the migration— otherwise existing models will be neither published nor unpublished.
|
56
57
|
|
57
58
|
== Usage
|
58
59
|
|
@@ -82,6 +83,7 @@ is not specified) is +:published+.
|
|
82
83
|
|
83
84
|
== Copyright
|
84
85
|
|
85
|
-
Copyright (c) 2010 Martin Linkhorst, released under the MIT license.
|
86
|
-
Copyright (c) 2013 тιηуηυмвєяѕ. See LICENSE.txt for further details.
|
86
|
+
Copyright (c) 2010-2014 Martin Linkhorst, released under the MIT license.
|
87
|
+
Copyright (c) 2013-2014 тιηуηυмвєяѕ. See LICENSE.txt for further details.
|
88
|
+
Copyright (c) 2013-2014 Andrew Janssen. See LICENSE.txt for further details.
|
87
89
|
|
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ begin
|
|
21
21
|
gem.description = 'Provides methods to publish and unpublish your active record models based on a boolean flag, a date, or a datetime. Also adds named scopes to nicely filter your records. Does not touch any controller or views.'
|
22
22
|
gem.email = ['m.linkhorst@googlemail.com', 'info@tinynumbers.com']
|
23
23
|
gem.homepage = 'http://github.com/linki/publishable'
|
24
|
-
gem.authors = ['Martin Linkhorst', 'тιηуηυмвєяѕ']
|
24
|
+
gem.authors = ['Martin Linkhorst', 'тιηуηυмвєяѕ', 'Andrew Janssen']
|
25
25
|
gem.version = "#{Publishable::VERSION}"
|
26
26
|
# dependencies defined in Gemfile
|
27
27
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
@@ -37,11 +37,6 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
37
37
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
38
38
|
end
|
39
39
|
|
40
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
41
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
42
|
-
spec.rcov = true
|
43
|
-
end
|
44
|
-
|
45
40
|
task :default => :spec
|
46
41
|
|
47
42
|
require 'yard'
|
data/lib/publishable.rb
CHANGED
@@ -11,8 +11,9 @@ require 'publishable/railtie' if defined?(Rails)
|
|
11
11
|
# Provides scopes for finding published and unpublished items, and (for date/datetime published columns) for returning
|
12
12
|
# recent or upcoming items.
|
13
13
|
#
|
14
|
-
# @author Martin Linkhorst <m.linkhorst@
|
14
|
+
# @author Martin Linkhorst <m.linkhorst@gmail.com>
|
15
15
|
# @author David Daniell / тιηуηυмвєяѕ <info@tinynumbers.com>
|
16
|
+
# @author Andrew Janssen <andrew.janssen@sardiusgroup.com>
|
16
17
|
module Publishable
|
17
18
|
|
18
19
|
# Add our features to the base class.
|
@@ -117,7 +118,7 @@ module Publishable
|
|
117
118
|
end
|
118
119
|
|
119
120
|
def unpublish()
|
120
|
-
self.#{column_name} =
|
121
|
+
self.#{column_name} = nil
|
121
122
|
end
|
122
123
|
|
123
124
|
def unpublish!()
|
@@ -144,7 +145,7 @@ module Publishable
|
|
144
145
|
end
|
145
146
|
|
146
147
|
def unpublish()
|
147
|
-
self.#{column_name} =
|
148
|
+
self.#{column_name} = nil
|
148
149
|
end
|
149
150
|
|
150
151
|
def unpublish!()
|
@@ -255,7 +256,7 @@ module Publishable
|
|
255
256
|
|
256
257
|
# @!method unpublish
|
257
258
|
# Un-publish this object, i.e. set it to not be published. For a Boolean publish field, the field is set to
|
258
|
-
# false; for a Date/DateTime field, the field is
|
259
|
+
# false; for a Date/DateTime field, the field is cleared.
|
259
260
|
# @!scope instance
|
260
261
|
|
261
262
|
# @!method unpublish!
|
data/lib/publishable/version.rb
CHANGED
data/publishable.gemspec
CHANGED
@@ -12,11 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.version = Publishable::VERSION.to_s
|
13
13
|
|
14
14
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
15
|
-
s.authors = ["Martin Linkhorst", "\321\202\316\271\316\267\321\203\316\267\317\205\320\274\320\262\321\224\321\217\321\225"]
|
16
|
-
s.date = "
|
17
|
-
s.date = "2013-04-30"
|
15
|
+
s.authors = ["Martin Linkhorst", "\321\202\316\271\316\267\321\203\316\267\317\205\320\274\320\262\321\224\321\217\321\225", "Andrew Janssen"]
|
16
|
+
s.date = "2014-03-04"
|
18
17
|
s.description = "Provides methods to publish and unpublish your active record models based on a boolean flag, a date, or a datetime. Also adds named scopes to nicely filter your records. Does not touch any controller or views."
|
19
|
-
s.email = ["m.linkhorst@googlemail.com", "info@tinynumbers.com"]
|
18
|
+
s.email = ["m.linkhorst@googlemail.com", "info@tinynumbers.com", "andrew.janssen@sardiusgroup.com"]
|
20
19
|
s.extra_rdoc_files = [
|
21
20
|
"LICENSE.txt",
|
22
21
|
"README.rdoc"
|
@@ -52,20 +51,17 @@ Gem::Specification.new do |s|
|
|
52
51
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
53
52
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
54
53
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
55
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
56
54
|
else
|
57
55
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
58
56
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
59
57
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
60
58
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
61
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
62
59
|
end
|
63
60
|
else
|
64
61
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
65
62
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
66
63
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
67
64
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
68
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
69
65
|
end
|
70
66
|
end
|
71
67
|
|
data/spec/publishable_spec.rb
CHANGED
@@ -78,6 +78,13 @@ describe Publishable do
|
|
78
78
|
@post.published.should <= Date.current
|
79
79
|
end
|
80
80
|
|
81
|
+
it 'can be unpublished' do
|
82
|
+
@post.published = Date.current
|
83
|
+
@post.should be_published
|
84
|
+
@post.unpublish!
|
85
|
+
@post.should_not be_published
|
86
|
+
end
|
87
|
+
|
81
88
|
end
|
82
89
|
|
83
90
|
context 'with a DateTime publish attribute' do
|
@@ -119,6 +126,13 @@ describe Publishable do
|
|
119
126
|
@post.published.should <= DateTime.now
|
120
127
|
end
|
121
128
|
|
129
|
+
it 'can be unpublished' do
|
130
|
+
@post.published = DateTime.now - 1.minute
|
131
|
+
@post.should be_published
|
132
|
+
@post.unpublish!
|
133
|
+
@post.should_not be_published
|
134
|
+
end
|
135
|
+
|
122
136
|
end
|
123
137
|
|
124
138
|
describe 'querying for all upcoming items' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,82 +1,110 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: publishable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Martin Linkhorst
|
8
|
-
-
|
9
|
-
|
10
|
-
|
9
|
+
- тιηуηυмвєяѕ
|
10
|
+
- Andrew Janssen
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
18
17
|
name: yard
|
19
|
-
|
20
|
-
|
21
|
-
requirements:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
22
21
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0.7'
|
25
24
|
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rdoc
|
29
25
|
prerelease: false
|
30
|
-
|
31
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0.7'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: rdoc
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
32
37
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.12'
|
35
40
|
type: :development
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: bundler
|
39
41
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.12'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: bundler
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
42
53
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version:
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
45
56
|
type: :development
|
46
|
-
version_requirements: *id003
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: jeweler
|
49
57
|
prerelease: false
|
50
|
-
|
51
|
-
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
52
61
|
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.0'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: jeweler
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
54
71
|
version: 1.8.4
|
55
72
|
type: :development
|
56
|
-
version_requirements: *id004
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: rcov
|
59
73
|
prerelease: false
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version:
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.8.4
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 2.8.0
|
66
88
|
type: :development
|
67
|
-
|
68
|
-
|
69
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.8.0
|
96
|
+
description: Provides methods to publish and unpublish your active record models based
|
97
|
+
on a boolean flag, a date, or a datetime. Also adds named scopes to nicely filter
|
98
|
+
your records. Does not touch any controller or views.
|
99
|
+
email:
|
70
100
|
- m.linkhorst@googlemail.com
|
71
101
|
- info@tinynumbers.com
|
72
102
|
executables: []
|
73
|
-
|
74
103
|
extensions: []
|
75
|
-
|
76
|
-
extra_rdoc_files:
|
104
|
+
extra_rdoc_files:
|
77
105
|
- LICENSE.txt
|
78
106
|
- README.rdoc
|
79
|
-
files:
|
107
|
+
files:
|
80
108
|
- .document
|
81
109
|
- .rspec
|
82
110
|
- .travis.yml
|
@@ -93,30 +121,31 @@ files:
|
|
93
121
|
- spec/spec_helper.rb
|
94
122
|
- spec/support/matcher_each.rb
|
95
123
|
homepage: http://github.com/linki/publishable
|
96
|
-
licenses:
|
124
|
+
licenses:
|
97
125
|
- MIT
|
98
|
-
metadata: {}
|
99
|
-
|
100
126
|
post_install_message:
|
101
127
|
rdoc_options: []
|
102
|
-
|
103
|
-
require_paths:
|
128
|
+
require_paths:
|
104
129
|
- lib
|
105
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
segments:
|
137
|
+
- 0
|
138
|
+
hash: -3050157289836478071
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
113
145
|
requirements: []
|
114
|
-
|
115
146
|
rubyforge_project:
|
116
|
-
rubygems_version:
|
147
|
+
rubygems_version: 1.8.23.2
|
117
148
|
signing_key:
|
118
149
|
specification_version: 3
|
119
150
|
summary: Adds publishing functionality to your active record model
|
120
151
|
test_files: []
|
121
|
-
|
122
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 199486df5736d6d10673c9fa5b7fa8ca0b914927
|
4
|
-
data.tar.gz: 240ca5dfe93d47c8caa60de6c63366f93c395c9b
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 85e1707cc27d01e497e4e494f3d7b0657d6c632e8db6221b4dca286469d0eab52e83f9683b6fb98f7f241cbe2e44fed445d8ec2e6c79b40abbe8e5709a9bbeab
|
7
|
-
data.tar.gz: e14f17c5830f578289c8e179ae28963deea9e1e59d4aa4ef2a6f921d84a5915cc5eee2c465b5d0b11c57bf3d40398ebb4e03870f86bc522b865e7397e8c07672
|