public
Description: A simple gem for creating the stub of other gems
Clone URL: git://github.com/markbates/gemstub.git
Search Repo:
gemstub / Rakefile
100644 69 lines (60 sloc) 1.975 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'rake'
require 'rake/gempackagetask'
require 'rake/clean'
require 'find'
require 'rubyforge'
require 'rubygems'
require 'rubygems/gem_runner'
require 'rake/testtask'
require 'rake/rdoctask'
 
GEM_VERSION = '1.0.14'
GEM_NAME = "gemstub"
GEM_RUBYFORGE_PROJECT = "magrathea"
 
gem_spec = Gem::Specification.new do |s|
  s.name = GEM_NAME
  s.version = GEM_VERSION
  s.author = "Mark Bates"
  s.email = "mark@markbates.com"
  s.homepage = "http://www.mackframework.com"
  s.rubyforge_project = GEM_RUBYFORGE_PROJECT
  s.summary = %{Gemstub is a very simple tool for creating the stub code you need to build a gem.
 
Usage: at a command prompt simply type: gemstub your_gem_name_here
 
That's it, after that, you all you have to do is the actual coding of your gem! Enjoy!
}
  
  s.test_files = FileList['test/**/*']
  
  s.files = FileList['lib/**/*.*', 'README', 'doc/**/*.*', 'bin/**/*.*']
  s.require_paths << 'lib'
  s.bindir = "bin"
  s.executables << "gemstub"
  s.add_dependency("mack-facets")
end
 
Rake::GemPackageTask.new(gem_spec) do |pkg|
  pkg.need_zip = false
  pkg.need_tar = false
  rm_f FileList['pkg/**/*.*']
end
 
desc "Install the gemstub"
task :install => :package do |t|
  system "sudo gem install pkg/#{GEM_NAME}-#{GEM_VERSION}.gem --no-update-sources --local"
end
 
desc "Release gemstub"
task :release => :install do |t|
  begin
    rf = RubyForge.new
    rf.configure
    rf.login
    begin
      rf.add_release(GEM_RUBYFORGE_PROJECT, GEM_NAME, GEM_VERSION, File.join("pkg", "#{GEM_NAME}-#{GEM_VERSION}.gem"))
    rescue Exception => e
      if e.message.match("Invalid package_id") || e.message.match("no <package_id> configured for")
        puts "You need to create the package!"
        rf.create_package(GEM_RUBYFORGE_PROJECT, GEM_NAME)
        rf.add_release(GEM_RUBYFORGE_PROJECT, GEM_NAME, GEM_VERSION, File.join("pkg", "#{GEM_NAME}-#{GEM_VERSION}.gem"))
      else
        raise e
      end
    end
  rescue Exception => e
    puts e
  end
end