Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ruby_installer/2.7.3 #1387

Merged
merged 7 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/conan.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env:
splitByBuildTypes: "true"
BPT_SPLIT_BY_BUILD_TYPES: "true"
CONAN_REMOTES: "https://bincrafters.jfrog.io/artifactory/api/conan/public-conan@bincrafters"
CONAN_UPLOAD: "https://bincrafters.jfrog.io/artifactory/api/conan/conan"

Expand All @@ -9,14 +9,14 @@ on:
branches: ["main"]
pull_request:

# bincrafters-conventions:gha-workflow-version:10
# bincrafters-conventions:gha-workflow-version:11
# You can add custom environment variables above the version tag
# Do not modify the tag or anything below the tag
# This script gets automatically updated
#
# Possible configurations:
# env:
# splitByBuildTypes: "false" # Possible values "false", "true", default: false
# BPT_SPLIT_BY_BUILD_TYPES: "false" # Possible values "false", "true", default: false
#
# You can furthermore set any environment variable understood by Conan and Conan Package Tools
#
Expand Down Expand Up @@ -44,8 +44,6 @@ jobs:
conan user
- name: Generate Job Matrix
id: set-matrix
env:
splitByBuildTypes: ${{ env.splitByBuildTypes }}
run: |
MATRIX=$(bincrafters-package-tools generate-ci-jobs --platform gha)
echo "${MATRIX}"
Expand Down
102 changes: 102 additions & 0 deletions recipes/ruby_installer/2.x.x/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import os
from conans import ConanFile, tools, AutoToolsBuildEnvironment


class RubyInstallerConan(ConanFile):
name = "ruby_installer"
license = "Ruby"
settings = "os", "arch", "compiler", "build_type"
url = "https://github.com/bincrafters/community"
homepage = "https://www.ruby-lang.org"
description = "Ruby is an interpreted, high-level, general-purpose programming language"
topics = ("installer", "ruby", "gem")
_autotools = None

@property
def _api_version(self):
return "2.7.0"

@property
def _rubyinstaller_release(self):
return "1"

@property
def _source_subfolder(self):
return "source_subfolder"

def package_id(self):
del self.info.settings.compiler

def requirements(self):
if self.settings.os == "Linux":
self.requires("zlib/1.2.11")

def build_requirements(self):
if self.settings.os == "Windows":
self.build_requires("7zip/19.00")
else:
self.build_requires("openssl/1.1.1k")

def source(self):
sha256 = "8925a95e31d8f2c81749025a52a544ea1d05dad18794e6828709268b92e55338"
source_url = "https://cache.ruby-lang.org"
tools.get("{}/pub/ruby/{}/ruby-{}.tar.gz".format(
source_url,
self.version.rpartition(".")[0],
self.version), sha256=sha256)
extracted_folder = "ruby-" + self.version
os.rename(extracted_folder, self._source_subfolder)

def _configure_autotools(self):
if not self._autotools:
self._autotools = AutoToolsBuildEnvironment(self)
args = [
"--disable-install-doc",
"--with-out-ext=gdbm,pty,readline,syslog",
"--without-gmp",
"--enable-load-relative",
"--with-openssl-dir={}".format(self.deps_cpp_info["openssl"]
.rootpath)
]
self._autotools.configure(args=args, configure_dir=self._source_subfolder)
return self._autotools

def _configure_installer(self):
# Extract binaries into a directory called "ruby"
arch = {"x86": "x86",
"x86_64": "x64"}[str(self.settings.arch)]
name = "RubyInstaller-{}-{}".format(self.version, self._rubyinstaller_release)
folder = "{}-{}".format(name.lower(), arch)
url = "https://github.com/oneclick/rubyinstaller2/releases/download/{}/{}.7z".format(
name, folder)
tools.download(url, "ruby.7z")
self.run("7z x {}".format("ruby.7z"), run_environment=True)
tools.rmdir(self._source_subfolder)
os.rename(folder, self._source_subfolder)
# Remove non-standard defaults directory
tools.rmdir(os.path.join(self._source_subfolder, "lib", "ruby", self._api_version, "rubygems", "defaults"))

def build(self):
if self.settings.os == "Windows":
self._configure_installer()
else:
autotools = self._configure_autotools()
autotools.make()

def package(self):
if self.settings.os == "Windows":
self.copy("*", src=self._source_subfolder, symlinks=True, excludes="LICENSE.txt")
self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder)
else:
self.copy("COPYING", dst="licenses", src=self._source_subfolder)
self.copy("LEGAL", dst="licenses", src=self._source_subfolder)
self.copy("GPL", dst="licenses", src=self._source_subfolder)
autotools = self._configure_autotools()
autotools.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))

def package_info(self):
bindir = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bindir))
self.env_info.PATH.append(bindir)
15 changes: 15 additions & 0 deletions recipes/ruby_installer/2.x.x/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
from conans import ConanFile


class RubyInstallerTestConan(ConanFile):
settings = "os", "arch", "build_type", "arch"
generators = "txt"

def build(self):
pass

def test(self):
self.run("ruby -v", run_environment=True)
self.run("ruby -e \"puts 'hello'\"", run_environment=True)
self.run("ruby -e \"require 'date';puts Date.today\" --disable-gems", run_environment=True)
3 changes: 3 additions & 0 deletions recipes/ruby_installer/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"2.7.3":
folder: "2.x.x"