Sha256: 8ccb405f284a02ae2becce55f07dce32cee475aacad78ff1930fc75e16d929af

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

require 'pathname'

module Bagboy
  module Core
    module SCM
      class Git < Base

        include Singleton

        def pull
          execute_command "cd #{Bagboy.chef_repo}; git pull"
        end

        def commit( file, message )
          execute_command "cd #{Bagboy.chef_repo}; git add '#{clean_filename file}'; git commit '#{clean_filename file}' -m '#{message}'; git push"
        end

        private

        def execute_command cmd
          `#{cmd}`
        end
        
        def clean_filename( file )
          absolute  = Pathname.new(file)
          root      = Pathname.new(Bagboy.chef_repo)
          relative  = absolute.relative_path_from(root)
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bagboy-0.0.1 lib/bagboy/core/scm/git.rb