Sha256: 1d7498016b3c6e26149c1a378466c77f13fa23f4cc841388123108c055998b77

Contents?: true

Size: 838 Bytes

Versions: 1

Compression:

Stored size: 838 Bytes

Contents

module Flydata
  module Command
    class Routine < Base
      def run
        unless flydata.credentials.authenticated?
          raise "Authentication error. Please login."
        end
        log_paths = retrieve_log_paths
        log_paths and log_paths.size() > 0 and log_paths.each { |path|
          if File.exist?(path) and File.writable?(path)
            Flydata::LogMonitor.new(path).setup.rotate
          else
            puts "Skip - #{path}. System cannot access this path."
          end
        }
      end

      private
      def retrieve_log_paths
        data_entries = JSON.parse(flydata.get('/data_entries'))
        unless flydata.response.code == 200 && data_entries.size > 0
          raise "Failed to retrieve data_ports ids"
        end
        data_entries.map {|e| e["log_path"]}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flydata-0.0.1.2011101801 lib/flydata/command/routine.rb