Sha256: 29d91b998d6adf67a1967e8ec6178234741d0f08424a6ba2397b411c62aa6a7d

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

Dir["#{File.dirname(__FILE__)}/stencil/*.rb"].each do |path|
  require path
end

class Stencil
  
  def initialize(args)
    @path = Dir.pwd
    @name = File.basename(@path).intern
    
    # If template, do a template merge
    if Config.exists?(:templates, @path)
      Merge.template(@path)
    
    # If project
    elsif Config.exists?(:projects, @path)
      
      # If upstream commit, merge upstream
      if args.first('<')
        Merge.upstream args[1..-1]
      
      # If template specified, update config
      elsif args.first
        Config.update(:projects => {
          @name => {
            :template => template,
            :branches => branches
          }
        })
      
      # Do a project merge
      Merge.project(@path)
    
    # If not configured
    else
      
      # Update config
      Msg.is_template_or_project?(@name)
      Config.update((STDIN.gets[0..0].downcase == 't' ? :templates : :projects) => {
        @name => { :path => @path }
      })

      # Re-run
      initialize args
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stencil-0.1.0 lib/stencil.rb