gem2deb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/gem2deb.gemspec ADDED
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{gem2deb}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["David A. Cuadrado"]
12
+ s.date = %q{2009-10-17}
13
+ s.email = %q{krawek@gmail.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "TODO",
25
+ "VERSION",
26
+ "gem2deb.gemspec",
27
+ "lib/commands/deb.rb",
28
+ "lib/rubygems_plugin.rb",
29
+ "lib/templates/debian/changelog",
30
+ "lib/templates/debian/compat",
31
+ "lib/templates/debian/control",
32
+ "lib/templates/debian/copyright",
33
+ "lib/templates/debian/rules",
34
+ "lib/templates/executable",
35
+ "test/gem2deb_test.rb",
36
+ "test/test_helper.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/dcu/gem2deb}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.5}
42
+ s.summary = %q{Convert ruby gems to debian packages}
43
+ s.test_files = [
44
+ "test/test_helper.rb",
45
+ "test/gem2deb_test.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ else
54
+ end
55
+ else
56
+ end
57
+ end
data/lib/commands/deb.rb CHANGED
@@ -42,6 +42,8 @@ class Gem::Commands::DebCommand < Gem::Command
42
42
  @templates_dir = File.dirname(__FILE__)+"/../templates"
43
43
  @install_dir = Dir.tmpdir+"/gemdeb_home"
44
44
  @current_dir = Dir.getwd
45
+ @rubylibdir = Config::CONFIG["rubylibdir"]
46
+ @dist_dir = "#{@rubylibdir}/deb"
45
47
 
46
48
  FileUtils.mkpath(@install_dir)
47
49
  end
@@ -96,8 +98,7 @@ class Gem::Commands::DebCommand < Gem::Command
96
98
 
97
99
  tpl_path = File.join(debian_tpl_dir, tpl)
98
100
 
99
- @tpl_options = {:spec => spec, :files => files}
100
- @tpl_options[:libdir] = Config::CONFIG["rubylibdir"]
101
+ @tpl_options = {:spec => spec, :files => files, :distdir => "#{@dist_dir}/#{spec.full_name}"}
101
102
  @tpl_options[:arch] = "all" # FIXME: autodetect
102
103
 
103
104
  data = ERB.new(File.read(tpl_path)).result(binding)
@@ -106,6 +107,17 @@ class Gem::Commands::DebCommand < Gem::Command
106
107
  end
107
108
  end
108
109
 
110
+ binary_dir = debian_dir+"/bin/"
111
+ FileUtils.mkpath(binary_dir)
112
+
113
+ spec.executables.each do |executable_name|
114
+ executable = ERB.new(File.read(@templates_dir + "/executable")).result(binding)
115
+
116
+ File.open("#{binary_dir}/#{executable_name}", "w") do |f|
117
+ f.puts executable
118
+ end
119
+ end
120
+
109
121
  old_umask=File.umask(0)
110
122
  File.chmod(0755, "#{debian_dir}/rules")
111
123
  File.umask(old_umask)
@@ -3,23 +3,25 @@ SHELL = /bin/bash
3
3
 
4
4
  tmp = debian/tmp
5
5
  bindir = /usr/bin
6
- libdir = <%= @tpl_options[:libdir] %>
7
-
6
+ libdir = <%= @rubylibdir %>
7
+ distdir = <%= @tpl_options[:distdir] %>
8
8
 
9
9
  build:
10
10
  dh_testdir
11
11
 
12
- mkdir -p "$(tmp)$(libdir)/deb/"
12
+ mkdir -p "$(tmp)$(distdir)" "$(tmp)$(bindir)"
13
13
  <% @tpl_options[:files].each do |file| %>
14
14
  <% next if file =~ /^debian/ %>
15
- -cp -r <%= file %> "$(tmp)$(libdir)/deb/"
15
+ -cp -r <%= file %> "$(tmp)$(distdir)"
16
16
  <% end %>
17
+ -cp -r debian/bin/* "$(tmp)$(bindir)"
17
18
 
18
19
  install: build
19
20
  dh_testdir
20
21
  dh_testroot
21
22
 
22
- echo "$(tmp)$(libdir)/deb/" >debian/<%= @tpl_options[:spec].name %>.install
23
+ echo "$(tmp)$(distdir)" >debian/<%= @tpl_options[:spec].name %>.install
24
+ echo "$(tmp)$(bindir)" >>debian/<%= @tpl_options[:spec].name %>.install
23
25
 
24
26
  dh_install
25
27
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by gem2deb.
4
+ #
5
+ load "<%= File.join(@dist_dir, spec.full_name) %>/bin/<%= executable_name %>"
6
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem2deb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David A. Cuadrado
@@ -29,6 +29,8 @@ files:
29
29
  - README.rdoc
30
30
  - Rakefile
31
31
  - TODO
32
+ - VERSION
33
+ - gem2deb.gemspec
32
34
  - lib/commands/deb.rb
33
35
  - lib/rubygems_plugin.rb
34
36
  - lib/templates/debian/changelog
@@ -36,6 +38,7 @@ files:
36
38
  - lib/templates/debian/control
37
39
  - lib/templates/debian/copyright
38
40
  - lib/templates/debian/rules
41
+ - lib/templates/executable
39
42
  - test/gem2deb_test.rb
40
43
  - test/test_helper.rb
41
44
  has_rdoc: true