Skip to content
Newer
Older
100644 85 lines (69 sloc) 2.19 KB
2d67913 @josevalim Created rake_helper and refactored Rakefiles.
josevalim authored
1 current_dir = File.dirname(__FILE__)
2 require File.join(current_dir, "remarkable/lib/remarkable/version.rb")
3
4 require 'rubygems'
5 require 'rake/gempackagetask'
6 require 'rake/rdoctask'
7
8 ########### Common package && release
9
10 RUBY_FORGE_PROJECT = "remarkable"
11 PROJECT_URL = "http://github.com/carlosbrando/remarkable"
12
13 GEM_VERSION = Remarkable::VERSION
14 PACKAGE_DIR = File.join(File.dirname(__FILE__), 'pkg')
15 RELEASE_NAME = "REL #{GEM_VERSION}"
16
17 RSPEC_VERSION = '1.2.0'
18
afeab80 @josevalim More rake refactoring.
josevalim authored
19 def self.configure_gemspec!
20 $spec = Gem::Specification.new do |s|
21 s.rubyforge_project = RUBY_FORGE_PROJECT
22 s.name = GEM_NAME
23 s.version = GEM_VERSION
24 s.platform = Gem::Platform::RUBY
25 s.has_rdoc = true
26 s.extra_rdoc_files = EXTRA_RDOC_FILES
27 s.summary = PROJECT_SUMMARY
28 s.description = PROJECT_DESCRIPTION
29 s.authors = GEM_AUTHOR
30 s.email = GEM_EMAIL
31 s.homepage = PROJECT_URL
32 s.require_path = 'lib'
33 s.files = EXTRA_RDOC_FILES + Dir.glob("{lib,locale}/**/*")
34 s.test_files = Dir.glob("spec/**/*")
afdf127 @josevalim Add rspec as requirement for all gems.
josevalim authored
35 s.add_dependency('rspec', ">= #{RSPEC_VERSION}")
afeab80 @josevalim More rake refactoring.
josevalim authored
36 yield s
37 end
38
39 Rake::GemPackageTask.new($spec) do |pkg|
40 pkg.package_dir = PACKAGE_DIR
41 pkg.gem_spec = $spec
42 pkg.need_zip = true
43 pkg.need_tar = true
44 end
45 end
46
2d67913 @josevalim Created rake_helper and refactored Rakefiles.
josevalim authored
47 desc "Create a gemspec file"
48 task :gemspec do
49 File.open("#{GEM_NAME}.gemspec", "w") do |file|
50 file.puts $spec.to_ruby
51 end
52 end
53
54 desc "Build the gem and install it"
55 task :install => :gem do
081856c @josevalim --no-ri and --no-rdoc when rake install is run.
josevalim authored
56 system("sudo gem install #{PACKAGE_DIR}/#{GEM_NAME}-#{GEM_VERSION}.gem --local --ignore-dependencies --no-ri --no-rdoc")
2d67913 @josevalim Created rake_helper and refactored Rakefiles.
josevalim authored
57 end
58
59 desc "Uninstall the gem"
60 task :uninstall do
61 system("sudo gem uninstall #{GEM_NAME} --version #{GEM_VERSION}")
62 end
63
64 ########### Common specs
65
d64dd60 @josevalim Make :through associations look for the through_reflection and source…
josevalim authored
66 gem 'rspec'
2d67913 @josevalim Created rake_helper and refactored Rakefiles.
josevalim authored
67 require 'spec/rake/spectask'
68
69 desc "Run the specs under spec"
70 Spec::Rake::SpecTask.new do |t|
71 t.spec_opts = ['--options', "spec/spec.opts"]
72 t.spec_files = FileList['spec/**/*_spec.rb']
73 end
74
75 ########## Common rdoc
76
77 Rake::RDocTask.new do |rdoc|
78 rdoc.main = "README"
79 rdoc.rdoc_dir = 'rdoc'
80 rdoc.title = GEM_NAME
81 rdoc.rdoc_files.include(*EXTRA_RDOC_FILES)
82 rdoc.rdoc_files.include('lib/**/*.rb')
83 rdoc.options << '--line-numbers' << '--inline-source'
84 end
Something went wrong with that request. Please try again.