carrierwave-unique-filename 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODk2Mzc1YmU0OWE2OWVhZjhjYzM5YmM3YWE5YTA4YmYzY2I1ZTczYQ==
5
+ data.tar.gz: !binary |-
6
+ MzkxYWQ3ZDM2OTI5MmYyMDg2NmRlMjNmNjQ1YWMyOWI3Njc4Y2RhMA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MmY0ODE2YmQ0YzcxZmQxZmMwODhmYTVjNmQyNDQxMzE2YTc2NmM2MTQ5Zjcz
10
+ MzM0OTU2MGY2NTZiOGQxZjNmN2FmMmZmZDA4NDE3NzgxMDU3OTk2MDI3MDFj
11
+ ZGRiZWQyNmVhYjliMzU1ZmY4YmY1Yjg0Yzg3ZTIwM2NhNDQ5NmY=
12
+ data.tar.gz: !binary |-
13
+ MTE1ZGE2NmE2MGEzMDlmZTY1YzgwMGZjYjQ5Mjk4M2Y4YjA1NzY3MTVhODhk
14
+ MjQxYTczZDFkNzMwOGFjYzg0ZTkwYzBmZDVhOGUyMGQ4ZjE1YmQyNzE2ODMw
15
+ YjYwYjc5YjRmNzAyYWNiOGI5MDYxMmFiMjE0M2NkNWFkZjhkNmU=
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in carrierwave-unique-filename.gemspec
4
+ gemspec
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2014 aaron
2
+
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Carrierwave::Unique::Filename
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'carrierwave-unique-filename'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install carrierwave-unique-filename
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'carrierwave/unique_filename/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "carrierwave-unique-filename"
8
+ spec.version = Carrierwave::UniqueFilename::VERSION
9
+ spec.authors = ["aaron\n"]
10
+ spec.email = ["yalong1976@gmail.com"]
11
+ spec.description = %q{generate unique filename for carrierwave uploader attachment}
12
+ spec.summary = %q{generate unique filename for carrierwave uploader attachment}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "carrierwave"
24
+ end
@@ -0,0 +1,21 @@
1
+ require "carrierwave/unique_filename/version"
2
+ module CarrierWave
3
+ module UniqueFilename
4
+ def filename
5
+ if original_filename.present?
6
+ @name ||= unique_filename
7
+ "#{@name}.#{file.extension}"
8
+ end
9
+ end
10
+
11
+ private
12
+ def unique_filename
13
+ if version_name
14
+ original_name = current_path.gsub("#{version_name}_","")
15
+ else
16
+ original_name = current_path
17
+ end
18
+ Digest::MD5.hexdigest(original_name)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module Carrierwave
2
+ module UniqueFilename
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: carrierwave-unique-filename
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - ! 'aaron
8
+
9
+ '
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2014-04-25 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: '1.3'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: carrierwave
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ description: generate unique filename for carrierwave uploader attachment
58
+ email:
59
+ - yalong1976@gmail.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - .gitignore
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - carrierwave-unique-filename.gemspec
70
+ - lib/carrierwave/unique_filename.rb
71
+ - lib/carrierwave/unique_filename/version.rb
72
+ homepage: ''
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.2.1
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: generate unique filename for carrierwave uploader attachment
96
+ test_files: []
97
+ has_rdoc: