Sha256: b899d643766aa2c3066cc13205ac0a70c60b3d161f64a69a635b36dba90e5062

Contents?: true

Size: 904 Bytes

Versions: 7

Compression:

Stored size: 904 Bytes

Contents

module Deano
  class AppDestroyer < Deano::NameCommand

    def self.command
      "destroy:app"
    end

    def self.help
      "app_name"
    end

    def classified
      "#{self.name.classify}App"
    end

    def call
      path = app_path("apps", "#{self.underscored}.rb")
      rm path

      path = app_path("apps", "views", self.underscored)
      rm_r path

      path = app_path("spec", "apps", "#{self.underscored}_spec.rb")
      rm path

      path = app_path("assets", "javascripts", "#{self.underscored}.js.coffee")
      rm path

      path = app_path("assets", "stylesheets", "#{self.underscored}.css.scss")
      rm path

      path = app_path("config.ru")
      old = File.read(path)
      File.open(path, "w") do |file|
        map = <<-EOF
  map "/#{self.underscored}" do
    run #{self.classified}
  end
        EOF
        file.puts old.gsub(map, "")
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
deano-1.2.1 lib/deano/commands/app_destroyer_command.rb
deano-1.2.0 lib/deano/commands/app_destroyer_command.rb
deano-1.1.3 lib/deano/commands/app_destroyer_command.rb
deano-1.1.2 lib/deano/commands/app_destroyer_command.rb
deano-1.1.1 lib/deano/commands/app_destroyer_command.rb
deano-1.1.0 lib/deano/commands/app_destroyer_command.rb
deano-1.0.0 lib/deano/commands/app_destroyer_command.rb