gisha 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/hooks/update +16 -0
- data/lib/gisha.rb +1 -0
- data/lib/gisha/cli.rb +17 -1
- data/lib/gisha/commands/receive.rb +1 -1
- data/lib/gisha/commands/update.rb +22 -0
- data/lib/gisha/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 189959371d8b60434210b71ff7fd29e4c5e63695
|
4
|
+
data.tar.gz: c2ec3d8a0919b1d267b5aa36955f08e59573f1e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53ea7ca34065bfa949d045b8dafb243ba62822317d4a7fa775982aa193156e01c6e145e88e26b40e3f564ed7d4606babade41e74e0f23cc23fe3ef296d767fe2
|
7
|
+
data.tar.gz: f5ec5a373cfd5d3b16770eedcfb1d25a1cea0140e8dd69d8bd234fb9d8139b4eaf28a55cf4da575cd1627257570ec0fe8dba89fb7d2a5ed4f0dec6678ea2305d
|
data/hooks/update
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
ref_name = ARGV[0]
|
4
|
+
old_revision = ARGV[1]
|
5
|
+
new_revision = ARGV[2]
|
6
|
+
key_id = ENV['KEY_ID']
|
7
|
+
repository_path = Dir.pwd
|
8
|
+
|
9
|
+
|
10
|
+
require 'gisha'
|
11
|
+
|
12
|
+
begin
|
13
|
+
Gisha::CLI.run 'gisha', ['update', key_id, repository_path, new_revision]
|
14
|
+
rescue
|
15
|
+
exit 1
|
16
|
+
end
|
data/lib/gisha.rb
CHANGED
data/lib/gisha/cli.rb
CHANGED
@@ -39,6 +39,11 @@ module Gisha
|
|
39
39
|
|
40
40
|
def execute
|
41
41
|
Rugged::Repository.init_at(path, :bare)
|
42
|
+
FileUtils.cp("#{root_path}/hooks/update", "#{path}/hooks")
|
43
|
+
end
|
44
|
+
|
45
|
+
def root_path
|
46
|
+
@root_path ||= File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
42
47
|
end
|
43
48
|
end
|
44
49
|
|
@@ -46,7 +51,17 @@ module Gisha
|
|
46
51
|
parameter 'PATH', 'path to delete repository'
|
47
52
|
|
48
53
|
def execute
|
49
|
-
|
54
|
+
FileUtils.rm_rf(path)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class UpdateCommand < Clamp::Command
|
59
|
+
parameter 'KEY_ID', 'id to identify the key'
|
60
|
+
parameter 'PATH', 'repository path'
|
61
|
+
parameter 'REVISION', 'repository path'
|
62
|
+
|
63
|
+
def execute
|
64
|
+
Commands::Update.new(key_id, path, revision).exec
|
50
65
|
end
|
51
66
|
end
|
52
67
|
|
@@ -58,6 +73,7 @@ module Gisha
|
|
58
73
|
subcommand 'repositories:delete', 'delete repository', DeleteRepositoryCommand
|
59
74
|
|
60
75
|
subcommand 'receive', 'receive what is pushed into the repository', ReceiveCommand
|
76
|
+
subcommand 'update', 'update repository to last version', UpdateCommand
|
61
77
|
end
|
62
78
|
|
63
79
|
end
|
@@ -2,7 +2,7 @@ module Gisha
|
|
2
2
|
class Commands::Receive
|
3
3
|
class DisallowedCommandError < StandardError; end
|
4
4
|
|
5
|
-
attr_accessor :key_id, :
|
5
|
+
attr_accessor :key_id, :git_cmd, :repos_path, :repo_name
|
6
6
|
|
7
7
|
def initialize(key_id)
|
8
8
|
@key_id = key_id
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Gisha
|
2
|
+
class Commands::Update
|
3
|
+
attr_accessor :key_id, :repo_path, :revision
|
4
|
+
|
5
|
+
def initialize(key_id, repo_path, revision)
|
6
|
+
@key_id = key_id
|
7
|
+
@repo_path = repo_path
|
8
|
+
@revision = revision
|
9
|
+
end
|
10
|
+
|
11
|
+
def exec
|
12
|
+
puts "Update repo: #{repo_name} to revision: #{revision} by key: #{key_id}"
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def repo_name
|
18
|
+
repo_path.split('/').last
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/gisha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gisha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salvatore Ferrucci
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -81,10 +81,12 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- bin/gisha
|
83
83
|
- gisha.gemspec
|
84
|
+
- hooks/update
|
84
85
|
- lib/gisha.rb
|
85
86
|
- lib/gisha/cli.rb
|
86
87
|
- lib/gisha/commands/key.rb
|
87
88
|
- lib/gisha/commands/receive.rb
|
89
|
+
- lib/gisha/commands/update.rb
|
88
90
|
- lib/gisha/version.rb
|
89
91
|
- spec/lib/gisha/commands/receive_spec.rb
|
90
92
|
- spec/spec_helper.rb
|