gitlab-development-kit 0.2.1 → 0.2.6
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 +5 -5
- data/bin/gdk +55 -17
- data/lib/gitlab_development_kit.rb +3 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a7dfe37321d4fec2d19623b010a3556ed485c92042af3370955194058f66b62
|
4
|
+
data.tar.gz: 53db7606b58f3551896416466869cba7be108599c077ab661085e4e25ded97e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0215ec330bc334a8245021fdba947e839a377c5cf5ed9fafb32479ef97f63feceef4d081bec5b3f76b428b5d70dbc7ca9278252f2da679734d328ddcf63bc0c
|
7
|
+
data.tar.gz: 469deab8137ca29da1c6ca4e482ab95c440e74bd76084c0a91c3bf0e6d1efa430869ff561be8c5b8c5ab5e7645d8d2e14f271259311c67a4f8eec94a54a2689f
|
data/bin/gdk
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'yaml'
|
3
3
|
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
5
|
+
require 'gitlab_development_kit'
|
6
|
+
|
4
7
|
# Gitlab Development Kit CLI launcher
|
5
8
|
#
|
6
9
|
# Note to contributors: this script must not change (much) because it is
|
@@ -9,18 +12,30 @@ require 'yaml'
|
|
9
12
|
|
10
13
|
module GDK
|
11
14
|
DOTFILE = File.expand_path('~/.gdk.yml')
|
12
|
-
TRUSTED_KEY = 'trusted_directories'
|
15
|
+
TRUSTED_KEY = 'trusted_directories'.freeze
|
16
|
+
ROOT_CHECK_FILE = '.gdk-install-root'.freeze
|
17
|
+
DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
|
13
18
|
|
14
19
|
def self.launcher_main
|
15
20
|
case ARGV.first
|
21
|
+
when 'version'
|
22
|
+
puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
|
23
|
+
true
|
16
24
|
when 'init'
|
17
|
-
if ARGV.count > 2
|
25
|
+
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == "-help" || ARGV[1] == "--help"))
|
18
26
|
puts "Usage: gdk init [DIR]"
|
19
27
|
return false
|
20
28
|
end
|
21
|
-
directory = ARGV.count == 2 ? ARGV[1] :
|
22
|
-
|
23
|
-
|
29
|
+
directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
|
30
|
+
if directory.start_with?('-')
|
31
|
+
puts <<-EOS.gsub(/^\s+\|/, '')
|
32
|
+
|The gdk directory cannot start with a dash ('-'). Did you mean:
|
33
|
+
|gdk init #{directory.sub(/^-+/,'')}
|
34
|
+
EOS
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
|
38
|
+
system(*cmd) && trust!(directory) && remember!(directory)
|
24
39
|
when 'trust'
|
25
40
|
if ARGV.count != 2
|
26
41
|
puts "Usage: gdk trust DIR"
|
@@ -30,12 +45,20 @@ module GDK
|
|
30
45
|
else
|
31
46
|
$gdk_root = find_root(Dir.pwd)
|
32
47
|
if $gdk_root.nil?
|
33
|
-
puts
|
48
|
+
puts <<-EOS.gsub(/^\s+\|/, '')
|
49
|
+
|
|
50
|
+
|The current working directory is not inside a gitlab-development-kit
|
51
|
+
|installation. Use 'cd' to go to your gitlab-development-kit or create
|
52
|
+
|a new one with 'gdk init'.
|
53
|
+
|
|
54
|
+
|gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
|
55
|
+
|
|
56
|
+
EOS
|
34
57
|
return false
|
35
58
|
end
|
36
|
-
|
59
|
+
warn "(in #{$gdk_root})"
|
37
60
|
|
38
|
-
|
61
|
+
unless trusted?($gdk_root)
|
39
62
|
puts <<-EOS.gsub(/^\s+\|/, '')
|
40
63
|
|
|
41
64
|
|This GitLab Development Kit root directory is not known to the "gdk"
|
@@ -48,12 +71,10 @@ module GDK
|
|
48
71
|
end
|
49
72
|
|
50
73
|
load(File.join($gdk_root, 'lib/gdk.rb'))
|
51
|
-
GDK
|
74
|
+
GDK.main
|
52
75
|
end
|
53
76
|
end
|
54
77
|
|
55
|
-
private
|
56
|
-
|
57
78
|
def self.find_root(current)
|
58
79
|
if File.exist?(File.join(current, 'GDK_ROOT'))
|
59
80
|
File.realpath(current)
|
@@ -68,20 +89,37 @@ module GDK
|
|
68
89
|
trusted_directories = load_dotfile[TRUSTED_KEY] || []
|
69
90
|
!!trusted_directories.include?(File.realpath(directory))
|
70
91
|
end
|
71
|
-
|
92
|
+
|
72
93
|
def self.trust!(directory)
|
73
94
|
directory = File.realpath(directory)
|
74
95
|
config = load_dotfile
|
75
96
|
config[TRUSTED_KEY] ||= []
|
76
|
-
|
77
|
-
|
78
|
-
|
97
|
+
|
98
|
+
if config[TRUSTED_KEY].include?(directory)
|
99
|
+
puts "#{directory} is already in #{TRUSTED_KEY} in #{DOTFILE}"
|
100
|
+
else
|
101
|
+
config[TRUSTED_KEY] << directory
|
102
|
+
config[TRUSTED_KEY].uniq!
|
103
|
+
puts "Adding #{directory} to #{TRUSTED_KEY} in #{DOTFILE}"
|
104
|
+
File.open(DOTFILE, 'w') { |f| YAML.dump(config, f) }
|
105
|
+
end
|
106
|
+
|
79
107
|
true
|
80
108
|
end
|
81
109
|
|
82
110
|
def self.load_dotfile
|
83
|
-
File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.
|
111
|
+
File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.safe_load(f) } || {}
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.remember!(directory)
|
115
|
+
open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
|
116
|
+
f.puts File.realpath(directory)
|
117
|
+
end
|
118
|
+
true
|
119
|
+
rescue => ex
|
120
|
+
warn ex
|
121
|
+
false
|
84
122
|
end
|
85
123
|
end
|
86
124
|
|
87
|
-
exit(GDK
|
125
|
+
exit(GDK.launcher_main)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-development-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Vosmaer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: CLI for GitLab Development Kit.
|
14
14
|
email:
|
@@ -19,28 +19,28 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- bin/gdk
|
22
|
+
- lib/gitlab_development_kit.rb
|
22
23
|
homepage: https://gitlab.com/gitlab-org/gitlab-development-kit
|
23
24
|
licenses:
|
24
25
|
- MIT
|
25
26
|
metadata: {}
|
26
|
-
post_install_message:
|
27
|
+
post_install_message:
|
27
28
|
rdoc_options: []
|
28
29
|
require_paths:
|
29
30
|
- lib
|
30
31
|
required_ruby_version: !ruby/object:Gem::Requirement
|
31
32
|
requirements:
|
32
|
-
- - "
|
33
|
+
- - "~>"
|
33
34
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
35
|
+
version: 2.6.5
|
35
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
37
|
requirements:
|
37
38
|
- - ">="
|
38
39
|
- !ruby/object:Gem::Version
|
39
40
|
version: '0'
|
40
41
|
requirements: []
|
41
|
-
|
42
|
-
|
43
|
-
signing_key:
|
42
|
+
rubygems_version: 3.0.3
|
43
|
+
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: CLI for GitLab Development Kit
|
46
46
|
test_files: []
|