Skip to content
Newer
Older
100644 104 lines (92 sloc) 3.48 KB
f3172f3 First import/fork.
unknown authored
1 require 'rubygems'
2 require 'rake'
3 require 'rake/clean'
4 require 'rake/testtask'
5 require 'rake/packagetask'
6 require 'rake/gempackagetask'
7 require 'rake/rdoctask'
8 require 'rake/contrib/rubyforgepublisher'
9 require 'fileutils'
10 require 'hoe'
11 include FileUtils
12 require File.join(File.dirname(__FILE__), 'lib', 'right_http_connection')
13
14 AUTHOR = 'RightScale' # can also be an array of Authors
15 EMAIL = "rubygems@rightscale.com"
16 DESCRIPTION = "RightScale's robust HTTP/S connection module"
17 GEM_NAME = 'right_http_connection' # what ppl will type to install your gem
18 RUBYFORGE_PROJECT = 'rightscale' # The unix name for your project
19 HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
20 DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
21
22 NAME = "right_http_connection"
23 REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24 VERS = RightHttpConnection::VERSION::STRING + (REV ? ".#{REV}" : "")
25 CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
26 RDOC_OPTS = ['--quiet', '--title', 'right_http_connection documentation',
27 "--opname", "index.html",
28 "--line-numbers",
29 "--main", "README",
30 "--inline-source"]
31
32 # Suppress Hoe's self-inclusion as a dependency for our Gem. This also keeps
33 # Rake & rubyforge out of the dependency list. Users must manually install
34 # these gems to run tests, etc.
35 # TRB 2/19/09: also do this for the extra_dev_deps array present in newer hoes.
36 # Older versions of RubyGems will try to install developer-dependencies as
37 # required runtime dependencies....
38 class Hoe
39 def extra_deps
40 @extra_deps.reject do |x|
41 Array(x).first == 'hoe'
42 end
43 end
44 def extra_dev_deps
45 @extra_dev_deps.reject do |x|
46 Array(x).first == 'hoe'
47 end
48 end
49 end
50
51 # Generate all the Rake tasks
52 # Run 'rake -T' to see list of generated tasks (from gem root directory)
53 hoe = Hoe.new(GEM_NAME, VERS) do |p|
54 p.author = AUTHOR
55 p.description = DESCRIPTION
56 p.email = EMAIL
57 p.summary = DESCRIPTION
58 p.url = HOMEPATH
59 p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
60 p.test_globs = ["test/**/test_*.rb"]
61 p.clean_globs = CLEAN #An array of file patterns to delete on clean.
62 p.remote_rdoc_dir = "right_http_gem_doc"
63
64 # == Optional
65 p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
66 #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
67 #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68 end
69
70
71 desc 'Generate website files'
72 task :website_generate do
73 Dir['website/**/*.txt'].each do |txt|
74 sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
75 end
76 end
77
78 desc 'Upload website files to rubyforge'
79 task :website_upload do
80 config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
81 host = "#{config["username"]}@rubyforge.org"
82 remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
83 # remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
84 local_dir = 'website'
85 sh %{rsync -av #{local_dir}/ #{host}:#{remote_dir}}
86 end
87
88 desc 'Generate and upload website files'
89 task :website => [:website_generate, :website_upload]
90
91 desc 'Release the website and new gem version'
92 task :deploy => [:check_version, :website, :release]
93
94 task :check_version do
95 unless ENV['VERSION']
96 puts 'Must pass a VERSION=x.y.z release version'
97 exit
98 end
99 unless ENV['VERSION'] == VERS
100 puts "Please update your version.rb to match the release version, currently #{VERS}"
101 exit
102 end
103 end
Something went wrong with that request. Please try again.