Sha256: 8d996c0fc27dd472909f2ac3d242e78dbb281074275e2ad4cc29d2456c7e6e75

Contents?: true

Size: 1016 Bytes

Versions: 3

Compression:

Stored size: 1016 Bytes

Contents

require "require_all"
require "thor"

module Screengem
  class CLI < Thor
    option :root
    option :config, default: "dampen_configuration.yml"
    option :questions, default: "questions"
    option :tasks, default: "tasks"
    option :quiet, default: false
    desc "generate", "Create the sample dampening configuration"
    def generate
      root = options[:root]

      # Require all questions and tasks for inclusion in the sample configuration.
      require_all File.join(root, options[:questions])
      require_all File.join(root, options[:tasks])

      Screengem.configure do |config|
        config.dampen_configuration_filename = File.join(root, options[:config])
      end

      sample_filename = Screengem.configuration.dampen_configuration_sample_filename

      puts "Regenerating #{sample_filename} ..." unless options[:quiet]

      sample_configuration = Screengem::DampenConfigurationGenerator.new.generate

      File.write(sample_filename, sample_configuration.to_yaml)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
screengem-0.1.2 lib/screengem/cli.rb
screengem-0.1.1 lib/screengem/cli.rb
screengem-0.1.0 lib/screengem/cli.rb