gurney_client 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/gurney/cli.rb +7 -4
- data/lib/gurney/cli/option_parser.rb +6 -1
- data/lib/gurney/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb46098ee5a2a49bdccf9bb4d5db373b2ce5847ae1398f30fe2a676a9d732b07
|
4
|
+
data.tar.gz: 78b5b151888f590897f8869ae6d30788b4d4398ff122ef63525fd4048cb1bbd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1bf0ed5a79b112999cd347f383de248a2fbb5ff0c85a0ef1250e19bafde7b089f6e94b04b19d1c39f17791b6db0cf452bceb03b2d43e2d60beb4cc940305ec
|
7
|
+
data.tar.gz: c007024b0dc4197d983c66ba8182f7847fb04b4af8650cc6597f30f5fee5f89f7cd3e0bf16d92bfa47af276edb0dfcf2545752d61370498887b63cfa66c917f0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -17,6 +17,8 @@ Usage: gurney [options]
|
|
17
17
|
Token to be send to the api in the X-AuthToken header
|
18
18
|
-c, --config [CONFIG FILE] Config file to use
|
19
19
|
-h, --hook Run as a git post-receive hook
|
20
|
+
--client-hook
|
21
|
+
Run as a git pre-push hook
|
20
22
|
-p, --project-id [PROJECT ID] Specify project id for api
|
21
23
|
--help
|
22
24
|
Prints this help
|
data/lib/gurney/cli.rb
CHANGED
@@ -9,6 +9,7 @@ module Gurney
|
|
9
9
|
class CLI
|
10
10
|
|
11
11
|
HOOK_STDIN_REGEX = /(?<old>[0-9a-f]{40}) (?<new>[0-9a-f]{40}) refs\/heads\/(?<ref>\w+)/m
|
12
|
+
CLIENT_HOOK_STDIN_REGEX = /refs\/heads\/(?<ref>\w+) (?<new>[0-9a-f]{40}) refs\/heads\/(?<remote_ref>\w+) (?<remote_sha>[0-9a-f]{40})/m
|
12
13
|
|
13
14
|
def self.run(cmd_parameter=[])
|
14
15
|
options = Gurney::CLI::OptionParser.parse(cmd_parameter)
|
@@ -30,6 +31,7 @@ module Gurney
|
|
30
31
|
config_file ||= '---'
|
31
32
|
config = Gurney::Config.from_yaml(config_file)
|
32
33
|
|
34
|
+
options.branches ||= config&.branches
|
33
35
|
options.branches ||= config&.branches
|
34
36
|
options.api_token ||= config&.api_token
|
35
37
|
options.api_url ||= config&.api_url
|
@@ -40,10 +42,11 @@ module Gurney
|
|
40
42
|
end
|
41
43
|
|
42
44
|
branches = []
|
43
|
-
if options.hook
|
45
|
+
if options.hook || options.client_hook
|
44
46
|
# we get passed changed branches and refs via stdin
|
45
47
|
$stdin.each_line do |line|
|
46
|
-
|
48
|
+
regex = options.client_hook ? CLIENT_HOOK_STDIN_REGEX : HOOK_STDIN_REGEX
|
49
|
+
matches = line.match(regex)
|
47
50
|
if matches && matches[:new] != '0' * 40
|
48
51
|
if options.branches.include? matches[:ref]
|
49
52
|
branches << matches[:ref]
|
@@ -62,10 +65,10 @@ module Gurney
|
|
62
65
|
branches.each do |branch|
|
63
66
|
dependencies = []
|
64
67
|
|
65
|
-
yarn_source = Gurney::Source::Yarn.new(yarn_lock: read_file(g, options.hook, branch, 'yarn.lock'))
|
68
|
+
yarn_source = Gurney::Source::Yarn.new(yarn_lock: read_file(g, options.hook || options.client_hook, branch, 'yarn.lock'))
|
66
69
|
dependencies.concat yarn_source.dependencies || []
|
67
70
|
|
68
|
-
bundler_source = Gurney::Source::Bundler.new(gemfile_lock: read_file(g, options.hook, branch, 'Gemfile.lock'))
|
71
|
+
bundler_source = Gurney::Source::Bundler.new(gemfile_lock: read_file(g, options.hook || options.client_hook, branch, 'Gemfile.lock'))
|
69
72
|
dependencies.concat bundler_source.dependencies || []
|
70
73
|
|
71
74
|
dependencies.compact!
|
@@ -8,6 +8,7 @@ module Gurney
|
|
8
8
|
def self.parse(args)
|
9
9
|
options = OpenStruct.new
|
10
10
|
options.hook = false
|
11
|
+
options.client_hook = false
|
11
12
|
options.config_file = 'gurney.yml'
|
12
13
|
|
13
14
|
option_parser = ::OptionParser.new do |opts|
|
@@ -20,7 +21,7 @@ module Gurney
|
|
20
21
|
options.api_url = api_url
|
21
22
|
end
|
22
23
|
|
23
|
-
opts.on('', '--api-token [API TOKEN]', 'Token to be send to api in the X-AuthToken header') do |api_token|
|
24
|
+
opts.on('', '--api-token [API TOKEN]', 'Token to be send to the api in the X-AuthToken header') do |api_token|
|
24
25
|
options.api_token = api_token
|
25
26
|
end
|
26
27
|
|
@@ -32,6 +33,10 @@ module Gurney
|
|
32
33
|
options.hook = hook
|
33
34
|
end
|
34
35
|
|
36
|
+
opts.on('', '--client-hook', 'Run as a git pre-push hook') do |client_hook|
|
37
|
+
options.client_hook = client_hook
|
38
|
+
end
|
39
|
+
|
35
40
|
opts.on('-p', '--project-id [PROJECT ID]', 'Specify project id for api') do |project_id|
|
36
41
|
options.project_id = project_id
|
37
42
|
end
|
data/lib/gurney/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gurney_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Schaflitzl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|