dragonfly-activerecord 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.gitignore +0 -12
- data/Gemfile.lock +94 -0
- data/README.md +9 -7
- data/lib/dragonfly-activerecord/store.rb +7 -7
- data/lib/dragonfly-activerecord/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 804ea5bfdd90237f08a7c477f0b0019e040648c8
         | 
| 4 | 
            +
              data.tar.gz: 3ef8c72e9b1aea1e513400751f39369acf91647c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 04dcc1651721230e8d937252fc08045f2b4e16afaf5359ff82408da7ac313a532f8ee9b18785ffe9b74d52414fe58594b5af2d0d88f4d7f425aea9c89a741b3b
         | 
| 7 | 
            +
              data.tar.gz: 4cb3cd91cce1c350174cee6d4b91836d673ad33ece38f107884df2cc04651a4c77e073d119f02f74be912dad601ad4759ab5d3726a6400e2d4afd36bb56af519
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/Gemfile.lock
    ADDED
    
    | @@ -0,0 +1,94 @@ | |
| 1 | 
            +
            PATH
         | 
| 2 | 
            +
              remote: .
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                dragonfly-activerecord (0.0.2)
         | 
| 5 | 
            +
                  activerecord (>= 3.2.6)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            GEM
         | 
| 8 | 
            +
              remote: http://yarp.dev/
         | 
| 9 | 
            +
              specs:
         | 
| 10 | 
            +
                activemodel (4.0.2)
         | 
| 11 | 
            +
                  activesupport (= 4.0.2)
         | 
| 12 | 
            +
                  builder (~> 3.1.0)
         | 
| 13 | 
            +
                activerecord (4.0.2)
         | 
| 14 | 
            +
                  activemodel (= 4.0.2)
         | 
| 15 | 
            +
                  activerecord-deprecated_finders (~> 1.0.2)
         | 
| 16 | 
            +
                  activesupport (= 4.0.2)
         | 
| 17 | 
            +
                  arel (~> 4.0.0)
         | 
| 18 | 
            +
                activerecord-deprecated_finders (1.0.3)
         | 
| 19 | 
            +
                activesupport (4.0.2)
         | 
| 20 | 
            +
                  i18n (~> 0.6, >= 0.6.4)
         | 
| 21 | 
            +
                  minitest (~> 4.2)
         | 
| 22 | 
            +
                  multi_json (~> 1.3)
         | 
| 23 | 
            +
                  thread_safe (~> 0.1)
         | 
| 24 | 
            +
                  tzinfo (~> 0.3.37)
         | 
| 25 | 
            +
                appraisal (0.5.2)
         | 
| 26 | 
            +
                  bundler
         | 
| 27 | 
            +
                  rake
         | 
| 28 | 
            +
                arel (4.0.1)
         | 
| 29 | 
            +
                atomic (1.1.14)
         | 
| 30 | 
            +
                builder (3.1.4)
         | 
| 31 | 
            +
                celluloid (0.15.2)
         | 
| 32 | 
            +
                  timers (~> 1.1.0)
         | 
| 33 | 
            +
                coderay (1.1.0)
         | 
| 34 | 
            +
                diff-lcs (1.2.5)
         | 
| 35 | 
            +
                ffi (1.9.3)
         | 
| 36 | 
            +
                formatador (0.2.4)
         | 
| 37 | 
            +
                guard (2.2.5)
         | 
| 38 | 
            +
                  formatador (>= 0.2.4)
         | 
| 39 | 
            +
                  listen (~> 2.1)
         | 
| 40 | 
            +
                  lumberjack (~> 1.0)
         | 
| 41 | 
            +
                  pry (>= 0.9.12)
         | 
| 42 | 
            +
                  thor (>= 0.18.1)
         | 
| 43 | 
            +
                guard-rspec (4.2.3)
         | 
| 44 | 
            +
                  guard (~> 2.1)
         | 
| 45 | 
            +
                  rspec (>= 2.14, < 4.0)
         | 
| 46 | 
            +
                i18n (0.6.9)
         | 
| 47 | 
            +
                listen (2.4.0)
         | 
| 48 | 
            +
                  celluloid (>= 0.15.2)
         | 
| 49 | 
            +
                  rb-fsevent (>= 0.9.3)
         | 
| 50 | 
            +
                  rb-inotify (>= 0.9)
         | 
| 51 | 
            +
                lumberjack (1.0.4)
         | 
| 52 | 
            +
                method_source (0.8.2)
         | 
| 53 | 
            +
                minitest (4.7.5)
         | 
| 54 | 
            +
                multi_json (1.8.2)
         | 
| 55 | 
            +
                mysql2 (0.3.14)
         | 
| 56 | 
            +
                pg (0.17.1)
         | 
| 57 | 
            +
                pry (0.9.12.4)
         | 
| 58 | 
            +
                  coderay (~> 1.0)
         | 
| 59 | 
            +
                  method_source (~> 0.8)
         | 
| 60 | 
            +
                  slop (~> 3.4)
         | 
| 61 | 
            +
                rake (10.1.1)
         | 
| 62 | 
            +
                rb-fsevent (0.9.4)
         | 
| 63 | 
            +
                rb-inotify (0.9.3)
         | 
| 64 | 
            +
                  ffi (>= 0.5.0)
         | 
| 65 | 
            +
                rspec (2.14.1)
         | 
| 66 | 
            +
                  rspec-core (~> 2.14.0)
         | 
| 67 | 
            +
                  rspec-expectations (~> 2.14.0)
         | 
| 68 | 
            +
                  rspec-mocks (~> 2.14.0)
         | 
| 69 | 
            +
                rspec-core (2.14.7)
         | 
| 70 | 
            +
                rspec-expectations (2.14.4)
         | 
| 71 | 
            +
                  diff-lcs (>= 1.1.3, < 2.0)
         | 
| 72 | 
            +
                rspec-mocks (2.14.4)
         | 
| 73 | 
            +
                slop (3.4.7)
         | 
| 74 | 
            +
                sqlite3 (1.3.8)
         | 
| 75 | 
            +
                thor (0.18.1)
         | 
| 76 | 
            +
                thread_safe (0.1.3)
         | 
| 77 | 
            +
                  atomic
         | 
| 78 | 
            +
                timers (1.1.0)
         | 
| 79 | 
            +
                tzinfo (0.3.38)
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            PLATFORMS
         | 
| 82 | 
            +
              ruby
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            DEPENDENCIES
         | 
| 85 | 
            +
              appraisal
         | 
| 86 | 
            +
              bundler (~> 1.3)
         | 
| 87 | 
            +
              dragonfly-activerecord!
         | 
| 88 | 
            +
              guard
         | 
| 89 | 
            +
              guard-rspec
         | 
| 90 | 
            +
              mysql2
         | 
| 91 | 
            +
              pg
         | 
| 92 | 
            +
              rake
         | 
| 93 | 
            +
              rspec
         | 
| 94 | 
            +
              sqlite3
         | 
    
        data/README.md
    CHANGED
    
    | @@ -10,16 +10,18 @@ backed by ActiveRecord. | |
| 10 10 |  | 
| 11 11 | 
             
            Requires a Rails application using Dragonfly 1.0+.
         | 
| 12 12 |  | 
| 13 | 
            +
            Tested with MRI 1.9.3, 2.0, 2.1; ActiveRecord 3.2 and 4.0; and MySQL,
         | 
| 14 | 
            +
            PostgreSQL, and SQLite stores.
         | 
| 13 15 |  | 
| 14 | 
            -
            ##  | 
| 16 | 
            +
            ## Use case
         | 
| 15 17 |  | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
            many use cases (up to a few gigabytes of storage) it really eases the
         | 
| 21 | 
            -
            maintenance burden.
         | 
| 18 | 
            +
            If your app's dynamic assets (user uploaded images for instance) weigh up to a
         | 
| 19 | 
            +
            few gigabytes, it can make sense to store them in the app's database instead of
         | 
| 20 | 
            +
            another service (e.g. Amazon's S3): your stack has one less dependency to care
         | 
| 21 | 
            +
            about, and backups get more complicated.
         | 
| 22 22 |  | 
| 23 | 
            +
            `dragonfly-activerecord`, lets you store assets to your app's relational
         | 
| 24 | 
            +
            database.
         | 
| 23 25 |  | 
| 24 26 | 
             
            ## Installation
         | 
| 25 27 |  | 
| @@ -7,20 +7,20 @@ module Dragonfly::ActiveRecord | |
| 7 7 |  | 
| 8 8 | 
             
                # +temp_object+ should respond to +data+ and +meta+
         | 
| 9 9 | 
             
                def write(temp_object, opts={})
         | 
| 10 | 
            -
                  File. | 
| 11 | 
            -
                    file =  | 
| 12 | 
            -
                    file.data | 
| 10 | 
            +
                  File.new.tap do |file|
         | 
| 11 | 
            +
                    file.metadata = temp_object.meta
         | 
| 12 | 
            +
                    file.data     = temp_object.data
         | 
| 13 13 | 
             
                    file.save!
         | 
| 14 14 | 
             
                    return file.id.to_s
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
| 18 18 | 
             
                def read(uid)
         | 
| 19 | 
            -
                  file = File. | 
| 20 | 
            -
                  file. | 
| 19 | 
            +
                  file = File.where(id: uid.to_i).first
         | 
| 20 | 
            +
                  return nil if file.nil?
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  file.update_column(:accessed_at, Time.now)
         | 
| 21 23 | 
             
                  [ file.data, file.metadata ]
         | 
| 22 | 
            -
                rescue ActiveRecord::RecordNotFound
         | 
| 23 | 
            -
                  nil
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 26 | 
             
                def destroy(uid)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dragonfly-activerecord
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Julien Letessier
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-01- | 
| 11 | 
            +
            date: 2014-01-04 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -163,6 +163,7 @@ files: | |
| 163 163 | 
             
            - .travis.yml
         | 
| 164 164 | 
             
            - Appraisals
         | 
| 165 165 | 
             
            - Gemfile
         | 
| 166 | 
            +
            - Gemfile.lock
         | 
| 166 167 | 
             
            - Guardfile
         | 
| 167 168 | 
             
            - LICENSE.txt
         | 
| 168 169 | 
             
            - README.md
         |