Sha256: a5c9f8af28260331b7f9dcae22a3344d91c6bef5d10d1c7eb13c09bd221dc07c

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

module MagLove
  module Command
    class Compile
      include Commander::Methods
      
      def run
        
        task :coffee, theme: "!" do |args, options|
          asset = theme_asset("theme.coffee", options.theme)
          debug("▸ created #{asset.logical_path}") if asset.write!
        end
        
        task :css, theme: "!" do |args, options|
          if File.exists?(theme_path("theme.scss", options.theme))
            asset = theme_asset("theme.scss", options.theme)
          else
            asset = theme_asset("theme.less", options.theme)
          end
          debug("▸ created #{asset.logical_path}") if asset.write!
        end
  
        task :yaml, theme: "!" do |args, options|
          asset = theme_asset("theme.yml", options.theme)
          debug("▸ created #{asset.logical_path}") if asset.write!
        end
  
        task :templates, theme: "!", bucket: "localhost:3002" do |args, options|
          Hamloft::Options.defaults[:asset_uri] = "http://#{options.bucket}"
          theme_glob("templates/*.{html,haml,twig}", options.theme).each do |file|
            # check if yaml file exists
            locals = {}
            locals_contents = theme_contents(file.sub(/\.[^.]+\z/, ".yml"), options.theme)
            if locals_contents
              locals = YAML.load(locals_contents).with_indifferent_access
            end
            asset = theme_asset(file, options.theme, locals)
            debug("▸ created #{asset.logical_path}") if asset.write!
          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
maglove-0.8.1 lib/maglove/command/compile.rb
maglove-0.8.0 lib/maglove/command/compile.rb
maglove-0.7.2 lib/maglove/command/compile.rb
maglove-0.7.1 lib/maglove/command/compile.rb
maglove-0.7.0 lib/maglove/command/compile.rb