scribd_fu 2.0.10 → 2.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.10
1
+ 2.0.11
@@ -1,6 +1,6 @@
1
1
  module ScribdFu
2
2
 
3
- ConfigPath = "#{::Rails.root.to_s}/config/scribd_fu.yml".freeze
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
- raise ScribdFuError, "#{ConfigPath} does not exist" unless File.file?(ConfigPath)
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(ConfigPath).each_pair{|k,v| {k=>v.to_s.strip}}.symbolize_keys!
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
- def has_ipaper_and_uses(str)
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
- after_save :upload_to_scribd # This *MUST* be an after_save
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
+
@@ -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
- path = attached_file.url
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
+
@@ -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.10"
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-28}
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 = [
@@ -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("#{RAILS_ROOT}/config/scribd_fu.yml").and_return(false)
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.10
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-28 00:00:00 -04:00
13
+ date: 2011-03-29 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency