Sha256: f132142b81e879ecc8b1adaf38b68adb97b54d8283235610875a3388c539b1de

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

module Jets::Gems
  class Agree
    def initialize
      @agree_file = "#{ENV['HOME']}/.jets/agree"
    end

    # Only prompts if hasnt prompted before and saved a ~/.jets/agree file
    def prompt
      return if File.exist?(@agree_file)

      puts "The Jets project contains binary gems that are not yet available in your gems source. You can help make Jets and the community better by reporting the missing binary gems.  Reported gems get built more quickly.  BoltOps takes privacy seriously and only collects anonymous non-identifiable data. You will only be asked this once."
      puts "Do you want send reporting data to BoltOps? (Y/n)?"
      answer = $stdin.gets.strip
      value = answer =~ /y/i ? 'yes' : 'no'

      FileUtils.mkdir_p(File.dirname(@agree_file))
      IO.write(@agree_file, value)
    end

    def yes?
      File.exist?(@agree_file) && IO.read(@agree_file).strip == 'yes'
    end

    def no?
      File.exist?(@agree_file) && IO.read(@agree_file).strip == 'no'
    end

    def yes!
      write_file("yes")
    end

    def no!
      write_file("no")
    end

    def write_file(content)
      FileUtils.mkdir_p(File.dirname(@agree_file))
      IO.write(@agree_file, content)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
jets-1.4.5 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.4.4 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.4.3 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.4.2 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.4.1 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.4.0 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.9 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.8 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.7 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.6 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.5 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.4 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.3 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.2 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.1 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.3.0 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.2.1 vendor/jets-gems/lib/jets/gems/agree.rb
jets-1.2.0 vendor/jets-gems/lib/jets/gems/agree.rb