/* * Copyright (c) 2018-2022, FusionAuth, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the License. */ pubVersion = "" project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.41.0", licenses: ["ApacheV2_0"]) { workflow { fetch { cache() url(url: "https://repository.savantbuild.org") } publish { cache() } } publishWorkflow { subversion(repository: "https://svn.savantbuild.org") } pubVersion = project.version.toString().replaceAll('-', '.pre.') publications { main { publication(name: "fusionauth_client", type: "gem", file: "pkg/fusionauth_client-${pubVersion}.gem") } } } // Plugins file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.4") release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.4") target(name: "clean", description: "Cleans build directory") { file.prune(dir: 'pkg') } target(name: "compile", description: "Compiles the source code") { ProcessBuilder pb = new ProcessBuilder('rake', 'build').inheritIO() clearEnvironment(pb) if (pb.start().waitFor() != 0) { fail("Build failed") } } target(name: "test", description: "Runs the project's unit tests", dependsOn: ["compile"]) { ProcessBuilder pb = new ProcessBuilder('rake', 'test').inheritIO() clearEnvironment(pb) if (pb.start().waitFor() != 0) { fail("Tests failed") } } target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["compile"]) { // No-op } target(name: "idea", description: "Updates the IntelliJ IDEA module file") { // No-op } target(name: "bundle", description: "Builds the project release bundle", dependsOn: ["int"]) { } target(name: "publish", description: "Publish the GEM file", dependsOn: ["clean", "compile"]) { ProcessBuilder pb = new ProcessBuilder('gem', 'push', "pkg/fusionauth_client-${pubVersion}.gem").inheritIO() clearEnvironment(pb) if (pb.start().waitFor() != 0) { fail("Gem push failed") } } target(name: "release", description: "Releases a full version of the project", dependsOn: ["clean", "int"]) { release.release() } /** * Clears out the RBENV variables in the environment. * * @param pb THe ProcessBuilder to clear out. */ private static void clearEnvironment(ProcessBuilder pb) { pb.environment().remove("RBENV_VERSION") pb.environment().remove("RBENV_DIR") pb.environment().remove("RBENV_ROOT") }