Sha256: a82d939553ef58f97689d5738be719b56ccff948ccb07bcbb40ac07675ebff57

Contents?: true

Size: 815 Bytes

Versions: 50

Compression:

Stored size: 815 Bytes

Contents

module FlashPlayer

  class Trust

    attr_accessor :logger

    def initialize
      @logger = $stdout
    end

    def add path
      file = trust_file
      create(file) unless File.exists?(file)
      update_if_necessary file, path
    end

    private

    def create file
      dir = File.dirname file
      FileUtils.makedirs(dir) unless File.exists?(dir)
      FileUtils.touch file
    end

    def update_if_necessary file, path
      path = File.expand_path path
      if(!has_path?(file, path))
        File.open(file, 'a') do |f|
          f.puts path
        end
        logger.puts ">> Added #{path} to Flash Player Trust file at: #{file}"
      end
    end

    def has_path? file, path
      !File.read(file).index(path).nil?
    end

    def trust_file
      FlashPlayer.trust
    end
  end
end

Version data entries

50 entries across 50 versions & 4 rubygems

Version Path
h4oflashsdk-1.0.13 lib/flashplayer/trust.rb
h4oflashsdk-1.0.12 lib/flashplayer/trust.rb
h4oflashsdk-1.0.11 lib/flashplayer/trust.rb
h4oflashsdk-1.0.10 lib/flashplayer/trust.rb
h4oflashsdk-1.0.9 lib/flashplayer/trust.rb
h4oflashsdk-1.0.8 lib/flashplayer/trust.rb
h4oflashsdk-1.0.7 lib/flashplayer/trust.rb
h4oflashsdk-1.0.6 lib/flashplayer/trust.rb
h4oflashsdk-1.0.5 lib/flashplayer/trust.rb
h4oflashsdk-1.0.4 lib/flashplayer/trust.rb
h4oflashsdk-1.0.3 lib/flashplayer/trust.rb
h4oflashsdk-1.0.2 lib/flashplayer/trust.rb
h4oflashsdk-1.0.1 lib/flashplayer/trust.rb
h4oflashsdk-1.0.0 lib/flashplayer/trust.rb
flashsdk_sqe-0.0.14 lib/flashplayer/trust.rb
flashsdk_sqe-0.0.13 lib/flashplayer/trust.rb
flashsdk_sqe-0.0.12 lib/flashplayer/trust.rb
flashsdk_sqe-0.0.11 lib/flashplayer/trust.rb
flashsdk_sqe-0.0.10 lib/flashplayer/trust.rb
flashsdk_sqe-0.0.9 lib/flashplayer/trust.rb