fastlane-plugin-s3_actions 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +51 -0
- data/lib/fastlane/plugin/s3_actions.rb +16 -0
- data/lib/fastlane/plugin/s3_actions/actions/s3_check_file_action.rb +70 -0
- data/lib/fastlane/plugin/s3_actions/actions/s3_download_action.rb +74 -0
- data/lib/fastlane/plugin/s3_actions/actions/s3_upload_action.rb +84 -0
- data/lib/fastlane/plugin/s3_actions/helper/s3_actions_helper.rb +12 -0
- data/lib/fastlane/plugin/s3_actions/version.rb +5 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d025c9929d3324bdf97b9dc1c18a59762e1d4bdc
|
4
|
+
data.tar.gz: 0ae77707f76fa742f0840a644ff4d9a9cfec78bb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cac06a2fde113995da72fbb861c14ad695148a8470a134e69a786ca458ca7996147736b86fc5d56cfeef5b825a4167329df74bf729632a53b92a953ef3bbafc7
|
7
|
+
data.tar.gz: 131eaee47096e3b234032fb96b3a167a71bfe7e394265667064a82c60572ddb5c3d122887acb542a62d73c29737121057b170bd188fa73f3cef835ed2254203c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Fernando Saragoca <fsaragoca@me.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# s3_actions plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-s3_actions)
|
4
|
+
[![Twitter: @fsaragoca](https://img.shields.io/badge/contact-@fsaragoca-blue.svg?style=flat)](https://twitter.com/fsaragoca)
|
5
|
+
|
6
|
+
[![CircleCI](https://circleci.com/gh/fsaragoca/fastlane-plugin-s3_actions.svg?style=svg)](https://circleci.com/gh/fsaragoca/fastlane-plugin-s3_actions)
|
7
|
+
|
8
|
+
## Getting Started
|
9
|
+
|
10
|
+
This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-s3_actions`, add it to your project by running:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
fastlane add_plugin s3_actions
|
14
|
+
```
|
15
|
+
|
16
|
+
## About s3_actions
|
17
|
+
|
18
|
+
Download and upload files from AWS S3. This plugin uses [s3](https://github.com/qoobaa/s3) library for accessing AWS S3.
|
19
|
+
|
20
|
+
## Example
|
21
|
+
|
22
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
23
|
+
|
24
|
+
## Run tests for this plugin
|
25
|
+
|
26
|
+
To run both the tests, and code style validation, run
|
27
|
+
|
28
|
+
```
|
29
|
+
rake
|
30
|
+
```
|
31
|
+
|
32
|
+
To automatically fix many of the styling issues, use
|
33
|
+
```
|
34
|
+
rubocop -a
|
35
|
+
```
|
36
|
+
|
37
|
+
## Issues and Feedback
|
38
|
+
|
39
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
40
|
+
|
41
|
+
## Troubleshooting
|
42
|
+
|
43
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
44
|
+
|
45
|
+
## Using `fastlane` Plugins
|
46
|
+
|
47
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
48
|
+
|
49
|
+
## About `fastlane`
|
50
|
+
|
51
|
+
`fastlane` is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/s3_actions/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module S3Actions
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::S3Actions.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 's3'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class S3CheckFileAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
Actions.verify_gem!('s3')
|
8
|
+
|
9
|
+
service = S3::Service.new(access_key_id: params[:access_key_id],
|
10
|
+
secret_access_key: params[:secret_access_key])
|
11
|
+
|
12
|
+
bucket_name = params[:bucket]
|
13
|
+
file_name = params[:file_name]
|
14
|
+
|
15
|
+
bucket = service.buckets.find(bucket_name)
|
16
|
+
if bucket.nil?
|
17
|
+
UI.user_error! "Bucket '#{bucket_name}' not found, please verify bucket and credentials 🚫"
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
bucket.objects.find(file_name)
|
22
|
+
true
|
23
|
+
rescue
|
24
|
+
false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Check if file exists in AWS S3"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.authors
|
33
|
+
["Fernando Saragoca"]
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.return_value
|
37
|
+
"Returns 'true' if object exists, 'false' if not"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.available_options
|
41
|
+
[
|
42
|
+
FastlaneCore::ConfigItem.new(key: :access_key_id,
|
43
|
+
env_name: "S3_ACTIONS_ACCESS_KEY_ID",
|
44
|
+
description: "AWS Access Key",
|
45
|
+
optional: false,
|
46
|
+
type: String),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :secret_access_key,
|
48
|
+
env_name: "S3_ACTIONS_SECRET_ACCESS_KEY",
|
49
|
+
description: "AWS Secret Access Key",
|
50
|
+
optional: false,
|
51
|
+
type: String),
|
52
|
+
FastlaneCore::ConfigItem.new(key: :bucket,
|
53
|
+
env_name: "S3_ACTIONS_BUCKET",
|
54
|
+
description: "S3 Bucket",
|
55
|
+
optional: false,
|
56
|
+
type: String),
|
57
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
58
|
+
env_name: "S3_ACTIONS_CHECK_FILE_NAME",
|
59
|
+
description: "File name",
|
60
|
+
optional: true,
|
61
|
+
type: String)
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.is_supported?(platform)
|
66
|
+
true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 's3'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class S3DownloadAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
Actions.verify_gem!('s3')
|
8
|
+
|
9
|
+
service = S3::Service.new(access_key_id: params[:access_key_id],
|
10
|
+
secret_access_key: params[:secret_access_key])
|
11
|
+
|
12
|
+
bucket_name = params[:bucket]
|
13
|
+
file_name = params[:file_name]
|
14
|
+
output_path = params[:output_path]
|
15
|
+
|
16
|
+
bucket = service.buckets.find(bucket_name)
|
17
|
+
if bucket.nil?
|
18
|
+
UI.user_error! "Bucket '#{bucket_name}' not found, please verify bucket and credentials 🚫"
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
object = bucket.objects.find(file_name)
|
23
|
+
rescue
|
24
|
+
UI.user_error! "Object '#{file_name}' not found, please verify file and bucket 🚫"
|
25
|
+
end
|
26
|
+
|
27
|
+
UI.important("Downloading file '#{bucket_name}/#{file_name}' 📥")
|
28
|
+
File.write(output_path, object.content)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
"Download a file from AWS S3"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.authors
|
36
|
+
["Fernando Saragoca"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.available_options
|
40
|
+
[
|
41
|
+
FastlaneCore::ConfigItem.new(key: :access_key_id,
|
42
|
+
env_name: "S3_ACTIONS_ACCESS_KEY_ID",
|
43
|
+
description: "AWS Access Key",
|
44
|
+
optional: false,
|
45
|
+
type: String),
|
46
|
+
FastlaneCore::ConfigItem.new(key: :secret_access_key,
|
47
|
+
env_name: "S3_ACTIONS_SECRET_ACCESS_KEY",
|
48
|
+
description: "AWS Secret Access Key",
|
49
|
+
optional: false,
|
50
|
+
type: String),
|
51
|
+
FastlaneCore::ConfigItem.new(key: :bucket,
|
52
|
+
env_name: "S3_ACTIONS_BUCKET",
|
53
|
+
description: "S3 Bucket",
|
54
|
+
optional: false,
|
55
|
+
type: String),
|
56
|
+
FastlaneCore::ConfigItem.new(key: :output_path,
|
57
|
+
env_name: "S3_ACTIONS_OUTPUT_PATH",
|
58
|
+
description: "Path to save downloaded file",
|
59
|
+
optional: false,
|
60
|
+
type: String),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
62
|
+
env_name: "S3_ACTIONS_DOWNLOAD_FILE_NAME",
|
63
|
+
description: "File name",
|
64
|
+
optional: true,
|
65
|
+
type: String)
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.is_supported?(platform)
|
70
|
+
true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 's3'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class S3UploadAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
Actions.verify_gem!('s3')
|
8
|
+
|
9
|
+
service = S3::Service.new(access_key_id: params[:access_key_id],
|
10
|
+
secret_access_key: params[:secret_access_key])
|
11
|
+
|
12
|
+
bucket_name = params[:bucket]
|
13
|
+
bucket = service.buckets.find(bucket_name)
|
14
|
+
if bucket.nil?
|
15
|
+
UI.user_error! "Bucket '#{bucket_name}' not found, please verify bucket and credentials 🚫"
|
16
|
+
end
|
17
|
+
|
18
|
+
file_name = params[:name] || params[:content_path].split('/').last
|
19
|
+
|
20
|
+
object = bucket.objects.build(file_name)
|
21
|
+
object.content = open(params[:content_path])
|
22
|
+
object.acl = params[:access_control]
|
23
|
+
|
24
|
+
UI.important("Uploading file to '#{bucket_name}/#{file_name}' 📤")
|
25
|
+
object.save
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Upload a file to AWS S3"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.authors
|
33
|
+
["Fernando Saragoca"]
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :access_key_id,
|
39
|
+
env_name: "S3_ACTIONS_ACCESS_KEY_ID",
|
40
|
+
description: "AWS Access Key",
|
41
|
+
optional: false,
|
42
|
+
type: String),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :secret_access_key,
|
44
|
+
env_name: "S3_ACTIONS_SECRET_ACCESS_KEY",
|
45
|
+
description: "AWS Secret Access Key",
|
46
|
+
optional: false,
|
47
|
+
type: String),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :bucket,
|
49
|
+
env_name: "S3_ACTIONS_BUCKET",
|
50
|
+
description: "S3 Bucket",
|
51
|
+
optional: false,
|
52
|
+
type: String),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :access_control,
|
54
|
+
env_name: "S3_ACTIONS_UPLOAD_ACCESS_CONTROL",
|
55
|
+
description: "File ACL: :public_read or :private",
|
56
|
+
optional: false,
|
57
|
+
default_value: :private,
|
58
|
+
type: String),
|
59
|
+
FastlaneCore::ConfigItem.new(key: :content_path,
|
60
|
+
env_name: "S3_ACTIONS_UPLOAD_CONTENT_PATH",
|
61
|
+
description: "Path for file to upload",
|
62
|
+
optional: false,
|
63
|
+
type: String,
|
64
|
+
verify_block: proc do |value|
|
65
|
+
if value.nil? || value.empty?
|
66
|
+
UI.user_error!("No content path for S3_upload action given, pass using `content_path: 'path/to/file.txt'`")
|
67
|
+
elsif File.file?(value) == false
|
68
|
+
UI.user_error!("File for path '#{value}' not found")
|
69
|
+
end
|
70
|
+
end),
|
71
|
+
FastlaneCore::ConfigItem.new(key: :name,
|
72
|
+
env_name: "S3_ACTIONS_FILE_NAME",
|
73
|
+
description: "File name",
|
74
|
+
optional: true,
|
75
|
+
type: String)
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.is_supported?(platform)
|
80
|
+
true
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class S3ActionsHelper
|
4
|
+
# class methods that you define here become available in your action
|
5
|
+
# as `Helper::S3ActionsHelper.your_method`
|
6
|
+
#
|
7
|
+
def self.show_message
|
8
|
+
UI.message("Hello from the s3_actions plugin helper!")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-s3_actions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fernando Saragoca
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: s3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: fastlane
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.0.5
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.0.5
|
111
|
+
description:
|
112
|
+
email: fsaragoca@me.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- LICENSE
|
118
|
+
- README.md
|
119
|
+
- lib/fastlane/plugin/s3_actions.rb
|
120
|
+
- lib/fastlane/plugin/s3_actions/actions/s3_check_file_action.rb
|
121
|
+
- lib/fastlane/plugin/s3_actions/actions/s3_download_action.rb
|
122
|
+
- lib/fastlane/plugin/s3_actions/actions/s3_upload_action.rb
|
123
|
+
- lib/fastlane/plugin/s3_actions/helper/s3_actions_helper.rb
|
124
|
+
- lib/fastlane/plugin/s3_actions/version.rb
|
125
|
+
homepage: https://github.com/fsaragoca/fastlane-plugin-s3_actions
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.5.1
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Download and upload files to AWS S3
|
149
|
+
test_files: []
|