Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Start working on npm source

  • Loading branch information...
commit a9aa68a05089a5a5c2394635eefd059d6b2be151 1 parent 44c5656
@jordansissel authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 lib/fpm/source/npm.rb
View
35 lib/fpm/source/npm.rb
@@ -0,0 +1,35 @@
+require "fpm/namespace"
+require "fpm/source"
+require "fileutils"
+
+class FPM::Source::Npm < FPM::Source
+ def get_source(params)
+ @npm = @paths.first
+ end # def get_source
+
+ def download(npm_name, version=nil)
+ end # def download
+
+ def get_metadata
+ # set self[:...] values
+ # :name
+ # :maintainer
+ # :url
+ # :category
+ # :dependencies
+ end # def get_metadata
+
+ def make_tarball!(tar_path, builddir)
+ tmpdir = "#{tar_path}.dir"
+ installdir = "#{tmpdir}/#{::Gem::dir}"
+ ::FileUtils.mkdir_p(installdir)
+ args = ["gem", "install", "--quiet", "--no-ri", "--no-rdoc",
+ "--install-dir", installdir, "--ignore-dependencies", @paths.first]
+ system(*args)
+ tar(tar_path, ".", tmpdir)
+
+ # TODO(sissel): Make a helper method.
+ system(*["gzip", "-f", tar_path])
+ end
+
+end # class FPM::Source::Gem
Please sign in to comment.
Something went wrong with that request. Please try again.