Sha256: 2871dbc963f22610f2a21bfcea346c77e2208bd085a119dcd8099e899e98ebf4

Contents?: true

Size: 1.37 KB

Versions: 14

Compression:

Stored size: 1.37 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 :less, theme: "!" do |args, options|
          asset = theme_asset("theme.less", options.theme)
          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

14 entries across 14 versions & 1 rubygems

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