Sha256: 699ff587f640f803c8d2fd7a839f130339cd2b3586d1babb88f70d04c8444825

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

require 'fileutils'
require 'git'
require 'provisional/rails_application'

module Provisional
  module SCM
    class Git
      def initialize(options)
        @options = options
      end

      def gitignore
        Provisional::IGNORE_FILES.join("\n")
      end

      def init
        rescuing_exceptions do
          FileUtils.mkdir_p @options['name']
          Dir.chdir @options['name']
          @options['path'] = Dir.getwd
          ::Git.init
        end
      end

      def generate_rails
        rescuing_exceptions do
          Provisional::RailsApplication.new(@options['path'], @options['template_path'])
        end
      end

      def checkin
        rescuing_exceptions do
          repo = ::Git.open @options['path']
          Dir.chdir @options['path']
          File.open('.gitignore', 'w') do |f|
            f.puts gitignore
          end
          repo.add '.'
          repo.commit 'Initial commit by Provisional'
          repo
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vigetlabs-provisional-2.1.3 lib/provisional/scm/git.rb
vigetlabs-provisional-2.1.4 lib/provisional/scm/git.rb