Class: Usmu::S3
- Inherits:
-
Object
- Object
- Usmu::S3
- Defined in:
- lib/usmu/s3.rb,
lib/usmu/s3/version.rb,
lib/usmu/s3/uploader.rb,
lib/usmu/s3/remote_files.rb,
lib/usmu/s3/s3_configuration.rb
Overview
Usmu::S3 is the main plugin class for this plugin. It contains entry hooks as required to implement the S3 deployment interface.
Defined Under Namespace
Classes: RemoteFiles, S3Configuration, Uploader
Constant Summary collapse
- VERSION =
The current version string for the gem
'1.0.0'
Instance Attribute Summary collapse
-
#log ⇒ void
readonly
private
Returns the value of attribute log.
-
#ui ⇒ void
private
Returns the value of attribute ui.
Instance Method Summary collapse
- #command_deploy(args = [], options = {}) ⇒ void
- #commands(ui, c) ⇒ void
-
#initialize ⇒ S3
constructor
A new instance of S3.
Constructor Details
Instance Attribute Details
#log ⇒ void (readonly, private)
Returns the value of attribute log.
49 50 51 |
# File 'lib/usmu/s3.rb', line 49 def log @log end |
#ui ⇒ void (private)
Returns the value of attribute ui.
50 51 52 |
# File 'lib/usmu/s3.rb', line 50 def ui @ui end |
Instance Method Details
#command_deploy(args = [], options = {}) ⇒ void
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/usmu/s3.rb', line 33 def command_deploy(args = [], = {}) raise 'This command does not take arguments.' unless args.empty? raise 'Invalid options, must be a Hash.' unless .instance_of? Hash configuration = @ui.configuration s3_configuration = S3Configuration.new(configuration['plugin', 's3', default: {}]) @log.info('Gathering information...') diff = Deployment::DirectoryDiff.new(configuration, RemoteFiles.new(s3_configuration)) @log.info('Uploading files.') uploader = Uploader.new(configuration, s3_configuration) uploader.push(diff.get_diffs) @log.info('Website updated successfully.') end |
#commands(ui, c) ⇒ void
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/usmu/s3.rb', line 22 def commands(ui, c) @log.debug('Adding commands from usmu-s3.') @ui = ui c.command(:'s3 deploy') do |command| command.syntax = 'usmu s3 deploy' command.description = 'Deploys your website to S3' command.action &method(:command_deploy) end end |