Skip to content

Commit 7b9083e

Browse files
Merge pull request #460 from jpogran/GH-454-fix-pdk-ruby-path
(GH-454) Fix PDK Ruby file path
2 parents 7f03d77 + 4c6bd3c commit 7b9083e

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- [Puppet Resource](#puppet-resource)
2727
- [Puppet Node Graph](#puppet-node-graph)
2828
- [Puppet Development Kit Support](#puppet-development-kit-support)
29+
- [PDK Supported Versions](#pdk-supported-versions)
2930
- [PDK New Module](#pdk-new-module)
3031
- [PDK New Class](#pdk-new-class)
3132
- [PDK Validate](#pdk-validate)
@@ -213,6 +214,10 @@ You can use the [Puppet Development Kit](https://puppet.com/blog/develop-modules
213214
214215
> Note: `pdk convert` is not available in the command palette as it is a complicated command that requires user input to succeed. It is better to use it from the builtin terminal.
215216
217+
#### PDK Supported Versions
218+
219+
The Puppet VSCode Extension supports the current PDK version, and one older version. This is currently 1.8.0 and 1.7.1.
220+
216221
#### PDK new module
217222

218223
`PDK New Module` is available even if the extension isn't loaded, the rest of the commands are only available when the extension is loaded.

src/configuration.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
1313
public timeout: number;
1414
public debugFilePath: string;
1515
private settings: ISettings;
16+
private gemRubyVersionDir: string;
17+
private rubyVersionDir: string;
1618

1719
constructor() {
1820
this.settings = settingsFromWorkspace();
@@ -23,6 +25,9 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
2325
this.debugFilePath = this.settings.editorService.debugFilePath;
2426

2527
this._puppetInstallType = this.settings.installType;
28+
29+
this.rubyVersionDir = '2.5.1';
30+
this.gemRubyVersionDir = '2.5.0';
2631
}
2732

2833
private _puppetInstallType: PuppetInstallType;
@@ -207,16 +212,14 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
207212

208213
get pdkRubyVerDir(): string {
209214
var rootDir = path.join(this.puppetBaseDir, 'private', 'puppet', 'ruby');
210-
var versionDir = '2.4.0';
211215

212-
return PathResolver.resolveSubDirectory(rootDir, versionDir);
216+
return path.join(rootDir, this.gemRubyVersionDir);
213217
}
214218

215219
get pdkGemDir(): string {
216220
// GEM_HOME=C:\Users\user\AppData\Local/PDK/cache/ruby/2.4.0
217221
var rootDir = path.join(this.puppetBaseDir, 'share', 'cache', 'ruby');
218-
var versionDir = '2.4.0';
219-
var directory = PathResolver.resolveSubDirectory(rootDir, versionDir);
222+
var directory = path.join(rootDir, this.gemRubyVersionDir);
220223

221224
if (process.platform === 'win32') {
222225
// Translate all slashes to / style to avoid puppet/ruby issue #11930
@@ -227,9 +230,8 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
227230

228231
get pdkRubyDir(): string {
229232
var rootDir = path.join(this.puppetBaseDir, 'private', 'ruby');
230-
var versionDir = '2.4.4';
231233

232-
return PathResolver.resolveSubDirectory(rootDir, versionDir);
234+
return path.join(rootDir, this.rubyVersionDir);;
233235
}
234236

235237
get pdkRubyBinDir(): string {
@@ -238,9 +240,8 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
238240

239241
get pdkGemVerDir(): string {
240242
var rootDir = path.join(this.pdkRubyDir, 'lib', 'ruby', 'gems');
241-
var versionDir = '2.4.0';
242243

243-
return PathResolver.resolveSubDirectory(rootDir, versionDir);
244+
return path.join(rootDir, this.gemRubyVersionDir);;
244245
}
245246

246247
// GEM_PATH=C:/Program Files/Puppet Labs/DevelopmentKit/private/ruby/2.4.4/lib/ruby/gems/2.4.0;C:/Program Files/Puppet Labs/DevelopmentKit/share/cache/ruby/2.4.0;C:/Program Files/Puppet Labs/DevelopmentKit/private/puppet/ruby/2.4.0

src/handlers/stdio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class StdioConnectionHandler extends ConnectionHandler {
3939
logPrefix = '[getRubyEnvFromPDK] ';
4040
this.logger.debug(logPrefix + 'Using environment variable DEVKIT_BASEDIR=' + exe.options.env.DEVKIT_BASEDIR);
4141
this.logger.debug(logPrefix + 'Using environment variable GEM_HOME=' + exe.options.env.GEM_HOME);
42-
this.logger.debug(logPrefix + 'Using environment variable GEM_HOME=' + exe.options.env.GEM_HOME);
42+
this.logger.debug(logPrefix + 'Using environment variable GEM_PATH=' + exe.options.env.GEM_PATH);
4343
break;
4444
case PuppetInstallType.PUPPET:
4545
logPrefix = '[getRubyExecFromPuppetAgent] ';

0 commit comments

Comments
 (0)