fpm 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
2
 
4
3
  require "optparse"
5
4
  require "ostruct"
@@ -40,17 +39,18 @@ builddir="#{Dir.pwd}/npm2pkg"
40
39
  # Prefix package names with 'nodejs-'
41
40
  PACKAGEPREFIX = "nodejs-"
42
41
 
43
- INSTALLPATH="/usr/lib/node"
44
42
  Dir.mkdir(builddir) if !File.exists?(builddir)
45
43
  File.open("#{builddir}/.npmrc", "w") do |file|
46
- file.puts "root = #{builddir}#{INSTALLPATH}"
44
+ file.puts "root = #{builddir}/usr/lib/node"
45
+ file.puts "binroot = #{builddir}/usr/lib/node/bin"
46
+ file.puts "manroot = #{builddir}/usr/share/man"
47
47
  end
48
48
 
49
49
  ## Trick npm into using a custom .npmrc
50
50
  system("env - PATH=$PATH HOME=#{builddir} npm install #{settings.name} #{settings.version}")
51
51
 
52
52
  # Find all installed npms in builddir, make packages.
53
- Dir.glob("#{builddir}#{INSTALLPATH}/.npm/*/*") do |path|
53
+ Dir.glob("#{builddir}/usr/lib/node/.npm/*/*") do |path|
54
54
  next if File.symlink?(path)
55
55
  puts path
56
56
 
@@ -86,10 +86,19 @@ Dir.glob("#{builddir}#{INSTALLPATH}/.npm/*/*") do |path|
86
86
 
87
87
  pkgcmd += ["-p", "#{PACKAGEPREFIX}#{package["name"]}-VERSION_ARCH.deb"]
88
88
  pkgcmd += ["-C", builddir]
89
- pkgcmd << "#{INSTALLPATH[1..-1]}/.npm/#{package["name"]}/active"
90
- pkgcmd << "#{INSTALLPATH[1..-1]}/#{package["name"]}"
91
- pkgcmd << "#{INSTALLPATH[1..-1]}/#{package["name"]}@#{package["version"]}"
89
+ pkgcmd << "usr/lib/node/.npm/#{package["name"]}/active"
90
+ pkgcmd << "usr/lib/node/.npm/#{package["name"]}/#{package["version"]}"
91
+ pkgcmd << "usr/lib/node/#{package["name"]}"
92
+ pkgcmd << "usr/lib/node/#{package["name"]}@#{package["version"]}"
93
+
94
+ # Include bin files, install to usr/lib/node/bin
95
+ (package["bin"] or []).each do |bin, script|
96
+ pkgcmd << "usr/lib/node/bin/#{bin}"
97
+ pkgcmd << "usr/lib/node/bin/#{bin}@#{package["version"]}"
98
+ end
99
+
100
+ # TODO(sissel): We could include manpages and docs, but I don't care right
101
+ # now. If you want it, I accept patches! :)
92
102
 
93
- puts pkgcmd.map { |x| "\"#{x}\"" }.join(" ")
94
103
  system *pkgcmd
95
104
  end
@@ -47,7 +47,7 @@ class FPM::Deb < FPM::Package
47
47
 
48
48
  # Generate 'control' file
49
49
  template = File.new("#{File.dirname(__FILE__)}/../../templates/deb.erb").read()
50
- control = ERB.new(template).result(binding)
50
+ control = ERB.new(template, nil, "<>").result(binding)
51
51
  File.open("#{builddir}/control", "w") { |f| f.puts control }
52
52
  end
53
53
 
@@ -40,11 +40,12 @@ class FPM::Package
40
40
 
41
41
  def initialize
42
42
  @iteration = 1
43
- @url = ""
43
+ @url = "http://nourlgiven.example.com/no/url/given"
44
44
  @category = "default"
45
45
  @license = "unknown"
46
46
  @maintainer = "<#{ENV["USER"]}@#{Socket.gethostname}>"
47
47
  @architecture = nil
48
+ @summary = "no summary given"
48
49
 
49
50
  # Garbage is stuff you may want to clean up.
50
51
  @garbage = []
@@ -1,11 +1,13 @@
1
1
  Package: <%= @name %>
2
2
  Version: <%= @version %>-<%= @iteration %>
3
3
  Architecture: <%= @architecture %>
4
- Maintainer: <%= @maintainer %>
4
+ Maintainer: <%= @maintainer or "<unknown>" %>
5
+ <% if @dependencies.size > 0 %>
5
6
  Depends: <%= @dependencies.join(", ") %>
6
- Section: <%= @category %>
7
+ <% end %>
8
+ Standards-Version: 3.9.1
9
+ Section: <%= @category or "unknown" %>
7
10
  Priority: extra
8
- Homepage: <%= @url %>
9
- Description: <%= @summary %>
10
- <%= @summary %>
11
-
11
+ Homepage: <%= @url or "http://nourlgiven.example.com/" %>
12
+ Description: <%= @summary or "no summary given" %>
13
+ <%= @summary or "no description given"%>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordan Sissel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-03 00:00:00 -08:00
18
+ date: 2011-01-04 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency