Sha256: 5b41149e8bfbebac02d322a77d24521983babec3b009948d8f4ae2d297bbbf21

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

require 'mharris_ext'

%w(files template_file thor_file project from_command).each do |f|
  load File.dirname(__FILE__) + "/overapp/#{f}.rb"
end

module Overapp
  class << self
    def with_repo_path(url)
      dir = "/tmp/#{rand(100000000000000000000)}"
      `mkdir #{dir}`
      Dir.chdir(dir) do
        `git clone #{url} .`
      end
      yield dir
    ensure
      `rm -rf #{dir}`
    end
    def with_local_path(overapp_path,&b)
      if overapp_path =~ /git/
        with_repo_path(overapp_path) do |dir|
          b[dir]
        end
      else
        yield overapp_path
      end
    end
    def write_project(overapp_path,output_path)
      with_local_path(overapp_path) do |dir|
        Overapp::Project.new(:path => dir).write_to!(output_path)
      end
    end

    def ec(cmd,ops={})
      `#{cmd}`
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
overapp-0.3.0 lib/overapp.rb
overapp-0.2.0 lib/overapp.rb