Sha256: ce221f3eedd054e8c4d3f345e5897e1ac920e2fef2d2e1bbaec31cbc044ffb61

Contents?: true

Size: 1.87 KB

Versions: 16

Compression:

Stored size: 1.87 KB

Contents

module MagLove
  module Command
    class Util
      include Commander::Methods
      
      def run
        
        task :cache_clear, bucket: "cdn.magloft.com" do |args, options|
          debug("▸ clearing cache for #{options.bucket}.magloft.com")
          system "gsutil -m setmeta -R -h 'Cache-Control:public, max-age=0, no-transform' gs://#{options.bucket}.magloft.com/themes"
        end
        
        task :browser_sync, theme: "!", files: "!", port: "3002", proxy_port: "3001", host: "localhost", start_path: "/", log_level: "silent" do |args, options|
          debug("▸ starting browser-sync")
          job = fork do
            begin
              system "browser-sync start --proxy #{options.host}:#{options.proxy_port} --port #{options.port} --files '#{options.files}' --startPath '#{options.start_path}' --logLevel #{options.log_level} --no-ui"
            rescue Exception => e
              info("▸ shutting down browser sync")
            end
          end
          Process.detach(job)
        end
        
        task :watch, theme: "!", block: "NO" do |args, options|
          info("▸ watching theme #{options.theme}")
          watch_config({
            "compile:coffee" => [theme_path("**/*.{coffee,js}", options.theme), theme_base_path("**/*.{coffee,js}", options.theme)],
            "compile:less" => [theme_path("**/*.{less,css}", options.theme), theme_base_path("**/*.{less,css}", options.theme)],
            "compile:templates" => [theme_path("**/*.{haml,twig,html}", options.theme)],
            "copy:base_images" => theme_base_path("images/**/*.{jpg,jpeg,gif,png,svg}", options.theme),
            "copy:images" => theme_path("images/**/*.{jpg,jpeg,gif,png,svg}", options.theme)
          }, options)
          
          if options.block == "YES"
            while true
              sleep 100
            end
          end
        end

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
maglove-0.6.6 lib/maglove/command/util.rb
maglove-0.6.5 lib/maglove/command/util.rb
maglove-0.6.4 lib/maglove/command/util.rb
maglove-0.6.3 lib/maglove/command/util.rb
maglove-0.6.2 lib/maglove/command/util.rb
maglove-0.6.1 lib/maglove/command/util.rb
maglove-0.6.0 lib/maglove/command/util.rb
maglove-0.5.9 lib/maglove/command/util.rb
maglove-0.5.8 lib/maglove/command/util.rb
maglove-0.5.7 lib/maglove/command/util.rb
maglove-0.5.5 lib/maglove/command/util.rb
maglove-0.5.4 lib/maglove/command/util.rb
maglove-0.5.2 lib/maglove/command/util.rb
maglove-0.5.1 lib/maglove/command/util.rb
maglove-0.5.0 lib/maglove/command/util.rb
maglove-0.3.0 lib/maglove/command/util.rb