publish 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +1 -0
- data/README.md +10 -2
- data/gemfiles/mongoid-master.gemfile +1 -1
- data/lib/mongoid/publish/version.rb +1 -1
- data/lib/mongoid/publish.rb +4 -1
- data/publish.gemspec +1 -1
- data/test/publish/mongoid/publish_test.rb +14 -1
- metadata +7 -17
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzNhOTQ5NmRlOTUwMWFiZjg0OGZkOTFkZDdmNWRmMDk0Zjc0ZWY3OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGRkNzAxZDI1OGVkZWI0YmYyMmY2NzYzMDhiMWVhNWJhZjEzYjkzYQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTU3ZGEyMWEwYjY3YzEwZjdlZTUxNWFlNzk3OWVlYjg3NGYyNDc4MmVlZjBi
|
10
|
+
OTVmMGY2N2MxODk1MjMxYzJjYzY5ZGExZTM2NzY1YjU1ZTM5NjI2YjYyN2Yw
|
11
|
+
ZWY1NWYyOWFkNjNiOTgzZDMzMDE3NGYyYzI2NjA4NWQ2MDRjNjY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWE3YzVlNGQ1NTU1NzUwYmFmY2Y3YWIzZjkyZDIxMTg5MzBhYmQ0NTEyZTIz
|
14
|
+
NDkxNTQ2Y2I0Y2M3NTE0MGI0YWJjNmNhYzYyMGQ0Y2VhMzFiZjcyMTc1OWQ0
|
15
|
+
NWExMjJmMWRjZGJhZTViMjQzZTlmNzE5MGRhZThkMDhkYmQ0ZjY=
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Publish is a gem that adds the common functionality to publish (or set as draft)
|
|
8
8
|
Add to Gemfile
|
9
9
|
|
10
10
|
``` ruby
|
11
|
-
gem "publish", "~> 0.
|
11
|
+
gem "publish", "~> 0.2.0"
|
12
12
|
```
|
13
13
|
|
14
14
|
Then run
|
@@ -66,4 +66,12 @@ end
|
|
66
66
|
|
67
67
|
product = Product.new
|
68
68
|
product.publish! #=> before publish after publish
|
69
|
-
```
|
69
|
+
```
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create new Pull Request
|
data/lib/mongoid/publish.rb
CHANGED
@@ -13,7 +13,7 @@ module Mongoid
|
|
13
13
|
end
|
14
14
|
|
15
15
|
include Mongoid::Publish::Callbacks
|
16
|
-
|
16
|
+
|
17
17
|
def published?
|
18
18
|
return true if self.published && self.published_at && self.published_at <= Date.today
|
19
19
|
false
|
@@ -35,6 +35,9 @@ module Mongoid
|
|
35
35
|
end
|
36
36
|
|
37
37
|
module ClassMethods
|
38
|
+
def list(includes_drafts=true)
|
39
|
+
includes_drafts ? all : published
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
43
|
end
|
data/publish.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_dependency "mongoid", ">= 3.1.0"
|
22
22
|
|
23
|
-
gem.add_development_dependency "rails", "
|
23
|
+
gem.add_development_dependency "rails", ">= 3.2.0"
|
24
24
|
gem.add_development_dependency "rake", "~> 10.0"
|
25
25
|
gem.add_development_dependency "simplecov", "~> 0.7.0"
|
26
26
|
end
|
@@ -3,7 +3,7 @@ require File.expand_path("../../../test_helper", __FILE__)
|
|
3
3
|
class PublishTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
setup do
|
6
|
-
@post = create(:post)
|
6
|
+
@post = create(:post, :published => false)
|
7
7
|
end
|
8
8
|
|
9
9
|
test "should create published at field" do
|
@@ -72,5 +72,18 @@ class PublishTest < ActiveSupport::TestCase
|
|
72
72
|
|
73
73
|
assert_equal Post.last.publication_status, Date.today
|
74
74
|
end
|
75
|
+
|
76
|
+
test "should list posts excluding drafts" do
|
77
|
+
3.times { create(:post, :published => true) }
|
78
|
+
create(:post, :published => false)
|
79
|
+
|
80
|
+
assert_equal 3, Post.list(false).count
|
81
|
+
end
|
75
82
|
|
83
|
+
test "should list posts including drafts" do
|
84
|
+
4.times { create(:post, :published => true) }
|
85
|
+
create(:post, :published => false)
|
86
|
+
|
87
|
+
assert_equal 6, Post.list(true).count
|
88
|
+
end
|
76
89
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: publish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Lucas Renan
|
@@ -11,12 +10,11 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: mongoid
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,7 +22,6 @@ dependencies:
|
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ! '>='
|
30
27
|
- !ruby/object:Gem::Version
|
@@ -32,23 +29,20 @@ dependencies:
|
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: rails
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
|
-
- -
|
33
|
+
- - ! '>='
|
38
34
|
- !ruby/object:Gem::Version
|
39
35
|
version: 3.2.0
|
40
36
|
type: :development
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
|
-
- -
|
40
|
+
- - ! '>='
|
46
41
|
- !ruby/object:Gem::Version
|
47
42
|
version: 3.2.0
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: rake
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - ~>
|
54
48
|
- !ruby/object:Gem::Version
|
@@ -56,7 +50,6 @@ dependencies:
|
|
56
50
|
type: :development
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - ~>
|
62
55
|
- !ruby/object:Gem::Version
|
@@ -64,7 +57,6 @@ dependencies:
|
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
58
|
name: simplecov
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
61
|
- - ~>
|
70
62
|
- !ruby/object:Gem::Version
|
@@ -72,7 +64,6 @@ dependencies:
|
|
72
64
|
type: :development
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
68
|
- - ~>
|
78
69
|
- !ruby/object:Gem::Version
|
@@ -147,27 +138,26 @@ files:
|
|
147
138
|
- test/test_helper.rb
|
148
139
|
homepage: https://github.com/lucasrenan/publish
|
149
140
|
licenses: []
|
141
|
+
metadata: {}
|
150
142
|
post_install_message:
|
151
143
|
rdoc_options: []
|
152
144
|
require_paths:
|
153
145
|
- lib
|
154
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
147
|
requirements:
|
157
148
|
- - ! '>='
|
158
149
|
- !ruby/object:Gem::Version
|
159
150
|
version: '0'
|
160
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
152
|
requirements:
|
163
153
|
- - ! '>='
|
164
154
|
- !ruby/object:Gem::Version
|
165
155
|
version: '0'
|
166
156
|
requirements: []
|
167
157
|
rubyforge_project:
|
168
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.0.3
|
169
159
|
signing_key:
|
170
|
-
specification_version:
|
160
|
+
specification_version: 4
|
171
161
|
summary: Adds the functionality to publish/unpublish mongoid docs
|
172
162
|
test_files:
|
173
163
|
- test/dummy/Rakefile
|