webpacker-manifest_s3 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/webpacker/manifest_s3/configuration_extention.rb +25 -0
- data/lib/webpacker/manifest_s3/manifest_extention.rb +50 -0
- data/lib/webpacker/manifest_s3/version.rb +5 -0
- data/lib/webpacker/manifest_s3.rb +8 -0
- data/webpacker-manifest_s3.gemspec +27 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2542ec00b5fcc99382479319ec5061e47b4c3de9
|
4
|
+
data.tar.gz: 347133909334f22ce29ca460be07ab19859a063a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2893532f94efea2e59e2c16a181b4c15b96048d5504b7fd74199de8570919e30416f42ee07223375ca0d873cf8236f919e29c5e8bf6fd9d89221452d52b0b957
|
7
|
+
data.tar.gz: 77a2f8b6bb59a0c7bdf071abbd8f004be047674958ccb02370309c77ff4b2c93028f8c05379bfea18442ed77a03231212df07b0bc2a865220e4de88309de35ae
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Shota Iguchi
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Webpacker::ManifestS3
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/webpacker/manifest_s3`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'webpacker-manifest_s3'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install webpacker-manifest_s3
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/webpacker-manifest_s3.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "webpacker/manifest_s3"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Webpacker
|
2
|
+
module ManifestS3
|
3
|
+
module ConfigurationExtention
|
4
|
+
def manifest_s3_bucket
|
5
|
+
fetch(:manifest_s3_bucket)
|
6
|
+
end
|
7
|
+
|
8
|
+
def manifest_s3_key
|
9
|
+
fetch(:manifest_s3_key)
|
10
|
+
end
|
11
|
+
|
12
|
+
def aws_access_key_id
|
13
|
+
fetch(:aws_access_key_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def aws_secret_access_key
|
17
|
+
fetch(:aws_secret_access_key)
|
18
|
+
end
|
19
|
+
|
20
|
+
def aws_region
|
21
|
+
fetch(:aws_region)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
|
3
|
+
module Webpacker
|
4
|
+
module ManifestS3
|
5
|
+
module ManifestExtention
|
6
|
+
private
|
7
|
+
|
8
|
+
def load
|
9
|
+
if Webpacker::Configuration.manifest_s3_bucket && Webpacker::Configuration.manifest_s3_key
|
10
|
+
resp = s3_client.get_object(bucket: Webpacker::Configuration.manifest_s3_bucket, key: Webpacker::Configuration.manifest_s3_key)
|
11
|
+
JSON.parse(resp.body.read)
|
12
|
+
else
|
13
|
+
return super unless File.exist?(@path)
|
14
|
+
JSON.parse(File.read(@path))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def s3_client
|
19
|
+
Aws::S3::Client.new(client_options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def client_options
|
23
|
+
hash = {}
|
24
|
+
hash[:credentials] = credentials
|
25
|
+
hash[:region] = region if region
|
26
|
+
hash
|
27
|
+
end
|
28
|
+
|
29
|
+
def credentials
|
30
|
+
if access_key_id && secret_access_key
|
31
|
+
Aws::Credentials.new(access_key_id, secret_access_key)
|
32
|
+
else
|
33
|
+
Aws::InstanceProfileCredentials.new
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def access_key_id
|
38
|
+
Webpacker::Configuration.aws_access_key_id || ENV['AWS_ACCESS_KEY_ID']
|
39
|
+
end
|
40
|
+
|
41
|
+
def secret_access_key
|
42
|
+
Webpacker::Configuration.aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
|
43
|
+
end
|
44
|
+
|
45
|
+
def region
|
46
|
+
Webpacker::Configuration.aws_region || ENV['AWS_REGION']
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require "webpacker/manifest_s3/version"
|
2
|
+
require 'webpacker/manifest_s3/configuration_extention'
|
3
|
+
require 'webpacker/manifest_s3/manifest_extention'
|
4
|
+
require 'webpacker/configuration'
|
5
|
+
require 'webpacker/manifest'
|
6
|
+
|
7
|
+
Webpacker::Configuration.send(:extend, Webpacker::ManifestS3::ConfigurationExtention)
|
8
|
+
Webpacker::Manifest.send(:prepend, Webpacker::ManifestS3::ManifestExtention)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'webpacker/manifest_s3/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "webpacker-manifest_s3"
|
8
|
+
spec.version = Webpacker::ManifestS3::VERSION
|
9
|
+
spec.authors = ["Shota Iguchi"]
|
10
|
+
spec.email = ["shota-iguchi@cookpad.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Webpacker extention to load manifest file from s3'
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
+
f.match(%r{^(test|spec|features)/})
|
17
|
+
end
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'aws-sdk', '>= 2'
|
23
|
+
spec.add_dependency 'webpacker', '>= 2'
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webpacker-manifest_s3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shota Iguchi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: webpacker
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- shota-iguchi@cookpad.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/console
|
98
|
+
- bin/setup
|
99
|
+
- lib/webpacker/manifest_s3.rb
|
100
|
+
- lib/webpacker/manifest_s3/configuration_extention.rb
|
101
|
+
- lib/webpacker/manifest_s3/manifest_extention.rb
|
102
|
+
- lib/webpacker/manifest_s3/version.rb
|
103
|
+
- webpacker-manifest_s3.gemspec
|
104
|
+
homepage:
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.6.11
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Webpacker extention to load manifest file from s3
|
128
|
+
test_files: []
|