Skip to content

Commit

Permalink
Sorting Git module
Browse files Browse the repository at this point in the history
Adding Gemfile
Removing Jeweler
Removing ruby-git gemspec
  • Loading branch information
robertodecurnex committed Apr 10, 2013
1 parent 6dea92c commit a308cc9
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 159 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.gem
*.kpf
*.sw?
.DS_Store
coverage
rdoc
pkg

rdoc
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gemspec :name => 'git'
22 changes: 22 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PATH
remote: .
specs:
git (1.2.6)

GEM
remote: https://rubygems.org/
specs:
json (1.7.7)
rdoc (4.0.1)
json (~> 1.4)
ruby-prof (0.13.0)
test-unit (2.5.4)

PLATFORMS
ruby

DEPENDENCIES
git!
rdoc
ruby-prof
test-unit
34 changes: 3 additions & 31 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
require 'rdoc/task'
require 'rubygems'

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "git"
gem.summary = %Q{Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories by wrapping system calls to the git binary}
gem.email = "schacon@gmail.com"
gem.homepage = "http://github.com/schacon/ruby-git"
gem.authors = "Scott Chacon"
gem.rubyforge_project = "git"
gem.files = FileList["lib/**/*.rb"]
gem.test_files = FileList["test/*.rb"]
gem.extra_rdoc_files = ["README"]
gem.requirements << 'git 1.6.0.0, or greater'

# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end

Jeweler::RubyforgeTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

require "#{File.expand_path(File.dirname(__FILE__))}/lib/git/version"

desc "Upload Docs"
task :upload_docs do |t|
Expand All @@ -34,17 +14,9 @@ task :test do |t|
require File.dirname(__FILE__) + '/tests/all_tests.rb'
end

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION.yml')
config = YAML.load(File.read('VERSION.yml'))
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
else
version = ""
end

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "ruby-git #{version}"
rdoc.title = "ruby-git #{Git::VERSION}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Expand Down
84 changes: 38 additions & 46 deletions git.gemspec
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
require 'date'

require "#{File.expand_path(File.dirname(__FILE__))}/lib/git/version"

Gem::Specification.new do |s|
s.name = %q{git}
s.version = "1.2.5"
s.authors = ['Scott Chacon']
s.date = Date.today.to_s
s.email = 'schacon@gmail.com'
s.homepage = 'http://github.com/schacon/ruby-git'
s.name = 'git'
s.summary = 'Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories by wrapping system calls to the git binary.'
s.version = Git::VERSION

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Scott Chacon"]
s.date = %q{2009-10-17}
s.email = %q{schacon@gmail.com}
s.extra_rdoc_files = [
"README"
]
s.files = [
"lib/git.rb",
"lib/git/author.rb",
"lib/git/base.rb",
"lib/git/branch.rb",
"lib/git/branches.rb",
"lib/git/diff.rb",
"lib/git/index.rb",
"lib/git/lib.rb",
"lib/git/log.rb",
"lib/git/object.rb",
"lib/git/path.rb",
"lib/git/remote.rb",
"lib/git/repository.rb",
"lib/git/stash.rb",
"lib/git/stashes.rb",
"lib/git/status.rb",
"lib/git/working_directory.rb"
]
s.homepage = %q{http://github.com/schacon/ruby-git}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.requirements = ["git 1.6.0.0, or greater"]
s.rubyforge_project = %q{git}
s.rubygems_version = %q{1.3.5}
s.summary = %q{Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories by wrapping system calls to the git binary}
s.require_paths = ['lib']
s.requirements = ['git 1.6.0.0, or greater']

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
s.add_development_dependency 'rdoc'
s.add_development_dependency 'ruby-prof'
s.add_development_dependency 'test-unit'

s.extra_rdoc_files = ['README']
s.rdoc_options = ['--charset=UTF-8']

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
s.files = [
'lib/git.rb',
'lib/git/author.rb',
'lib/git/base.rb',
'lib/git/branch.rb',
'lib/git/branches.rb',
'lib/git/diff.rb',
'lib/git/index.rb',
'lib/git/lib.rb',
'lib/git/log.rb',
'lib/git/object.rb',
'lib/git/path.rb',
'lib/git/remote.rb',
'lib/git/repository.rb',
'lib/git/stash.rb',
'lib/git/stashes.rb',
'lib/git/status.rb',
'lib/git/version.rb',
'lib/git/working_directory.rb'
]
end
116 changes: 54 additions & 62 deletions lib/git.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@

# Add the directory containing this file to the start of the load path if it
# isn't there already.
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require 'git/author'
require 'git/base'
require 'git/path'
require 'git/lib'

require 'git/repository'
require 'git/branch'
require 'git/branches'
require 'git/diff'
require 'git/index'
require 'git/working_directory'

require 'git/lib'
require 'git/log'
require 'git/object'

require 'git/branches'
require 'git/branch'
require 'git/path'
require 'git/remote'

require 'git/diff'
require 'git/repository'
require 'git/status'
require 'git/author'

require 'git/stashes'
require 'git/stash'
require 'git/stashes'
require 'git/working_directory'

lib = Git::Lib.new(nil, nil)
unless lib.meets_required_version?
Expand All @@ -47,9 +41,29 @@
# Author:: Scott Chacon (mailto:schacon@gmail.com)
# License:: MIT License
module Git

VERSION = '1.0.4'

#g.config('user.name', 'Scott Chacon') # sets value
#g.config('user.email', 'email@email.com') # sets value
#g.config('user.name') # returns 'Scott Chacon'
#g.config # returns whole config hash
def config(name = nil, value = nil)
lib = Git::Lib.new
if(name && value)
# set value
lib.config_set(name, value)
elsif (name)
# return value
lib.config_get(name)
else
# return hash
lib.config_list
end
end

def global_config(name = nil, value = nil)
self.class.global_config(name, value)
end

# open a bare repository
#
# this takes the path to a bare git repo
Expand All @@ -60,29 +74,6 @@ def self.bare(git_dir, options = {})
Base.bare(git_dir, options)
end

# open an existing git working directory
#
# this will most likely be the most common way to create
# a git reference, referring to a working directory.
# if not provided in the options, the library will assume
# your git_dir and index are in the default place (.git/, .git/index)
#
# options
# :repository => '/path/to/alt_git_dir'
# :index => '/path/to/alt_index_file'
def self.open(working_dir, options = {})
Base.open(working_dir, options)
end

# initialize a new git repository, defaults to the current working directory
#
# options
# :repository => '/path/to/alt_git_dir'
# :index => '/path/to/alt_index_file'
def self.init(working_dir = '.', options = {})
Base.init(working_dir, options)
end

# clones a remote repository
#
# options
Expand All @@ -96,7 +87,7 @@ def self.init(working_dir = '.', options = {})
def self.clone(repository, name, options = {})
Base.clone(repository, name, options)
end

# Export the current HEAD (or a branch, if <tt>options[:branch]</tt>
# is specified) into the +name+ directory, then remove all traces of git from the
# directory.
Expand All @@ -110,25 +101,7 @@ def self.export(repository, name, options = {})
repo.checkout("origin/#{options[:branch]}") if options[:branch]
Dir.chdir(repo.dir.to_s) { FileUtils.rm_r '.git' }
end

#g.config('user.name', 'Scott Chacon') # sets value
#g.config('user.email', 'email@email.com') # sets value
#g.config('user.name') # returns 'Scott Chacon'
#g.config # returns whole config hash
def config(name = nil, value = nil)
lib = Git::Lib.new
if(name && value)
# set value
lib.config_set(name, value)
elsif (name)
# return value
lib.config_get(name)
else
# return hash
lib.config_list
end
end


# Same as g.config, but forces it to be at the global level
#
#g.config('user.name', 'Scott Chacon') # sets value
Expand All @@ -149,8 +122,27 @@ def self.global_config(name = nil, value = nil)
end
end

def global_config(name = nil, value = nil)
self.class.global_config(name, value)
# initialize a new git repository, defaults to the current working directory
#
# options
# :repository => '/path/to/alt_git_dir'
# :index => '/path/to/alt_index_file'
def self.init(working_dir = '.', options = {})
Base.init(working_dir, options)
end

# open an existing git working directory
#
# this will most likely be the most common way to create
# a git reference, referring to a working directory.
# if not provided in the options, the library will assume
# your git_dir and index are in the default place (.git/, .git/index)
#
# options
# :repository => '/path/to/alt_git_dir'
# :index => '/path/to/alt_index_file'
def self.open(working_dir, options = {})
Base.open(working_dir, options)
end

end
7 changes: 7 additions & 0 deletions lib/git/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Git

# The current gem version
# @return [String] the current gem version.
VERSION='1.2.6'

end
15 changes: 0 additions & 15 deletions ruby-git.gemspec

This file was deleted.

6 changes: 3 additions & 3 deletions tests/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require 'test/unit'
require 'fileutils'
require 'logger'
require File.dirname(__FILE__) + '/../lib/git'

require "#{File.expand_path(File.dirname(__FILE__))}/../lib/git"

class Test::Unit::TestCase

Expand All @@ -24,7 +25,6 @@ def set_file_paths

def teardown
if @tmp_path
#puts "teardown #{@tmp_path}"
FileUtils.rm_r(@tmp_path)
end
end
Expand Down Expand Up @@ -64,4 +64,4 @@ def append_file(name, contents)
end
end

end
end

0 comments on commit a308cc9

Please sign in to comment.