class Sftp::Sync::Config
Attributes
options[R]
Public Class Methods
new(_options = {})
click to toggle source
# File lib/sftp/sync/config.rb, line 8 def initialize(_options = {}) @options = ActiveSupport::HashWithIndifferentAccess.new(_options) #required options[:host] = ENV["SFTP_SYNC_HOST"] unless options[:host].present? raise "missing host. Set SFTP_SYNC_HOST env." unless options[:host].present? options[:username] = ENV["SFTP_SYNC_USERNAME"] unless options[:username].present? raise "missing username. Set SFTP_SYNC_USERNAME env." unless options[:username].present? #optional options[:port] = ENV["SFTP_SYNC_PORT"] unless options[:port].present? options[:password] = ENV["SFTP_SYNC_PASSWORD"] unless options[:password].present? end
Public Instance Methods
filter()
click to toggle source
# File lib/sftp/sync/config.rb, line 56 def filter if options[:filter].present? options[:filter] elsif File.exist?(".gitignore") && options[:gitignore] ".gitignore" else nil end end
filter?()
click to toggle source
# File lib/sftp/sync/config.rb, line 52 def filter? filter.present? end
host()
click to toggle source
# File lib/sftp/sync/config.rb, line 29 def host options[:host] end
output_dir()
click to toggle source
# File lib/sftp/sync/config.rb, line 66 def output_dir options[:output_dir] || "" end
password()
click to toggle source
# File lib/sftp/sync/config.rb, line 37 def password options[:password] end
port()
click to toggle source
# File lib/sftp/sync/config.rb, line 41 def port options[:port] end
remove_local?()
click to toggle source
# File lib/sftp/sync/config.rb, line 70 def remove_local? options[:remove_local] end
sftp_opts()
click to toggle source
# File lib/sftp/sync/config.rb, line 45 def sftp_opts {}.tap do |opts| opts[:password] = password unless password.nil? opts[:port] = port unless port.nil? end end
username()
click to toggle source
# File lib/sftp/sync/config.rb, line 33 def username options[:username] end
verbose?()
click to toggle source
# File lib/sftp/sync/config.rb, line 74 def verbose? options[:verbose] || false end