Class: Albacore::Tools::FluentMigrator::BatchMigrateTask
- Inherits:
-
Object
- Object
- Albacore::Tools::FluentMigrator::BatchMigrateTask
- Includes:
- Logging
- Defined in:
- lib/albacore/tools/fluent_migrator.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(*args) ⇒ BatchMigrateTask
constructor
A new instance of BatchMigrateTask.
Methods included from Logging
#debug, #err, #error, #fatal, #info, #puts, #trace, #warn
Constructor Details
#initialize(*args) ⇒ BatchMigrateTask
Returns a new instance of BatchMigrateTask.
150 151 152 153 154 155 156 |
# File 'lib/albacore/tools/fluent_migrator.rb', line 150 def initialize *args @args = Map. args @args.apply :direction => 'migrate:up', :silent => true raise ArgumentError, 'Passed nil file' if @args.get(:file).nil? raise ArgumentError, "Could not find file '#{@args.get(:file)}'" unless File.exists? @args.get(:file) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
148 149 150 |
# File 'lib/albacore/tools/fluent_migrator.rb', line 148 def args @args end |
Instance Method Details
#execute ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/albacore/tools/fluent_migrator.rb', line 158 def execute File.open(args[:file], "r") do |file_handle| file_handle.each_line do |server| server = server.chomp unless server.nil? or server.empty? info '' info " ********** Starting '#{server}' ************ " info '' ::Albacore::Tools::FluentMigrator::Cmd.new(@args.set(:conn => server)).execute info '' info " ********** Finished '#{server}' ************ " info '' end end end end |