Sha256: 9aa890938f81fa2d2c9fac9e335dd8f5be8407be6a3f6a379b2486e72f965141

Contents?: true

Size: 1.23 KB

Versions: 21

Compression:

Stored size: 1.23 KB

Contents

begin
  require "lograge"
rescue Exception
end

require "timber/cli/config_file"
require "timber/cli/installer"
require "timber/cli/io/messages"

module Timber
  class CLI
    module Installers
      class ConfigFile < Installer
        def run(app, path)
          config_file = Timber::CLI::ConfigFile.new(path, file_helper)

          if config_file.exists?
            io.task_complete("#{config_file.path} already created")
            return true
          end

          if lograge?
            task_message = "Enabling logrageify in #{config_file.path}"
            io.task(task_message) { config_file.logrageify! }
          elsif action_view?
            task_message = "Silencing template renders in #{config_file.path}"
            io.task(task_message) { config_file.silence_template_renders! }
          end

          task_message = "Creating #{config_file.path}"
          io.task(task_message) { config_file.create! }
        end

        private
          def lograge?
            require "lograge"
            true
          rescue Exception
            false
          end

          def action_view?
            require("action_view")
            true
          rescue Exception
            false
          end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
timber-2.6.2 lib/timber/cli/installers/config_file.rb
timber-2.6.1 lib/timber/cli/installers/config_file.rb
timber-2.6.0 lib/timber/cli/installers/config_file.rb
timber-2.6.0.pre.beta2 lib/timber/cli/installers/config_file.rb
timber-2.6.0.pre.beta1 lib/timber/cli/installers/config_file.rb
timber-2.5.1 lib/timber/cli/installers/config_file.rb
timber-2.5.0 lib/timber/cli/installers/config_file.rb
timber-2.4.0 lib/timber/cli/installers/config_file.rb
timber-2.3.4 lib/timber/cli/installers/config_file.rb
timber-2.3.3 lib/timber/cli/installers/config_file.rb
timber-2.3.2 lib/timber/cli/installers/config_file.rb
timber-2.3.1 lib/timber/cli/installers/config_file.rb
timber-2.3.0 lib/timber/cli/installers/config_file.rb
timber-2.2.3 lib/timber/cli/installers/config_file.rb
timber-2.2.2 lib/timber/cli/installers/config_file.rb
timber-2.2.1 lib/timber/cli/installers/config_file.rb
timber-2.2.0 lib/timber/cli/installers/config_file.rb
timber-2.1.10 lib/timber/cli/installers/config_file.rb
timber-2.1.9 lib/timber/cli/installers/config_file.rb
timber-2.1.8 lib/timber/cli/installers/config_file.rb