nix 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -82,7 +82,10 @@ class Gem::Commands::NixCommand < Gem::Command
82
82
  begin
83
83
  @prerelease = false;
84
84
 
85
- args = options[:args];
85
+ options[:nix_file] = options[:nix_file] ||
86
+ (options[:user_install] ? options[:user_generated_nix] : options[:system_generated_nix])
87
+
88
+ args = options[:args]
86
89
 
87
90
  if FileTest.exists?(options[:nix_file])
88
91
  raise "File #{options[:nix_file]} is not a regular file" unless FileTest.file?(options[:nix_file])
@@ -97,6 +100,7 @@ class Gem::Commands::NixCommand < Gem::Command
97
100
  end
98
101
 
99
102
  args.sort!
103
+ args.uniq!
100
104
 
101
105
  say "Will generate nix file for the following gems: #{args.join ', '}" if Gem::configuration.really_verbose
102
106
 
@@ -162,7 +166,7 @@ class Gem::Commands::NixCommand < Gem::Command
162
166
  @gems_with_deps[full_name] = nil # there maybe circular dependencies. thus mark this gem seen as early as possible
163
167
 
164
168
  # development deps can't be found. Some are old. Thus only add rutime dependencies
165
- deps = spec.dependencies.find_all { |d| d.type == :runtime }
169
+ deps = spec.dependencies.find_all { |d| d.type != :development }
166
170
 
167
171
  say " total deps of #{full_name}: #{deps.length}" if Gem.configuration.really_verbose
168
172
 
@@ -192,6 +196,8 @@ class Gem::Commands::NixCommand < Gem::Command
192
196
  end
193
197
  end
194
198
 
199
+ raise "#{dep.name} not found!" unless @specs_by_name.key?(dep.name)
200
+
195
201
  found = @specs_by_name[dep.name].select do |version, spec_platform, source_uri|
196
202
  dep.match?(dep.name, version)
197
203
  end
@@ -1,3 +1,3 @@
1
1
  module Nix
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,15 +4,26 @@ require 'rubygems/dependency_installer'
4
4
  class Gem::Commands::NixCommand < Gem::Command
5
5
  def initialize
6
6
  defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
7
- :nix_file => ENV.fetch('NIXPKGS_ALL', '/etc/nixos/nixpkgs') + '/pkgs/development/interpreters/ruby/gems-generated.nix',
7
+ :system_generated_nix => ENV.fetch('NIXPKGS_ALL', '/etc/nixos/nixpkgs') + '/pkgs/development/interpreters/ruby/generated.nix',
8
+ :user_generated_nix => ENV['HOME'] + '/.nixpkgs/gems/generated.nix',
9
+ :user_install => true,
10
+ :nix_file => nil,
8
11
  :ignore_existing => false
9
12
  })
10
13
  super 'nix', 'Create a nix file containing expressions of the gems', defaults
11
14
 
12
- add_option('--nix-file=/path/to/gems-generated.nix', 'Use specified nix file instead of default one') do |value, options|
15
+ add_option('--nix-file=/path/to/generated.nix', 'Use specified nix file instead of default one') do |value, options|
13
16
  options[:nix_file] = value
14
17
  end
15
18
 
19
+ add_option('--[no-]user-install',
20
+ "Which generated.nix file to use:",
21
+ " * user-specific (#{defaults[:user_generated_nix]})",
22
+ " * system-wide (#{defaults[:system_generated_nix]})"
23
+ ) do |value, options|
24
+ options[:user_install] = value
25
+ end
26
+
16
27
  add_option('--[no-]ignore-existing', 'Ignore gems from the previous run') do |value, options|
17
28
  options[:ignore_existing] = value
18
29
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nix
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- version: "0.1"
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Yury G. Kudryashov
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-01-18 00:00:00 +03:00
18
+ date: 2011-04-04 00:00:00 +04:00
18
19
  default_executable:
19
20
  dependencies: []
20
21