Sha256: de8cd3f10a330ba71fccac1577ac239aa01b7d895196bdd4ab3040140a57961c

Contents?: true

Size: 1.64 KB

Versions: 19

Compression:

Stored size: 1.64 KB

Contents

module Boxes
  class Command
    # Command handling for the environment used for building boxes.
    class Env < Command
      self.abstract_command = true
      self.default_subcommand = 'show'

      self.summary = 'Manage the build environment'
      self.description = 'Expore the environment that boxes uses for building '\
                         'inside of.'

      # Prints out the environment and configuration.
      class Show < Env
        self.summary = 'Show the environment and configuration'
        self.description = <<-DESC
            This lists the environment variables and other parts of the
            configuration that boxes uses to handle builds.
        DESC

        def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
          puts 'Configuration:'.underline
          puts ''
          puts "HOME_DIR=\"#{Boxes.config.home_dir}\""
          puts "WORKING_DIR=\"#{Boxes.config.working_dir}\""
          puts "TEMPLATE_PATHS=\"#{Boxes.config.template_paths.join(', ')}\""
          puts "SCRIPT_PATHS=\"#{Boxes.config.script_paths.join(', ')}\""

          puts ''
          puts 'Environment Variables:'.underline
          puts ''
          Boxes.config.environment_vars.each do |e|
            puts "#{e.keys.join}=\"#{e.values.join}\""
          end
        end
      end

      # Tidies up the working environment
      class Clean < Env
        self.summary = 'Clean up the environment.'
        self.description = 'Removes any files from the working directory.'

        def run
          working_dir = Boxes.config.working_dir

          FileUtils.rm_rf(working_dir) if working_dir.exist?
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
boxes-3.7.0 lib/boxes/command/env.rb
boxes-3.6.1 lib/boxes/command/env.rb
boxes-3.6.0 lib/boxes/command/env.rb
boxes-3.5.0 lib/boxes/command/env.rb
boxes-3.4.0 lib/boxes/command/env.rb
boxes-3.3.1 lib/boxes/command/env.rb
boxes-3.3.0 lib/boxes/command/env.rb
boxes-3.2.0 lib/boxes/command/env.rb
boxes-3.1.0 lib/boxes/command/env.rb
boxes-3.0.0 lib/boxes/command/env.rb
boxes-2.5.0 lib/boxes/command/env.rb
boxes-2.4.0 lib/boxes/command/env.rb
boxes-2.3.0 lib/boxes/command/env.rb
boxes-2.2.0 lib/boxes/command/env.rb
boxes-2.1.1 lib/boxes/command/env.rb
boxes-2.1.0 lib/boxes/command/env.rb
boxes-2.0.2 lib/boxes/command/env.rb
boxes-2.0.1 lib/boxes/command/env.rb
boxes-2.0.0 lib/boxes/command/env.rb