Sha256: b42ee7aba9556646cec433f32dacd284ccf5f6f84012f0ff43bff1fe0f6a5f81

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

require 'json'

namespace :siesqo do
  namespace :assets do
    desc 'Compile the assets'
    task :compile do
      run_locally do
        execute :gulp, '--silent', 'build:theme'
      end
    end

    desc 'Uploads the build assets to the remote server'
    task :put do
      invoke 'siesqo:assets:compile'
      on roles(:web) do
        remote_path = "#{release_path}/src/Frontend/Themes/#{theme}/Core"

        # delete old folder
        execute :rm, '-rf', remote_path
        execute :mkdir, '-p', remote_path

        # upload compiled theme
        upload! "./src/Frontend/Themes/#{theme}/Core", "#{File.dirname(remote_path)}", recursive: true
      end
    end

    def theme
      package = JSON.parse(File.read('package.json'))

      if not package.key?('theme')
        warn Airbrussh::Colors.red('✘') + ' No theme available in package.json.'
        exit 1
      end

      package['theme']
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-siesqo-1.0.0 lib/capistrano/tasks/assets.rake