Sha256: 2c0efd3b597e92baebece5e9beb4f9ed1490585fca25f17650f45f9478b5f5d6

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

require File.join(File.dirname(__FILE__), 'project_base')

module Compass
  module Commands
    class WriteConfiguration < ProjectBase
      
      def initialize(working_path, options)
        super
        assert_project_directory_exists!
      end

      def perform
        config_file = projectize("config.rb")
        if File.exists?(config_file)
          if options[:force]
            logger.record(:overwrite, config_file)
          else
            message = "#{config_file} already exists. Run with --force to overwrite."
            raise Compass::FilesystemConflict.new(message)
          end
        else
          logger.record(:create, basename(config_file))
        end
        project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil
        open(config_file,'w') do |config|
          config.puts Compass.configuration.serialize
        end
        Compass.configuration.project_path = project_path
      end


    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chriseppstein-compass-0.6.0 lib/compass/commands/write_configuration.rb