rails_s3_uploader 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 139d3f98e569ddbb1be9e95d54bf99606037c2f526c7981112e24c5a2d5bb0a9
4
- data.tar.gz: 7e07b130e856ae8bf482b42599c4a65e5e5a826cdff2270b77c93f3130b3859a
3
+ metadata.gz: 37706c7dbcb59c11c70fc3743c52270d1c4a7c81b38edefabb50431f1c7c8992
4
+ data.tar.gz: 2323539b33ffc365ceb253922c28d44b107c17d523d4437868b77e04a7c50601
5
5
  SHA512:
6
- metadata.gz: bfd90abc4b69ab891b2ec55af6b190a263f6629a6fe2a257ddb7e0f09a1a8a869ac397e7e5fe5fa12ac75be7fa5f122fc3015b96a34c8d8925113291b6494b3a
7
- data.tar.gz: 1a404d9730d6b5ac4720cc93309df6e5e19c440e714569b513bd43aa9bcc0bd6fa2b4ecd312c1dd40a2e546ac3a2d3d342b20345883d38fab0a7b2c8f249b383
6
+ metadata.gz: c30f89ebe5c7551b73a7ff20ff2192f7a20e927ee4a73bf018b422030e9d7899cd585e70d7fc385db164e2d6850fbc0487f4c6402646af254988840f731ad495
7
+ data.tar.gz: abe71291c35fc435e4d755f0567e861b95ba095995f8b9793589ea6d50ce2a945349d3f3fd1c38e4f5068db8512c0ec06eb80f699dbaec24d4e247983fec5ebb
data/.env.sample ADDED
@@ -0,0 +1,4 @@
1
+ AWS_ACCESS_KEY_ID=your_access_key_id
2
+ AWS_SECRET_ACCESS_KEY=your_secret_access_key
3
+ AWS_REGION=your_region
4
+ AWS_BUCKET=your_bucket
data/CHANGELOG.md CHANGED
@@ -1,2 +1,17 @@
1
- # CHANGE LOG
1
+ ## 0.1.3
2
2
 
3
+ - Change readme
4
+ - Change changelog
5
+ - Add MIT License
6
+
7
+ ## 0.1.2
8
+
9
+ - Change readme
10
+
11
+ ## 0.1.1
12
+
13
+ - Add first logic on gem
14
+
15
+ ## 0.1.0
16
+
17
+ - First release
data/MIT-LICENSE.md ADDED
@@ -0,0 +1,5 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2
+
3
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,30 @@
1
1
  # Rails S3 Uploader
2
2
 
3
- Rails S3 Uploader is a gem in development to facilitate file uploads to Amazon S3 using Active Storage in Rails applications.
3
+ **Rails S3 Uploader** is a gem that facilitates the process of uploading files to cloud storage services, such as **AWS S3**, by integrating flexibly with Active Storage. This gem was developed to offer advanced and customizable features beyond those natively provided by Active Storage.
4
+
5
+ ## Purpose and Key Benefits
6
+
7
+ The primary purpose of **Rails S3 Uploader** is to provide developers with greater flexibility and control over file management in the cloud. By integrating this gem into your Rails project, you can:
8
+
9
+ ### Customization and Configuration Flexibility
10
+
11
+ - Easily configure integration with AWS S3 or other cloud storage services through custom storage policies, advanced security, and detailed control over files.
12
+
13
+ ### Advanced File Handling
14
+
15
+ - Implement sophisticated operations on files before or after uploading, such as image processing, thumbnail generation, and content validation, automating complex tasks directly within the gem.
16
+
17
+ ### Integration with APIs and External Services
18
+
19
+ - Easily integrate with external APIs to send notifications, process files in external systems, or integrate with content analysis services to ensure security and compliance.
20
+
21
+ ### Custom Retention and Expiration Policies
22
+
23
+ - Define custom policies to manage file retention and expiration according to your project's specific requirements.
24
+
25
+ ### Support for Business-Specific Features
26
+
27
+ - Meet specific business needs, such as version control of files, secure sharing of download links with expiration, and detailed auditing of upload operations.
4
28
 
5
29
  ---
6
30
 
@@ -20,6 +44,18 @@ And run: **bundle install**
20
44
 
21
45
  **Note:** Full usage documentation will be provided in future versions.
22
46
 
47
+ Rails S3 Uploader was developed to facilitate the file upload process to AWS S3 in Ruby on Rails projects. It can be especially useful in projects that need to store and manage files efficiently in the AWS cloud.
48
+
49
+ ### Recommended Project Types
50
+
51
+ - **Web Applications:** Easily integrate image, document, and other file uploads in web applications built with Ruby on Rails.
52
+
53
+ - **E-commerce Applications:** Manage product images, catalogs, and media files on e-commerce platforms.
54
+
55
+ - **Content Management Systems (CMS):** Allow users to upload and manage multimedia content in Rails-based CMS systems.
56
+
57
+ - **Collaboration Projects:** Facilitate document sharing among users on collaborative platforms.
58
+
23
59
  ## Initial Configuration
24
60
 
25
61
  #### Environment Variables
@@ -68,11 +104,20 @@ bundle exec rake install
68
104
 
69
105
  Contributions are welcome! Bug reports and pull requests are welcome on GitHub at *https://github.com/eltonsantos/rails_s3_uploader*.
70
106
 
71
- ## Licence
107
+ ## Requirements
72
108
 
73
- This gem is available as open-source under the terms of the MIT license.
109
+ - Ruby >= 2.6.0 (recommended 2.7+)
110
+
111
+ - Rails >= 6.0 (compatible up to Rails 7)
112
+
113
+ - AWS S3 Account: You need an S3 bucket and access credentials to use the rails_s3_uploader gem.
74
114
 
115
+ ## Contributing to Rails S3 Uploader
75
116
 
117
+ Fork, fix, then send a pull request.
76
118
 
119
+ ## Licence
77
120
 
121
+ This gem is available as open-source under the terms of The MIT License (MIT).
78
122
 
123
+ Copyright (c) 2024 **Elton Santos, Raquel Fonseca**. See **MIT-LICENSE** for further details.
@@ -0,0 +1,7 @@
1
+ RailsS3Uploader.configure do |config|
2
+ config.access_key_id = ENV['AWS_ACCESS_KEY_ID']
3
+ config.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
4
+ config.region = ENV['AWS_REGION']
5
+ config.bucket = ENV['AWS_BUCKET']
6
+ end
7
+
@@ -0,0 +1,6 @@
1
+ amazon:
2
+ service: S3
3
+ access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
4
+ secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
5
+ region: <%= ENV['AWS_REGION'] %>
6
+ bucket: <%= ENV['AWS_BUCKET'] %>
@@ -0,0 +1,13 @@
1
+ module RailsS3Uploader
2
+ class Configuration
3
+ attr_accessor :access_key_id, :secret_access_key, :region, :bucket
4
+
5
+ def initialize
6
+ @access_key_id = ENV['AWS_ACCESS_KEY_ID']
7
+ @secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
8
+ @region = ENV['AWS_REGION']
9
+ @bucket = ENV['AWS_BUCKET']
10
+ end
11
+ end
12
+ end
13
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsS3Uploader
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -1,8 +1,22 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "rails_s3_uploader/version"
4
-
1
+ require 'aws-sdk-s3'
5
2
  module RailsS3Uploader
6
- class Error < StandardError; end
7
- # Your code goes here...
3
+ class S3Uploader
4
+ def initialize
5
+ @s3_client = Aws::S3::Client.new(
6
+ access_key_id: RailsS3Uploader.configuration.access_key_id,
7
+ secret_access_key: RailsS3Uploader.configuration.secret_access_key,
8
+ region: RailsS3Uploader.configuration.region
9
+ )
10
+ @bucket = RailsS3Uploader.configuration.bucket
11
+ end
12
+
13
+ def upload(file, key)
14
+ obj = Aws::S3::Object.new(bucket_name: @bucket, key: key, client: @s3_client)
15
+ obj.upload_file(file.path)
16
+ obj.public_url
17
+ rescue StandardError => e
18
+ puts "Error uploading file: #{e.message}"
19
+ nil
20
+ end
21
+ end
8
22
  end
@@ -1,39 +1,34 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require_relative "lib/rails_s3_uploader/version"
4
3
 
5
4
  Gem::Specification.new do |spec|
6
- spec.name = "rails_s3_uploader"
7
- spec.version = RailsS3Uploader::VERSION
8
- spec.authors = ["Elton Santos", "Raquel Fonseca"]
9
- spec.email = ["eltonaxl@hotmail.com", "raque-leto@hotmail.com"]
10
- spec.summary = "Gem that makes it easy to integrate and upload files with AWS S3 using active storage"
11
- spec.description = "Gem that makes it easy to integrate and upload files with AWS S3 using active storage. Pay Attention: this gem still is in development. Please CONTRIBUTE!"
12
- spec.homepage = "https://github.com/eltonsantos/rails_s3_uploader"
5
+ spec.name = "rails_s3_uploader"
6
+ spec.version = RailsS3Uploader::VERSION
7
+ spec.authors = ["Elton Santos", "Raquel Fonseca"]
8
+ spec.email = ["eltonaxl@hotmail.com", "raque-leto@hotmail.com"]
9
+ spec.summary = "Gem that makes it easy to integrate and upload files with AWS S3 using Active Storage"
10
+ spec.description = "Gem that makes it easy to integrate and upload files to AWS S3 using Active Storage. Pay attention: this gem is still in development. Please CONTRIBUTE!"
11
+ spec.homepage = "https://github.com/eltonsantos/rails_s3_uploader"
13
12
  spec.required_ruby_version = ">= 2.6.0"
14
- spec.license = "MIT"
13
+ spec.license = "MIT"
15
14
 
16
15
  spec.metadata = {
17
- "homepage_uri" => spec.homepage,
18
- "source_code_uri" => "https://github.com/eltonsantos/rails_s3_uploader",
19
- "changelog_uri" => "https://github.com/eltonsantos/rails_s3_uploader/blob/master/CHANGELOG.md",
16
+ "homepage_uri" => spec.homepage,
17
+ "source_code_uri"=> "https://github.com/eltonsantos/rails_s3_uploader",
18
+ "changelog_uri" => "https://github.com/eltonsantos/rails_s3_uploader/blob/master/CHANGELOG.md",
20
19
  }
21
20
 
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(__dir__) do
21
+ spec.files = Dir.chdir(__dir__) do
25
22
  `git ls-files -z`.split("\x0").reject do |f|
26
23
  (File.expand_path(f) == __FILE__) ||
27
24
  f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
28
25
  end
29
26
  end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
27
 
34
- # Uncomment to register a new dependency of your gem
35
- # spec.add_dependency "example-gem", "~> 1.0"
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
36
31
 
37
- # For more information and examples about making a new gem, check out our
38
- # guide at: https://bundler.io/guides/creating_gem.html
32
+ spec.add_dependency "rails", ">= 6.0"
33
+ spec.add_dependency "aws-sdk-s3", "~> 1.0"
39
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_s3_uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elton Santos
@@ -9,10 +9,38 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-06-23 00:00:00.000000000 Z
13
- dependencies: []
14
- description: 'Gem that makes it easy to integrate and upload files with AWS S3 using
15
- active storage. Pay Attention: this gem still is in development. Please CONTRIBUTE!'
12
+ date: 2024-06-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '6.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '6.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: aws-sdk-s3
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.0'
42
+ description: 'Gem that makes it easy to integrate and upload files to AWS S3 using
43
+ Active Storage. Pay attention: this gem is still in development. Please CONTRIBUTE!'
16
44
  email:
17
45
  - eltonaxl@hotmail.com
18
46
  - raque-leto@hotmail.com
@@ -20,10 +48,15 @@ executables: []
20
48
  extensions: []
21
49
  extra_rdoc_files: []
22
50
  files:
51
+ - ".env.sample"
23
52
  - CHANGELOG.md
53
+ - MIT-LICENSE.md
24
54
  - README.md
25
55
  - Rakefile
56
+ - config/initializers/rails_s3_uploader.rb
57
+ - config/storage.yml
26
58
  - lib/rails_s3_uploader.rb
59
+ - lib/rails_s3_uploader/configuration.rb
27
60
  - lib/rails_s3_uploader/version.rb
28
61
  - rails_s3_uploader.gemspec
29
62
  - sig/rails_s3_uploader.rbs
@@ -52,6 +85,6 @@ requirements: []
52
85
  rubygems_version: 3.5.3
53
86
  signing_key:
54
87
  specification_version: 4
55
- summary: Gem that makes it easy to integrate and upload files with AWS S3 using active
56
- storage
88
+ summary: Gem that makes it easy to integrate and upload files with AWS S3 using Active
89
+ Storage
57
90
  test_files: []