scribd_fu 2.0.10 → 2.0.11
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/scribd_fu.rb +8 -5
- data/lib/scribd_fu/paperclip.rb +6 -1
- data/scribd_fu.gemspec +2 -2
- data/spec/scribd_fu_spec.rb +3 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.11
|
data/lib/scribd_fu.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module ScribdFu
|
2
2
|
|
3
|
-
ConfigPath = "
|
3
|
+
ConfigPath = "config/scribd_fu.yml".freeze
|
4
4
|
|
5
5
|
# A list of content types supported by iPaper.
|
6
6
|
ContentTypes = [
|
@@ -80,10 +80,11 @@ module ScribdFu
|
|
80
80
|
|
81
81
|
# Read, store, and return the ScribdFu config file's contents
|
82
82
|
def config
|
83
|
-
|
83
|
+
path = defined?(Rails) ? File.join(Rails.root, ConfigPath) : ConfigPath
|
84
|
+
raise ScribdFuError, "#{path} does not exist" unless File.file?(path)
|
84
85
|
|
85
86
|
# Load the config file and strip any whitespace from the values
|
86
|
-
@config ||= YAML.load_file(
|
87
|
+
@config ||= YAML.load_file(path).each_pair{|k,v| {k=>v.to_s.strip}}.symbolize_keys!
|
87
88
|
end
|
88
89
|
|
89
90
|
# Get the preferred access level for iPaper documents
|
@@ -120,13 +121,14 @@ module ScribdFu
|
|
120
121
|
module ClassMethods
|
121
122
|
|
122
123
|
# Load and inject ScribdFu goodies
|
123
|
-
|
124
|
+
# opts can be :on => :create, defaults to :on => :save
|
125
|
+
def has_ipaper_and_uses(str, opts = {:on => :save })
|
124
126
|
check_environment
|
125
127
|
load_base_plugin(str)
|
126
128
|
|
127
129
|
include InstanceMethods
|
128
130
|
|
129
|
-
|
131
|
+
send("after_#{opts[:on]}", :upload_to_scribd) # This *MUST* be an after_save
|
130
132
|
before_destroy :destroy_ipaper_document
|
131
133
|
end
|
132
134
|
|
@@ -265,3 +267,4 @@ end
|
|
265
267
|
|
266
268
|
# Let's do this.
|
267
269
|
ActiveRecord::Base.send(:include, ScribdFu) if Object.const_defined?("ActiveRecord")
|
270
|
+
|
data/lib/scribd_fu/paperclip.rb
CHANGED
@@ -29,7 +29,11 @@ module ScribdFu
|
|
29
29
|
# local file if the file is stored locally.
|
30
30
|
def file_path
|
31
31
|
if ScribdFu::amazon_based?(attached_file.url)
|
32
|
-
|
32
|
+
if attached_file.instance_variable_get(:@s3_permissions) == "authenticated-read"
|
33
|
+
return attached_file.expiring_url(60)
|
34
|
+
else
|
35
|
+
path = attached_file.url
|
36
|
+
end
|
33
37
|
else
|
34
38
|
path = attached_file.path
|
35
39
|
end
|
@@ -55,3 +59,4 @@ module ScribdFu
|
|
55
59
|
end
|
56
60
|
|
57
61
|
end
|
62
|
+
|
data/scribd_fu.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{scribd_fu}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Darby"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-29}
|
13
13
|
s.description = %q{A Rails gem that streamlines interactions with the Scribd service}
|
14
14
|
s.email = %q{matt@matt-darby.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/scribd_fu_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe "ScribdFu" do
|
|
14
14
|
|
15
15
|
describe "that is missing a config file" do
|
16
16
|
before do
|
17
|
-
File.should_receive(:file?).with("
|
17
|
+
File.should_receive(:file?).with("config/scribd_fu.yml").and_return(false)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should raise an error" do
|
@@ -350,10 +350,11 @@ describe "Viewing an iPaper document" do
|
|
350
350
|
@document.display_ipaper(options).should =~ /.*scribd_doc\.addParam\('width', '100'\);.*/
|
351
351
|
@document.display_ipaper(options).should_not =~ /.*scribd_doc\.addParam\('some_dumb_setting', '100'\);.*/
|
352
352
|
end
|
353
|
-
|
353
|
+
|
354
354
|
it "should send booleans as booleans" do
|
355
355
|
options = {:hide_disabled_buttons => true}
|
356
356
|
@document.display_ipaper(options).should =~ /.*scribd_doc\.addParam\('hide_disabled_buttons', true\);.*/
|
357
357
|
end
|
358
358
|
|
359
359
|
end
|
360
|
+
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: scribd_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.11
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matt Darby
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-29 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|