gisha 0.0.4 → 0.0.5
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/gisha.gemspec +1 -0
- data/hooks/update +3 -3
- data/lib/gisha/cli.rb +4 -3
- data/lib/gisha/commands/deploy.rb +48 -0
- data/lib/gisha/commands/receive.rb +7 -1
- data/lib/gisha/version.rb +1 -1
- data/lib/gisha.rb +1 -1
- metadata +16 -2
- data/lib/gisha/commands/update.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71693b315b8357c394cd38e1a410a32e93674cd6
|
4
|
+
data.tar.gz: 0e73a174ac2d38b91f266eb43d02614d327f1338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fadfaea2b82219bd2bcd6ddb8b157fc1a50b5ea256e1ac38724c7494f9d89f44ace13d46e79a039d269461cd720216cab1ac33c0ae65cb499a44c02dee349932
|
7
|
+
data.tar.gz: ed32ba0410387ec244dd6dc08547c3287c7d993aa5ff6459b45ea2e816fb0eb6c26c497a9639acad859c61905d01f7814680ab2f0074643bf82c70b83a661eb0
|
data/gisha.gemspec
CHANGED
data/hooks/update
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
ref_name = ARGV[0]
|
4
4
|
old_revision = ARGV[1]
|
5
5
|
new_revision = ARGV[2]
|
6
|
-
key_id = ENV['KEY_ID']
|
7
6
|
repository_path = Dir.pwd
|
8
|
-
|
7
|
+
key_id = ENV['KEY_ID']
|
8
|
+
deploy_url = "#{ENV['SPASS_CONTROLLER_URL']}/api/deploy/start"
|
9
9
|
|
10
10
|
require 'gisha'
|
11
11
|
|
12
12
|
begin
|
13
|
-
Gisha::CLI.run 'gisha', ['update', key_id, repository_path, new_revision]
|
13
|
+
Gisha::CLI.run 'gisha', ['update', deploy_url, key_id, repository_path, new_revision]
|
14
14
|
rescue
|
15
15
|
exit 1
|
16
16
|
end
|
data/lib/gisha/cli.rb
CHANGED
@@ -55,13 +55,14 @@ module Gisha
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
class
|
58
|
+
class DeployCommand < Clamp::Command
|
59
|
+
parameter 'URL', 'url to deploy'
|
59
60
|
parameter 'KEY_ID', 'id to identify the key'
|
60
61
|
parameter 'PATH', 'repository path'
|
61
62
|
parameter 'REVISION', 'repository path'
|
62
63
|
|
63
64
|
def execute
|
64
|
-
Commands::
|
65
|
+
Commands::Deploy.new(url, key_id, path, revision).exec
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
@@ -73,7 +74,7 @@ module Gisha
|
|
73
74
|
subcommand 'repositories:delete', 'delete repository', DeleteRepositoryCommand
|
74
75
|
|
75
76
|
subcommand 'receive', 'receive what is pushed into the repository', ReceiveCommand
|
76
|
-
subcommand '
|
77
|
+
subcommand 'deploy', 'deploy to spass', DeployCommand
|
77
78
|
end
|
78
79
|
|
79
80
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'em-eventsource'
|
2
|
+
|
3
|
+
module Gisha
|
4
|
+
class Commands::Deploy
|
5
|
+
attr_accessor :url, :key_id, :repo_path, :revision
|
6
|
+
|
7
|
+
def initialize(url, key_id, repo_path, revision)
|
8
|
+
@url = url
|
9
|
+
@key_id = key_id
|
10
|
+
@repo_path = repo_path
|
11
|
+
@revision = revision
|
12
|
+
end
|
13
|
+
|
14
|
+
def exec
|
15
|
+
EM.run do
|
16
|
+
source = EventMachine::EventSource.new(url)
|
17
|
+
|
18
|
+
source.on('progress') do |message|
|
19
|
+
write(message)
|
20
|
+
end
|
21
|
+
|
22
|
+
source.on('completed') do |message|
|
23
|
+
source.close
|
24
|
+
EM.stop
|
25
|
+
end
|
26
|
+
|
27
|
+
source.error do |error|
|
28
|
+
write(error)
|
29
|
+
source.close
|
30
|
+
EM.stop
|
31
|
+
end
|
32
|
+
source.start
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def repo_name
|
40
|
+
repo_path.split('/').last
|
41
|
+
end
|
42
|
+
|
43
|
+
def write(msg)
|
44
|
+
puts "\e[1G-----> #{msg}\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -31,7 +31,13 @@ module Gisha
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def exec_cmd(*args)
|
34
|
-
Kernel::exec(
|
34
|
+
Kernel::exec(
|
35
|
+
{
|
36
|
+
'PATH' => ENV['PATH'],
|
37
|
+
'LD_LIBRARY_PATH' => ENV['LD_LIBRARY_PATH'],
|
38
|
+
'SPASS_CONTROLLER_URL' => ENV['SPASS_CONTROLLER_URL'],
|
39
|
+
'KEY_ID' => key_id
|
40
|
+
}, *args, unsetenv_others: true)
|
35
41
|
end
|
36
42
|
|
37
43
|
def parse_cmd
|
data/lib/gisha/version.rb
CHANGED
data/lib/gisha.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salvatore Ferrucci
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: em-eventsource
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,9 +98,9 @@ files:
|
|
84
98
|
- hooks/update
|
85
99
|
- lib/gisha.rb
|
86
100
|
- lib/gisha/cli.rb
|
101
|
+
- lib/gisha/commands/deploy.rb
|
87
102
|
- lib/gisha/commands/key.rb
|
88
103
|
- lib/gisha/commands/receive.rb
|
89
|
-
- lib/gisha/commands/update.rb
|
90
104
|
- lib/gisha/version.rb
|
91
105
|
- spec/lib/gisha/commands/receive_spec.rb
|
92
106
|
- spec/spec_helper.rb
|
@@ -1,22 +0,0 @@
|
|
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
|