s3_assets_deployer 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6948a1a6132c0c4530995ae9792be783227b63f4
4
- data.tar.gz: 76f2f14069bc5a88d721b05d19c7f8d209aa54f7
3
+ metadata.gz: 0bbc6cc1e1b9506379131531f81e773272bce3b8
4
+ data.tar.gz: 3873880ee4a9b4c1278e054ba0dd6b72742f018d
5
5
  SHA512:
6
- metadata.gz: 53b5ac8f350719530ad82b2ccac765e498b5122ae011718c9d3cd3c49fc7099588b7f732e16aef5c8419526f39796864acc1f4e6a51005f2e7884bbd17aa86e6
7
- data.tar.gz: 92992e22a827dd9fdd6d23261ebcd32e32776c9e940512899728a9e4e213088ab38ab925a38fdc335979a7bf612d82ad43204211bf423e7f19eeb533d7ef9295
6
+ metadata.gz: b2b6d0da76e6f25a2e6f7ad8a58047dc070e500a0e4a7d3f9607eb4c1387e858e5f022d09d521fbe4314904a0c7e6d9d47bb0717fa8decaaf239d665e3ceeb39
7
+ data.tar.gz: a43efefa8ef9e1bcda3cafb193b901b8868224797f9a3a0a9b6f9e5cb4deee8f5173559343d84de10eb18d2d0bf91d340b45b785bd7b05199f06a523995eddbc
data/README.md CHANGED
@@ -27,7 +27,6 @@ Add initializer at `config/iniitializers/s3_assets_deployer.rb`
27
27
  S3AssetsDeployer.configure do |config|
28
28
  config.assets.root_path = Rails.root.join('public')
29
29
  config.assets.prefix_paths = ['assets', 'packs']
30
- config.assets.ignore_paths = ['packs/manifest.json']
31
30
  # your storage service configurations
32
31
  config.s3.region = 'ap-northeast-1'
33
32
  config.s3.bucket = 'bucket_name'
@@ -8,7 +8,6 @@ module S3AssetsDeployer
8
8
  storage: s3,
9
9
  root_path: config.assets.root_path,
10
10
  prefix_paths: config.assets.prefix_paths,
11
- ignore_paths: config.assets.ignore_paths
12
11
  )
13
12
 
14
13
  deployer.run
@@ -2,19 +2,17 @@ require 'mime/types'
2
2
 
3
3
  module S3AssetsDeployer
4
4
  class AssetFile
5
- attr_reader :prefix
6
-
7
- def initialize(prefix, path)
8
- @prefix = prefix
5
+ def initialize(path, realpath)
9
6
  @path = path
7
+ @realpath = realpath
10
8
  end
11
9
 
12
10
  def key
13
- [prefix, File.basename(@path)].join('/')
11
+ @path
14
12
  end
15
13
 
16
14
  def body
17
- File.new(@path)
15
+ File.new(@realpath)
18
16
  end
19
17
 
20
18
  def content_type
@@ -5,8 +5,8 @@ module S3AssetsDeployer
5
5
  def initialize(credentials:, region: nil, bucket: nil, prefix_key: nil)
6
6
  @credentials = credentials
7
7
  @bucket = bucket
8
- @prefix_key = prefix_key
9
8
  @region = region
9
+ @prefix_key = prefix_key
10
10
  end
11
11
 
12
12
  def upload(files)
@@ -3,10 +3,9 @@ module S3AssetsDeployer
3
3
  attr_accessor :assets,
4
4
  :s3
5
5
 
6
- class AssetsConfiguration < Struct.new(:root_path, :prefix_paths, :ignore_paths)
6
+ class AssetsConfiguration < Struct.new(:root_path, :prefix_paths)
7
7
  def initialize
8
8
  self.prefix_paths = ['assets']
9
- self.ignore_paths = []
10
9
  end
11
10
  end
12
11
 
@@ -2,11 +2,10 @@ require 's3_assets_deployer/asset_file'
2
2
 
3
3
  module S3AssetsDeployer
4
4
  class Deployer
5
- def initialize(storage:, root_path:, prefix_paths:, ignore_paths:)
5
+ def initialize(storage:, root_path:, prefix_paths:)
6
6
  @storage = storage
7
7
  @root_path = root_path
8
8
  @prefix_paths = prefix_paths
9
- @ignore_paths = ignore_paths.map { |path| File.join(root_path, path) }
10
9
  end
11
10
 
12
11
  def run
@@ -17,8 +16,10 @@ module S3AssetsDeployer
17
16
 
18
17
  def files
19
18
  @files ||= @prefix_paths.flat_map do |prefix|
20
- Dir.glob(@root_path.join(prefix).join('**', '**')).map do |path|
21
- AssetFile.new(prefix, path) if Pathname.new(path).file? && !@ignore_paths.include?(path)
19
+ Dir.chdir(@root_path) do
20
+ Dir.glob(Pathname.new(prefix).join('**', '**')).map do |path|
21
+ AssetFile.new(path, File.realpath(path)) if Pathname.new(path).file?
22
+ end
22
23
  end
23
24
  end.compact
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module S3AssetsDeployer
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_assets_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Iguchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-28 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.6.13
93
+ rubygems_version: 2.6.14
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Rails assets deployer