dpkg-tools 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/CHANGES +198 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +17 -0
  4. data/Rakefile +1 -0
  5. data/bin/dpkg-etc +6 -0
  6. data/bin/dpkg-gem +6 -0
  7. data/bin/dpkg-rails +6 -0
  8. data/lib/dpkg-tools.rb +6 -0
  9. data/lib/dpkg-tools/command_line.rb +142 -0
  10. data/lib/dpkg-tools/package.rb +30 -0
  11. data/lib/dpkg-tools/package/builder.rb +112 -0
  12. data/lib/dpkg-tools/package/config.rb +96 -0
  13. data/lib/dpkg-tools/package/control_files.rb +24 -0
  14. data/lib/dpkg-tools/package/control_files/base.rb +75 -0
  15. data/lib/dpkg-tools/package/control_files/changelog.rb +23 -0
  16. data/lib/dpkg-tools/package/control_files/control.rb +148 -0
  17. data/lib/dpkg-tools/package/control_files/copyright.rb +27 -0
  18. data/lib/dpkg-tools/package/control_files/rakefile.rb +28 -0
  19. data/lib/dpkg-tools/package/control_files/rules.rb +29 -0
  20. data/lib/dpkg-tools/package/data.rb +125 -0
  21. data/lib/dpkg-tools/package/etc.rb +26 -0
  22. data/lib/dpkg-tools/package/etc/builder.rb +19 -0
  23. data/lib/dpkg-tools/package/etc/control_files.rb +22 -0
  24. data/lib/dpkg-tools/package/etc/control_files/changelog.rb +30 -0
  25. data/lib/dpkg-tools/package/etc/control_files/rakefile.rb +18 -0
  26. data/lib/dpkg-tools/package/etc/data.rb +48 -0
  27. data/lib/dpkg-tools/package/etc/rake.rb +31 -0
  28. data/lib/dpkg-tools/package/etc/setup.rb +30 -0
  29. data/lib/dpkg-tools/package/fs_methods.rb +10 -0
  30. data/lib/dpkg-tools/package/gem.rb +43 -0
  31. data/lib/dpkg-tools/package/gem/builder.rb +77 -0
  32. data/lib/dpkg-tools/package/gem/control_files.rb +23 -0
  33. data/lib/dpkg-tools/package/gem/control_files/changelog.rb +19 -0
  34. data/lib/dpkg-tools/package/gem/control_files/copyright.rb +24 -0
  35. data/lib/dpkg-tools/package/gem/control_files/rakefile.rb +19 -0
  36. data/lib/dpkg-tools/package/gem/data.rb +115 -0
  37. data/lib/dpkg-tools/package/gem/gem_format.rb +10 -0
  38. data/lib/dpkg-tools/package/gem/rake.rb +37 -0
  39. data/lib/dpkg-tools/package/gem/setup.rb +159 -0
  40. data/lib/dpkg-tools/package/rails.rb +26 -0
  41. data/lib/dpkg-tools/package/rails/builder.rb +77 -0
  42. data/lib/dpkg-tools/package/rails/cap.rb +30 -0
  43. data/lib/dpkg-tools/package/rails/control_files.rb +22 -0
  44. data/lib/dpkg-tools/package/rails/control_files/changelog.rb +19 -0
  45. data/lib/dpkg-tools/package/rails/control_files/rakefile.rb +24 -0
  46. data/lib/dpkg-tools/package/rails/data.rb +160 -0
  47. data/lib/dpkg-tools/package/rails/rake.rb +40 -0
  48. data/lib/dpkg-tools/package/rails/setup.rb +84 -0
  49. data/lib/dpkg-tools/package/rake.rb +90 -0
  50. data/lib/dpkg-tools/package/setup.rb +145 -0
  51. data/lib/dpkg-tools/version.rb +23 -0
  52. data/spec/dpkg-tools/command_line_spec.rb +9 -0
  53. data/spec/dpkg-tools/package/builder_spec.rb +159 -0
  54. data/spec/dpkg-tools/package/config_spec.rb +150 -0
  55. data/spec/dpkg-tools/package/control_files/base_spec.rb +111 -0
  56. data/spec/dpkg-tools/package/control_files/changelog_spec.rb +22 -0
  57. data/spec/dpkg-tools/package/control_files/control_spec.rb +131 -0
  58. data/spec/dpkg-tools/package/control_files/copyright_spec.rb +29 -0
  59. data/spec/dpkg-tools/package/control_files/rakefile_spec.rb +37 -0
  60. data/spec/dpkg-tools/package/control_files/rules_spec.rb +16 -0
  61. data/spec/dpkg-tools/package/control_files_spec.rb +12 -0
  62. data/spec/dpkg-tools/package/data_spec.rb +115 -0
  63. data/spec/dpkg-tools/package/etc/builder_spec.rb +28 -0
  64. data/spec/dpkg-tools/package/etc/control_files/changelog_spec.rb +21 -0
  65. data/spec/dpkg-tools/package/etc/control_files/rakefile_spec.rb +16 -0
  66. data/spec/dpkg-tools/package/etc/control_files_spec.rb +12 -0
  67. data/spec/dpkg-tools/package/etc/data_spec.rb +74 -0
  68. data/spec/dpkg-tools/package/etc/rake_spec.rb +71 -0
  69. data/spec/dpkg-tools/package/etc/setup_spec.rb +62 -0
  70. data/spec/dpkg-tools/package/etc_spec.rb +39 -0
  71. data/spec/dpkg-tools/package/fs_methods_spec.rb +33 -0
  72. data/spec/dpkg-tools/package/gem/builder_spec.rb +84 -0
  73. data/spec/dpkg-tools/package/gem/control_files/changelog_spec.rb +25 -0
  74. data/spec/dpkg-tools/package/gem/control_files/copyright_spec.rb +28 -0
  75. data/spec/dpkg-tools/package/gem/control_files/rakefile_spec.rb +17 -0
  76. data/spec/dpkg-tools/package/gem/control_files_spec.rb +12 -0
  77. data/spec/dpkg-tools/package/gem/data_spec.rb +176 -0
  78. data/spec/dpkg-tools/package/gem/gem_format_spec.rb +26 -0
  79. data/spec/dpkg-tools/package/gem/rake_spec.rb +102 -0
  80. data/spec/dpkg-tools/package/gem/setup_spec.rb +274 -0
  81. data/spec/dpkg-tools/package/gem_spec.rb +68 -0
  82. data/spec/dpkg-tools/package/rails/builder_spec.rb +113 -0
  83. data/spec/dpkg-tools/package/rails/cap_spec.rb +37 -0
  84. data/spec/dpkg-tools/package/rails/control_files/changelog_spec.rb +25 -0
  85. data/spec/dpkg-tools/package/rails/control_files/rakefile_spec.rb +24 -0
  86. data/spec/dpkg-tools/package/rails/control_files_spec.rb +12 -0
  87. data/spec/dpkg-tools/package/rails/data_spec.rb +178 -0
  88. data/spec/dpkg-tools/package/rails/rake_spec.rb +78 -0
  89. data/spec/dpkg-tools/package/rails/setup_spec.rb +152 -0
  90. data/spec/dpkg-tools/package/rails_spec.rb +27 -0
  91. data/spec/dpkg-tools/package/rake_spec.rb +87 -0
  92. data/spec/dpkg-tools/package/setup_spec.rb +247 -0
  93. data/spec/dpkg-tools/package_spec.rb +34 -0
  94. data/spec/fixtures/BlueCloth-1.0.0.gem +1190 -0
  95. data/spec/fixtures/database.yml +33 -0
  96. data/spec/spec.opts +1 -0
  97. data/spec/spec_helper.rb +52 -0
  98. data/tasks/dist.rake +118 -0
  99. data/tasks/rspec.rake +21 -0
  100. metadata +165 -0
data/CHANGES ADDED
@@ -0,0 +1,198 @@
1
+ == Version 0.3.3
2
+
3
+ 2008-06-06: Initial Rubyforge release, lots of rough edges around the process (and the software)
4
+
5
+ * Initial release at Rubyforge
6
+ * Lots of reorganisation of the release infrastructure, which I have been looting wholesale from RSpec.
7
+
8
+ == Version 0.3.0
9
+
10
+ 2008-05-08
11
+
12
+ * Plenty tweaks to Rails startup scripts, added dpkg-etc for config. package generation
13
+
14
+ == Version 0.2.20
15
+
16
+ 2008-01-18
17
+
18
+ * Tweaks to mongrel startup script and corresponding data
19
+ values in DpkgTools::Package::Rails::Data
20
+
21
+ == Version 0.2.19
22
+
23
+ 2008-01-17
24
+
25
+ * refactor Gem::Format creation so that Package::Builder can
26
+ cope with old formats
27
+
28
+ == Version 0.2.18
29
+
30
+ 2008-01-15
31
+
32
+ * Making dpkg:setup:reset more robust in its error checking
33
+
34
+ == Version 0.2.17
35
+
36
+ 2008-01-15
37
+
38
+ * Added the ruby .deb to the base deps for rails packages
39
+ (otherwise only ruby18 is there)
40
+
41
+ == Version 0.2.16
42
+
43
+ 2008-01-07
44
+
45
+ * Fixed a problem where directories were treated as files
46
+ in dpkg-rails
47
+
48
+ == Version 0.2.15
49
+
50
+ 2007-12-14
51
+
52
+ * Modified maintainer scripts for controlled modification of
53
+ sudoers
54
+ * Modified Rails setup tasks so they can be re-run on an app
55
+ from Rake
56
+
57
+ == Version 0.2.14
58
+
59
+ 2007-12-04
60
+
61
+ * Modified maintainer scripts to make them tidy up
62
+ after themselves a bit better
63
+ * Added username to deploy.rb
64
+
65
+ == Version 0.2.13
66
+
67
+ 2007-12-04
68
+
69
+ * Includes modified Capistrano deployment recipes
70
+ * Generates the ssh authorized_keys file in a Rails package
71
+
72
+ == Version 0.2.12
73
+
74
+ 2007-12-01
75
+
76
+ * postinst quotes the MySQL strings correctly now.
77
+
78
+ == Version 0.2.11
79
+
80
+ 2007-12-01
81
+
82
+ * Refactored out the Rake build tasks stuff to DRY it up a bit
83
+ * Made certain things happen more in accordance with debian policy
84
+ stuff (Gem gets installed on debian/rules build)
85
+ * -arch and -indep rake tasks get invoked from binary and build
86
+ properly (i.e. only one)
87
+ * postinst and comrades actually have the right names now
88
+
89
+ == Version 0.2.10
90
+
91
+ 2007-12-01
92
+
93
+ * Tweaks to base package list for rails apps
94
+
95
+ == Version 0.2.9
96
+
97
+ 2007-12-01
98
+
99
+ * Copes with nil values in Gem::Format.files (thanks, mysql...)
100
+ * Also looks for COPYING to contain the license info
101
+
102
+ == Version 0.2.8
103
+
104
+ 2007-12-01
105
+
106
+ * Maintains a list of -dev packages for gems which need to compile
107
+ against them and adds those to build-time dependencies as
108
+ appropriate
109
+
110
+ == Version 0.2.7
111
+
112
+ 2007-11-25
113
+
114
+ * Nasty bug with hold-out from before refactoring squished
115
+
116
+ == Version 0.2.6
117
+
118
+ 2007-11-25
119
+
120
+ * Maintainer scripts are in
121
+
122
+ == Version 0.2.5
123
+
124
+ 2007-11-20
125
+
126
+ * Changes (under the hood) to the way control files are generated
127
+
128
+ == Version 0.2.3
129
+
130
+ 2007-11-20
131
+
132
+ * Tweak to make sure config/deb.yml is created
133
+
134
+ == Version 0.2.2
135
+
136
+ 2007-11-20
137
+
138
+ * Added Rails apache 2.2 / mod_proxy_balancer to the supported packages
139
+
140
+ == Version 0.1.11
141
+
142
+ 2007-11-13
143
+
144
+ * Fix bug in dependency name generation for debian/control
145
+
146
+ == Version 0.1.10
147
+
148
+ 2007-11-13
149
+
150
+ * Fix generation of deb_filename
151
+
152
+ == Version 0.1.9
153
+
154
+ 2007-11-13
155
+
156
+ * Fix bad changelog and control file generation
157
+
158
+ == Version 0.1.8
159
+
160
+ 2007-11-13
161
+
162
+ * Correctly handle gems which have underscores or capitalisation in their names
163
+
164
+ == Version 0.1.7
165
+
166
+ 2007-10-31
167
+
168
+ * Correctly handle gems which need to be parsed with Gem::OldFormat
169
+
170
+ == Version 0.1.6
171
+
172
+ 2007-10-31
173
+
174
+ * Allow spec.platform to be nil (as with bluecloth)
175
+
176
+ == Version 0.1.5
177
+
178
+ 2007-10-31
179
+
180
+ * Append -1 to all version dependencies so version requirements like (= 1.4.4) become (= 1.4.4-1) and can be met
181
+
182
+ == Version 0.1.4
183
+
184
+ 2007-10-31
185
+
186
+ * Fixed a bug in the monkey-patching of Gem.bindir so that bin install should work again
187
+
188
+ == Version 0.1.3
189
+
190
+ 2007-10-31
191
+
192
+ * Improved the bin/dpkg-gem so it runs when called from Rubygems' generated wrapper script
193
+
194
+ == Version 0.1.2
195
+
196
+ 2007-10-30
197
+
198
+ * Initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007-2008 Matt Patterson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,17 @@
1
+ = dpkg-tools: less-painful OS package building
2
+
3
+ dpkg-tools is a set of tools which aim to dramatically simplify the process of creating and building OS packages. We're targetting .debs, and creating one can be as simple as creating and maintaining a YAML configuration file. For Rubygems, the process is even easier - a single command makes a gem ready to be built into a .deb
4
+
5
+ == Warning: Alpha software
6
+
7
+ Hey, this is alpha stuff. There's plenty cruft and rough edges, the RDoc's pretty bad and there's a general lack of good documentation and examples. I'm working on it. You're more than welcome to join in.
8
+
9
+ == How to get it
10
+
11
+ gem install dpkg-tools
12
+
13
+ Or, the gem can be downloaded from http://rubyforge.org/projects/dpkg-tools/.
14
+
15
+ The source is available from Github: http://github.com/fidothe/dpkg-tools/, and bugs, requests and other queries can be filed at http://dpkg-tools.lighthouseapp.com/. You can clone the public Git repo with:
16
+
17
+ git clone git://github.com/fidothe/dpkg-tools.git
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/dpkg-etc ADDED
@@ -0,0 +1,6 @@
1
+ #! /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
2
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
3
+
4
+ require 'dpkg-tools/command_line'
5
+
6
+ DpkgTools::CommandLine::Etc.run(ARGV, STDERR, STDOUT)
data/bin/dpkg-gem ADDED
@@ -0,0 +1,6 @@
1
+ #! /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
2
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
3
+
4
+ require 'dpkg-tools/command_line'
5
+
6
+ DpkgTools::CommandLine::Gem.run(ARGV, STDERR, STDOUT)
data/bin/dpkg-rails ADDED
@@ -0,0 +1,6 @@
1
+ #! /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
2
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
3
+
4
+ require 'dpkg-tools/command_line'
5
+
6
+ DpkgTools::CommandLine::Rails.run(ARGV, STDERR, STDOUT)
data/lib/dpkg-tools.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'dpkg-tools/package'
2
+ require 'dpkg-tools/version'
3
+
4
+ module DpkgTools
5
+
6
+ end
@@ -0,0 +1,142 @@
1
+ require 'optparse'
2
+ require 'dpkg-tools'
3
+
4
+ module DpkgTools
5
+ module CommandLine
6
+ module Rails
7
+ class << self
8
+ def run(args, err, out)
9
+ options = {}
10
+ opt_parser = OptionParser.new do |opts|
11
+ opts.banner = "Usage: dpkg-rails [options] PATH_TO_RAILS_APP"
12
+
13
+ opts.separator ""
14
+ opts.separator "Common options:"
15
+
16
+ opts.on_tail("-h", "--help", "Show this message") do
17
+ err.puts opts
18
+ exit
19
+ end
20
+
21
+ # Another typical switch to print the version.
22
+ opts.on_tail("--version", "Show version") do
23
+ err.puts DpkgTools::Version.STRING
24
+ exit
25
+ end
26
+ end
27
+ opt_parser.parse!(args)
28
+
29
+ begin
30
+ app_path = args.first
31
+ raise ArgumentError, "You must supply a valid path to a rails app - #{app_path} doesn't exist!" unless File.exist?(app_path)
32
+
33
+ DpkgTools::Package::Rails.setup_from_path(app_path)
34
+ rescue ArgumentError => e
35
+ err.puts opt_parser
36
+ err.puts ""
37
+ err.puts e
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ module Etc
44
+ class << self
45
+ def run(args, err, out)
46
+ options = {}
47
+ opt_parser = OptionParser.new do |opts|
48
+ opts.banner = "Usage: dpkg-etc [options] PATH_TO_CONF_PACKAGE"
49
+
50
+ opts.separator ""
51
+ opts.separator "Common options:"
52
+
53
+ opts.on_tail("-h", "--help", "Show this message") do
54
+ err.puts opts
55
+ exit
56
+ end
57
+
58
+ # Another typical switch to print the version.
59
+ opts.on_tail("--version", "Show version") do
60
+ err.puts DpkgTools::Version.STRING
61
+ exit
62
+ end
63
+ end
64
+ opt_parser.parse!(args)
65
+
66
+ begin
67
+ package_path = args.first
68
+ package_parent_path = File.dirname(package_path)
69
+ raise ArgumentError, "You must supply a valid path to a package - #{package_parent_path} doesn't exist!" unless File.exist?(package_parent_path)
70
+
71
+ DpkgTools::Package::Etc.setup_from_path(package_path)
72
+ rescue ArgumentError => e
73
+ err.puts opt_parser
74
+ err.puts ""
75
+ err.puts e
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ module Gem
82
+ class << self
83
+ def run(args, err, out)
84
+ options = {}
85
+ opt_parser = OptionParser.new do |opts|
86
+ opts.banner = "Usage: dpkg-gem [options] GEM-NAME"
87
+
88
+ opts.separator ""
89
+ opts.separator "Specific options:"
90
+
91
+ opts.on("-f", "--from-gem", "Take the GEM-NAME argument as the path",
92
+ "to a .gem and create package from that",
93
+ "rather than looking remotely.",
94
+ "Implies --ignore-dependencies.") do |from_path|
95
+ options[:from_path] = from_path
96
+ options[:ignore_dependencies] = true
97
+ end
98
+
99
+ opts.on("-f", "--ignore-dependencies", "Don't fetch and create packages for dependencies.") do
100
+ options[:ignore_dependencies] = true
101
+ end
102
+
103
+ opts.separator ""
104
+ opts.separator "Common options:"
105
+
106
+ opts.on_tail("-h", "--help", "Show this message") do
107
+ err.puts opts
108
+ exit
109
+ end
110
+
111
+ # Another typical switch to print the version.
112
+ opts.on_tail("--version", "Show version") do
113
+ err.puts DpkgTools::Version.STRING
114
+ exit
115
+ end
116
+ end
117
+ opt_parser.parse!(args)
118
+
119
+ DpkgTools::Package::Config.root_path = File.expand_path('./')
120
+
121
+ begin
122
+ if options[:from_path]
123
+ raise ArgumentError, "You must supply the path to a valid gem file!" unless args.size > 0
124
+ gem_path = args.first
125
+ raise ArgumentError, "You must supply the path to a valid gem file - #{gem_path} doesn't exist!" unless File.exist?(gem_path)
126
+ raise ArgumentError, "You must supply the path to a valid gem file - #{gem_path} is a directory!" unless File.file?(gem_path)
127
+
128
+ DpkgTools::Package::Gem.setup_from_path(gem_path, options)
129
+ else
130
+ raise ArgumentError, "You must supply the name of a gem!" unless args.size > 0
131
+ DpkgTools::Package::Gem.setup_from_name(args.first, options)
132
+ end
133
+ rescue ArgumentError => e
134
+ err.puts opt_parser
135
+ err.puts ""
136
+ err.puts e
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,30 @@
1
+ require 'dpkg-tools/package/config'
2
+ require 'dpkg-tools/package/data'
3
+ require 'dpkg-tools/package/control_files'
4
+ require 'dpkg-tools/package/fs_methods'
5
+ require 'dpkg-tools/package/setup'
6
+ require 'dpkg-tools/package/builder'
7
+ require 'dpkg-tools/package/rake'
8
+
9
+ require 'dpkg-tools/package/gem'
10
+ require 'dpkg-tools/package/rails'
11
+ require 'dpkg-tools/package/etc'
12
+
13
+ module DpkgTools
14
+ module Package
15
+ class << self
16
+ def create_gem_structure(gem_name)
17
+ Gem.create_structure(gem_name)
18
+ end
19
+
20
+ def check_package_dir(config)
21
+ package_dir_path = config.base_path
22
+ Dir.mkdir(package_dir_path) unless File.directory?(package_dir_path)
23
+ end
24
+
25
+ def standards_version
26
+ "3.7.2"
27
+ end
28
+ end
29
+ end
30
+ end