paperclip-time-stamped 1.0.5 → 1.0.6
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/VERSION +1 -1
- data/lib/paperclip-time-stamped.rb +1 -1
- data/paperclip-time-stamped.gemspec +6 -5
- data/spec/paperclip-time-stamped_spec.rb +17 -8
- metadata +24 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
@@ -23,7 +23,7 @@ ActiveRecord::Base.class_eval do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
define_method("#{name}?") do |*style|
|
26
|
-
send(name).
|
26
|
+
send("#{name}_file_name").present? && (style.empty? ? send(name).exists? : File.file?(send("#{name}_path", style.first)))
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{paperclip-time-stamped}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcin Nowicki"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-03-25}
|
13
13
|
s.description = %q{Allow to use time-stamped urls from paperclip attachments}
|
14
14
|
s.email = %q{pr0d1r2@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.homepage = %q{http://github.com/Pr0d1r2/paperclip-time-stamped}
|
31
31
|
s.rdoc_options = ["--charset=UTF-8"]
|
32
32
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.
|
33
|
+
s.rubygems_version = %q{1.3.6}
|
34
34
|
s.summary = %q{Allow to use time-stamped urls from paperclip attachments}
|
35
35
|
s.test_files = [
|
36
36
|
"spec/paperclip-time-stamped_spec.rb",
|
@@ -53,3 +53,4 @@ Gem::Specification.new do |s|
|
|
53
53
|
s.add_dependency(%q<Pr0d1r2-active_record_connectionless>, [">= 0"])
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
@@ -8,6 +8,10 @@ class PaperclipTimeStamped < ActiveRecord::Base
|
|
8
8
|
has_attached_file :name, :styles => {:thumbnail=> "80x80>", :small => "180x180>"}, :path => '/'
|
9
9
|
has_timestamped_paperclip_attachment :name
|
10
10
|
|
11
|
+
def name_file_name
|
12
|
+
'name.png'
|
13
|
+
end
|
14
|
+
|
11
15
|
end
|
12
16
|
|
13
17
|
|
@@ -31,31 +35,36 @@ describe "PaperclipTimeStamped" do
|
|
31
35
|
end
|
32
36
|
|
33
37
|
describe 'name?' do
|
34
|
-
it 'should be true when name.exists? is true and no style given' do
|
38
|
+
it 'should be true when name_file_name is present and name.exists? is true and no style given' do
|
39
|
+
@paperclip_time_stamped.should_receive(:name_file_name).and_return('name.png')
|
35
40
|
@paperclip_time_stamped.should_receive(:name).and_return(@name)
|
36
41
|
@name.should_receive(:exists?).and_return(true)
|
37
42
|
@paperclip_time_stamped.name?.should be_true
|
38
43
|
end
|
39
44
|
|
40
45
|
it 'should be true when name.exists? is true and File.file? on given file with style is true' do
|
41
|
-
@paperclip_time_stamped.should_receive(:
|
42
|
-
@name.should_receive(:exists?).and_return(true)
|
43
|
-
File.should_receive(:file?).with('path').and_return(true)
|
46
|
+
@paperclip_time_stamped.should_receive(:name_file_name).and_return('name.png')
|
44
47
|
@paperclip_time_stamped.should_receive(:name_path).with(:small).and_return('path')
|
48
|
+
File.should_receive(:file?).with('path').and_return(true)
|
45
49
|
@paperclip_time_stamped.name?(:small).should be_true
|
46
50
|
end
|
47
51
|
|
52
|
+
it 'should be false when name_file_name is not present' do
|
53
|
+
@paperclip_time_stamped.should_receive(:name_file_name).and_return(nil)
|
54
|
+
@paperclip_time_stamped.name?(:small).should be_false
|
55
|
+
end
|
56
|
+
|
48
57
|
it 'should be false when name.exists? is false' do
|
58
|
+
@paperclip_time_stamped.should_receive(:name_file_name).and_return('name.png')
|
49
59
|
@paperclip_time_stamped.should_receive(:name).and_return(@name)
|
50
60
|
@name.should_receive(:exists?).and_return(false)
|
51
|
-
@paperclip_time_stamped.name
|
61
|
+
@paperclip_time_stamped.name?.should be_false
|
52
62
|
end
|
53
63
|
|
54
64
|
it 'should be false when name.exists? is true but File.file? on given file with style is false' do
|
55
|
-
@
|
56
|
-
@paperclip_time_stamped.should_receive(:name).and_return(@name)
|
57
|
-
File.should_receive(:file?).with('path').and_return(false)
|
65
|
+
@paperclip_time_stamped.should_receive(:name_file_name).and_return('name.png')
|
58
66
|
@paperclip_time_stamped.should_receive(:name_path).with(:small).and_return('path')
|
67
|
+
File.should_receive(:file?).with('path').and_return(false)
|
59
68
|
@paperclip_time_stamped.name?(:small).should be_false
|
60
69
|
end
|
61
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-time-stamped
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
version: 1.0.6
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Marcin Nowicki
|
@@ -9,29 +14,33 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-03-25 00:00:00 +01:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
25
32
|
- !ruby/object:Gem::Dependency
|
26
33
|
name: Pr0d1r2-active_record_connectionless
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
33
41
|
version: "0"
|
34
|
-
|
42
|
+
type: :development
|
43
|
+
version_requirements: *id002
|
35
44
|
description: Allow to use time-stamped urls from paperclip attachments
|
36
45
|
email: pr0d1r2@gmail.com
|
37
46
|
executables: []
|
@@ -64,18 +73,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
73
|
requirements:
|
65
74
|
- - ">="
|
66
75
|
- !ruby/object:Gem::Version
|
76
|
+
segments:
|
77
|
+
- 0
|
67
78
|
version: "0"
|
68
|
-
version:
|
69
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
80
|
requirements:
|
71
81
|
- - ">="
|
72
82
|
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
73
85
|
version: "0"
|
74
|
-
version:
|
75
86
|
requirements: []
|
76
87
|
|
77
88
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
89
|
+
rubygems_version: 1.3.6
|
79
90
|
signing_key:
|
80
91
|
specification_version: 3
|
81
92
|
summary: Allow to use time-stamped urls from paperclip attachments
|