Sha256: 9237f40fef5483bcd66e029abf869ffb420654d7a5fd91adadd8af2125aea7d2

Contents?: true

Size: 924 Bytes

Versions: 6

Compression:

Stored size: 924 Bytes

Contents

require 'json'

namespace :sumo 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 'sumo: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

6 entries across 6 versions & 1 rubygems

Version Path
capistrano-sumo-1.4.2 lib/capistrano/tasks/assets.rake
capistrano-sumo-1.4.1 lib/capistrano/tasks/assets.rake
capistrano-sumo-1.4.0 lib/capistrano/tasks/assets.rake
capistrano-sumo-1.3.1 lib/capistrano/tasks/assets.rake
capistrano-sumo-1.3.0 lib/capistrano/tasks/assets.rake
capistrano-sumo-1.2.0 lib/capistrano/tasks/assets.rake