Skip to content

Commit 91894c0

Browse files
committed
renamed project name
1 parent 47de8f5 commit 91894c0

14 files changed

+55
-55
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'http://rubygems.org'
22

3-
# Specify your gem's dependencies in s3_direct_upload.gemspec
3+
# Specify your gem's dependencies in s3-upnow.gemspec
44
gemspec
55
gem 'rspec'
66
gem 'jquery-fileupload-rails'

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# S3DirectUpload
1+
# S3UpNow
22

3-
[![Build Status](https://travis-ci.org/waynehoover/s3_direct_upload.png)](https://travis-ci.org/waynehoover/s3_direct_upload)
3+
[![Build Status](https://travis-ci.org/cerdiogenes/s3-upnow.svg)](https://travis-ci.org/cerdiogenes/s3-upnow)
44

55
Easily generate a form that allows you to upload directly to Amazon S3.
66
Multi file uploading supported by jquery-fileupload.
@@ -10,13 +10,13 @@ Code extracted from Ryan Bates' [gallery-jquery-fileupload](https://github.com/r
1010
## Installation
1111
Add this line to your application's Gemfile:
1212

13-
gem 's3_direct_upload'
13+
gem 's3-upnow'
1414

1515
Then add a new initalizer with your AWS credentials:
1616

17-
**config/initializers/s3_direct_upload.rb**
17+
**config/initializers/s3-upnow.rb**
1818
```ruby
19-
S3DirectUpload.config do |c|
19+
S3UpNow.config do |c|
2020
c.access_key_id = "" # your access key id
2121
c.secret_access_key = "" # your secret access key
2222
c.bucket = "" # your bucket name
@@ -44,12 +44,12 @@ Add the following js and css to your asset pipeline:
4444

4545
**application.js.coffee**
4646
```coffeescript
47-
#= require s3_direct_upload
47+
#= require s3-upnow
4848
```
4949

5050
**application.css**
5151
```css
52-
//= require s3_direct_upload_progress_bars
52+
//= require s3-upnow_progress_bars
5353
```
5454

5555
## Usage
@@ -128,15 +128,15 @@ So that javascript code would be executed after the model instance is created, w
128128
Note: the POST request to the rails app also includes the following parameters `filesize`, `filetype`, `filename` and `filepath`.
129129
130130
### Advanced Customizations
131-
Feel free to override the styling for the progress bars in s3_direct_upload_progress_bars.css, look at the source for inspiration.
131+
Feel free to override the styling for the progress bars in s3-upnow_progress_bars.css, look at the source for inspiration.
132132
133133
Also feel free to write your own js to interface with jquery-file-upload. You might want to do this to do custom validations on the files before it is sent to S3 for example.
134-
To do this remove `s3_direct_upload` from your application.js and include the necessary jquery-file-upload scripts in your asset pipeline (they are included in this gem automatically):
134+
To do this remove `s3-upnow` from your application.js and include the necessary jquery-file-upload scripts in your asset pipeline (they are included in this gem automatically):
135135
```cofeescript
136136
#= require jquery-fileupload/basic
137137
#= require jquery-fileupload/vendor/tmpl
138138
```
139-
Use the javascript in `s3_direct_upload` as a guide.
139+
Use the javascript in `s3-upnow` as a guide.
140140
141141
142142
## Options for S3Upload jQuery Plugin
@@ -256,16 +256,16 @@ First, add the fog gem to your `Gemfile` and run `bundle`:
256256

257257
Then, run the rake task to delete uploads older than 2 days:
258258
```
259-
$ rake s3_direct_upload:clean_remote_uploads
259+
$ rake s3-upnow:clean_remote_uploads
260260
Deleted file with key: "uploads/20121210T2139Z_03846cb0329b6a8eba481ec689135701/06 - PCR_RYA014-25.jpg"
261261
Deleted file with key: "uploads/20121210T2139Z_03846cb0329b6a8eba481ec689135701/05 - PCR_RYA014-24.jpg"
262262
$
263263
```
264264

265265
Optionally customize the prefix used for cleaning (default is `uploads/#{2.days.ago.strftime('%Y%m%d')}`):
266-
**config/initalizers/s3_direct_upload.rb**
266+
**config/initalizers/s3-upnow.rb**
267267
```ruby
268-
S3DirectUpload.config do |c|
268+
S3UpNow.config do |c|
269269
# ...
270270
c.prefix_to_clean = "my_path/#{1.week.ago.strftime('%y%m%d')}"
271271
end

lib/s3-upnow.rb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require 's3-upnow/version'
2+
require 'jquery-fileupload-rails' if defined?(Rails)
3+
4+
require 'base64'
5+
require 'openssl'
6+
require 'digest/sha1'
7+
8+
require 's3-upnow/config_aws'
9+
require 's3-upnow/form_helper'
10+
require 's3-upnow/engine' if defined?(Rails)
11+
require 's3-upnow/railtie' if defined?(Rails)
12+
13+
ActionView::Base.send(:include, S3UpNow::UploadHelper) if defined?(ActionView::Base)

lib/s3_direct_upload/config_aws.rb lib/s3-upnow/config_aws.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "singleton"
22

3-
module S3DirectUpload
3+
module S3UpNow
44
class Config
55
include Singleton
66

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module S3DirectUpload
1+
module S3UpNow
22
class Engine < ::Rails::Engine
33
end
44
end

lib/s3_direct_upload/form_helper.rb lib/s3-upnow/form_helper.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module S3DirectUpload
1+
module S3UpNow
22
module UploadHelper
33
def s3_uploader_form(options = {}, &block)
44
uploader = S3Uploader.new(options)
@@ -13,11 +13,11 @@ class S3Uploader
1313
def initialize(options)
1414
@key_starts_with = options[:key_starts_with] || "uploads/"
1515
@options = options.reverse_merge(
16-
aws_access_key_id: S3DirectUpload.config.access_key_id,
17-
aws_secret_access_key: S3DirectUpload.config.secret_access_key,
18-
bucket: options[:bucket] || S3DirectUpload.config.bucket,
19-
region: S3DirectUpload.config.region || "s3",
20-
url: S3DirectUpload.config.url,
16+
aws_access_key_id: S3UpNow.config.access_key_id,
17+
aws_secret_access_key: S3UpNow.config.secret_access_key,
18+
bucket: options[:bucket] || S3UpNow.config.bucket,
19+
region: S3UpNow.config.region || "s3",
20+
url: S3UpNow.config.url,
2121
ssl: true,
2222
acl: "public-read",
2323
expiration: 10.hours.from_now.utc.iso8601,

lib/s3_direct_upload/railtie.rb lib/s3-upnow/railtie.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module S3DirectUpload
1+
module S3UpNow
22
class Railtie < Rails::Railtie
33
initializer "railtie.configure_rails_initialization" do |app|
44
app.middleware.use JQuery::FileUpload::Rails::Middleware
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module S3DirectUpload
1+
module S3UpNow
22
VERSION = "0.1.7"
33
end

lib/s3_direct_upload.rb

-13
This file was deleted.

lib/tasks/s3_direct_upload.rake lib/tasks/s3_upnow.rake

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
namespace :s3_direct_upload do
1+
namespace :'s3-upnow' do
22
desc "Removes old uploads from specified s3 bucket/directory -- Useful when uploads are processed into another directory"
33
task :clean_remote_uploads => :environment do
44
require 'thread'
55
require 'fog'
66

7-
s3 = Fog::Storage.new(provider: "AWS", aws_access_key_id: S3DirectUpload.config.access_key_id, aws_secret_access_key: S3DirectUpload.config.secret_access_key)
8-
bucket = S3DirectUpload.config.bucket
9-
prefix = S3DirectUpload.config.prefix_to_clean || "uploads/#{2.days.ago.strftime('%Y%m%d')}"
7+
s3 = Fog::Storage.new(provider: "AWS", aws_access_key_id: S3UpNow.config.access_key_id, aws_secret_access_key: S3UpNow.config.secret_access_key)
8+
bucket = S3UpNow.config.bucket
9+
prefix = S3UpNow.config.prefix_to_clean || "uploads/#{2.days.ago.strftime('%Y%m%d')}"
1010

1111
queue = Queue.new
1212
semaphore = Mutex.new

s3_direct_upload.gemspec s3-upnow.gemspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# -*- encoding: utf-8 -*-
2-
require File.expand_path('../lib/s3_direct_upload/version', __FILE__)
2+
require File.expand_path('../lib/s3-upnow/version', __FILE__)
33

44
Gem::Specification.new do |gem|
5-
gem.authors = ["Wayne Hoover"]
6-
gem.email = ["w@waynehoover.com"]
5+
gem.authors = ["Carlos Eduardo Rodrigues Diógenes"]
6+
gem.email = ["carlos.diogenes@fnix.com.br"]
77
gem.description = %q{Direct Upload to Amazon S3 With CORS and jquery-file-upload}
88
gem.summary = %q{Gives a form helper for Rails which allows direct uploads to s3. Based on RailsCast#383}
99
gem.homepage = ""
1010

1111
gem.files = Dir["{lib,app}/**/*"] + ["LICENSE", "README.md"]
1212
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
1313
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14-
gem.name = "s3_direct_upload"
14+
gem.name = "s3-upnow"
1515
gem.require_paths = ["lib"]
16-
gem.version = S3DirectUpload::VERSION
16+
gem.version = S3UpNow::VERSION
1717

1818
gem.add_dependency 'rails', '>= 3.1'
1919
gem.add_dependency 'coffee-rails', '>= 3.1'

spec/existance_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
require 'spec_helper'
2-
describe S3DirectUpload do
2+
describe S3UpNow do
33
it "version must be defined" do
4-
S3DirectUpload::VERSION.should be_true
4+
S3UpNow::VERSION.should be_true
55
end
66

77
it "config must be defined" do
8-
S3DirectUpload.config.should be_true
8+
S3UpNow.config.should be_true
99
end
1010

1111
end

spec/helpers/form_helper_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
require "spec_helper"
22

3-
describe S3DirectUpload::UploadHelper::S3Uploader do
3+
describe S3UpNow::UploadHelper::S3Uploader do
44
describe "policy_data" do
55

66
describe "starts-with $key" do
77
it "is configurable with the key_starts_with option" do
88
key_starts_with = "uploads/"
9-
s3_uploader = S3DirectUpload::UploadHelper::S3Uploader.new({:key_starts_with => key_starts_with})
9+
s3_uploader = S3UpNow::UploadHelper::S3Uploader.new({:key_starts_with => key_starts_with})
1010
s3_uploader.policy_data[:conditions].should include ["starts-with", "$key", key_starts_with]
1111
end
1212

1313
it "defaults to 'uploads/'" do
14-
s3_uploader = S3DirectUpload::UploadHelper::S3Uploader.new({})
14+
s3_uploader = S3UpNow::UploadHelper::S3Uploader.new({})
1515
s3_uploader.policy_data[:conditions].should include ["starts-with", "$key", "uploads/"]
1616
end
1717
end
1818

1919
describe "starts-with $content-type" do
2020
it "is configurable with the content_type_starts_with option" do
2121
content_type_starts_with = "image/"
22-
s3_uploader = S3DirectUpload::UploadHelper::S3Uploader.new({:content_type_starts_with => content_type_starts_with})
22+
s3_uploader = S3UpNow::UploadHelper::S3Uploader.new({:content_type_starts_with => content_type_starts_with})
2323
s3_uploader.policy_data[:conditions].should include ["starts-with", "$content-type", content_type_starts_with]
2424
end
2525

2626
it "is defaults to an empty string" do
27-
s3_uploader = S3DirectUpload::UploadHelper::S3Uploader.new({})
27+
s3_uploader = S3UpNow::UploadHelper::S3Uploader.new({})
2828
s3_uploader.policy_data[:conditions].should include ["starts-with", "$content-type", ""]
2929
end
3030
end

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'active_support/all'
2-
require 's3_direct_upload'
2+
require 's3-upnow'
33

44
RSpec.configure do |config|
55
config.treat_symbols_as_metadata_keys_with_true_values = true

0 commit comments

Comments
 (0)