carrierwave 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of carrierwave might be problematic. Click here for more details.

data/Generators ADDED
@@ -0,0 +1,4 @@
1
+ scope 'merb-gen' do
2
+ dir = File.join(File.dirname(__FILE__), 'merb_generators/')
3
+ Merb.add_generators dir + 'uploader_generator'
4
+ end
data/lib/carrierwave.rb CHANGED
@@ -7,7 +7,7 @@ require 'carrierwave/core_ext/inheritable_attributes'
7
7
 
8
8
  module CarrierWave
9
9
 
10
- VERSION = "0.4.5"
10
+ VERSION = "0.4.10"
11
11
 
12
12
  class << self
13
13
  attr_accessor :root
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ module Merb
4
+ module Generators
5
+ class UploaderGenerator < NamedGenerator
6
+
7
+ def self.source_root
8
+ File.join(File.dirname(__FILE__), '..', '..', 'rails_generators', 'uploader', 'templates')
9
+ end
10
+
11
+ first_argument :name, :required => true, :desc => "The name of this uploader"
12
+
13
+ template :uploader do |t|
14
+ t.source = 'uploader.rb'
15
+ t.destination = "app/uploaders/#{file_name}_uploader.rb"
16
+ end
17
+ end
18
+
19
+ add :uploader, UploaderGenerator
20
+
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ Description:
2
+ Generates a skeleton for a new uploader.
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ class <%= class_name %>Uploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or ImageScience support
6
+ # include CarrierWave::RMagick
7
+ # include CarrierWave::ImageScience
8
+
9
+ # Choose what kind of storage to use for this uploader
10
+ storage :file
11
+ # storage :s3
12
+
13
+ # Override the directory where uploaded files will be stored
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ def store_dir
16
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
17
+ end
18
+
19
+ # Provide a default URL as a default if there hasn't been a file uploaded
20
+ # def default_url
21
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
22
+ # end
23
+
24
+ # Process files as they are uploaded.
25
+ # process :scale => [200, 300]
26
+ #
27
+ # def scale(width, height)
28
+ # # do something
29
+ # end
30
+
31
+ # Create different versions of your uploaded files
32
+ # version :thumb do
33
+ # process :scale => [50, 50]
34
+ # end
35
+
36
+ # Add a white list of extensions which are allowed to be uploaded,
37
+ # for images you might use something like this:
38
+ # def extension_white_list
39
+ # %w(jpg jpeg gif png)
40
+ # end
41
+
42
+ # Override the filename of the uploaded files
43
+ # def filename
44
+ # "something.jpg" if original_filename
45
+ # end
46
+
47
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ class UploaderGenerator < Rails::Generator::NamedBase
4
+
5
+ def manifest
6
+ record do |m|
7
+ m.directory 'app/uploaders'
8
+ m.template 'uploader.rb', "app/uploaders/#{name.underscore}_uploader.rb"
9
+ end
10
+ end
11
+
12
+ def class_name
13
+ name.camelize
14
+ end
15
+
16
+ protected
17
+
18
+ def banner
19
+ "Usage: #{$0} uploader UploaderName"
20
+ end
21
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 9
9
- version: 0.4.9
8
+ - 10
9
+ version: 0.4.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonas Nicklas
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-21 00:00:00 +02:00
17
+ date: 2010-08-24 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -63,7 +63,12 @@ files:
63
63
  - lib/carrierwave/uploader/versions.rb
64
64
  - lib/carrierwave/uploader.rb
65
65
  - lib/carrierwave.rb
66
+ - rails_generators/uploader/templates/uploader.rb
67
+ - rails_generators/uploader/uploader_generator.rb
68
+ - rails_generators/uploader/USAGE
69
+ - merb_generators/uploader_generator.rb
66
70
  - README.rdoc
71
+ - Generators
67
72
  has_rdoc: true
68
73
  homepage: http://carrierwave.rubyforge.org
69
74
  licenses: []