gitti 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 47d89819b39043972c9b7eb001c6295640482f6f
4
+ data.tar.gz: 9ab6759b243dd50d6bf6cc84f598f013a896e838
5
+ SHA512:
6
+ metadata.gz: 6f345ee2b66cd374cd1e7969235ed65324a1c34e814f40126e7f8be9ff7eab29dc3c484fc5eb95cc4aaf88ab4989b48f4cee8f68f28fb623ff1de9a5f5660d7e
7
+ data.tar.gz: c8657d76b2919817ce5f90fa34b31d4a595ee8ac3db39d6398ee5c4d700e6ef993a7adc33001f489267da781446e7c62824e0f946977ce041ffb5126377ed507
data/HISTORY.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.0.1 / 2015-11-16
2
+
3
+ * Everything is new. First release.
4
+
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ HISTORY.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ lib/gitti.rb
6
+ lib/gitti/lib.rb
7
+ lib/gitti/version.rb
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # gitti
2
+
3
+ gitti gem - (yet) another (lite) git command line wrapper / library
4
+
5
+ * home :: [github.com/rubylibs/gitti](https://github.com/rubylibs/gitti)
6
+ * bugs :: [github.com/rubylibs/gitti/issues](https://github.com/rubylibs/gitti/issues)
7
+ * gem :: [rubygems.org/gems/gitti](https://rubygems.org/gems/gitti)
8
+ * rdoc :: [rubydoc.info/gems/gitti](http://rubydoc.info/gems/gitti)
9
+
10
+
11
+ ## Usage
12
+
13
+ TBD
14
+
15
+
16
+ ## License
17
+
18
+ The `gitti` scripts are dedicated to the public domain.
19
+ Use it as you please with no restrictions whatsoever.
20
+
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'hoe'
2
+ require './lib/gitti/version.rb'
3
+
4
+ Hoe.spec 'gitti' do
5
+
6
+ self.version = Gitti::VERSION
7
+
8
+ self.summary = 'gitti - (yet) another (lite) git command line wrapper / library'
9
+ self.description = summary
10
+
11
+ self.urls = ['https://github.com/rubylibs/gitti']
12
+
13
+ self.author = 'Gerald Bauer'
14
+ self.email = 'ruby-talk@ruby-lang.org'
15
+
16
+ # switch extension to .markdown for gihub formatting
17
+ self.readme_file = 'README.md'
18
+ self.history_file = 'HISTORY.md'
19
+
20
+ self.extra_deps = [
21
+ ['logutils' ],
22
+ ]
23
+
24
+ self.licenses = ['Public Domain']
25
+
26
+ self.spec_extras = {
27
+ required_ruby_version: '>= 1.9.2'
28
+ }
29
+
30
+ end
data/lib/gitti/lib.rb ADDED
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ module Gitti
5
+
6
+ class GitError < StandardError
7
+ end
8
+
9
+ class GitLib
10
+
11
+ def clone( repo, opts={} )
12
+ command( "clone #{repo}" )
13
+ end
14
+
15
+ def mirror( repo, opts={} )
16
+ command( "clone --mirror #{repo}" )
17
+ end
18
+
19
+ def pull( opts={} )
20
+ command( "pull" )
21
+ end
22
+
23
+ def remote_update( opts={} )
24
+ command( "remote update" )
25
+ end
26
+
27
+
28
+ ## todo/fix:
29
+ ## add last_exit or something ?? why? why not??
30
+
31
+ def command( cmd )
32
+ ## note: for now use Kernel#system for calling external git command
33
+ ##
34
+
35
+ cmdline = "git #{cmd}"
36
+ puts " trying >#{cmdline}< in (#{Dir.pwd})..."
37
+
38
+ result = nil
39
+ result = system( cmdline )
40
+
41
+ pp result
42
+
43
+ # note: Kernel#system returns
44
+ # - true if the command gives zero exit status
45
+ # - false for non zero exit status
46
+ # - nil if command execution fails
47
+ # An error status is available in $?.
48
+
49
+ if result.nil?
50
+ puts "*** error was #{$?}"
51
+ fail "[Kernel.system] command execution failed >#{cmdline}< - #{$?}"
52
+ elsif result ## true => zero exit code (OK)
53
+ puts 'OK' ## zero exit; assume OK
54
+ true ## assume ok
55
+ else ## false => non-zero exit code (ERR/NOK)
56
+ puts "*** error: non-zero exit - #{$?} !!" ## non-zero exit (e.g. 1,2,3,etc.); assume error
57
+
58
+ ## log error for now ???
59
+ # File.open( './errors.log', 'a' ) do |f|
60
+ # f.write "#{Time.now} -- repo #{@owner}/#{@name} - command execution failed - non-zero exit\n"
61
+ # end
62
+ raise GitError.new( "command execution failed >#{cmdline}< - non-zero exit (#{$?})" )
63
+ end
64
+ end # method command
65
+ end # class Lib
66
+
67
+
68
+ module Git
69
+ ## todo/fix: use "shared" singelton lib - why? why not??
70
+ def self.clone( repo, opts={} ) GitLib.new.clone( repo, opts ); end
71
+ def self.mirror( repo, opts={} ) GitLib.new.mirror( repo, opts ); end
72
+
73
+ def self.pull( opts={} ) GitLib.new.pull( opts ); end
74
+ def self.remote_update( opts={} ) GitLib.new.remote_update( opts ); end
75
+ end # module Git
76
+
77
+ end # module Gitti
78
+
79
+
80
+ ### convenience top level Git module - check if defined? make optional? why? why not??
81
+ ## Git = Gitti::Git
82
+
83
+ # for now use include Gitti - why? why not??
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ module Gitti
4
+ MAJOR = 0 ## todo: namespace inside version or something - why? why not??
5
+ MINOR = 1
6
+ PATCH = 0
7
+ VERSION = [MAJOR,MINOR,PATCH].join('.')
8
+
9
+ def self.version
10
+ VERSION
11
+ end
12
+
13
+ def self.banner
14
+ "gitti/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
15
+ end
16
+
17
+ def self.root
18
+ "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
19
+ end
20
+ end # module Gitti
21
+
data/lib/gitti.rb ADDED
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ require 'net/http'
4
+ require "net/https"
5
+ require 'uri'
6
+
7
+ require 'pp'
8
+ require 'json'
9
+ require 'yaml'
10
+
11
+
12
+ # 3rd party gems/libs
13
+ require 'logutils'
14
+
15
+ # our own code
16
+ require 'gitti/version' # note: let version always go first
17
+ require 'gitti/lib'
18
+
19
+
20
+ # say hello
21
+ puts Gitti.banner if defined?($RUBYLIBS_DEBUG)
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitti
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gerald Bauer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logutils
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hoe
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.14'
55
+ description: gitti - (yet) another (lite) git command line wrapper / library
56
+ email: ruby-talk@ruby-lang.org
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files:
60
+ - HISTORY.md
61
+ - Manifest.txt
62
+ - README.md
63
+ files:
64
+ - HISTORY.md
65
+ - Manifest.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/gitti.rb
69
+ - lib/gitti/lib.rb
70
+ - lib/gitti/version.rb
71
+ homepage: https://github.com/rubylibs/gitti
72
+ licenses:
73
+ - Public Domain
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options:
77
+ - "--main"
78
+ - README.md
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.9.2
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.3
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: gitti - (yet) another (lite) git command line wrapper / library
97
+ test_files: []