gitlab-development-kit 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gdk +49 -24
  3. data/lib/gitlab_development_kit.rb +2 -1
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc4cf26603278a9754743fcf00d907067bc2fa85b97fb2b9492ff62e2bee599c
4
- data.tar.gz: bc07f637757bb001ad7d4d67edb5aa69ef22886e8a2bcd12d096a3497415c53e
3
+ metadata.gz: db463a96b5d0f8bca71fcb5ba61e019985403cfde2677fff138b507c355d2da7
4
+ data.tar.gz: ae4f0852a1e2d19c5999c75815742901dfaf1f397f50e8c58a24974c91cf03a3
5
5
  SHA512:
6
- metadata.gz: 5814a7b66f3195787d1212a7950b217c6a9a48a86396806c549e9cd49927d51d419047e0faa53cbabf0fba9e4d2e150b24bf62696dd5e9aa11ef2c7e2e6d2300
7
- data.tar.gz: 9a62b8c0152a7406b1dc8b5d9c99ff6723be8f7a521ddecd04d07cfcb5adb11b78129bc84e22d214ae5fb344bdfeee745743aa027e010fab761085ece09b49f2
6
+ metadata.gz: 1372bb27ee7a8461a4c9dfcb0b7083eee84d420fedf94ebe4815290e7ee42b8b3aad9f3fb985b0140fabfe7eabf5f192d6d7f4b12426f999b500161734ef747e
7
+ data.tar.gz: 291032043e2f088398bbb06b7f44faf88154ef8e9f863877113d6004d9786108c4b8f04b90b26019bd4e153d542651ab80ac35e8579635a62f5de00952b4cd58
data/bin/gdk CHANGED
@@ -20,14 +20,12 @@ module GDK
20
20
 
21
21
  def self.launcher_main # rubocop:disable Metrics/CyclomaticComplexity
22
22
  case ARGV.first
23
- when 'version'
24
- puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
25
- true
26
23
  when 'init'
27
24
  if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == '-help' || ARGV[1] == '--help'))
28
25
  puts 'Usage: gdk init [DIR]'
29
26
  return false
30
27
  end
28
+
31
29
  directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
32
30
  if directory.start_with?('-')
33
31
  warn <<~INVALID_GDK_DIR_NAME
@@ -36,6 +34,7 @@ module GDK
36
34
  INVALID_GDK_DIR_NAME
37
35
  return false
38
36
  end
37
+
39
38
  cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
40
39
  system(*cmd) && trust!(directory) && remember!(directory)
41
40
  when 'trust'
@@ -43,41 +42,67 @@ module GDK
43
42
  puts 'Usage: gdk trust DIR'
44
43
  return false
45
44
  end
45
+
46
46
  trust!(ARGV[1])
47
47
  else
48
- # rubocop:disable Style/GlobalVars
49
- $gdk_root = find_root(Dir.pwd)
50
- if $gdk_root.nil?
51
- warn <<~NOT_A_GDK_DIR
48
+ if print_version?
49
+ puts VERSION
52
50
 
53
- The current working directory is not inside a gitlab-development-kit
54
- installation. Use 'cd' to go to your gitlab-development-kit or create
55
- a new one with 'gdk init'.
51
+ return true
52
+ end
56
53
 
57
- gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
54
+ unless gdk_dir?
55
+ warn_not_gdk_dir
58
56
 
59
- NOT_A_GDK_DIR
60
57
  return false
61
58
  end
62
59
 
63
- unless trusted?($gdk_root)
64
- warn <<~NOT_A_TRUSTED_GDK_DIR
65
-
66
- This GitLab Development Kit root directory is not known to the "gdk"
67
- command. To mark it as trusted run:
68
-
69
- gdk trust #{$gdk_root}
60
+ unless trusted?
61
+ warn_not_trusted_dir
70
62
 
71
- NOT_A_TRUSTED_GDK_DIR
72
63
  return false
73
64
  end
74
65
 
75
- load(File.join($gdk_root, 'lib/gdk.rb'))
76
- # rubocop:enable Style/GlobalVars
66
+ load(File.join(gdk_root, 'lib/gdk.rb'))
77
67
  GDK.main
78
68
  end
79
69
  end
80
70
 
71
+ def self.warn_not_gdk_dir
72
+ warn <<~NOT_A_GDK_DIR
73
+
74
+ The current working directory is not inside a gitlab-development-kit
75
+ installation. Use 'cd' to go to your gitlab-development-kit or create
76
+ a new one with 'gdk init'.
77
+
78
+ gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
79
+
80
+ NOT_A_GDK_DIR
81
+ end
82
+
83
+ def self.warn_not_trusted_dir
84
+ warn <<~NOT_A_TRUSTED_GDK_DIR
85
+
86
+ This GitLab Development Kit root directory is not known to the "gdk"
87
+ command. To mark it as trusted run:
88
+
89
+ gdk trust #{gdk_root}
90
+
91
+ NOT_A_TRUSTED_GDK_DIR
92
+ end
93
+
94
+ def self.gdk_root
95
+ @gdk_root ||= find_root(Dir.pwd)
96
+ end
97
+
98
+ def self.gdk_dir?
99
+ !gdk_root.nil?
100
+ end
101
+
102
+ def self.print_version?
103
+ %w[version --version].include?(ARGV.first) && !gdk_dir?
104
+ end
105
+
81
106
  def self.find_root(current)
82
107
  if File.exist?(File.join(current, 'GDK_ROOT'))
83
108
  File.realpath(current)
@@ -88,9 +113,9 @@ module GDK
88
113
  end
89
114
  end
90
115
 
91
- def self.trusted?(directory)
116
+ def self.trusted?
92
117
  trusted_directories = load_dotfile[TRUSTED_KEY] || []
93
- !!trusted_directories.include?(File.realpath(directory))
118
+ !!trusted_directories.include?(File.realpath(gdk_root))
94
119
  end
95
120
 
96
121
  def self.trust!(directory)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GDK
4
- GEM_VERSION = '0.2.10'
4
+ GEM_VERSION = '0.2.11'
5
+ VERSION = "GitLab Development Kit #{GEM_VERSION}"
5
6
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-development-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Vosmaer
8
8
  - GitLab
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-25 00:00:00.000000000 Z
12
+ date: 2021-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -39,7 +39,7 @@ homepage: https://gitlab.com/gitlab-org/gitlab-development-kit
39
39
  licenses:
40
40
  - MIT
41
41
  metadata: {}
42
- post_install_message:
42
+ post_install_message:
43
43
  rdoc_options: []
44
44
  require_paths:
45
45
  - lib
@@ -47,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 2.6.6
50
+ version: 2.7.2
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubygems_version: 3.1.4
58
- signing_key:
58
+ signing_key:
59
59
  specification_version: 4
60
60
  summary: CLI for GitLab Development Kit
61
61
  test_files: []