gitlab-development-kit 0.2.6 → 0.2.7

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 +40 -35
  3. data/lib/gitlab_development_kit.rb +3 -1
  4. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a7dfe37321d4fec2d19623b010a3556ed485c92042af3370955194058f66b62
4
- data.tar.gz: 53db7606b58f3551896416466869cba7be108599c077ab661085e4e25ded97e5
3
+ metadata.gz: bf613de53ce1d786cd089d946aea46954738e639f0866836b6bddc69e8f9d804
4
+ data.tar.gz: f2f2481311a8e70c8ca803344b0383bfcbd24545f2fb13c7bde6203c79fd579b
5
5
  SHA512:
6
- metadata.gz: d0215ec330bc334a8245021fdba947e839a377c5cf5ed9fafb32479ef97f63feceef4d081bec5b3f76b428b5d70dbc7ca9278252f2da679734d328ddcf63bc0c
7
- data.tar.gz: 469deab8137ca29da1c6ca4e482ab95c440e74bd76084c0a91c3bf0e6d1efa430869ff561be8c5b8c5ab5e7645d8d2e14f271259311c67a4f8eec94a54a2689f
6
+ metadata.gz: 508f5077dbb2195433259bb651fe70e42133160399435510b8a5af8bd9d526d802370eb8bab8ecb40b538a185c7911ccc5bf1a3639d9ca9e854741c9cc5dda93
7
+ data.tar.gz: 4202049aecfdf6512e0dd7ee5140ec803cd8592b2ea32b6e81e29e113d0b81ed6d670eaee005b871564a718ac8028dd8fef69356d311338ad6fc81080ed2f9fd
data/bin/gdk CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
2
5
  require 'yaml'
3
6
 
4
- $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
7
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
8
  require 'gitlab_development_kit'
6
9
 
7
10
  # Gitlab Development Kit CLI launcher
@@ -9,68 +12,68 @@ require 'gitlab_development_kit'
9
12
  # Note to contributors: this script must not change (much) because it is
10
13
  # installed outside the gitlab-development-kit repository with 'gem
11
14
  # install'. Edit lib/gdk.rb to define new commands.
12
-
13
15
  module GDK
14
16
  DOTFILE = File.expand_path('~/.gdk.yml')
15
- TRUSTED_KEY = 'trusted_directories'.freeze
16
- ROOT_CHECK_FILE = '.gdk-install-root'.freeze
17
+ TRUSTED_KEY = 'trusted_directories'
18
+ ROOT_CHECK_FILE = '.gdk-install-root'
17
19
  DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
18
20
 
19
- def self.launcher_main
21
+ def self.launcher_main # rubocop:disable Metrics/CyclomaticComplexity
20
22
  case ARGV.first
21
23
  when 'version'
22
24
  puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
23
25
  true
24
26
  when 'init'
25
- if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == "-help" || ARGV[1] == "--help"))
26
- puts "Usage: gdk init [DIR]"
27
+ if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == '-help' || ARGV[1] == '--help'))
28
+ puts 'Usage: gdk init [DIR]'
27
29
  return false
28
30
  end
29
31
  directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
30
32
  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
33
+ warn <<~INVALID_GDK_DIR_NAME
34
+ The gdk directory cannot start with a dash ('-'). Did you mean:
35
+ gdk init #{directory.sub(/^-+/, '')}
36
+ INVALID_GDK_DIR_NAME
37
+ return false
36
38
  end
37
39
  cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
38
40
  system(*cmd) && trust!(directory) && remember!(directory)
39
41
  when 'trust'
40
42
  if ARGV.count != 2
41
- puts "Usage: gdk trust DIR"
43
+ puts 'Usage: gdk trust DIR'
42
44
  return false
43
45
  end
44
46
  trust!(ARGV[1])
45
47
  else
48
+ # rubocop:disable Style/GlobalVars
46
49
  $gdk_root = find_root(Dir.pwd)
47
50
  if $gdk_root.nil?
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
51
+ warn <<~NOT_A_GDK_DIR
52
+
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'.
56
+
57
+ gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
58
+
59
+ NOT_A_GDK_DIR
57
60
  return false
58
61
  end
59
- warn "(in #{$gdk_root})"
60
62
 
61
63
  unless trusted?($gdk_root)
62
- puts <<-EOS.gsub(/^\s+\|/, '')
63
- |
64
- |This GitLab Development Kit root directory is not known to the "gdk"
65
- |command. To mark it as trusted run:
66
- |
67
- |gdk trust #{$gdk_root}
68
- |
69
- EOS
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}
70
+
71
+ NOT_A_TRUSTED_GDK_DIR
70
72
  return false
71
73
  end
72
74
 
73
75
  load(File.join($gdk_root, 'lib/gdk.rb'))
76
+ # rubocop:enable Style/GlobalVars
74
77
  GDK.main
75
78
  end
76
79
  end
@@ -108,16 +111,18 @@ module GDK
108
111
  end
109
112
 
110
113
  def self.load_dotfile
111
- File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.safe_load(f) } || {}
114
+ File.open(DOTFILE, File::RDONLY | File::CREAT) do |f|
115
+ YAML.safe_load(f)
116
+ end || {}
112
117
  end
113
118
 
114
119
  def self.remember!(directory)
115
- open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
120
+ File.open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
116
121
  f.puts File.realpath(directory)
117
122
  end
118
123
  true
119
- rescue => ex
120
- warn ex
124
+ rescue StandardError => e
125
+ warn e
121
126
  false
122
127
  end
123
128
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GDK
2
- GEM_VERSION = '0.2.6'.freeze
4
+ GEM_VERSION = '0.2.7'
3
5
  end
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-development-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Vosmaer
8
+ - GitLab
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -12,7 +13,7 @@ date: 2020-06-18 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: CLI for GitLab Development Kit.
14
15
  email:
15
- - jacob@gitlab.com
16
+ - gitlab_rubygems@gitlab.com
16
17
  executables:
17
18
  - gdk
18
19
  extensions: []