Sha256: 40619a7531737bd28ba452d00102a6f9ddb1609865da0c6294f14f2aee22cbcd

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require 'awestruct/cli/manifest'
require 'sass'
require 'sass/plugin'

module Awestruct
  module CLI
    class Init
      BASE_MANIFEST = Manifest.new {
        mkdir( '_config' )
        mkdir( '_layouts' )
        mkdir( '_ext' )
        copy_file( '_ext/pipeline.rb', File.join( File.dirname(__FILE__), '/../frameworks/base_pipeline.rb' ) )
        mkdir( 'stylesheets' )
        touch_file( '.awestruct_ignore' )
      }

      def initialize(dir=Dir.pwd,framework='compass',scaffold=true)
        @dir       = dir
        @framework = framework
        @scaffold  = scaffold
      end

      def run()
        manifest = Manifest.new( BASE_MANIFEST )
        manifest.install_compass( @framework )
        scaffold_name = ( @framework == 'compass' ? 'blueprint' : @framework )
        if ( @scaffold )
          manifest.copy_file( '_layouts/base.html.haml', 
                              File.join( File.dirname(__FILE__), "/../frameworks/#{scaffold_name}/base_layout.html.haml" ) )
          if ( File.file? File.join( File.dirname(__FILE__), "/frameworks/#{scaffold_name}/base_index.html.haml" ) )
            manifest.copy_file( 'index.html.haml', 
                                File.join( File.dirname(__FILE__), "/../frameworks/#{scaffold_name}/base_index.html.haml" ) )
          else
            manifest.copy_file( 'index.html.haml', 
                                File.join( File.dirname(__FILE__), "/../frameworks/base_index.html.haml" ) )
          end
          manifest.touch_file( '_config/site.yml' )
        end
        manifest.perform( @dir )
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
awestruct-0.4.8 lib/awestruct/cli/init.rb
awestruct-0.4.7 lib/awestruct/cli/init.rb
awestruct-0.4.6 lib/awestruct/cli/init.rb
awestruct-0.4.5 lib/awestruct/cli/init.rb