rubyfmt: init at 0.8.1
This commit is contained in:
committed by
Anderson Torres
parent
b6fbd87328
commit
6f53567aa8
@@ -0,0 +1,25 @@
|
||||
From d9df7aaaaf9c758499f569376a041045d99e4015 Mon Sep 17 00:00:00 2001
|
||||
From: Bob van der Linden <bobvanderlinden@gmail.com>
|
||||
Date: Thu, 9 Feb 2023 16:17:46 +0100
|
||||
Subject: [PATCH 1/2] cargo: lock: update version
|
||||
|
||||
---
|
||||
Cargo.lock | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 79a81d1..374c10a 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -642,7 +642,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rubyfmt-main"
|
||||
-version = "0.8.0-pre"
|
||||
+version = "0.8.1"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"clap",
|
||||
--
|
||||
2.39.1
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From 3bbc396c4ddc8a5e26f7776155bb366c8d47c440 Mon Sep 17 00:00:00 2001
|
||||
From: Bob van der Linden <bobvanderlinden@gmail.com>
|
||||
Date: Thu, 9 Feb 2023 16:55:00 +0100
|
||||
Subject: [PATCH 2/2] remove dependency on git
|
||||
|
||||
---
|
||||
librubyfmt/build.rs | 35 +++--------------------------------
|
||||
1 file changed, 3 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/librubyfmt/build.rs b/librubyfmt/build.rs
|
||||
index ef94c09..4668785 100644
|
||||
--- a/librubyfmt/build.rs
|
||||
+++ b/librubyfmt/build.rs
|
||||
@@ -26,27 +26,9 @@ fn main() -> Output {
|
||||
let path = std::env::current_dir()?;
|
||||
let ruby_checkout_path = path.join("ruby_checkout");
|
||||
|
||||
- let old_checkout_sha = if ruby_checkout_path.join(ripper).exists() {
|
||||
- Some(get_ruby_checkout_sha())
|
||||
- } else {
|
||||
- None
|
||||
- };
|
||||
-
|
||||
- let _ = Command::new("git")
|
||||
- .args(&["submodule", "update", "--init"])
|
||||
- .status();
|
||||
-
|
||||
- let new_checkout_sha = get_ruby_checkout_sha();
|
||||
-
|
||||
- // Only rerun this build if the ruby_checkout has changed
|
||||
- match old_checkout_sha {
|
||||
- Some(old_sha) if old_sha == new_checkout_sha => {}
|
||||
- _ => {
|
||||
- make_configure(&ruby_checkout_path)?;
|
||||
- run_configure(&ruby_checkout_path)?;
|
||||
- build_ruby(&ruby_checkout_path)?;
|
||||
- }
|
||||
- }
|
||||
+ make_configure(&ruby_checkout_path)?;
|
||||
+ run_configure(&ruby_checkout_path)?;
|
||||
+ build_ruby(&ruby_checkout_path)?;
|
||||
|
||||
cc::Build::new()
|
||||
.file("src/rubyfmt.c")
|
||||
@@ -152,14 +134,3 @@ fn check_process_success(command: &str, code: ExitStatus) -> Output {
|
||||
}
|
||||
}
|
||||
|
||||
-fn get_ruby_checkout_sha() -> String {
|
||||
- String::from_utf8(
|
||||
- Command::new("git")
|
||||
- .args(&["rev-parse", "HEAD"])
|
||||
- .current_dir("./ruby_checkout")
|
||||
- .output()
|
||||
- .expect("git rev-parse shouldn't fail")
|
||||
- .stdout,
|
||||
- )
|
||||
- .expect("output should be valid utf8")
|
||||
-}
|
||||
--
|
||||
2.39.1
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, autoconf
|
||||
, automake
|
||||
, bison
|
||||
, ruby
|
||||
, zlib
|
||||
, libxcrypt
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "rubyfmt";
|
||||
version = "0.8.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "fables-tales";
|
||||
repo = "rubyfmt";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-lHq9lcLMp6HUHMonEe3T2YGwMYW1W131H1jo1cy6kyc=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoconf
|
||||
automake
|
||||
bison
|
||||
ruby
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
zlib
|
||||
libxcrypt
|
||||
];
|
||||
|
||||
cargoPatches = [
|
||||
# The 0.8.1 release did not have an up-to-date lock file. The rubyfmt
|
||||
# version in Cargo.toml was bumped, but it wasn't updated in the lock file.
|
||||
./0001-cargo-lock-update-version.patch
|
||||
|
||||
# Avoid checking whether ruby gitsubmodule is up-to-date.
|
||||
./0002-remove-dependency-on-git.patch
|
||||
];
|
||||
|
||||
cargoHash = "sha256-keeIonGNgE0U0IVi8DeXAy6ygTXVXH+WDjob36epUDI=";
|
||||
|
||||
preFixup = ''
|
||||
mv $out/bin/rubyfmt{-main,}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Ruby autoformatter";
|
||||
homepage = "https://github.com/fables-tales/rubyfmt";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ bobvanderlinden ];
|
||||
};
|
||||
}
|
||||
@@ -17863,6 +17863,8 @@ with pkgs;
|
||||
|
||||
rbenv = callPackage ../development/ruby-modules/rbenv { };
|
||||
|
||||
rubyfmt = callPackage ../development/tools/rubyfmt { };
|
||||
|
||||
inherit (callPackage ../development/interpreters/ruby {
|
||||
inherit (darwin) libobjc libunwind;
|
||||
inherit (darwin.apple_sdk.frameworks) Foundation;
|
||||
|
||||
Reference in New Issue
Block a user