Browse files

Add creation date of commit to the api

  • Loading branch information...
1 parent 6f89ad7 commit 6464611bfdc1f709870443d22a18c406d10c1eb8 @oivoodoo committed Jun 25, 2012
Showing with 29 additions and 5 deletions.
  1. +8 −2 README.md
  2. +4 −1 lib/deployments/project.rb
  3. +8 −2 spec/build_spec.rb
  4. +9 −0 spec/project_spec.rb
View
10 README.md
@@ -57,8 +57,14 @@ Request params:
{
:author => "author",
:commit_attributes => {
- "commit id" => "Add readme file",
- "commit id" => "Change readme file"
+ "commit id" => {
+ "message" => "Add readme file",
+ "created_at" => "2012-05-23 10:38:46 +0300"
+ },
+ "commit id" => {
+ "message" => "Change readme file",
+ "created_at" => "2012-05-23 10:39:18 +0300"
+ }
},
:env => "staging",
:version => "1.0.1",
View
5 lib/deployments/project.rb
@@ -20,7 +20,10 @@ def commits
commits = between_tags(repo) if has_commits_between_tags?
(commits || repo.commits).inject({}) do |hash, commit|
- hash[commit.id] = commit.message
+ hash[commit.id] = {
+ :message => commit.message,
+ :created_at => commit.date.to_s
+ }
hash
end
end
View
10 spec/build_spec.rb
@@ -38,8 +38,14 @@
it "should return commits of the git project between the latests tags" do
hash = {}
- hash["dc7671f8a112706b6ee2404bae958fb8079dbda0"] = "Added deployments section to the README file"
- hash["45bedbc8cbb57792e00ad8dd9c9e7740ff3c2da5"] = "Added README file"
+ hash["dc7671f8a112706b6ee2404bae958fb8079dbda0"] = {
+ :message => "Added deployments section to the README file",
+ :created_at=> "2012-05-23 10:39:18 +0300"
+ }
+ hash["45bedbc8cbb57792e00ad8dd9c9e7740ff3c2da5"] = {
+ :message => "Added README file",
+ :created_at => "2012-05-23 10:38:46 +0300"
+ }
params[:commit_attributes].should == hash
end
View
9 spec/project_spec.rb
@@ -14,6 +14,10 @@
project.commits.to_s.should include("Added README file")
end
+ it "should be possible to get creation date of commit" do
+ project.commits.to_s.should include("2012-06-05 11:05:43 +0300")
+ end
+
it "should retrieve empty tag" do
project.tag.should be_nil
end
@@ -27,6 +31,11 @@
project.commits.to_s.should include("Added README file")
end
+ it "should be possible to get creation dates of commits" do
+ project.commits.to_s.should include("2012-05-21 17:33:22 +0300")
+ project.commits.to_s.should include("2012-05-21 17:32:57 +0300")
+ end
+
it "should retrieve empty tag" do
project.tag.should be_nil
end

0 comments on commit 6464611

Please sign in to comment.