paperclip-fedora 0.1.0 → 0.2.0
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/README.md +30 -4
 - data/Rakefile +3 -1
 - data/lib/paperclip-fedora/railtie.rb +11 -0
 - data/lib/paperclip-fedora/rake.rb +8 -0
 - data/lib/paperclip-fedora/version.rb +1 -1
 - data/lib/paperclip-fedora.rb +17 -2
 - data/paperclip-fedora.gemspec +3 -2
 - metadata +18 -5
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -5,10 +5,36 @@ Paperclip-Fedora uses Rubydora to extend the storage options of Paperclip to use 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            ## Installation
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
            To use, require the gem in your Gemfile:
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            `gem 'paperclip-fedora'`
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
            To specify Fedora Commons as your storage location, add the storage option to your
         
     | 
| 
      
 13 
     | 
    
         
            +
            has_attachment:
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
            `has_attached_file :content, :storage => :Fedora`
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            For server connection options, you should have a file titled paperclip_fedora.yml in your
         
     | 
| 
      
 18 
     | 
    
         
            +
            /config folder. There is a nifty rake task to put the yaml file there for you:
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            `rake paperclip:fedora:setup`
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            After that, go edit the yaml file with your server settings per rails environment (They default to a server on the localhost).
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ## Overview
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            The Fedora Commons storage has very complex ways of connecting data. Currently in
         
     | 
| 
      
 27 
     | 
    
         
            +
            paperclip-fedora there is no support for complex relationships. The upload creates
         
     | 
| 
      
 28 
     | 
    
         
            +
            a data object with a datastream per style (such as thumbnails, image sizes, or
         
     | 
| 
      
 29 
     | 
    
         
            +
            other that you specify), as well as the original upload.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## Todo
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            The object and datastream labels are currently static and not too pretty. Plans to 
         
     | 
| 
      
 34 
     | 
    
         
            +
            make the object label the original filename and the datastreams follow a similar pattern.
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ## Copyright & Acknowledgements
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            Using Paperclip: https://github.com/thoughtbot/paperclip
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            Using Rubydora: https://github.com/cbeer/rubydora
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/paperclip-fedora.rb
    CHANGED
    
    | 
         @@ -1,13 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "paperclip-fedora/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "paperclip-fedora/railtie" if Rails.version >= "3.0"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "FileUtils" unless defined?(FileUtils)
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            module Paperclip
         
     | 
| 
       4 
6 
     | 
    
         
             
              module Storage
         
     | 
| 
       5 
7 
     | 
    
         
             
                module Fedora
         
     | 
| 
      
 8 
     | 
    
         
            +
                  extend self
         
     | 
| 
       6 
9 
     | 
    
         
             
                  def self.extended(base)
         
     | 
| 
       7 
10 
     | 
    
         
             
                    require 'rubydora'
         
     | 
| 
       8 
11 
     | 
    
         
             
                    base.instance_eval do
         
     | 
| 
       9 
12 
     | 
    
         
             
                      if(!@options[:fedora_config])
         
     | 
| 
       10 
     | 
    
         
            -
                        @options[:fedora_config] =  
     | 
| 
      
 13 
     | 
    
         
            +
                        @options[:fedora_config] = config_file
         
     | 
| 
       11 
14 
     | 
    
         
             
                      end
         
     | 
| 
       12 
15 
     | 
    
         | 
| 
       13 
16 
     | 
    
         
             
                      @fedora_config = parse_config(@options[:fedora_config])
         
     | 
| 
         @@ -38,7 +41,7 @@ module Paperclip 
     | 
|
| 
       38 
41 
     | 
    
         
             
                      ds.file = file
         
     | 
| 
       39 
42 
     | 
    
         
             
                      ds.dsLabel = "TempFile"
         
     | 
| 
       40 
43 
     | 
    
         
             
                      ds.save
         
     | 
| 
       41 
     | 
    
         
            -
                      log("Added #{style} to #{@object_id}")
         
     | 
| 
      
 44 
     | 
    
         
            +
                      log("Added #{style} datastream to #{@object_id}")
         
     | 
| 
       42 
45 
     | 
    
         
             
                    end
         
     | 
| 
       43 
46 
     | 
    
         
             
                    @queued_for_write = {}
         
     | 
| 
       44 
47 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -75,6 +78,18 @@ module Paperclip 
     | 
|
| 
       75 
78 
     | 
    
         
             
                    (config[Rails.env] || config).symbolize_keys
         
     | 
| 
       76 
79 
     | 
    
         
             
                  end
         
     | 
| 
       77 
80 
     | 
    
         | 
| 
      
 81 
     | 
    
         
            +
                  def setup!
         
     | 
| 
      
 82 
     | 
    
         
            +
                    FileUtils.cp(File.dirname(__FILE__) + "/../config/paperclip_fedora.yml", config_file) unless config?
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                  def config_file
         
     | 
| 
      
 86 
     | 
    
         
            +
                    Rails.root.join("config", "paperclip_fedora.yml").to_s
         
     | 
| 
      
 87 
     | 
    
         
            +
                  end
         
     | 
| 
      
 88 
     | 
    
         
            +
                  
         
     | 
| 
      
 89 
     | 
    
         
            +
                  def config?
         
     | 
| 
      
 90 
     | 
    
         
            +
                    File.file? config_file
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       78 
93 
     | 
    
         
             
                  private
         
     | 
| 
       79 
94 
     | 
    
         | 
| 
       80 
95 
     | 
    
         
             
                  def find_credentials config
         
     | 
    
        data/paperclip-fedora.gemspec
    CHANGED
    
    | 
         @@ -18,6 +18,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
       19 
19 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              s. 
     | 
| 
       22 
     | 
    
         
            -
              s. 
     | 
| 
      
 21 
     | 
    
         
            +
              s.add_dependency "paperclip"
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_dependency "rubydora"
         
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_development_dependency "rake", "0.9.2"
         
     | 
| 
       23 
24 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: paperclip-fedora
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -13,7 +13,7 @@ date: 2011-09-14 00:00:00.000000000Z 
     | 
|
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: paperclip
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &2152442460 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *2152442460
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: rubydora
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &2152441900 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -32,7 +32,18 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *2152441900
         
     | 
| 
      
 36 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 37 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &2152441060 !ruby/object:Gem::Requirement
         
     | 
| 
      
 39 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 40 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 41 
     | 
    
         
            +
                - - =
         
     | 
| 
      
 42 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 43 
     | 
    
         
            +
                    version: 0.9.2
         
     | 
| 
      
 44 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 45 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *2152441060
         
     | 
| 
       36 
47 
     | 
    
         
             
            description: Adds Fedora Commons storage support for the Paperclip gem.
         
     | 
| 
       37 
48 
     | 
    
         
             
            email:
         
     | 
| 
       38 
49 
     | 
    
         
             
            - jaredsartin@gmail.com
         
     | 
| 
         @@ -46,6 +57,8 @@ files: 
     | 
|
| 
       46 
57 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       47 
58 
     | 
    
         
             
            - config/paperclip_fedora.yml
         
     | 
| 
       48 
59 
     | 
    
         
             
            - lib/paperclip-fedora.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/paperclip-fedora/railtie.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/paperclip-fedora/rake.rb
         
     | 
| 
       49 
62 
     | 
    
         
             
            - lib/paperclip-fedora/version.rb
         
     | 
| 
       50 
63 
     | 
    
         
             
            - paperclip-fedora.gemspec
         
     | 
| 
       51 
64 
     | 
    
         
             
            homepage: https://github.com/JaredSartin/paperclip-fedora
         
     |