Module: Hoe::Newgem

Defined in:
lib/hoe/newgem.rb

Instance Method Summary collapse

Instance Method Details

#define_newgem_tasksObject

Define gemspec task if not already defined



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
70
71
72
73
# File 'lib/hoe/newgem.rb', line 24

def define_newgem_tasks
  unless self.extra_dev_deps.find { |dep| dep.first == 'newgem' }
    require File.dirname(__FILE__) + '/../newgem'
    self.extra_dev_deps ||= []
    self.extra_dev_deps << ['newgem', ">= #{::Newgem::VERSION}"] unless name == 'newgem'
  end
  
  return if Rake::Task.tasks.find { |t| t.name == 'gemspec' }
  desc "Generate a #{name}.gemspec file"
  task :gemspec do
    File.open("#{name}.gemspec", "w") do |file|
      file.puts spec.to_ruby
    end
  end
  
  task :release do
    puts <<-EOS.gsub(/^  /,'')
    Remember to create tag your release; eg for Git:
      git tag REL-#{$hoe.version}

    Announce your release on RubyForge News:
      rake post_news
    EOS
  end

  task :check_version do
    unless ENV['VERSION']
      puts 'Must pass a VERSION=x.y.z release version'
      exit
    end
    unless ENV['VERSION'] == $hoe.version
      puts "Please update your lib/#{$hoe.name}.rb to match the release version, currently #{$hoe.version}"
      exit
    end
  end

  desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
  task :install_gem_no_doc => [:clean, :package] do
    sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
  end
  
  task :ruby_env do
    $ruby_app = if RUBY_PLATFORM =~ /java/
      "jruby"
    else
      "ruby"
    end
  end
  
end

#initialize_newgemObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/hoe/newgem.rb', line 12

def initialize_newgem
  require(File.dirname(__FILE__) + "/../newgem")
  require 'newgem/tasks'

  self.clean_globs |= %w[**/.DS_Store tmp *.log]
  path = (self.rubyforge_name == self.name) ? self.rubyforge_name : "\#{self.rubyforge_name}/\#{self.name}"
  self.remote_rdoc_dir = File.join(path.gsub(/^#{self.rubyforge_name}\/?/,''), 'rdoc')
  self.rsync_args = '-av --delete --ignore-errors'
  self.readme_file = "README.rdoc"
end