deployments 0.0.1
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/.gitignore +17 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +19 -0
- data/Guardfile +7 -0
- data/LICENSE +22 -0
- data/README.md +28 -0
- data/Rakefile +2 -0
- data/config/deployments.yml +2 -0
- data/deployments.gemspec +21 -0
- data/lib/deployments/build.rb +36 -0
- data/lib/deployments/dispatcher.rb +26 -0
- data/lib/deployments/project.rb +41 -0
- data/lib/deployments/railtie.rb +13 -0
- data/lib/deployments/version.rb +3 -0
- data/lib/deployments.rb +13 -0
- data/lib/tasks/deployments.rake +15 -0
- data/spec/build_spec.rb +43 -0
- data/spec/deployments_spec.rb +10 -0
- data/spec/dispatcher_spec.rb +51 -0
- data/spec/fixtures/repositories/commits/README +2 -0
- data/spec/fixtures/repositories/commits/dot_git/COMMIT_EDITMSG +1 -0
- data/spec/fixtures/repositories/commits/dot_git/HEAD +1 -0
- data/spec/fixtures/repositories/commits/dot_git/config +6 -0
- data/spec/fixtures/repositories/commits/dot_git/description +1 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/applypatch-msg.sample +15 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/commit-msg.sample +24 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/post-commit.sample +8 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/post-receive.sample +15 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/post-update.sample +8 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/pre-applypatch.sample +14 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/pre-commit.sample +46 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/pre-rebase.sample +169 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/fixtures/repositories/commits/dot_git/hooks/update.sample +128 -0
- data/spec/fixtures/repositories/commits/dot_git/index +0 -0
- data/spec/fixtures/repositories/commits/dot_git/info/exclude +6 -0
- data/spec/fixtures/repositories/commits/dot_git/logs/HEAD +2 -0
- data/spec/fixtures/repositories/commits/dot_git/logs/refs/heads/master +2 -0
- data/spec/fixtures/repositories/commits/dot_git/objects/0e/f7d9a5b81e3944a1aff4dff604cd8ec51b643e +1 -0
- data/spec/fixtures/repositories/commits/dot_git/objects/54/3b9bebdc6bd5c4b22136034a95dd097a57d3dd +0 -0
- data/spec/fixtures/repositories/commits/dot_git/objects/56/4afd6047dd8e9ffaba37b37db3563f2a305990 +0 -0
- data/spec/fixtures/repositories/commits/dot_git/objects/89/21daeccfb9870c0d79efbedc6c5977a8e459d0 +0 -0
- data/spec/fixtures/repositories/commits/dot_git/objects/cb/57bbb4eefe68fec78490d18e78f79cbbdf5b03 +0 -0
- data/spec/fixtures/repositories/commits/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/spec/fixtures/repositories/commits/dot_git/refs/heads/master +1 -0
- data/spec/fixtures/repositories/commits_tag/README +2 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/COMMIT_EDITMSG +1 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/HEAD +1 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/config +6 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/description +1 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/applypatch-msg.sample +15 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/commit-msg.sample +24 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/post-commit.sample +8 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/post-receive.sample +15 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/post-update.sample +8 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/pre-applypatch.sample +14 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/pre-commit.sample +46 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/pre-rebase.sample +169 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/hooks/update.sample +128 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/index +0 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/info/exclude +6 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/logs/HEAD +2 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/logs/refs/heads/master +2 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/objects/45/bedbc8cbb57792e00ad8dd9c9e7740ff3c2da5 +0 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/objects/54/3b9bebdc6bd5c4b22136034a95dd097a57d3dd +0 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/objects/56/4afd6047dd8e9ffaba37b37db3563f2a305990 +0 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/objects/89/21daeccfb9870c0d79efbedc6c5977a8e459d0 +0 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/objects/dc/7671f8a112706b6ee2404bae958fb8079dbda0 +5 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/refs/heads/master +1 -0
- data/spec/fixtures/repositories/commits_tag/dot_git/refs/tags/0.0.1 +1 -0
- data/spec/fixtures/repositories/commits_tags/README +3 -0
- data/spec/fixtures/repositories/commits_tags/config.rb +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/COMMIT_EDITMSG +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/HEAD +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/config +6 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/description +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/applypatch-msg.sample +15 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/commit-msg.sample +24 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/post-commit.sample +8 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/post-receive.sample +15 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/post-update.sample +8 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/pre-applypatch.sample +14 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/pre-commit.sample +46 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/pre-rebase.sample +169 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/hooks/update.sample +128 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/index +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/info/exclude +6 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/logs/HEAD +4 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/logs/refs/heads/master +4 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/14/e1208852a51b6b9b504d8f341c297e17a9cc34 +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/36/a6db1da19073578865cf0abf3ee36d0e46bbce +3 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/43/492464a9a16b233f5e7fb091e80321ada87687 +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/54/3b9bebdc6bd5c4b22136034a95dd097a57d3dd +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/63/18a50043e3f5a213cd0d37e5b6a53b1fe61e19 +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/71/dcbac57898e7ec88ab676d10ae416bf0ea6024 +2 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/93/3a3e1c3f7e4860f2f47d947650596283698320 +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/b4/b1532fabadea3358eff3765c5dba8c86d6b8e1 +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/bc/02f5403a84f9fc08c16c91e4f6f3729ea67974 +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/c7/80ec8329c9b5b944d737dc94f7f5babdeb3745 +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/refs/heads/master +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/refs/tags/0.0.1 +1 -0
- data/spec/fixtures/repositories/commits_tags/dot_git/refs/tags/0.0.2 +1 -0
- data/spec/project_spec.rb +58 -0
- data/spec/spec_helper.rb +6 -0
- metadata +296 -0
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--colour
|
data/.rvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rvm use --create 1.9.3@deployments
|
data/Gemfile
ADDED
data/Guardfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
guard 'rspec', :cli => '--format documentation', :version => 2, :all_after_pass => false, :all_on_start => false, :keep_failed => false do
|
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
3
|
+
watch(%r{^spec/.+\.rb$})
|
|
4
|
+
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
|
5
|
+
watch(%r{^lib/messaging_app/(.+)\.rb$}) { "spec" }
|
|
6
|
+
watch('spec/spec_helper.rb') { "spec" }
|
|
7
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 Alexander Korsak
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Deployments
|
|
2
|
+
|
|
3
|
+
Library for pushing details(commits, tag, username, env) about the current app
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'deployments'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install deployments
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Contributing
|
|
23
|
+
|
|
24
|
+
1. Fork it
|
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
26
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
28
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/deployments.gemspec
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path('../lib/deployments/version', __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |gem|
|
|
5
|
+
gem.authors = ["Alexander Korsak"]
|
|
6
|
+
gem.email = ["alex.korsak@gmail.com"]
|
|
7
|
+
gem.description = %q{Library for pushing details(commits, tag, username, env) about the current app}
|
|
8
|
+
gem.summary = %q{Library for pushing details(commits, tag, username, env) about the current app}
|
|
9
|
+
gem.homepage = ""
|
|
10
|
+
|
|
11
|
+
gem.files = `git ls-files`.split($\)
|
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
14
|
+
gem.name = "deployments"
|
|
15
|
+
gem.require_paths = ["lib"]
|
|
16
|
+
gem.version = Deployments::VERSION
|
|
17
|
+
|
|
18
|
+
gem.add_dependency('curb')
|
|
19
|
+
gem.add_dependency('grit')
|
|
20
|
+
gem.add_dependency('simple-conf')
|
|
21
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'etc'
|
|
2
|
+
|
|
3
|
+
module Deployments
|
|
4
|
+
class Build
|
|
5
|
+
attr_reader :env, :project
|
|
6
|
+
|
|
7
|
+
def initialize(env)
|
|
8
|
+
@env = env
|
|
9
|
+
@project = Project.new('./')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_params
|
|
13
|
+
{
|
|
14
|
+
:username => username,
|
|
15
|
+
:env => env,
|
|
16
|
+
:tag => tag,
|
|
17
|
+
:commits => commits
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def username
|
|
24
|
+
Etc.getlogin
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def commits
|
|
28
|
+
project.commits
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def tag
|
|
32
|
+
project.tag
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'curb'
|
|
2
|
+
|
|
3
|
+
module Deployments
|
|
4
|
+
class Dispatcher
|
|
5
|
+
attr_reader :build
|
|
6
|
+
|
|
7
|
+
def initialize(build)
|
|
8
|
+
@build = build
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
c = Curl::Easy.http_post(Deployments.server, fields)
|
|
13
|
+
|
|
14
|
+
c.response_code.to_i == 200
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def fields
|
|
20
|
+
build.to_params.map do |key, value|
|
|
21
|
+
Curl::PostField.content(key, value)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'grit'
|
|
2
|
+
|
|
3
|
+
module Deployments
|
|
4
|
+
class Project
|
|
5
|
+
attr_reader :path, :repo
|
|
6
|
+
|
|
7
|
+
def initialize(path)
|
|
8
|
+
@path = path
|
|
9
|
+
@repo = Grit::Repo.new(path)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def commits
|
|
13
|
+
commits = between_tags(repo) if has_commits_between_tags?
|
|
14
|
+
|
|
15
|
+
(commits || repo.commits).map do |commit|
|
|
16
|
+
commit.message
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def tag
|
|
21
|
+
repo.tags.last.name if has_tags?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def between_tags(repo)
|
|
27
|
+
last = repo.tags.last
|
|
28
|
+
previous = repo.tags[repo.tags.size - 2]
|
|
29
|
+
repo.commits_between(previous.commit.id, last.commit.id)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def has_commits_between_tags?
|
|
33
|
+
repo.tags.size > 1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def has_tags?
|
|
37
|
+
not repo.tags.empty?
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
data/lib/deployments.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "deployments/version"
|
|
2
|
+
require "deployments/project"
|
|
3
|
+
require "deployments/build"
|
|
4
|
+
require "deployments/dispatcher"
|
|
5
|
+
|
|
6
|
+
require "deployments/railtie" if defined?(Rails) and Rails.version > "3.0.0"
|
|
7
|
+
|
|
8
|
+
require 'simple-conf'
|
|
9
|
+
|
|
10
|
+
module Deployments
|
|
11
|
+
include SimpleConf
|
|
12
|
+
end
|
|
13
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'deployments'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
include Rake::DSL if defined?(Rake::DSL)
|
|
5
|
+
|
|
6
|
+
namespace :deployments do
|
|
7
|
+
|
|
8
|
+
desc "Push deployments details to the server"
|
|
9
|
+
task :push do
|
|
10
|
+
build = Build.new(ENV['deployment_env'])
|
|
11
|
+
dispatcher = Deployments::Dispatcher.new(build)
|
|
12
|
+
dispatcher.run
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
data/spec/build_spec.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
include Deployments
|
|
4
|
+
|
|
5
|
+
describe Build do
|
|
6
|
+
let(:build) { Build.new("staging") }
|
|
7
|
+
|
|
8
|
+
describe "interface for getting build information as json params" do
|
|
9
|
+
it "should return deployer name information" do
|
|
10
|
+
Etc.should_receive(:getlogin).and_return("john.smith")
|
|
11
|
+
build.to_params[:username].should == "john.smith"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should return env" do
|
|
15
|
+
build.should_receive(:env).and_return("staging")
|
|
16
|
+
build.to_params[:env].should == "staging"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context "in the current git project" do
|
|
20
|
+
let(:project_path) { './spec/fixtures/repositories/commits_tag/dot_git' }
|
|
21
|
+
|
|
22
|
+
before do
|
|
23
|
+
@repo = Grit::Repo.new(project_path, :is_bare => true)
|
|
24
|
+
Grit::Repo.should_receive(:new).and_return(@repo)
|
|
25
|
+
|
|
26
|
+
@project = Project.new(project_path)
|
|
27
|
+
Project.should_receive(:new).and_return(@project)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should return current tag of the git project" do
|
|
31
|
+
build.to_params[:tag].should == "0.0.1"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should return commits of the git project between the latests tags" do
|
|
35
|
+
build.to_params[:commits].should == [
|
|
36
|
+
"Added deployments section to the README file",
|
|
37
|
+
"Added README file"
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
include Deployments
|
|
4
|
+
|
|
5
|
+
describe Dispatcher do
|
|
6
|
+
let(:build) { Build.new("staging") }
|
|
7
|
+
let(:dispatcher) { Dispatcher.new(build) }
|
|
8
|
+
|
|
9
|
+
context "post deployment data" do
|
|
10
|
+
before do
|
|
11
|
+
Curl::Easy.should_receive(:http_post).and_return(response)
|
|
12
|
+
|
|
13
|
+
build.should_receive(:to_params).and_return(fields)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "with valid data" do
|
|
17
|
+
let(:response) { double('response', :response_code => 200) }
|
|
18
|
+
let(:fields) do
|
|
19
|
+
{
|
|
20
|
+
:username => "john.smith",
|
|
21
|
+
:env => "staging",
|
|
22
|
+
:tag => "0.0.1",
|
|
23
|
+
:commits => [
|
|
24
|
+
"Added deployments section to the README file",
|
|
25
|
+
"Added README file"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should successfully send" do
|
|
31
|
+
dispatcher.run.should be_true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "with invalid data" do
|
|
36
|
+
let(:fields) { { :key => "invalid value" } }
|
|
37
|
+
let(:response) { double('response', :response_code => 500) }
|
|
38
|
+
|
|
39
|
+
it "should unlucky send" do
|
|
40
|
+
dispatcher.run.should be_false
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def curl_fields
|
|
46
|
+
fields.map do |key, value|
|
|
47
|
+
Curl::PostField.content(key, value)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Added deployments section to the README file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ref: refs/heads/master
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Unnamed repository; edit this file 'description' to name the repository.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to check the commit log message taken by
|
|
4
|
+
# applypatch from an e-mail message.
|
|
5
|
+
#
|
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
|
7
|
+
# appropriate message if it wants to stop the commit. The hook is
|
|
8
|
+
# allowed to edit the commit message file.
|
|
9
|
+
#
|
|
10
|
+
# To enable this hook, rename this file to "applypatch-msg".
|
|
11
|
+
|
|
12
|
+
. git-sh-setup
|
|
13
|
+
test -x "$GIT_DIR/hooks/commit-msg" &&
|
|
14
|
+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
|
15
|
+
:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to check the commit log message.
|
|
4
|
+
# Called by "git commit" with one argument, the name of the file
|
|
5
|
+
# that has the commit message. The hook should exit with non-zero
|
|
6
|
+
# status after issuing an appropriate message if it wants to stop the
|
|
7
|
+
# commit. The hook is allowed to edit the commit message file.
|
|
8
|
+
#
|
|
9
|
+
# To enable this hook, rename this file to "commit-msg".
|
|
10
|
+
|
|
11
|
+
# Uncomment the below to add a Signed-off-by line to the message.
|
|
12
|
+
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
|
13
|
+
# hook is more suited to it.
|
|
14
|
+
#
|
|
15
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
16
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
|
17
|
+
|
|
18
|
+
# This example catches duplicate Signed-off-by lines.
|
|
19
|
+
|
|
20
|
+
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
|
21
|
+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
|
22
|
+
echo >&2 Duplicate Signed-off-by lines.
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script for the "post-receive" event.
|
|
4
|
+
#
|
|
5
|
+
# The "post-receive" script is run after receive-pack has accepted a pack
|
|
6
|
+
# and the repository has been updated. It is passed arguments in through
|
|
7
|
+
# stdin in the form
|
|
8
|
+
# <oldrev> <newrev> <refname>
|
|
9
|
+
# For example:
|
|
10
|
+
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
|
|
11
|
+
#
|
|
12
|
+
# see contrib/hooks/ for a sample, or uncomment the next line and
|
|
13
|
+
# rename the file to "post-receive".
|
|
14
|
+
|
|
15
|
+
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to verify what is about to be committed
|
|
4
|
+
# by applypatch from an e-mail message.
|
|
5
|
+
#
|
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
|
7
|
+
# appropriate message if it wants to stop the commit.
|
|
8
|
+
#
|
|
9
|
+
# To enable this hook, rename this file to "pre-applypatch".
|
|
10
|
+
|
|
11
|
+
. git-sh-setup
|
|
12
|
+
test -x "$GIT_DIR/hooks/pre-commit" &&
|
|
13
|
+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
|
|
14
|
+
:
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to verify what is about to be committed.
|
|
4
|
+
# Called by "git commit" with no arguments. The hook should
|
|
5
|
+
# exit with non-zero status after issuing an appropriate message if
|
|
6
|
+
# it wants to stop the commit.
|
|
7
|
+
#
|
|
8
|
+
# To enable this hook, rename this file to "pre-commit".
|
|
9
|
+
|
|
10
|
+
if git rev-parse --verify HEAD >/dev/null 2>&1
|
|
11
|
+
then
|
|
12
|
+
against=HEAD
|
|
13
|
+
else
|
|
14
|
+
# Initial commit: diff against an empty tree object
|
|
15
|
+
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# If you want to allow non-ascii filenames set this variable to true.
|
|
19
|
+
allownonascii=$(git config hooks.allownonascii)
|
|
20
|
+
|
|
21
|
+
# Cross platform projects tend to avoid non-ascii filenames; prevent
|
|
22
|
+
# them from being added to the repository. We exploit the fact that the
|
|
23
|
+
# printable range starts at the space character and ends with tilde.
|
|
24
|
+
if [ "$allownonascii" != "true" ] &&
|
|
25
|
+
# Note that the use of brackets around a tr range is ok here, (it's
|
|
26
|
+
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
|
27
|
+
# the square bracket bytes happen to fall in the designated range.
|
|
28
|
+
test "$(git diff --cached --name-only --diff-filter=A -z $against |
|
|
29
|
+
LC_ALL=C tr -d '[ -~]\0')"
|
|
30
|
+
then
|
|
31
|
+
echo "Error: Attempt to add a non-ascii file name."
|
|
32
|
+
echo
|
|
33
|
+
echo "This can cause problems if you want to work"
|
|
34
|
+
echo "with people on other platforms."
|
|
35
|
+
echo
|
|
36
|
+
echo "To be portable it is advisable to rename the file ..."
|
|
37
|
+
echo
|
|
38
|
+
echo "If you know what you are doing you can disable this"
|
|
39
|
+
echo "check using:"
|
|
40
|
+
echo
|
|
41
|
+
echo " git config hooks.allownonascii true"
|
|
42
|
+
echo
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
exec git diff-index --check --cached $against --
|