forked from cstrahan/bundix
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Existing shell.nix didn't work for me.
- Loading branch information
Showing
3 changed files
with
72 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new do |t| | ||
t.pattern = 'test/*.rb' | ||
t.warning = false | ||
end | ||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
with (import <nixpkgs> {}); | ||
let | ||
ruby = pkgs.ruby_2_4_1; | ||
bundler = pkgs.bundler.override { inherit ruby; }; | ||
gems = bundlerEnv { | ||
minitest = buildRubyGem { | ||
inherit ruby; | ||
name = "bundix-gems"; | ||
gemdir = ./.; | ||
gemName = "minitest"; | ||
type = "gem"; | ||
version = "5.10.1"; | ||
sha256 = "1yk2m8sp0p5m1niawa3ncg157a4i0594cg7z91rzjxv963rzrwab"; | ||
gemPath = []; | ||
}; | ||
|
||
rake = buildRubyGem { | ||
inherit ruby; | ||
gemName = "rake"; | ||
type = "gem"; | ||
version = "12.0.0"; | ||
sha256 = "01j8fc9bqjnrsxbppncai05h43315vmz9fwg28qdsgcjw9ck1d7n"; | ||
gemPath = []; | ||
}; | ||
in | ||
stdenv.mkDerivation { | ||
name = "bundix-shell"; | ||
buildInputs = [ | ||
bundler | ||
(lowPrio gems) | ||
ruby | ||
postgresql96 | ||
]; | ||
stdenv.mkDerivation { | ||
name = "bundix"; | ||
src = ./.; | ||
phases = "installPhase"; | ||
installPhase = '' | ||
mkdir -p $out | ||
makeWrapper $src/bin/bundix $out/bin/bundix \ | ||
--prefix PATH : "${nix.out}/bin" \ | ||
--prefix PATH : "${nix-prefetch-git.out}/bin" \ | ||
--set GEM_PATH "${bundler}/${bundler.ruby.gemPath}" | ||
''; | ||
|
||
nativeBuildInputs = [makeWrapper]; | ||
|
||
buildInputs = [bundler ruby minitest rake nix-prefetch-scripts]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'minitest/autorun' | ||
require 'bundix/commandline' | ||
|
||
class CommandLineTest < Minitest::Test | ||
def setup | ||
@cli = Bundix::CommandLine.new | ||
@options = { | ||
project: "test-project", | ||
ruby: "test-ruby", | ||
gemfile: "test-gemfile", | ||
lockfile: "test-lockfile", | ||
gemset: "test-gemset", | ||
} | ||
end | ||
|
||
def test_shell_nix | ||
assert_equal(@cli.shell_nix_string(@options), <<SHELLNIX) | ||
with (import <nixpkgs> {}); | ||
let | ||
env = bundlerEnv { | ||
name = "test-project-bundler-env"; | ||
inherit test-ruby; | ||
gemfile = ./test-gemfile; | ||
lockfile = ./test-lockfile; | ||
gemset = ./test-gemset; | ||
}; | ||
in stdenv.mkDerivation { | ||
name = "test-project"; | ||
buildInputs = [ env ]; | ||
} | ||
SHELLNIX | ||
|
||
end | ||
end |