Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first commit

  • Loading branch information...
commit a11bef06a3f659402fe7563abf99ad00de2209e6 0 parents
@schacon authored
Showing with 54 additions and 0 deletions.
  1. +6 −0 README
  2. +23 −0 Rakefile
  3. +25 −0 lib/simplegit.rb
6 README
@@ -0,0 +1,6 @@
+SimpleGit Ruby Library
+======================
+
+This library calls git commands and returns the output.
+
+Author : Scott Chacon
23 Rakefile
@@ -0,0 +1,23 @@
+require 'rubygems'
+Gem::manage_gems
+require 'rake/gempackagetask'
+
+spec = Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = "simplegit"
+ s.version = "0.1.0"
+ s.author = "Scott Chacon"
+ s.email = "schacon@gmail.com"
+ s.summary = "A simple gem for using Git in Ruby code."
+ s.files = FileList['lib/**/*'].to_a
+ s.require_path = "lib"
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_tar = true
+end
+
+task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
+ puts "generated latest version"
+end
+
25 lib/simplegit.rb
@@ -0,0 +1,25 @@
+# a super simple example class to use git in ruby
+class SimpleGit
+
+ def initialize(git_dir = '.')
+ @git_dir = File.expand_path(git_dir)
+ end
+
+ def show(treeish = 'master')
+ command("git show #{treeish}")
+ end
+
+ private
+
+ def command(git_cmd)
+ Dir.chdir(@git_dir) do
+ return `#{git_cmd} 2>&1`.chomp
+ end
+ end
+
+end
+
+if $0 == __FILE__
+ git = SimpleGit.new
+ puts git.show
+end
Please sign in to comment.
Something went wrong with that request. Please try again.