Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add sequel_nested_set.gemspec

Refactor Rakefile to use gemspec for building gem locally
  • Loading branch information...
commit ed14562d6e1a6b6548e7b5ae242967d3bc9904ee 1 parent 1c34ef2
authored January 11, 2009

Showing 1 changed file with 21 additions and 48 deletions. Show diff stats Hide diff stats

  1. 69  Rakefile
69  Rakefile
@@ -2,13 +2,13 @@
2 2
 # Constants
3 3
 ##############################################################################
4 4
  
5  
-PluginName = "sequel_nested_set"
6  
-Version = "0.9"
7  
-Title = "Nested Set Sequel Plugin"
8  
-Summary = "Sequel Nested Set Plugin"
9  
-Authors = "Brian Cooke"
10  
-Emails = "kondzior.p@gmail.com"
11  
-Homepage = "http://sequel.rubyforge.org"
  5
+#PluginName = "sequel_nested_set"
  6
+#Version = "0.9"
  7
+#Title = "Sequel Nested Set Plugin"
  8
+#Summary = "Nested set implementation for Sequel Models"
  9
+#Authors = "Paweł Kondzior"
  10
+#Emails = "kondzior.p@gmail.com"
  11
+#Homepage = "http://sequelns.rubyforge.org"
12 12
  
13 13
 ##############################################################################
14 14
 # Gem Management
@@ -23,15 +23,11 @@ include FileUtils
23 23
  
24 24
 CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
25 25
  
26  
-RDocOptions = [
27  
-  "--quiet", "--title", Title,
28  
-  "--opname", "index.html",
29  
-  "--line-numbers",
30  
-  "--main", "README",
31  
-  "--inline-source"
32  
-]
  26
+gemspec_data = File.read("sequel_nested_set.gemspec")
  27
+spec = nil
  28
+Thread.new { spec = eval("$SAFE = 3\n#{gemspec_data}") }.join
33 29
  
34  
-desc "Packages up the Sequel Plugin: #{PluginName}."
  30
+desc "Packages up the Sequel Plugin: #{spec.name}."
35 31
 task :default => [:package]
36 32
 task :package => [:clean]
37 33
  
@@ -39,34 +35,11 @@ task :doc => [:rdoc]
39 35
  
40 36
 Rake::RDocTask.new do |rdoc|
41 37
   rdoc.rdoc_dir = "doc/rdoc"
42  
-  rdoc.options += RDocOptions
  38
+  rdoc.options += spec.rdoc_options
43 39
   rdoc.main = "README"
44  
-  rdoc.title = Title
45  
-  rdoc.rdoc_files.add ["README", "COPYING", "lib/#{PluginName}.rb", "lib/**/*.rb"]
46  
-end
47  
- 
48  
-spec = Gem::Specification.new do |s|
49  
-  s.name = PluginName
50  
-  s.version = Version
51  
-  s.platform = Gem::Platform::RUBY
52  
-  s.has_rdoc = true
53  
-  s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
54  
-  s.rdoc_options += RDocOptions# +
55  
-    #["--exclude", "^(examples|extras)\/", "--exclude", "lib/sequel.rb"]
56  
-  s.summary = Summary
57  
-  s.description = Summary
58  
-  s.author = Authors
59  
-  s.email = Emails
60  
-  s.homepage = Homepage
61  
-  # change this to the plugin name, if the plugin has command line portion
62  
-  #s.executables = ["sequel"]
63  
- 
64  
-  s.add_dependency("sequel_model")
65  
-  
66  
-  s.files = %w(COPYING README Rakefile) + Dir.glob("{bin,doc,spec,lib}/**/*")
67  
-  
68  
-  s.require_path = "lib"
69  
-  s.bindir = "bin"
  40
+  rdoc.title = spec.name
  41
+  rdoc.rdoc_files.add ["lib/*.rb", "lib/**/*.rb"]
  42
+  rdoc.rdoc_files.add spec.extra_rdoc_files
70 43
 end
71 44
  
72 45
 Rake::GemPackageTask.new(spec) do |p|
@@ -76,28 +49,28 @@ end
76 49
  
77 50
 task :release => [:package] do
78 51
   sh %{rubyforge login}
79  
-  sh %{rubyforge add_release sequel #{PluginName} #{Version} pkg/#{PluginName}-#{Version}.tgz}
80  
-  sh %{rubyforge add_file sequel #{PluginName} #{Version} pkg/#{PluginName}-#{Version}.gem}
  52
+  sh %{rubyforge add_release sequel #{spec.name} #{Version} pkg/#{spec.name}-#{spec.version}.tgz}
  53
+  sh %{rubyforge add_file sequel #{spec.name} #{Version} pkg/#{spec.name}-#{spec.version}.gem}
81 54
 end
82 55
  
83 56
 task :install do
84 57
   sh %{rake package}
85  
-  sh %{sudo gem install pkg/#{PluginName}-#{Version}.gem}
  58
+  sh %{sudo gem install pkg/#{spec.name}-#{spec.version}.gem}
86 59
 end
87 60
  
88 61
 task :install_no_docs do
89 62
   sh %{rake package}
90  
-  sh %{sudo gem install pkg/#{PluginName}-#{Version}.gem --no-rdoc --no-ri}
  63
+  sh %{sudo gem install pkg/#{spec.name}-#{spec.version}.gem --no-rdoc --no-ri}
91 64
 end
92 65
  
93 66
 task :uninstall => [:clean] do
94  
-  sh %{sudo gem uninstall #{PluginName}}
  67
+  sh %{sudo gem uninstall #{spec.name}}
95 68
 end
96 69
  
97 70
 desc "Update docs and upload to rubyforge.org"
98 71
 task :doc_rforge do
99 72
   sh %{rake doc}
100  
-  sh %{scp -r doc/rdoc/* ciconia@rubyforge.org:/var/www/gforge-projects/sequel/plugins/#{PluginName}}
  73
+  sh %{scp -r doc/rdoc/* ciconia@rubyforge.org:/var/www/gforge-projects/sequel/plugins/#{spec.name}}
101 74
 end
102 75
  
103 76
 ##############################################################################

0 notes on commit ed14562

Please sign in to comment.
Something went wrong with that request. Please try again.