gitlab-development-kit 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gdk +29 -17
- data/lib/gitlab_development_kit.rb +3 -0
- metadata +4 -4
- data/lib/gitlab-development-kit.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff26cd3455867518a1a5643f5281284d9cfe147e
|
4
|
+
data.tar.gz: 9b8cacd504980b0fbbff5319cac052ca824301d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab29297020e74599b09f296668f90df91b731032ecc8b631b165697f1fac45b49fe4bed091811eb21c431c3005b2038c0f5d864aa50d4f36b62cb175da2fdcbb
|
7
|
+
data.tar.gz: 61059b81659b30929b50f0ba63223bbdec36cc1cdb80ca1e7b629eb16a324de4d6bdd7ccc7dae0e8db395e10e58bc75eaeaa7d7be75f8a228344f82c819ca54f
|
data/bin/gdk
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'yaml'
|
3
3
|
|
4
|
-
|
5
|
-
require '
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
5
|
+
require 'gitlab_development_kit'
|
6
6
|
|
7
7
|
# Gitlab Development Kit CLI launcher
|
8
8
|
#
|
@@ -12,8 +12,8 @@ require 'gitlab-development-kit'
|
|
12
12
|
|
13
13
|
module GDK
|
14
14
|
DOTFILE = File.expand_path('~/.gdk.yml')
|
15
|
-
TRUSTED_KEY = 'trusted_directories'
|
16
|
-
ROOT_CHECK_FILE = '.gdk-install-root'
|
15
|
+
TRUSTED_KEY = 'trusted_directories'.freeze
|
16
|
+
ROOT_CHECK_FILE = '.gdk-install-root'.freeze
|
17
17
|
DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
|
18
18
|
|
19
19
|
def self.launcher_main
|
@@ -22,12 +22,19 @@ module GDK
|
|
22
22
|
puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
|
23
23
|
true
|
24
24
|
when 'init'
|
25
|
-
if ARGV.count > 2
|
25
|
+
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == "-help" || ARGV[1] == "--help"))
|
26
26
|
puts "Usage: gdk init [DIR]"
|
27
27
|
return false
|
28
28
|
end
|
29
29
|
directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
|
30
|
-
|
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}]
|
31
38
|
system(*cmd) && trust!(directory) && remember!(directory)
|
32
39
|
when 'trust'
|
33
40
|
if ARGV.count != 2
|
@@ -49,9 +56,9 @@ module GDK
|
|
49
56
|
EOS
|
50
57
|
return false
|
51
58
|
end
|
52
|
-
|
59
|
+
warn "(in #{$gdk_root})"
|
53
60
|
|
54
|
-
|
61
|
+
unless trusted?($gdk_root)
|
55
62
|
puts <<-EOS.gsub(/^\s+\|/, '')
|
56
63
|
|
|
57
64
|
|This GitLab Development Kit root directory is not known to the "gdk"
|
@@ -64,12 +71,10 @@ module GDK
|
|
64
71
|
end
|
65
72
|
|
66
73
|
load(File.join($gdk_root, 'lib/gdk.rb'))
|
67
|
-
GDK
|
74
|
+
GDK.main
|
68
75
|
end
|
69
76
|
end
|
70
77
|
|
71
|
-
private
|
72
|
-
|
73
78
|
def self.find_root(current)
|
74
79
|
if File.exist?(File.join(current, 'GDK_ROOT'))
|
75
80
|
File.realpath(current)
|
@@ -84,19 +89,26 @@ module GDK
|
|
84
89
|
trusted_directories = load_dotfile[TRUSTED_KEY] || []
|
85
90
|
!!trusted_directories.include?(File.realpath(directory))
|
86
91
|
end
|
87
|
-
|
92
|
+
|
88
93
|
def self.trust!(directory)
|
89
94
|
directory = File.realpath(directory)
|
90
95
|
config = load_dotfile
|
91
96
|
config[TRUSTED_KEY] ||= []
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
+
|
95
107
|
true
|
96
108
|
end
|
97
109
|
|
98
110
|
def self.load_dotfile
|
99
|
-
File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.
|
111
|
+
File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.safe_load(f) } || {}
|
100
112
|
end
|
101
113
|
|
102
114
|
def self.remember!(directory)
|
@@ -110,4 +122,4 @@ module GDK
|
|
110
122
|
end
|
111
123
|
end
|
112
124
|
|
113
|
-
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Vosmaer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: CLI for GitLab Development Kit.
|
14
14
|
email:
|
@@ -19,7 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- bin/gdk
|
22
|
-
- lib/
|
22
|
+
- lib/gitlab_development_kit.rb
|
23
23
|
homepage: https://gitlab.com/gitlab-org/gitlab-development-kit
|
24
24
|
licenses:
|
25
25
|
- MIT
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
42
|
rubyforge_project:
|
43
|
-
rubygems_version: 2.5.
|
43
|
+
rubygems_version: 2.5.2
|
44
44
|
signing_key:
|
45
45
|
specification_version: 4
|
46
46
|
summary: CLI for GitLab Development Kit
|