scm 0.1.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,3 @@
1
+ -
2
+ ChangeLog.*
3
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ doc/
2
+ pkg/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title "SCM Documentation" --protected
data/ChangeLog.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.1.0 / 2011-06-16
2
+
3
+ * Initial release:
4
+
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Hal Brodigan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # SCM
2
+
3
+ * [Source](http://github.com/postmodern/scm)
4
+ * [Issues](http://github.com/postmodern/scm/issues)
5
+ * [Documentation](http://rubydoc.info/gems/scm/frames)
6
+ * [Email](mailto:postmodern.mod3 at gmail.com)
7
+
8
+ ## Description
9
+
10
+ {SCM} is a simple Ruby library for interacting with common SCMs,
11
+ such as Git, Mercurial (Hg) and SubVersion (SVN).
12
+
13
+ ## Features
14
+
15
+ * Supports:
16
+ * [Git](http://www.git-scm.org/)
17
+ * [Mercurial (Hg)](http://mercurial.selenic.com/)
18
+ * [SubVersion (SVN)](http://subversion.tigris.org/)
19
+ * Provides a basic {SCM::Repository API} for each SCM.
20
+
21
+ ## Examples
22
+
23
+ require 'scm'
24
+
25
+ repo = SCM::Git.new('path/to/repo')
26
+
27
+ repo.branches
28
+ # => [...]
29
+
30
+ repo.tags
31
+ # => [...]
32
+
33
+ repo.status
34
+ # => {...}
35
+
36
+ repo.log
37
+
38
+ ## Install
39
+
40
+ $ gem install scm
41
+
42
+ ## Copyright
43
+
44
+ Copyright (c) 2011 Hal Brodigan
45
+
46
+ See {file:LICENSE.txt} for details.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+
6
+ begin
7
+ gem 'ore-tasks', '~> 0.4'
8
+ require 'ore/tasks'
9
+
10
+ Ore::Tasks.new
11
+ rescue LoadError => e
12
+ STDERR.puts e.message
13
+ STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
14
+ end
15
+
16
+ begin
17
+ gem 'rspec', '~> 2.4'
18
+ require 'rspec/core/rake_task'
19
+
20
+ RSpec::Core::RakeTask.new
21
+ rescue LoadError => e
22
+ task :spec do
23
+ abort "Please run `gem install rspec` to install RSpec."
24
+ end
25
+ end
26
+
27
+ task :test => :spec
28
+ task :default => :spec
29
+
30
+ begin
31
+ gem 'yard', '~> 0.7.0'
32
+ require 'yard'
33
+
34
+ YARD::Rake::YardocTask.new
35
+ rescue LoadError => e
36
+ task :yard do
37
+ abort "Please run `gem install yard` to install YARD."
38
+ end
39
+ end
40
+ task :doc => :yard
data/gemspec.yml ADDED
@@ -0,0 +1,16 @@
1
+ name: scm
2
+ summary: Ruby interface to common SCMs
3
+ description:
4
+ SCM is a simple Ruby library for interacting with common SCMs,
5
+ such as Git, Mercurial (Hg) and SubVersion (SVN).
6
+
7
+ license: MIT
8
+ authors: Postmodern
9
+ email: postmodern.mod3@gmail.com
10
+ homepage: http://github.com/postmodern/scm
11
+ has_yard: true
12
+
13
+ development_dependencies:
14
+ ore-tasks: ~> 0.4
15
+ rspec: ~> 2.4
16
+ yard: ~> 0.7.0
@@ -0,0 +1,64 @@
1
+ module SCM
2
+ module Commits
3
+ #
4
+ # Base-class for other SCM Commit classes.
5
+ #
6
+ class Commit
7
+
8
+ # The commit hash or revision number
9
+ attr_reader :commit
10
+
11
+ # The date of the commit
12
+ attr_reader :date
13
+
14
+ # The author of the commit
15
+ attr_reader :author
16
+
17
+ # The summary of the commit
18
+ attr_reader :summary
19
+
20
+ #
21
+ # Creates a new commit object.
22
+ #
23
+ # @param [String, Integer] commit
24
+ # The commit hash or revision number.
25
+ #
26
+ # @param [Time] date
27
+ # The date of the commit.
28
+ #
29
+ # @param [String] author
30
+ # The author of the commit.
31
+ #
32
+ # @param [String] summary
33
+ # The summary of the commit.
34
+ #
35
+ def initialize(commit,date,author,summary)
36
+ @commit = commit
37
+ @date = date
38
+ @author = author
39
+ @summary = summary
40
+ end
41
+
42
+ #
43
+ # Converts the commit to a String.
44
+ #
45
+ # @return [String]
46
+ # The commit hash or revision.
47
+ #
48
+ def to_s
49
+ @commit.to_s
50
+ end
51
+
52
+ #
53
+ # Coerces the commit into an Array.
54
+ #
55
+ # @return [Array<commit, date, author, summary>]
56
+ # The commit components.
57
+ #
58
+ def to_ary
59
+ [@commit, @date, @author, @summary]
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,62 @@
1
+ require 'scm/commits/commit'
2
+
3
+ module SCM
4
+ module Commits
5
+ class Git < Commit
6
+
7
+ # The parent of the commit
8
+ attr_reader :parent
9
+
10
+ # The tree of the commit
11
+ attr_reader :tree
12
+
13
+ # The email of the author
14
+ attr_reader :email
15
+
16
+ #
17
+ # Creates a new Git commit.
18
+ #
19
+ # @param [String] commit
20
+ # The SHA1 hash of the commit.
21
+ #
22
+ # @param [String] parent
23
+ # The SHA1 hash of the parent commit.
24
+ #
25
+ # @param [String] tree
26
+ # The SHA1 hash of the tree.
27
+ #
28
+ # @param [Time] date
29
+ # The date the commit was made.
30
+ #
31
+ # @param [String] author
32
+ # The author of the commit.
33
+ #
34
+ # @param [String] email
35
+ # The email for the author.
36
+ #
37
+ # @param [String] summary
38
+ # The summary of the commit.
39
+ #
40
+ def initialize(commit,parent,tree,date,author,email,summary)
41
+ super(commit,date,author,summary)
42
+
43
+ @parent = parent
44
+ @tree = tree
45
+ @email = email
46
+ end
47
+
48
+ alias sha1 commit
49
+
50
+ #
51
+ # Coerces the Git commit into an Array.
52
+ #
53
+ # @return [Array<commit, parent, tree, date, author, email, summary>]
54
+ # The commit components.
55
+ #
56
+ def to_ary
57
+ [@commit, @parent, @tree, @date, @author, @email, @summary]
58
+ end
59
+
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,69 @@
1
+ require 'scm/commits/commit'
2
+
3
+ module SCM
4
+ module Commits
5
+ #
6
+ # Represents a commit in an {SCM::Hg Hg Repository}.
7
+ #
8
+ class Hg < Commit
9
+
10
+ # The Hash of the commit
11
+ attr_reader :hash
12
+
13
+ # The branch of the commit
14
+ attr_reader :branch
15
+
16
+ #
17
+ # Creates a new Hg commit.
18
+ #
19
+ # @param [String, Integer] revision
20
+ # The revision of the commit.
21
+ #
22
+ # @param [String] hash
23
+ # The hash of the commit.
24
+ #
25
+ # @param [String] branch
26
+ # The branch the commit belongs to.
27
+ #
28
+ # @param [String] user
29
+ # The Hg user that made the commit.
30
+ #
31
+ # @param [Time] date
32
+ # The date the commit was made on.
33
+ #
34
+ # @param [String] summary
35
+ # The summary of the commit.
36
+ #
37
+ def initialize(revision,hash,branch,user,date,summary)
38
+ super(revision,date,user,summary)
39
+
40
+ @hash = hash
41
+ @branch = branch
42
+ end
43
+
44
+ alias revision commit
45
+ alias user author
46
+
47
+ #
48
+ # Converts the commit to an Integer.
49
+ #
50
+ # @return [Integer]
51
+ # The commit revision.
52
+ #
53
+ def to_i
54
+ @commit.to_i
55
+ end
56
+
57
+ #
58
+ # Coerces the Hg commit into an Array.
59
+ #
60
+ # @return [Array<commit, hash, branch, date, author, summary>]
61
+ # The commit components.
62
+ #
63
+ def to_ary
64
+ [@commit, @hash, @branch, @date, @user, @summary]
65
+ end
66
+
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,12 @@
1
+ require 'scm/commits/commit'
2
+
3
+ module SCM
4
+ module Commits
5
+ class SVN < Commit
6
+
7
+ alias revision commit
8
+ alias user author
9
+
10
+ end
11
+ end
12
+ end