auser-sprinkle 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/CREDITS +16 -0
  2. data/History.txt +4 -0
  3. data/MIT-LICENSE +20 -0
  4. data/Manifest.txt +67 -0
  5. data/README.rdoc +224 -0
  6. data/Rakefile +4 -0
  7. data/bin/sprinkle +86 -0
  8. data/config/hoe.rb +70 -0
  9. data/config/requirements.rb +17 -0
  10. data/examples/merb/deploy.rb +5 -0
  11. data/examples/rails/README +15 -0
  12. data/examples/rails/deploy.rb +2 -0
  13. data/examples/rails/packages/database.rb +9 -0
  14. data/examples/rails/packages/essential.rb +6 -0
  15. data/examples/rails/packages/rails.rb +28 -0
  16. data/examples/rails/packages/search.rb +11 -0
  17. data/examples/rails/packages/server.rb +28 -0
  18. data/examples/rails/rails.rb +71 -0
  19. data/examples/sprinkle/sprinkle.rb +38 -0
  20. data/lib/sprinkle.rb +28 -0
  21. data/lib/sprinkle/actors/capistrano.rb +89 -0
  22. data/lib/sprinkle/actors/vlad.rb +39 -0
  23. data/lib/sprinkle/configurable.rb +24 -0
  24. data/lib/sprinkle/deployment.rb +33 -0
  25. data/lib/sprinkle/extensions/arbitrary_options.rb +10 -0
  26. data/lib/sprinkle/extensions/array.rb +7 -0
  27. data/lib/sprinkle/extensions/blank_slate.rb +5 -0
  28. data/lib/sprinkle/extensions/dsl_accessor.rb +15 -0
  29. data/lib/sprinkle/extensions/string.rb +10 -0
  30. data/lib/sprinkle/extensions/symbol.rb +7 -0
  31. data/lib/sprinkle/installers/apt.rb +25 -0
  32. data/lib/sprinkle/installers/gem.rb +33 -0
  33. data/lib/sprinkle/installers/installer.rb +74 -0
  34. data/lib/sprinkle/installers/rake.rb +17 -0
  35. data/lib/sprinkle/installers/rpm.rb +20 -0
  36. data/lib/sprinkle/installers/source.rb +121 -0
  37. data/lib/sprinkle/package.rb +127 -0
  38. data/lib/sprinkle/policy.rb +85 -0
  39. data/lib/sprinkle/script.rb +13 -0
  40. data/lib/sprinkle/verifiers/directory.rb +11 -0
  41. data/lib/sprinkle/verifiers/executable.rb +17 -0
  42. data/lib/sprinkle/verifiers/file.rb +11 -0
  43. data/lib/sprinkle/verifiers/symlink.rb +15 -0
  44. data/lib/sprinkle/verify.rb +55 -0
  45. data/lib/sprinkle/version.rb +9 -0
  46. data/script/destroy +14 -0
  47. data/script/generate +14 -0
  48. data/spec/spec.opts +1 -0
  49. data/spec/spec_helper.rb +17 -0
  50. data/spec/sprinkle/actors/capistrano_spec.rb +170 -0
  51. data/spec/sprinkle/configurable_spec.rb +46 -0
  52. data/spec/sprinkle/deployment_spec.rb +80 -0
  53. data/spec/sprinkle/extensions/array_spec.rb +19 -0
  54. data/spec/sprinkle/extensions/string_spec.rb +21 -0
  55. data/spec/sprinkle/installers/apt_spec.rb +74 -0
  56. data/spec/sprinkle/installers/gem_spec.rb +75 -0
  57. data/spec/sprinkle/installers/installer_spec.rb +151 -0
  58. data/spec/sprinkle/installers/rpm_spec.rb +50 -0
  59. data/spec/sprinkle/installers/source_spec.rb +331 -0
  60. data/spec/sprinkle/package_spec.rb +422 -0
  61. data/spec/sprinkle/policy_spec.rb +126 -0
  62. data/spec/sprinkle/script_spec.rb +51 -0
  63. data/spec/sprinkle/sprinkle_spec.rb +25 -0
  64. data/spec/sprinkle/verify_spec.rb +137 -0
  65. data/sprinkle.gemspec +43 -0
  66. data/tasks/deployment.rake +34 -0
  67. data/tasks/environment.rake +7 -0
  68. data/tasks/rspec.rake +21 -0
  69. metadata +158 -0
data/CREDITS ADDED
@@ -0,0 +1,16 @@
1
+ = CREDITS
2
+
3
+ Many thanks to the following people who have submitted ideas, patches, helped with testing
4
+ and/or generally provided support to Sprinke, I really appreciate your help:
5
+
6
+ Kristin Baumann (http://crafterm.net/kristin/blog/)
7
+ Ben Schwarz (http://germanforblack.com/)
8
+ Jim Freeze (http://www.artima.com/rubycs/articles/ruby_as_dslP.html)
9
+ Matthew Tanase (http://www.slicehost.com)
10
+ Jared Kuolt (http://www.slicehost.com)
11
+ Jamis Buck (http://www.capify.org)
12
+ Matt Allen (http://blog.allen.com.au)
13
+ Eric Hodel (http://blog.segment7.net)
14
+ Pete Yandell (http://notahat.com)
15
+ Adam Meehan (http://duckpunching.com)
16
+ Mitchell Hashimoto (http://mitchellhashimoto.com)
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2008-03-11
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Marcus Crafter
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/Manifest.txt ADDED
@@ -0,0 +1,67 @@
1
+ CREDITS
2
+ History.txt
3
+ MIT-LICENSE
4
+ Manifest.txt
5
+ README.rdoc
6
+ Rakefile
7
+ bin/sprinkle
8
+ config/hoe.rb
9
+ config/requirements.rb
10
+ examples/merb/deploy.rb
11
+ examples/rails/README
12
+ examples/rails/deploy.rb
13
+ examples/rails/packages/database.rb
14
+ examples/rails/packages/essential.rb
15
+ examples/rails/packages/rails.rb
16
+ examples/rails/packages/search.rb
17
+ examples/rails/packages/server.rb
18
+ examples/rails/rails.rb
19
+ examples/sprinkle/sprinkle.rb
20
+ lib/sprinkle.rb
21
+ lib/sprinkle/actors/capistrano.rb
22
+ lib/sprinkle/actors/vlad.rb
23
+ lib/sprinkle/configurable.rb
24
+ lib/sprinkle/deployment.rb
25
+ lib/sprinkle/extensions/arbitrary_options.rb
26
+ lib/sprinkle/extensions/array.rb
27
+ lib/sprinkle/extensions/blank_slate.rb
28
+ lib/sprinkle/extensions/dsl_accessor.rb
29
+ lib/sprinkle/extensions/string.rb
30
+ lib/sprinkle/extensions/symbol.rb
31
+ lib/sprinkle/installers/apt.rb
32
+ lib/sprinkle/installers/gem.rb
33
+ lib/sprinkle/installers/installer.rb
34
+ lib/sprinkle/installers/rake.rb
35
+ lib/sprinkle/installers/rpm.rb
36
+ lib/sprinkle/installers/source.rb
37
+ lib/sprinkle/package.rb
38
+ lib/sprinkle/policy.rb
39
+ lib/sprinkle/script.rb
40
+ lib/sprinkle/verifiers/directory.rb
41
+ lib/sprinkle/verifiers/executable.rb
42
+ lib/sprinkle/verifiers/file.rb
43
+ lib/sprinkle/verifiers/symlink.rb
44
+ lib/sprinkle/verify.rb
45
+ lib/sprinkle/version.rb
46
+ script/destroy
47
+ script/generate
48
+ spec/spec.opts
49
+ spec/spec_helper.rb
50
+ spec/sprinkle/actors/capistrano_spec.rb
51
+ spec/sprinkle/deployment_spec.rb
52
+ spec/sprinkle/extensions/array_spec.rb
53
+ spec/sprinkle/extensions/string_spec.rb
54
+ spec/sprinkle/installers/apt_spec.rb
55
+ spec/sprinkle/installers/gem_spec.rb
56
+ spec/sprinkle/installers/installer_spec.rb
57
+ spec/sprinkle/installers/rpm_spec.rb
58
+ spec/sprinkle/installers/source_spec.rb
59
+ spec/sprinkle/package_spec.rb
60
+ spec/sprinkle/policy_spec.rb
61
+ spec/sprinkle/script_spec.rb
62
+ spec/sprinkle/sprinkle_spec.rb
63
+ spec/sprinkle/verify_spec.rb
64
+ sprinkle.gemspec
65
+ tasks/deployment.rake
66
+ tasks/environment.rake
67
+ tasks/rspec.rake
data/README.rdoc ADDED
@@ -0,0 +1,224 @@
1
+ = SPRINKLE
2
+
3
+ http://redartisan.com/2008/5/27/sprinkle-intro
4
+ http://github.com/crafterm/sprinkle
5
+
6
+ == DESCRIPTION:
7
+
8
+ Sprinkle is a software provisioning tool you can use to build remote servers with, after the base operating
9
+ system has been installed. For example, to install a Rails or Merb stack on a brand new slice directly after
10
+ its been created.
11
+
12
+ Properties of packages such as their name, type, dependencies, etc, and what packages apply to what machines
13
+ is described via a domain specific language that Sprinkle executes (in fact one of the aims of Sprinkle is to
14
+ define as concisely as possible a language for installing software).
15
+
16
+ An example package description follows:
17
+
18
+ package :ruby do
19
+ description 'Ruby Virtual Machine'
20
+ version '1.8.6'
21
+ source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz"
22
+ requires :ruby_dependencies
23
+
24
+ verify do
25
+ has_file '/usr/bin/ruby'
26
+ end
27
+ end
28
+
29
+ This defines a package called 'ruby', that uses the source based installer to build Ruby 1.8.6 from source,
30
+ installing the package 'ruby_dependencies' beforehand. Additionally, the package verifies it was installed
31
+ correctly by verifying the file '/usr/bin/ruby' exists after installation. If this verification fails, the
32
+ sprinkle script will gracefully stop.
33
+
34
+ Reasonable defaults are set by sprinkle, such as the install prefix, download area, etc, but can be customized
35
+ globally or per package (see below for an example).
36
+
37
+ Since packages come in many forms (eg. gems, pre-compiled debs, compressed source tar.gz, etc), Sprinkle supports
38
+ many different installer types, giving you the most amount of flexibility of how you'd like software installed.
39
+ New installer types can be added into the system easily.
40
+
41
+ For example, you could install Rails via gems, nginx via source, and mysql via APT, while retaining the flexibility
42
+ of changing installer types as software is updated upstream.
43
+
44
+ Sprinkle also supports dependencies between packages, allowing you specify pre-requisites that need to be
45
+ installed in order.
46
+
47
+ Packages can be grouped into polices to define several packages that should be installed together.
48
+
49
+ An example policy:
50
+
51
+ policy :rails, :roles => :app do
52
+ requires :rails, :version => '2.1.0'
53
+ requires :appserver
54
+ requires :database
55
+ requires :webserver
56
+ end
57
+
58
+ This defines a policy called Rails, that applies to machines of role :app. The policy includes the packages
59
+ rails (version 2.1.0), appserver, database and webserver.
60
+
61
+ appserver, database and webserver can be virtual packages, where the user will be prompted for selection if
62
+ multiple choices for the virtual package exist.
63
+
64
+ Sprinkle is architected to be extendable in many ways, one of those areas is in its deployment of commands to
65
+ remote hosts. Currently Sprinkle supports the use of Capistrano or Vlad to issue commands on remote hosts via ssh,
66
+ but could also be extended to use any other command transport mechanism or be used to simply issue installation
67
+ commands on the local system.
68
+
69
+ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL (via APT), and Apache (via source):
70
+
71
+ # Sprinkle Rails deployment script
72
+ #
73
+ # This is an example Sprinkle script, configured to install Rails from gems, Apache and Ruby from source,
74
+ # and mysql from apt on an Ubuntu system. Installation is configured to run via Capistrano (and
75
+ # an accompanying deploy.rb recipe script). Source based packages are downloaded and built into
76
+ # /usr/local on the remote system.
77
+ #
78
+ # A sprinkle script is separated into 3 different sections. Packages, policies and deployment.
79
+ #
80
+ # Packages
81
+ #
82
+ # Defines the world of packages as we know it. Each package has a name and
83
+ # set of metadata including its installer type (eg. apt, source, gem, etc). Packages can have
84
+ # relationships to each other via dependencies
85
+ #
86
+ # Policies
87
+ #
88
+ # Names a group of packages (optionally with versions) that apply to a particular set of roles.
89
+ #
90
+ # Deployment
91
+ #
92
+ # Defines script wide settings such as a delivery mechanism for executing commands on the target
93
+ # system (eg. capistrano), and installer defaults (eg. build locations, etc).
94
+
95
+ # Packages
96
+
97
+ package :ruby do
98
+ description 'Ruby Virtual Machine'
99
+ version '1.8.6'
100
+ source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz"
101
+ requires :ruby_dependencies
102
+ end
103
+
104
+ package :ruby_dependencies do
105
+ description 'Ruby Virtual Machine Build Dependencies'
106
+ apt %w( bison zlib1g-dev libssl-dev libreadline5-dev libncurses5-dev file )
107
+ end
108
+
109
+ package :mysql, :provides => :database do
110
+ description 'MySQL Database'
111
+ apt %w( mysql-server mysql-client )
112
+ end
113
+
114
+ package :apache, :provides => :webserver do
115
+ description 'Apache 2 HTTP Server'
116
+ version '2.2.9'
117
+ source "http://apache.wildit.net.au/httpd/httpd-#{version}.tar.bz2" do
118
+ enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
119
+ prefix "/opt/local/apache2-#{version}"
120
+ post :install, 'install -m 755 support/apachectl /etc/init.d/apache2', 'update-rc.d -f apache2 defaults'
121
+ end
122
+ requires :apache_dependencies
123
+ end
124
+
125
+ package :apache_dependencies do
126
+ description 'Apache 2 HTTP Server Build Dependencies'
127
+ apt %w( openssl libtool mawk zlib1g-dev libssl-dev )
128
+ end
129
+
130
+ package :rubygems do
131
+ description 'Ruby Gems Package Management System'
132
+ version '1.2.0'
133
+ source "http://rubyforge.org/frs/download.php/38646/rubygems-#{version}.tgz" do
134
+ custom_install 'ruby setup.rb'
135
+ end
136
+ requires :ruby
137
+ end
138
+
139
+ package :rails do
140
+ description 'Ruby on Rails'
141
+ gem 'rails'
142
+ version '2.1.0'
143
+ end
144
+
145
+ package :mongrel do
146
+ description 'Mongrel Application Server'
147
+ gem 'mongrel'
148
+ version '1.1.5'
149
+ end
150
+
151
+ package :mongrel_cluster, :provides => :appserver do
152
+ description 'Cluster Management for Mongrel'
153
+ gem 'mongrel_cluster' # :source => 'http://gems.github.com/' for alternate gem server
154
+ version '1.0.5'
155
+ requires :mongrel
156
+ end
157
+
158
+ # Policies
159
+
160
+ # Associates the rails policy to the application servers. Contains rails, and surrounding
161
+ # packages. Note, appserver, database and webserver are all virtual packages defined above. If
162
+ # there's only one implementation of a virtual package, it's selected automatically, otherwise
163
+ # the user is requested to select which one to use.
164
+
165
+ policy :rails, :roles => :app do
166
+ requires :rails, :version => '2.1.0'
167
+ requires :appserver
168
+ requires :database
169
+ requires :webserver
170
+ end
171
+
172
+ # Deployment
173
+
174
+ # Configures sprinkle to use capistrano for delivery of commands to the remote machines (via
175
+ # the named 'deploy' recipe). Also configures 'source' installer defaults to put package gear
176
+ # in /usr/local
177
+
178
+ deployment do
179
+
180
+ # mechanism for deployment
181
+ delivery :capistrano do
182
+ recipes 'deploy'
183
+ end
184
+
185
+ # source based package installer defaults
186
+ source do
187
+ prefix '/usr/local' # where all source packages will be configured to install
188
+ archives '/usr/local/sources' # where all source packages will be downloaded to
189
+ builds '/usr/local/build' # where all source packages will be built
190
+ end
191
+
192
+ end
193
+
194
+ Please see the examples directory for more complete examples of Sprinkle deployment scripts.
195
+
196
+ Sprinkle is a work in progress and I'm excited to hear if anyone finds it useful - please feel free to
197
+ comment, ask any questions, or send in any ideas, patches, bugs. All most welcome.
198
+
199
+ Marcus Crafter <crafterm@redartisan.com>
200
+
201
+ == LICENSE:
202
+
203
+ (The MIT License)
204
+
205
+ Copyright (c) 2008 Marcus Crafter <crafterm@redartisan.com>
206
+
207
+ Permission is hereby granted, free of charge, to any person obtaining
208
+ a copy of this software and associated documentation files (the
209
+ 'Software'), to deal in the Software without restriction, including
210
+ without limitation the rights to use, copy, modify, merge, publish,
211
+ distribute, sublicense, and/or sell copies of the Software, and to
212
+ permit persons to whom the Software is furnished to do so, subject to
213
+ the following conditions:
214
+
215
+ The above copyright notice and this permission notice shall be
216
+ included in all copies or substantial portions of the Software.
217
+
218
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
219
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
220
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
221
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
222
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
223
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
224
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/sprinkle ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2008-3-11.
4
+ # Copyright (c) 2008. All rights reserved.
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ # no rubygems to load, so we fail silently
10
+ end
11
+
12
+ require 'optparse'
13
+
14
+ # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
15
+
16
+ OPTIONS = {}
17
+ MANDATORY_OPTIONS = %w( path )
18
+
19
+ parser = OptionParser.new do |opts|
20
+ opts.banner = <<BANNER
21
+ Sprinkle
22
+ ========
23
+
24
+ http://github.com/crafterm/sprinkle
25
+
26
+ Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to
27
+ install a Rails or Merb stack on a brand new slice directly after its been created. It uses
28
+ a Ruby based domain specific language to describe packages and policies to determine what
29
+ should be installed on particular systems.
30
+
31
+ Please see http://github.com/crafterm/sprinkle/tree/master/README.txt for more information.
32
+
33
+ Usage
34
+ =====
35
+
36
+ $> #{File.basename($0)} [options]
37
+
38
+ Options are:
39
+ BANNER
40
+ opts.separator ""
41
+ opts.on("-s", "--script=PATH", String,
42
+ "Path to a sprinkle script to run") { |OPTIONS[:path]| }
43
+ opts.on("-t", "--test",
44
+ "Process but don't perform any actions") { |OPTIONS[:testing]| }
45
+ opts.on("-v", "--verbose",
46
+ "Verbose output") { |OPTIONS[:verbose]| }
47
+ opts.on("-c", "--cloud",
48
+ "Show powder cloud, ie. package hierarchy and installation order") { |OPTIONS[:cloud]| }
49
+ opts.on("-f", "--force",
50
+ "Force installation of all packages even if it is detected that it has been previously installed") { |OPTIONS[:force]| }
51
+ opts.on("-h", "--help",
52
+ "Show this help message.") { puts opts; exit }
53
+ opts.parse!(ARGV)
54
+
55
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
56
+ puts opts; exit
57
+ end
58
+ end
59
+
60
+ def force_mode(options)
61
+ Sprinkle::OPTIONS[:force] = OPTIONS[:force] || false
62
+ end
63
+
64
+ def operation_mode(options)
65
+ Sprinkle::OPTIONS[:testing] = OPTIONS[:testing] || false
66
+ end
67
+
68
+ def powder_cloud(options)
69
+ Sprinkle::OPTIONS[:cloud] = OPTIONS[:cloud] || false
70
+ end
71
+
72
+ def log_level(options)
73
+ Object.logger.level = ActiveSupport::BufferedLogger::Severity::DEBUG if options[:verbose]
74
+ end
75
+
76
+ require 'sprinkle'
77
+
78
+ powder = OPTIONS[:path]
79
+ raise "Sprinkle script is not readable: #{powder}" unless File.readable?(powder)
80
+
81
+ force_mode(OPTIONS)
82
+ operation_mode(OPTIONS)
83
+ powder_cloud(OPTIONS)
84
+ log_level(OPTIONS)
85
+
86
+ Sprinkle::Script.sprinkle File.read(powder), powder
data/config/hoe.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'sprinkle/version'
2
+
3
+ AUTHOR = 'Marcus Crafter' # can also be an array of Authors
4
+ EMAIL = "crafterm@redartisan.com"
5
+ DESCRIPTION = "Ruby DSL based software provisioning tool"
6
+ GEM_NAME = 'sprinkle' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'sprinkle' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+
11
+ @config_file = "~/.rubyforge/user-config.yml"
12
+ @config = nil
13
+ RUBYFORGE_USERNAME = "unknown"
14
+ def rubyforge_username
15
+ unless @config
16
+ begin
17
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
18
+ rescue
19
+ puts <<-EOS
20
+ ERROR: No rubyforge config file found: #{@config_file}
21
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
23
+ EOS
24
+ exit
25
+ end
26
+ end
27
+ RUBYFORGE_USERNAME.replace @config["username"]
28
+ end
29
+
30
+
31
+ REV = nil
32
+ # UNCOMMENT IF REQUIRED:
33
+ # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
34
+ VERS = Sprinkle::VERSION::STRING + (REV ? ".#{REV}" : "")
35
+ RDOC_OPTS = ['--quiet', '--title', 'sprinkle documentation',
36
+ "--opname", "index.html",
37
+ "--line-numbers",
38
+ "--main", "README",
39
+ "--inline-source"]
40
+
41
+ class Hoe
42
+ def extra_deps
43
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
+ @extra_deps
45
+ end
46
+ end
47
+
48
+ # Generate all the Rake tasks
49
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
+ hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
+ p.developer(AUTHOR, EMAIL)
52
+ p.description = DESCRIPTION
53
+ p.summary = DESCRIPTION
54
+ p.url = HOMEPATH
55
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
56
+ p.test_globs = ["test/**/test_*.rb"]
57
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
58
+
59
+ # == Optional
60
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
61
+ p.extra_deps = [ ['activesupport', '>= 2.0.2'], ['highline', '>= 1.4.0'], ['capistrano', '>= 2.2.0'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
62
+
63
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
+
65
+ end
66
+
67
+ CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
68
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
69
+ hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
70
+ hoe.rsync_args = '-av --delete --ignore-errors'