Class: Compass::Commands::WriteConfiguration
- Inherits:
-
ProjectBase
- Object
- Base
- ProjectBase
- Compass::Commands::WriteConfiguration
- Defined in:
- lib/compass/commands/write_configuration.rb
Instance Attribute Summary
Attributes inherited from ProjectBase
Attributes inherited from Base
Attributes included from Actions
Instance Method Summary collapse
-
#initialize(working_path, options) ⇒ WriteConfiguration
constructor
A new instance of WriteConfiguration.
- #perform ⇒ Object
Methods included from Actions
#basename, #compile, #copy, #directory, #relativize, #separate, #strip_trailing_separator, #write_file
Constructor Details
#initialize(working_path, options) ⇒ WriteConfiguration
Returns a new instance of WriteConfiguration.
7 8 9 10 |
# File 'lib/compass/commands/write_configuration.rb', line 7 def initialize(working_path, ) super assert_project_directory_exists! end |
Instance Method Details
#perform ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/compass/commands/write_configuration.rb', line 12 def perform read_project_configuration Compass.configuration.set_maybe() Compass.configuration.set_defaults! config_file = projectize("config.rb") if File.exists?(config_file) if [:force] logger.record(:overwrite, config_file) else = "#{config_file} already exists. Run with --force to overwrite." raise Compass::FilesystemConflict.new() 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 |