├── .gitignore ├── MAINTAINERS.md ├── README.md ├── src └── com │ └── puppetlabs │ └── BeakerIntellijPlugin │ ├── config │ ├── BeakerConfigFileType.java │ ├── BeakerConfigurationType.java │ ├── BeakerConfigurationFactory.java │ ├── BeakerRunConfigurationProducer.java │ └── BeakerRunConfiguration.java │ ├── settings │ ├── BeakerRunSettings.java │ └── BeakerSettingsEditor.java │ └── execution │ └── BeakerRunCommandLineState.java ├── META-INF └── plugin.xml └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Reviewers/Maintainers For BeakerRubyMinePlugin 2 | 3 | BeakerRubyMinePlugin is maintained by Puppet's Quality Assurance (QA) Team. These people 4 | will be reviewing & merging PRs to the project. 5 | 6 | | Name | Github | Email | 7 | |:--------------:|:---------------------------------------------------:|:---------------------------:| 8 | | Sam Woods | [samwoods1](https://github.com/samwoods1) | | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BeakerRubyMinePlugin 2 | An IntelliJ (RubyMine or Idea) Plugin for executing Beaker Tests against PuppetLabs. 3 | 4 | # Installation 5 | Install from https://plugins.jetbrains.com/plugin/7962?pr= 6 | In your IntelliJ IDE: 7 | - Select Preferences 8 | - Click Browse repositories button 9 | - Select 'Beaker Test Runner' and install 10 | - Restart your IDE 11 | 12 | # Features 13 | - Adds a new Beaker configuration type with simple support for some of the common parameters 14 | - Ability to run/debug Beaker tests from context (right click on a beaker test and either run or debug) 15 | - Ability to re-use the most recent saved hosts.yml for a configuration file 16 | - Ability to run/debug Beaker with or without Bundler 17 | - Ability to specify any additional command line arguments not included in the base configuration 18 | 19 | # Future capabilities 20 | - Additional code completion support for Beaker classes 21 | - Code generation - create new Beaker test case (possibly different templates) 22 | 23 | # Configuration 24 | - Set the default values for the Beaker configuration to match what you would typically run on command line 25 | - If your workflow generally consists of running a command to have Beaker spin up a node(s) and then executing tests against that existing node as a separate command, you can create a specific configuration(s) to spin up the nodes, and then use the default configuration to execute tests. 26 | 27 | # Usage 28 | After configuring the default Beaker Configuration, right click on a file in the Project window and select run or debug to execute it as a Beaker test. 29 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/config/BeakerConfigFileType.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.config; 2 | 3 | 4 | import com.intellij.icons.AllIcons; 5 | import com.intellij.lang.Language; 6 | import com.intellij.openapi.fileTypes.LanguageFileType; 7 | import com.intellij.openapi.fileTypes.PlainTextLanguage; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | import javax.swing.*; 11 | 12 | /** 13 | * Created by samwoods on 9/13/15. 14 | */ 15 | public class BeakerConfigFileType extends LanguageFileType { 16 | 17 | public static final BeakerConfigFileType INSTANCE = new BeakerConfigFileType(); 18 | 19 | /** 20 | * Creates a language file type for the specified language. 21 | */ 22 | protected BeakerConfigFileType() { 23 | super(findLanguage()); 24 | } 25 | 26 | @NotNull 27 | private static Language findLanguage() { 28 | Language language = Language.findLanguageByID("yaml"); 29 | if (language == null) { 30 | language = PlainTextLanguage.INSTANCE; 31 | } 32 | return language; 33 | } 34 | 35 | @NotNull 36 | @Override 37 | public String getName() { 38 | return "Beaker Test Runner"; 39 | } 40 | 41 | @NotNull 42 | @Override 43 | public String getDescription() { 44 | return "Beaker Test Runner configuration file"; 45 | } 46 | 47 | @NotNull 48 | @Override 49 | public String getDefaultExtension() { 50 | return "beaker"; 51 | } 52 | 53 | @NotNull 54 | @Override 55 | public Icon getIcon() { 56 | return AllIcons.General.Information; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/config/BeakerConfigurationType.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.config; 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory; 4 | import com.intellij.execution.configurations.ConfigurationType; 5 | import com.intellij.execution.configurations.ConfigurationTypeUtil; 6 | import com.intellij.icons.AllIcons; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import javax.swing.*; 10 | 11 | /** 12 | * Created by samwoods on 6/11/15. 13 | */ 14 | public class BeakerConfigurationType implements ConfigurationType { 15 | 16 | public BeakerConfigurationType() { 17 | } 18 | 19 | @Override 20 | public String getDisplayName() { 21 | return "Beaker"; 22 | } 23 | 24 | @Override 25 | public String getConfigurationTypeDescription() { 26 | return "Beaker Test Run Configuration"; 27 | } 28 | 29 | @Override 30 | public Icon getIcon() { 31 | return AllIcons.General.Information; 32 | } 33 | 34 | @NotNull 35 | @Override 36 | public String getId() { 37 | return "Beaker Test Runner"; 38 | } 39 | 40 | @Override 41 | public ConfigurationFactory[] getConfigurationFactories() { 42 | return new ConfigurationFactory[]{this.a}; 43 | } 44 | 45 | 46 | private final BeakerConfigurationFactory a = new BeakerConfigurationFactory(this); 47 | 48 | 49 | public static BeakerConfigurationType getInstance() { 50 | return ConfigurationTypeUtil.findConfigurationType(BeakerConfigurationType.class); 51 | } 52 | 53 | public BeakerConfigurationFactory getFactory() { 54 | return this.a; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | Beaker Test Runner 3 | Unit 4 | 0.1.3 5 | Puppet Labs 6 | 7 | com.intellij.modules.lang 8 | com.intellij.modules.ruby 9 | 10 | 12 | For running puppet labs Beaker tests from RubyMine 13 | ]]> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/settings/BeakerRunSettings.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.settings; 2 | 3 | /** 4 | * Created by samwoods on 9/6/15. 5 | */ 6 | public class BeakerRunSettings { 7 | private String configFile; 8 | private boolean useLatestPreserved; 9 | private String optionsFile; 10 | private String directory; 11 | private String testFilePath; 12 | private String rsaKey; 13 | private String additionalArguments; 14 | 15 | public BeakerRunSettings(){ 16 | configFile = "hosts.cfg"; 17 | useLatestPreserved = false; 18 | optionsFile = "options.rb"; 19 | directory = ""; 20 | testFilePath = ""; 21 | rsaKey = "~/.ssh/id_rsa-acceptance"; 22 | additionalArguments = ""; 23 | } 24 | 25 | public String getConfigFile() { 26 | return configFile; 27 | } 28 | 29 | public boolean getUseLatestPreserved() { 30 | return useLatestPreserved; 31 | } 32 | 33 | public String getOptionsFile() { 34 | return optionsFile; 35 | } 36 | 37 | public String getDirectory() { 38 | return directory; 39 | } 40 | 41 | public String getTestFilePath() { 42 | return testFilePath; 43 | } 44 | 45 | public String getAdditionalArguments() { 46 | return additionalArguments; 47 | } 48 | 49 | public String getRsaKey() { 50 | return rsaKey; 51 | } 52 | 53 | public void setConfigFile(String myConfigFile) { 54 | this.configFile = myConfigFile; 55 | } 56 | 57 | public void setUseLatestPreserved(boolean useLatestPreserved) { 58 | this.useLatestPreserved = useLatestPreserved; 59 | } 60 | 61 | public void setOptionsFile(String myOptionsFile) { 62 | this.optionsFile = myOptionsFile; 63 | } 64 | 65 | public void setDirectory(String myDirectory) { 66 | this.directory = myDirectory; 67 | } 68 | 69 | public void setTestFilePath(String myTestFilePath) { 70 | this.testFilePath = myTestFilePath; 71 | } 72 | 73 | public void setRsaKey(String myRsaKey) { 74 | this.rsaKey = myRsaKey; 75 | } 76 | 77 | public void setAdditionalArguments(String additionalArguments) { 78 | this.additionalArguments = additionalArguments; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/config/BeakerConfigurationFactory.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.puppetlabs.BeakerIntellijPlugin.config; 4 | 5 | import com.intellij.execution.RunnerAndConfigurationSettings; 6 | import com.intellij.openapi.module.Module; 7 | import com.intellij.openapi.project.Project; 8 | import com.intellij.openapi.roots.ModuleRootManager; 9 | import com.intellij.openapi.vfs.VirtualFile; 10 | import com.intellij.util.ArrayUtil; 11 | import com.intellij.util.Function; 12 | import org.jetbrains.annotations.NotNull; 13 | import org.jetbrains.annotations.Nullable; 14 | import org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration; 15 | import org.jetbrains.plugins.ruby.ruby.run.configuration.RubyRunConfigurationFactoryBase; 16 | import org.jetbrains.plugins.ruby.ruby.run.configuration.RunConfigurationUtil; 17 | 18 | /** 19 | * Created by samwoods on 6/11/15. 20 | */ 21 | public class BeakerConfigurationFactory extends RubyRunConfigurationFactoryBase { 22 | private static final String FACTORY_NAME = "Beaker configuration factory"; 23 | 24 | public BeakerConfigurationFactory(BeakerConfigurationType beakerConfigurationType) { 25 | super(beakerConfigurationType); 26 | this.setFactoryMethod(new Function() { 27 | public AbstractRubyRunConfiguration fun(Object var1) { 28 | return new BeakerRunConfiguration((Project)var1, BeakerConfigurationFactory.this); 29 | } 30 | }); 31 | } 32 | 33 | public RunnerAndConfigurationSettings createConfigurationSettings(@NotNull Module var1, @NotNull String var2) { 34 | String var3 = a(var1); 35 | RunnerAndConfigurationSettings var4 = RunConfigurationUtil.createSettings(var1.getProject(), this, ""); 36 | BeakerRunConfiguration var5 = (BeakerRunConfiguration)var4.getConfiguration(); 37 | var5.setWorkingDirectory(var3); 38 | return var4; 39 | } 40 | 41 | protected void initWithDefaultModule(AbstractRubyRunConfiguration var1, @NotNull Module var2) { 42 | super.initWithDefaultModule(var1, var2); 43 | var1.setWorkingDirectory(a(var2)); 44 | } 45 | 46 | @Nullable 47 | private static String a(@NotNull Module var0) { 48 | ModuleRootManager var1 = ModuleRootManager.getInstance(var0); 49 | if(var1 != null) { 50 | VirtualFile[] var2 = var1.getContentRoots(); 51 | if(var2.length == 1) { 52 | VirtualFile var3 = ArrayUtil.getFirstElement(var2); 53 | if(var3 != null) { 54 | return var3.getPath(); 55 | } 56 | } 57 | } 58 | 59 | return null; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/config/BeakerRunConfigurationProducer.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.config; 2 | 3 | import com.intellij.execution.Location; 4 | import com.intellij.execution.actions.ConfigurationContext; 5 | import com.intellij.execution.actions.RunConfigurationProducer; 6 | import com.intellij.execution.configurations.ConfigurationTypeUtil; 7 | import com.intellij.execution.configurations.RunConfiguration; 8 | import com.intellij.openapi.diagnostic.Logger; 9 | import com.intellij.openapi.util.Ref; 10 | import com.intellij.openapi.util.io.FileUtil; 11 | import com.intellij.openapi.vfs.VirtualFile; 12 | import com.intellij.psi.PsiDirectory; 13 | import com.intellij.psi.PsiElement; 14 | import com.intellij.psi.PsiFile; 15 | import com.intellij.util.ObjectUtils; 16 | import com.puppetlabs.BeakerIntellijPlugin.settings.BeakerRunSettings; 17 | import org.jetbrains.annotations.NotNull; 18 | 19 | /** 20 | * Created by samwoods on 9/6/15. 21 | */ 22 | public class BeakerRunConfigurationProducer extends RunConfigurationProducer{ 23 | private static final Logger LOG = Logger.getInstance(BeakerRunConfigurationProducer.class); 24 | 25 | public BeakerRunConfigurationProducer() { 26 | super(new BeakerConfigurationType()); 27 | } 28 | 29 | @Override 30 | protected boolean setupConfigurationFromContext(BeakerRunConfiguration configuration, ConfigurationContext context, Ref element) { 31 | 32 | RunConfiguration original = context.getOriginalConfiguration(null); 33 | if (original != null && !ConfigurationTypeUtil.equals(original.getType(), 34 | ConfigurationTypeUtil.findConfigurationType(BeakerConfigurationType.class))) { 35 | return false; 36 | } 37 | 38 | BeakerRunSettings settings = getBeakerRunSettings(configuration.getRunSettings(), context); 39 | configuration.setRunSettings(settings); 40 | 41 | configuration.setName(configuration.suggestedName()); 42 | 43 | return true; 44 | } 45 | 46 | @NotNull 47 | private BeakerRunSettings getBeakerRunSettings(BeakerRunSettings baseSettings, ConfigurationContext context) { 48 | Location location = context.getLocation(); 49 | BeakerRunSettings settings = baseSettings; 50 | if (settings == null){ 51 | settings = new BeakerRunSettings(); 52 | } 53 | 54 | PsiElement element = location.getPsiElement(); 55 | 56 | PsiFile psiFile = ObjectUtils.tryCast(element, PsiFile.class); 57 | 58 | if (psiFile != null){ 59 | VirtualFile file = psiFile.getVirtualFile(); 60 | if (file == null) { 61 | LOG.info("Beaker Intellij Plugin - virtualFile is null"); 62 | } 63 | settings.setTestFilePath(FileUtil.toSystemDependentName(file.getPath())); 64 | } 65 | else{ 66 | PsiDirectory psiDirectory = ObjectUtils.tryCast(element, PsiDirectory.class); 67 | if (psiDirectory != null){ 68 | VirtualFile directory = psiDirectory.getVirtualFile(); 69 | settings.setTestFilePath(FileUtil.toSystemDependentName(directory.getPath())); 70 | } 71 | } 72 | 73 | return settings; 74 | } 75 | 76 | @Override 77 | public boolean isConfigurationFromContext(BeakerRunConfiguration runConfiguration, ConfigurationContext configurationContext) { 78 | BeakerRunSettings pattern = getBeakerRunSettings(new BeakerRunSettings(), configurationContext); 79 | if (pattern == null){ 80 | return false; 81 | } 82 | 83 | BeakerRunSettings candidate = runConfiguration.getRunSettings(); 84 | return pattern.getTestFilePath() == candidate.getTestFilePath(); 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/config/BeakerRunConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.config; 2 | 3 | import com.intellij.execution.ExecutionException; 4 | import com.intellij.execution.configurations.ConfigurationFactory; 5 | import com.intellij.execution.configurations.RunProfileState; 6 | import com.intellij.execution.configurations.RuntimeConfigurationException; 7 | import com.intellij.execution.runners.ExecutionEnvironment; 8 | import com.intellij.openapi.options.SettingsEditor; 9 | import com.intellij.openapi.project.Project; 10 | import com.intellij.openapi.util.InvalidDataException; 11 | import com.intellij.openapi.util.JDOMExternalizer; 12 | import com.intellij.openapi.util.WriteExternalException; 13 | import com.puppetlabs.BeakerIntellijPlugin.execution.BeakerRunCommandLineState; 14 | import com.puppetlabs.BeakerIntellijPlugin.settings.BeakerRunSettings; 15 | import com.puppetlabs.BeakerIntellijPlugin.settings.BeakerSettingsEditor; 16 | import org.jdom.Element; 17 | import org.jetbrains.annotations.NotNull; 18 | import org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration; 19 | 20 | import java.nio.file.Path; 21 | import java.nio.file.Paths; 22 | 23 | /** 24 | * Created by samwoods on 6/11/15. 25 | */ 26 | public class BeakerRunConfiguration extends AbstractRubyRunConfiguration { 27 | 28 | private BeakerRunSettings runSettings; 29 | 30 | protected BeakerRunConfiguration(Project project, ConfigurationFactory factory) { 31 | super(project, factory); 32 | } 33 | 34 | protected String getSerializationId() { 35 | return "BEAKER_RUN_CONFIGURATION"; 36 | } 37 | 38 | protected RunProfileState createCommandLineState(@NotNull ExecutionEnvironment var1) throws ExecutionException { 39 | return new BeakerRunCommandLineState(this, var1); 40 | } 41 | 42 | public BeakerRunSettings getRunSettings() { 43 | if (runSettings == null){ 44 | runSettings = new BeakerRunSettings(); 45 | } 46 | return runSettings != null ? runSettings : new BeakerRunSettings(); 47 | } 48 | 49 | public void setRunSettings(String rsaKey, String configFile, Boolean useLatestPreserved, String optionsFile, String testFile, String additionalArguments, String workingDirectory) { 50 | runSettings = new BeakerRunSettings(); 51 | runSettings.setRsaKey(rsaKey); 52 | runSettings.setConfigFile(configFile); 53 | runSettings.setUseLatestPreserved(useLatestPreserved); 54 | runSettings.setOptionsFile(optionsFile); 55 | runSettings.setTestFilePath(testFile); 56 | runSettings.setAdditionalArguments(additionalArguments); 57 | runSettings.setDirectory(workingDirectory); 58 | } 59 | 60 | public void setRunSettings(BeakerRunSettings settings){ 61 | runSettings = settings; 62 | } 63 | 64 | @NotNull 65 | protected SettingsEditor createConfigurationEditor() { 66 | return new BeakerSettingsEditor(getProject()); 67 | } 68 | 69 | @Override 70 | protected void validateConfiguration(boolean var1) throws RuntimeConfigurationException { 71 | 72 | } 73 | 74 | @Override 75 | public void readExternal(Element element) throws InvalidDataException { 76 | super.readExternal(element); 77 | BeakerRunSettings settings = new BeakerRunSettings(); 78 | settings.setAdditionalArguments(JDOMExternalizer.readString(element, "additionalArguments")); 79 | settings.setTestFilePath(JDOMExternalizer.readString(element, "testFilePath")); 80 | settings.setDirectory(JDOMExternalizer.readString(element, "directory")); 81 | settings.setConfigFile(JDOMExternalizer.readString(element, "configFile")); 82 | settings.setOptionsFile(JDOMExternalizer.readString(element, "optionsFile")); 83 | settings.setRsaKey(JDOMExternalizer.readString(element, "rsaKey")); 84 | settings.setUseLatestPreserved(JDOMExternalizer.readBoolean(element, "useLatestPreserved")); 85 | setRunSettings(settings); 86 | } 87 | 88 | @Override 89 | public void writeExternal(Element element) throws WriteExternalException { 90 | super.writeExternal(element); 91 | if (runSettings == null){ 92 | try { 93 | readExternal(element); 94 | } 95 | catch (InvalidDataException ex){ 96 | //TODO: Not doing this at the moment anyways. 97 | } 98 | } 99 | JDOMExternalizer.write(element, "additionalArguments", runSettings.getAdditionalArguments()); 100 | JDOMExternalizer.write(element, "testFilePath", runSettings.getTestFilePath()); 101 | JDOMExternalizer.write(element, "directory", runSettings.getDirectory()); 102 | JDOMExternalizer.write(element, "configFile", runSettings.getConfigFile()); 103 | JDOMExternalizer.write(element, "optionsFile", runSettings.getOptionsFile()); 104 | JDOMExternalizer.write(element, "rsaKey", runSettings.getRsaKey()); 105 | JDOMExternalizer.write(element, "useLatestPreserved", runSettings.getUseLatestPreserved()); 106 | } 107 | 108 | @Override 109 | @NotNull 110 | public String suggestedName() { 111 | Path path = Paths.get(runSettings.getTestFilePath()); 112 | if (path.toString() == null || path.toString().equals("")){ 113 | return "BEAKER"; 114 | } 115 | return "BEAKER_" + path.getFileName(); 116 | } 117 | 118 | public String getGemName() { 119 | return "beaker"; 120 | } 121 | 122 | public String getExecutableName() { 123 | return "beaker"; 124 | } 125 | 126 | public String getExecutableArguments() { 127 | return null; 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/execution/BeakerRunCommandLineState.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.execution; 2 | 3 | import com.intellij.execution.ExecutionException; 4 | import com.intellij.execution.configurations.GeneralCommandLine; 5 | import com.intellij.execution.configurations.ParamsGroup; 6 | import com.intellij.execution.runners.ExecutionEnvironment; 7 | import com.intellij.openapi.projectRoots.Sdk; 8 | import com.puppetlabs.BeakerIntellijPlugin.config.BeakerRunConfiguration; 9 | import com.puppetlabs.BeakerIntellijPlugin.settings.BeakerRunSettings; 10 | import org.jetbrains.annotations.NonNls; 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.plugins.ruby.gem.RubyGemExecutionContext; 13 | import org.jetbrains.plugins.ruby.ruby.run.MergingCommandLineArgumentsProvider; 14 | import org.jetbrains.plugins.ruby.ruby.run.configuration.RubyAbstractCommandLineState; 15 | import org.jetbrains.plugins.ruby.ruby.run.configuration.RubyCommandLineData; 16 | import org.jetbrains.plugins.ruby.ruby.sdk.RubySdkAdditionalData; 17 | import org.jetbrains.plugins.ruby.ruby.sdk.RubySdkUtil; 18 | 19 | import java.io.File; 20 | import java.io.FileFilter; 21 | import java.nio.file.Path; 22 | import java.nio.file.Paths; 23 | 24 | public class BeakerRunCommandLineState extends RubyAbstractCommandLineState { 25 | @NonNls 26 | private static final String e = "ruby.gem.command.runner"; 27 | 28 | public BeakerRunCommandLineState(BeakerRunConfiguration runConfig, @NotNull ExecutionEnvironment executionEnvironment) { 29 | super(runConfig, executionEnvironment, false); 30 | } 31 | 32 | public BeakerRunConfiguration getConfig() { 33 | return (BeakerRunConfiguration)super.getConfig(); 34 | } 35 | 36 | protected RubyCommandLineData createRunCommandLine() throws ExecutionException { 37 | BeakerRunConfiguration beakerRunConfiguration = this.getConfig(); 38 | return createCommandLine(beakerRunConfiguration, this.getRunnerId()); 39 | } 40 | 41 | public static RubyCommandLineData createCommandLine(@NotNull BeakerRunConfiguration beakerRunConfiguration, String arguments) throws ExecutionException { 42 | RubyCommandLineData rubyCommandLineData = createDefaultCommandLine(beakerRunConfiguration, arguments); 43 | Sdk beakerRunConfigurationSdk = beakerRunConfiguration.getSdk(); 44 | 45 | assert beakerRunConfigurationSdk != null; 46 | 47 | String var4 = beakerRunConfiguration.getGemName(); 48 | String var5 = beakerRunConfiguration.getExecutableName(); 49 | String var6 = RubyGemExecutionContext.getScriptPath(beakerRunConfigurationSdk, beakerRunConfiguration.getModule(), var4, var5); 50 | BeakerRunSettings settings = beakerRunConfiguration.getRunSettings(); 51 | if(var6 != null) { 52 | GeneralCommandLine var7 = rubyCommandLineData.getCommandLine(); 53 | assert var7 != null; 54 | 55 | String workingDir = getWorkingDir(settings, beakerRunConfiguration.getProject().getBasePath()); 56 | var7.withWorkDirectory(workingDir); 57 | 58 | RubySdkAdditionalData var8 = RubySdkUtil.getRubySdkAdditionalData(beakerRunConfigurationSdk); 59 | ParamsGroup var9 = addExecutionScriptGroup("ruby.gem.command.runner", rubyCommandLineData, var7, var8.getRunner(beakerRunConfiguration.getModule()).addDefaultMappings(beakerRunConfiguration.getMappingSettings()), var8.getSdkSystemAccessor(), var6); 60 | String var10 = getArgs(settings, workingDir); 61 | if(!var10.isEmpty()) { 62 | var9.addParameters(MergingCommandLineArgumentsProvider.stringToArguments(var10)); 63 | } 64 | } 65 | 66 | return rubyCommandLineData; 67 | } 68 | 69 | public static String getWorkingDir(BeakerRunSettings settings, String basePath){ 70 | String workingDir = settings.getDirectory(); 71 | if (workingDir != null && !workingDir.isEmpty()) { 72 | if (!workingDir.startsWith("/") && !workingDir.startsWith("~/")) { 73 | workingDir = Paths.get(basePath, settings.getDirectory()).toAbsolutePath().toString(); 74 | } 75 | } 76 | else{ 77 | workingDir = basePath; 78 | } 79 | 80 | return workingDir; 81 | } 82 | 83 | public static String getArgs(BeakerRunSettings settings, String workingDir){ 84 | GeneralCommandLine commandLine = new GeneralCommandLine(); 85 | 86 | if (settings.getConfigFile() != null && !settings.getConfigFile().isEmpty()) { 87 | String configFile = settings.getConfigFile(); 88 | if (settings.getUseLatestPreserved()){ 89 | configFile = getLatestHostsPreserved(configFile, workingDir); 90 | } 91 | commandLine.addParameter("--hosts"); 92 | commandLine.addParameter(configFile); 93 | } 94 | 95 | if (settings.getOptionsFile() != null && !settings.getOptionsFile().isEmpty()){ 96 | commandLine.addParameter("--options-file"); 97 | commandLine.addParameter(settings.getOptionsFile()); 98 | } 99 | 100 | if (settings.getRsaKey() != null && !settings.getRsaKey().isEmpty()){ 101 | commandLine.addParameter("--keyfile"); 102 | commandLine.addParameter(settings.getRsaKey()); 103 | } 104 | 105 | if (settings.getTestFilePath() != null && !settings.getTestFilePath().isEmpty()){ 106 | commandLine.addParameter("--tests"); 107 | commandLine.addParameter(settings.getTestFilePath()); 108 | } 109 | 110 | if (settings.getAdditionalArguments() != null && !settings.getAdditionalArguments().isEmpty()){ 111 | for (String param : settings.getAdditionalArguments().split("\\s+")){ 112 | commandLine.addParameter(param); 113 | } 114 | } 115 | return commandLine.getParametersList().getParametersString(); 116 | } 117 | 118 | //Get the hosts_preserved.yml file from the latest log directory created by beaker. 119 | public static String getLatestHostsPreserved(String hostsConfigFile, String workingDir) { 120 | Path hostsConfigFilePath = Paths.get(hostsConfigFile); 121 | Path hostLogDirectoryPath = Paths.get(workingDir, "log", hostsConfigFilePath.getFileName().toString()); 122 | File fl = new File(hostLogDirectoryPath.toString()); 123 | File[] files = fl.listFiles(new FileFilter() { 124 | public boolean accept(File file) { 125 | return file.isDirectory(); 126 | } 127 | }); 128 | long lastMod = Long.MIN_VALUE; 129 | File choice = null; 130 | for (int i = 0; i < files.length; i++) { 131 | File dir = files[i]; 132 | if (dir.lastModified() > lastMod) { 133 | choice = dir; 134 | lastMod = dir.lastModified(); 135 | } 136 | } 137 | 138 | //No hosts_preserved.yml files exist yet, use the actual config. 139 | if(choice == null){ 140 | return hostsConfigFile; 141 | } 142 | Path latestPreservedPath = Paths.get(choice.getAbsolutePath(), "hosts_preserved.yml"); 143 | return latestPreservedPath.toString(); 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /src/com/puppetlabs/BeakerIntellijPlugin/settings/BeakerSettingsEditor.java: -------------------------------------------------------------------------------- 1 | package com.puppetlabs.BeakerIntellijPlugin.settings; 2 | 3 | import com.intellij.openapi.diagnostic.Logger; 4 | import com.intellij.openapi.fileChooser.FileChooserDescriptor; 5 | import com.intellij.openapi.fileChooser.FileChooserFactory; 6 | import com.intellij.openapi.options.ConfigurationException; 7 | import com.intellij.openapi.options.SettingsEditor; 8 | import com.intellij.openapi.project.Project; 9 | import com.intellij.openapi.ui.TextFieldWithBrowseButton; 10 | import com.intellij.ui.components.JBCheckBox; 11 | import com.intellij.ui.components.JBLabel; 12 | import com.intellij.util.ui.UIUtil; 13 | import com.puppetlabs.BeakerIntellijPlugin.config.BeakerRunConfiguration; 14 | import org.jetbrains.annotations.NotNull; 15 | 16 | import javax.swing.*; 17 | import java.awt.*; 18 | import java.awt.event.ActionEvent; 19 | import java.awt.event.ActionListener; 20 | 21 | public class BeakerSettingsEditor extends SettingsEditor { 22 | private static final Logger LOG = Logger.getInstance(BeakerSettingsEditor.class); 23 | 24 | private int verticalIncrementer = 1; 25 | 26 | private JPanel panel; 27 | private JBLabel rsaKeyLabel = new JBLabel("RSA Key:"); 28 | private TextFieldWithBrowseButton rsaKeyTextFieldWithBrowseButton = new TextFieldWithBrowseButton(); 29 | private JBLabel hostsConfigLabel = new JBLabel("Hosts Config file:"); 30 | private TextFieldWithBrowseButton hostsConfigTextFieldWithBrowseButton = new TextFieldWithBrowseButton(); 31 | private JBLabel optionsFileLabel = new JBLabel("Options file:"); 32 | private TextFieldWithBrowseButton optionsFileTextFieldWithBrowseButton = new TextFieldWithBrowseButton(); 33 | private JBLabel testFileLabel = new JBLabel("Test File or Dir:"); 34 | private TextFieldWithBrowseButton testFileTextFieldWithBrowseButton = new TextFieldWithBrowseButton(); 35 | private FileChooserDescriptor testFileChooserDescriptor = new FileChooserDescriptor(true, true, false, false, false, false); 36 | private JBLabel additionalArgumentsLabel = new JBLabel("Additional Arguments:"); 37 | private JTextField additionalArgumentsTextField = new JTextField(); 38 | private JBLabel workingDirectoryLabel = new JBLabel("Working Directory"); 39 | private TextFieldWithBrowseButton workingDirectoryTextFieldWithBrowseButton = new TextFieldWithBrowseButton(); 40 | private FileChooserDescriptor workingDirectoryFileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false); 41 | private JBCheckBox useLatestPreservedCheckBox = new JBCheckBox("Use latest preserved for this hosts file?"); 42 | 43 | public BeakerSettingsEditor(Project project) { 44 | panel = new JPanel(new GridBagLayout()); 45 | GridBagConstraints mainLabelConstraints = new GridBagConstraints( 46 | 0, 0, 47 | 5, 1, 48 | 0.0, 0.0, 49 | GridBagConstraints.WEST, 50 | GridBagConstraints.HORIZONTAL, 51 | new Insets(0, 0, 0, UIUtil.DEFAULT_HGAP), 52 | 0, 0 53 | ); 54 | panel.setPreferredSize(new Dimension(750, 0)); 55 | mainLabelConstraints.gridwidth = 5; 56 | JBLabel mainLabel = new JBLabel("Beaker Test Runner Configuration"); 57 | mainLabel.setHorizontalAlignment(SwingConstants.CENTER); 58 | panel.add(mainLabel, mainLabelConstraints); 59 | this.AddFileChooserToPanel(hostsConfigLabel, hostsConfigTextFieldWithBrowseButton, true); 60 | panel.add(useLatestPreservedCheckBox, getFieldConstraints()); 61 | verticalIncrementer++; 62 | this.AddFileChooserToPanel(optionsFileLabel, optionsFileTextFieldWithBrowseButton, true); 63 | this.AddProjectFileChooserToPanel(project, testFileLabel, testFileChooserDescriptor, testFileTextFieldWithBrowseButton); 64 | this.AddFileChooserToPanel(rsaKeyLabel, rsaKeyTextFieldWithBrowseButton, false); 65 | this.AddFieldToPanel(additionalArgumentsLabel, additionalArgumentsTextField); 66 | this.AddProjectFileChooserToPanel(project, workingDirectoryLabel, workingDirectoryFileChooserDescriptor, workingDirectoryTextFieldWithBrowseButton); 67 | verticalIncrementer++; 68 | } 69 | 70 | private void AddFileChooserToPanel(JBLabel chooserLabel, TextFieldWithBrowseButton textFieldWithBrowseButton, boolean hideFiles){ 71 | chooserLabel.setAnchor(textFieldWithBrowseButton); 72 | chooserLabel.setLabelFor(textFieldWithBrowseButton); 73 | final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false); 74 | final JTextField myTextField = textFieldWithBrowseButton.getTextField(); 75 | FileChooserFactory.getInstance().installFileCompletion(myTextField, descriptor, false, null); 76 | textFieldWithBrowseButton.addActionListener(new ActionListener() { 77 | @Override 78 | public void actionPerformed(ActionEvent e) { 79 | JFileChooser chooser = new JFileChooser(); 80 | chooser.setFileHidingEnabled(hideFiles); 81 | int returnVal = chooser.showDialog(panel, "Create"); 82 | if (returnVal == JFileChooser.APPROVE_OPTION) { 83 | myTextField.setText(chooser.getSelectedFile().getPath()); 84 | } 85 | } 86 | }); 87 | AddFieldToPanel(chooserLabel, textFieldWithBrowseButton); 88 | } 89 | 90 | private void AddProjectFileChooserToPanel(Project project, JBLabel chooserLabel, FileChooserDescriptor fileChooser, TextFieldWithBrowseButton textFieldWithBrowseButton){ 91 | textFieldWithBrowseButton.addBrowseFolderListener( 92 | null, 93 | null, 94 | project, 95 | fileChooser 96 | ); 97 | AddFieldToPanel(chooserLabel, textFieldWithBrowseButton); 98 | } 99 | 100 | private void AddFieldToPanel(JBLabel label, JComponent component){ 101 | label.setAnchor(component); 102 | label.setLabelFor(component); 103 | label.setMinimumSize(new Dimension(200, 0)); 104 | panel.add(label, getLabelConstraints()); 105 | panel.add(component, getFieldConstraints()); 106 | verticalIncrementer++; 107 | } 108 | 109 | @NotNull 110 | private GridBagConstraints getLabelConstraints() { 111 | return new GridBagConstraints( 112 | 0, verticalIncrementer, 113 | 2, 1, 114 | 0.17, 0.0, 115 | GridBagConstraints.WEST, 116 | GridBagConstraints.HORIZONTAL, 117 | new Insets(UIUtil.DEFAULT_VGAP, 0, 0, UIUtil.DEFAULT_HGAP), 118 | 0, 0 119 | ); 120 | } 121 | 122 | @NotNull 123 | private GridBagConstraints getFieldConstraints() { 124 | return new GridBagConstraints( 125 | 2, verticalIncrementer, 126 | 3, 1, 127 | 0.83, 0.0, 128 | GridBagConstraints.WEST, 129 | GridBagConstraints.HORIZONTAL, 130 | new Insets(UIUtil.DEFAULT_VGAP, 0, 0, UIUtil.DEFAULT_HGAP), 131 | 0, 0 132 | ); 133 | } 134 | 135 | @Override 136 | protected void resetEditorFrom(BeakerRunConfiguration runConfiguration) { 137 | BeakerRunSettings runSettings = runConfiguration.getRunSettings(); 138 | if (runSettings == null){ 139 | LOG.info("Beaker Intellij Plugin - Run Settings were null, getting default settings."); 140 | runSettings = new BeakerRunSettings(); 141 | } 142 | 143 | rsaKeyTextFieldWithBrowseButton.getTextField().setText(runSettings.getRsaKey()); 144 | hostsConfigTextFieldWithBrowseButton.getTextField().setText(runSettings.getConfigFile()); 145 | useLatestPreservedCheckBox.setSelected(runSettings.getUseLatestPreserved()); 146 | optionsFileTextFieldWithBrowseButton.getTextField().setText(runSettings.getOptionsFile()); 147 | testFileTextFieldWithBrowseButton.getTextField().setText(runSettings.getTestFilePath()); 148 | additionalArgumentsTextField.setText(runSettings.getAdditionalArguments()); 149 | LOG.debug("working directory = '" + runSettings.getDirectory() + "'"); 150 | workingDirectoryTextFieldWithBrowseButton.getTextField().setText(runSettings.getDirectory()); 151 | } 152 | 153 | @Override 154 | protected void applyEditorTo(BeakerRunConfiguration runConfiguration) throws ConfigurationException { 155 | runConfiguration.setRunSettings( 156 | rsaKeyTextFieldWithBrowseButton.getTextField().getText(), 157 | hostsConfigTextFieldWithBrowseButton.getTextField().getText(), 158 | useLatestPreservedCheckBox.isSelected(), 159 | optionsFileTextFieldWithBrowseButton.getTextField().getText(), 160 | testFileTextFieldWithBrowseButton.getTextField().getText(), 161 | additionalArgumentsTextField.getText(), 162 | workingDirectoryTextFieldWithBrowseButton.getTextField().getText()); 163 | } 164 | 165 | @NotNull 166 | @Override 167 | protected JComponent createEditor() { 168 | return panel; 169 | } 170 | 171 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------