acts_as_publishable 0.2 → 0.2.1
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.
- data/.bundle/config +2 -0
- data/.gitignore +3 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +41 -0
- data/Rakefile +2 -13
- data/acts_as_publishable.gemspec +14 -19
- data/lib/acts_as_publishable/acts_as_publishable.rb +5 -2
- data/lib/acts_as_publishable/version.rb +4 -0
- data/spec/acts_as_publishable_spec.rb +7 -1
- data/spec/spec_helper.rb +2 -0
- metadata +67 -23
- data/Manifest +0 -10
data/.bundle/config
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
acts_as_publishable (0.2.1)
|
5
|
+
rails (~> 2.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (2.3.10)
|
11
|
+
actionpack (= 2.3.10)
|
12
|
+
actionpack (2.3.10)
|
13
|
+
activesupport (= 2.3.10)
|
14
|
+
rack (~> 1.1.0)
|
15
|
+
activerecord (2.3.10)
|
16
|
+
activesupport (= 2.3.10)
|
17
|
+
activeresource (2.3.10)
|
18
|
+
activesupport (= 2.3.10)
|
19
|
+
activesupport (2.3.10)
|
20
|
+
rack (1.1.0)
|
21
|
+
rails (2.3.10)
|
22
|
+
actionmailer (= 2.3.10)
|
23
|
+
actionpack (= 2.3.10)
|
24
|
+
activerecord (= 2.3.10)
|
25
|
+
activeresource (= 2.3.10)
|
26
|
+
activesupport (= 2.3.10)
|
27
|
+
rake (>= 0.8.3)
|
28
|
+
rake (0.8.7)
|
29
|
+
rspec (1.3.1)
|
30
|
+
sqlite3 (1.3.3)
|
31
|
+
sqlite3-ruby (1.3.3)
|
32
|
+
sqlite3 (>= 1.3.3)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
acts_as_publishable!
|
39
|
+
rails (~> 2.3)
|
40
|
+
rspec (= 1.3.1)
|
41
|
+
sqlite3-ruby
|
data/Rakefile
CHANGED
@@ -1,14 +1,3 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'echoe'
|
4
|
-
|
5
|
-
Echoe.new('acts_as_publishable', '0.2') do |p|
|
6
|
-
p.description = "Rails gem that adds functionality to make Active Record models publishable"
|
7
|
-
p.url = "http://github.com/rbgrouleff/acts_as_publishable"
|
8
|
-
p.author = "Rasmus Bang Grouleff"
|
9
|
-
p.email = "rasmus@anybite.com"
|
10
|
-
p.ignore_pattern = ["tmp/*", "script/*", "watchr-runner.rb"]
|
11
|
-
p.development_dependencies = []
|
12
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
13
3
|
|
14
|
-
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/acts_as_publishable.gemspec
CHANGED
@@ -1,30 +1,25 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "acts_as_publishable/version"
|
2
4
|
|
3
5
|
Gem::Specification.new do |s|
|
4
6
|
s.name = %q{acts_as_publishable}
|
5
|
-
s.version =
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
7
|
+
s.version = ActsAsPublishable::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
8
9
|
s.authors = ["Rasmus Bang Grouleff"]
|
9
|
-
s.date = %q{2010-06-23}
|
10
|
-
s.description = %q{Rails gem that adds functionality to make Active Record models publishable}
|
11
10
|
s.email = %q{rasmus@anybite.com}
|
12
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/acts_as_publishable.rb", "lib/acts_as_publishable/acts_as_publishable.rb"]
|
13
|
-
s.files = ["README.rdoc", "Rakefile", "acts_as_publishable.gemspec", "lib/acts_as_publishable.rb", "lib/acts_as_publishable/acts_as_publishable.rb", "spec/acts_as_publishable_spec.rb", "spec/rspec_immediate_feedback_formatter.rb", "spec/spec.opts", "spec/spec_helper.rb", "Manifest"]
|
14
11
|
s.homepage = %q{http://github.com/rbgrouleff/acts_as_publishable}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Acts_as_publishable", "--main", "README.rdoc"]
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project = %q{acts_as_publishable}
|
18
|
-
s.rubygems_version = %q{1.3.7}
|
19
12
|
s.summary = %q{Rails gem that adds functionality to make Active Record models publishable}
|
13
|
+
s.description = %q{Rails gem that adds functionality to make Active Record models publishable}
|
14
|
+
|
15
|
+
s.rubyforge_project = %q{acts_as_publishable}
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
else
|
29
|
-
end
|
22
|
+
s.add_development_dependency 'rspec', '= 1.3.1'
|
23
|
+
s.add_development_dependency 'sqlite3-ruby'
|
24
|
+
s.add_dependency 'rails', '~> 2.3'
|
30
25
|
end
|
@@ -39,7 +39,10 @@ module ActsAsPublishable
|
|
39
39
|
now = Time.now
|
40
40
|
@from ||= self[self.class.published_from_column.to_sym]
|
41
41
|
@to ||= self[self.class.published_to_column.to_sym]
|
42
|
-
self[self.class.publish_now_column.to_sym]
|
42
|
+
is_published_now = self[self.class.publish_now_column.to_sym]
|
43
|
+
is_published_from_in_the_past = @from && @from <= now
|
44
|
+
is_published_to_in_the_future = @to && @to >= now
|
45
|
+
is_published_now || is_published_from_in_the_past && !@to || !@from && is_published_to_in_the_future || is_published_from_in_the_past && is_published_to_in_the_future
|
43
46
|
end
|
44
47
|
end
|
45
|
-
end
|
48
|
+
end
|
@@ -91,6 +91,12 @@ describe "Publishable with default columns" do
|
|
91
91
|
@post.published_from = Time.now
|
92
92
|
@post.valid?.should_not be_true
|
93
93
|
end
|
94
|
+
|
95
|
+
it "is published if published_from is set in the past" do
|
96
|
+
@post.published_from = 1.day.ago
|
97
|
+
@post.published?.should be_true
|
98
|
+
@post.published_to.should != nil
|
99
|
+
end
|
94
100
|
end
|
95
101
|
|
96
102
|
describe "Publishable with default_published_now set to true" do
|
@@ -163,4 +169,4 @@ describe "Publishable with non-default column names" do
|
|
163
169
|
Publishable.find(@publishable.id).from.should eql(a_day_ago)
|
164
170
|
Publishable.find(@publishable.id).to.should eql(tomorrow)
|
165
171
|
end
|
166
|
-
end
|
172
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_publishable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Rasmus Bang Grouleff
|
@@ -14,43 +15,84 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-01-21 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - "="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 25
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
- 1
|
34
|
+
version: 1.3.1
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: sqlite3-ruby
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rails
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 5
|
60
|
+
segments:
|
61
|
+
- 2
|
62
|
+
- 3
|
63
|
+
version: "2.3"
|
64
|
+
type: :runtime
|
65
|
+
version_requirements: *id003
|
21
66
|
description: Rails gem that adds functionality to make Active Record models publishable
|
22
67
|
email: rasmus@anybite.com
|
23
68
|
executables: []
|
24
69
|
|
25
70
|
extensions: []
|
26
71
|
|
27
|
-
extra_rdoc_files:
|
28
|
-
|
29
|
-
- lib/acts_as_publishable.rb
|
30
|
-
- lib/acts_as_publishable/acts_as_publishable.rb
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
31
74
|
files:
|
75
|
+
- .bundle/config
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
32
79
|
- README.rdoc
|
33
80
|
- Rakefile
|
34
81
|
- acts_as_publishable.gemspec
|
35
82
|
- lib/acts_as_publishable.rb
|
36
83
|
- lib/acts_as_publishable/acts_as_publishable.rb
|
84
|
+
- lib/acts_as_publishable/version.rb
|
37
85
|
- spec/acts_as_publishable_spec.rb
|
38
86
|
- spec/rspec_immediate_feedback_formatter.rb
|
39
87
|
- spec/spec.opts
|
40
88
|
- spec/spec_helper.rb
|
41
|
-
- Manifest
|
42
89
|
has_rdoc: true
|
43
90
|
homepage: http://github.com/rbgrouleff/acts_as_publishable
|
44
91
|
licenses: []
|
45
92
|
|
46
93
|
post_install_message:
|
47
|
-
rdoc_options:
|
48
|
-
|
49
|
-
- --inline-source
|
50
|
-
- --title
|
51
|
-
- Acts_as_publishable
|
52
|
-
- --main
|
53
|
-
- README.rdoc
|
94
|
+
rdoc_options: []
|
95
|
+
|
54
96
|
require_paths:
|
55
97
|
- lib
|
56
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -67,11 +109,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
109
|
requirements:
|
68
110
|
- - ">="
|
69
111
|
- !ruby/object:Gem::Version
|
70
|
-
hash:
|
112
|
+
hash: 3
|
71
113
|
segments:
|
72
|
-
-
|
73
|
-
|
74
|
-
version: "1.2"
|
114
|
+
- 0
|
115
|
+
version: "0"
|
75
116
|
requirements: []
|
76
117
|
|
77
118
|
rubyforge_project: acts_as_publishable
|
@@ -79,5 +120,8 @@ rubygems_version: 1.3.7
|
|
79
120
|
signing_key:
|
80
121
|
specification_version: 3
|
81
122
|
summary: Rails gem that adds functionality to make Active Record models publishable
|
82
|
-
test_files:
|
83
|
-
|
123
|
+
test_files:
|
124
|
+
- spec/acts_as_publishable_spec.rb
|
125
|
+
- spec/rspec_immediate_feedback_formatter.rb
|
126
|
+
- spec/spec.opts
|
127
|
+
- spec/spec_helper.rb
|
data/Manifest
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
README.rdoc
|
2
|
-
Rakefile
|
3
|
-
acts_as_publishable.gemspec
|
4
|
-
lib/acts_as_publishable.rb
|
5
|
-
lib/acts_as_publishable/acts_as_publishable.rb
|
6
|
-
spec/acts_as_publishable_spec.rb
|
7
|
-
spec/rspec_immediate_feedback_formatter.rb
|
8
|
-
spec/spec.opts
|
9
|
-
spec/spec_helper.rb
|
10
|
-
Manifest
|