bubbles 0.0.4.1 → 0.0.5

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: ea23e1f12dc2c015ac20730ce463b99d29374038
4
- data.tar.gz: c16242cd3bc2ce23e3fc3de294ebb9650dc52780
3
+ metadata.gz: 268469699924c6a01e8093ac8213509c95cfcdc8
4
+ data.tar.gz: 5caf988b1600e68ce86a37a7f3ba04ad89b2a912
5
5
  SHA512:
6
- metadata.gz: 6872861fa07912bc5edb06f391f223c385d2784344d6b7917f92b4baee9517b990b467fadeb8493d04197e1fba81d79d33599425867cdebb7866949b2c5bb4ce
7
- data.tar.gz: 7e574f69ed3a9a936e178505cee402ecfc2509a4b1f242c7caf3349f720019424aa616e5d0490acd80994371e92c47731dcda7de5b9d90e7b687cba8069dd77f
6
+ metadata.gz: cd4b0257ecf635009040d9bafe01acd81793dc96391023011b7239f7d80260958a1c24fd938050128888a4ad59cee80a05d4cb661aba26ea44c1b36d7703bc58
7
+ data.tar.gz: c305cd6f10835ec81fcfac0fcec0794e6d083d118d4106a01dc3a092225bdad1f34f7fc8d8bc2bfdac007a8e441b496a7d510b7c58b90665f0a1ac7ab66bcb55
data/README.md CHANGED
@@ -67,6 +67,7 @@ sleep_interval: 1 # sleep between next command
67
67
  num_of_files_to_schedule: 1 # how many files schedule for processing at the same time
68
68
 
69
69
  uploaders:
70
+ - 'Bubbles::Uploaders::S3EnsureConnection' # this will check if s3 connection can be established
70
71
  - 'Bubbles::Uploaders::S3' # by default only S3 uploader is used
71
72
  - 'Bubbles::Uploaders::LocalDir'
72
73
 
@@ -13,6 +13,7 @@ require "bubbles/bubblicious_file"
13
13
  require "bubbles/dir_watcher"
14
14
  require 'bubbles/common_uploader_interface'
15
15
  require "bubbles/uploaders/s3"
16
+ require "bubbles/uploaders/s3_ensure_connection"
16
17
  require "bubbles/uploaders/local_dir"
17
18
 
18
19
  module Bubbles
@@ -7,14 +7,16 @@ module Bubbles
7
7
  @config = config
8
8
  end
9
9
 
10
- def move_to_processing_dir
11
- config.logger.debug("BubbliciousFile: moving file #{file} to #{uid_file}")
12
- FileUtils.mv(file, uid_file)
10
+ def copy_to_processing_dir
11
+ config.logger.debug("BubbliciousFile: copy file #{file} to #{uid_file}")
12
+ FileUtils.cp(file, uid_file)
13
13
  end
14
14
 
15
15
  def remove_file
16
16
  config.logger.debug("BubbliciousFile: removing file #{uid_file}")
17
17
  FileUtils.rm(uid_file)
18
+ config.logger.debug("BubbliciousFile: removing file #{file}")
19
+ FileUtils.rm(file)
18
20
  end
19
21
 
20
22
  def metadata
@@ -16,7 +16,7 @@ module Bubbles
16
16
  .last(num_of_files_to_schedule)
17
17
  .each do |file|
18
18
  bfile = BubbliciousFile.new(file: file, config: config)
19
- bfile.move_to_processing_dir
19
+ bfile.copy_to_processing_dir
20
20
 
21
21
  uploader_classes.each do |uploader_class|
22
22
  command_queue << uploader_class.new(bfile: bfile, command_queue: command_queue, config: config)
@@ -0,0 +1,26 @@
1
+ module Bubbles
2
+ module Uploaders
3
+ class S3EnsureConnection
4
+ extend Forwardable
5
+ include Bubbles::CommonUploaderInterface
6
+
7
+ def call
8
+ s3.list_buckets
9
+ end
10
+
11
+ def inspect
12
+ "<##{self.class.name} testing connection to s3 bucket>"
13
+ end
14
+
15
+ private
16
+ def_delegators :config, :s3_bucket, :s3_credentials, :s3_region
17
+
18
+ def s3
19
+ @s3 ||= Aws::S3::Client.new({
20
+ region: s3_region,
21
+ credentials: s3_credentials
22
+ })
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Bubbles
2
- VERSION = "0.0.4.1"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bubbles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Valent
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -94,6 +94,7 @@ files:
94
94
  - lib/bubbles/dir_watcher.rb
95
95
  - lib/bubbles/uploaders/local_dir.rb
96
96
  - lib/bubbles/uploaders/s3.rb
97
+ - lib/bubbles/uploaders/s3_ensure_connection.rb
97
98
  - lib/bubbles/version.rb
98
99
  - tmp/dummy_local_dir_uploader_dir/.gitkeep
99
100
  - tmp/dummy_processing_dir/.gitkeep