Sha256: 79541f427f14bd93060df3c4c5cd603f41e5429faba5ec0b9817855845053c39

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

namespace :website do
  namespace :apptype do
    desc <<-DESC
      Change the application type of the website in the current working
      directory.
      
      When declaring a website, a type is (automatically or explicitely)
      assigned to it. It is possible to change that initial choice with this
      task:
        $ cd path/to/foo
        $ #{command "website:apptype:switch"} ID=custom
        $ #{command "website:backends:reprepare"}
      
      Environment variables:
        $ID: the ID or short name of the application type to switch to.
    DESC
    task :switch do
      website, type_id = fetch_current!, require_id!
    
      website.app_type = AppType.find(type_id)
    
      try_save website do
        puts_title "Application type switched"
        puts_long <<-MSG
          * The application type of website #{q website} has been successfully
            switched to #{q website.app_type}.
          
          * Remember to re-reprepare all backends with
            #{qcommand "website:backends:reprepare"}.
        MSG
      end
    end
  
    def require_id!
      ENV["ID"] || ENV["TO"] or
        error! <<-MSG
          The ID or short name of the application type to switch to must be
          specified by setting the $ID environment variable.
        MSG
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Flucti-flucti-cli-0.1.16 lib/flucti/tasks/website/apptype_tasks.rb