markbates-gemstub 1.2.6.20090611142140 → 1.5.0.20090722113517

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/gemstub.rb CHANGED
@@ -1,5 +1,147 @@
1
1
  require 'genosaurus'
2
2
  require "mack-facets"
3
- require File.join(File.dirname(__FILE__), 'gemstub', 'tools')
4
3
  require File.join(File.dirname(__FILE__), 'gemstub', 'gem_generator', 'gem_generator')
5
- require File.join(File.dirname(__FILE__), 'gemstub', 'yaml_generator', 'yaml_generator')
4
+
5
+ require 'rake'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/clean'
8
+ require 'rake/testtask'
9
+ require 'rake/rdoctask'
10
+ require 'find'
11
+ require 'rubyforge'
12
+ require 'rubygems'
13
+ require 'rubygems/gem_runner'
14
+ require 'spec'
15
+ require 'spec/rake/spectask'
16
+ require 'fileutils'
17
+
18
+ module Gemstub
19
+
20
+ class << self
21
+
22
+ attr_accessor :test_framework
23
+
24
+ def rspec?
25
+ test_framework == :rspec
26
+ end
27
+
28
+ def test_unit?
29
+ test_framework == :test_unit
30
+ end
31
+
32
+ def test_framework=(framework)
33
+ @test_framework = framework
34
+ if rspec?
35
+ # rake
36
+ desc 'Run specifications'
37
+ Spec::Rake::SpecTask.new(:default) do |t|
38
+ opts = File.join('spec', 'spec.opts')
39
+ t.spec_opts << '--options' << opts if File.exists?(opts)
40
+ t.spec_files = Dir.glob('spec/**/*_spec.rb')
41
+ end
42
+ elsif test_unit?
43
+ task :default => :test
44
+ Rake::TestTask.new do |t|
45
+ t.libs << "test"
46
+ t.pattern = 'test/unit/**/test_*.rb'
47
+ t.verbose = true
48
+ t.warning = true
49
+ end
50
+ end
51
+ end
52
+
53
+ def gem_spec(&block)
54
+ @gem_spec = Gem::Specification.new do |s|
55
+ s.name = File.basename(FileUtils.pwd)
56
+ s.version = "0.0.1"
57
+ s.summary = s.name
58
+ s.author = (ENV["USERNAME"] || ENV["USER"])
59
+ s.description = "#{s.name} was developed by: #{s.author}"
60
+ s.email = ""
61
+ s.homepage = ""
62
+ s.files = FileList['lib/**/*.*', 'README', 'LICENSE', 'bin/**/*.*']
63
+ s.require_paths = ['lib']
64
+ s.extra_rdoc_files = ['README', 'LICENSE']
65
+ s.has_rdoc = true
66
+ yield s
67
+ end
68
+
69
+ # rake package
70
+ Rake::GemPackageTask.new(@gem_spec) do |pkg|
71
+ pkg.need_zip = false
72
+ pkg.need_tar = false
73
+ rm_f FileList['pkg/**/*.*']
74
+ end
75
+
76
+ desc 'regenerate the gemspec'
77
+ task :gemspec do
78
+ @gem_spec.version = "#{@gem_spec.version}.#{Time.now.strftime('%Y%m%d%H%M%S')}"
79
+ File.open(File.join('content_o_matic.gemspec'), 'w') {|f| f.puts @gem_spec.to_ruby}
80
+ end
81
+
82
+ desc "Install the gem"
83
+ task :install => [:package] do |t|
84
+ sudo = ENV['SUDOLESS'] == 'true' || RUBY_PLATFORM =~ /win32|cygwin/ ? '' : 'sudo'
85
+ puts `#{sudo} gem install #{File.join("pkg", @gem_spec.name)}-#{@gem_spec.version}.gem --no-update-sources --no-ri --no-rdoc`
86
+ end
87
+
88
+ desc "Release the gem"
89
+ task :release => :install do |t|
90
+ begin
91
+ ac_path = File.join(ENV["HOME"], ".rubyforge", "auto-config.yml")
92
+ if File.exists?(ac_path)
93
+ fixed = File.open(ac_path).read.gsub(" ~: {}\n\n", '')
94
+ fixed.gsub!(/ !ruby\/object:Gem::Version \? \n.+\n.+\n\n/, '')
95
+ puts "Fixing #{ac_path}..."
96
+ File.open(ac_path, "w") {|f| f.puts fixed}
97
+ end
98
+ begin
99
+ rf = RubyForge.new
100
+ rf.configure
101
+ rf.login
102
+ rf.add_release(@gem_spec.rubyforge_project, @gem_spec.name, @gem_spec.version, File.join("pkg", "#{@gem_spec.name}-#{@gem_spec.version}.gem"))
103
+ rescue Exception => e
104
+ if e.message.match("Invalid package_id") || e.message.match("no <package_id> configured for")
105
+ puts "You need to create the package!"
106
+ rf.create_package(@gem_spec.rubyforge_project, @gem_spec.name)
107
+ rf.add_release(@gem_spec.rubyforge_project, @gem_spec.name, @gem_spec.version, File.join("pkg", "#{@gem_spec.name}-#{@gem_spec.version}.gem"))
108
+ else
109
+ raise e
110
+ end
111
+ end
112
+ rescue Exception => e
113
+ if e.message == "You have already released this version."
114
+ puts e
115
+ else
116
+ raise e
117
+ end
118
+ end
119
+ end
120
+
121
+ end # gem_spec
122
+
123
+ def rdoc(&block)
124
+ Rake::RDocTask.new do |rd|
125
+ rd.main = "README"
126
+ files = Dir.glob("**/*.rb")
127
+ if rspec?
128
+ files = files.collect {|f| f unless f.match("spec/") || f.match("doc/") }.compact
129
+ elsif test_unit?
130
+ files = files.collect {|f| f unless f.match("test/") || f.match("doc/") }.compact
131
+ end
132
+ files << 'README'
133
+ files << 'LICENSE'
134
+ rd.rdoc_files = files
135
+ rd.rdoc_dir = "doc"
136
+ rd.options << "--line-numbers"
137
+ rd.options << "--inline-source"
138
+ rd.title = "content_o_matic"
139
+ yield rd if block_given?
140
+ end
141
+ end
142
+
143
+ end # class << self
144
+
145
+ end # Gemstub
146
+
147
+ Gemstub.rdoc
@@ -1,133 +1,18 @@
1
- require 'rake'
2
- require 'rake/gempackagetask'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/rdoctask'
6
- require 'find'
7
- require 'rubyforge'
8
1
  require 'rubygems'
9
- require 'rubygems/gem_runner'
10
- <%- if rspec? -%>
11
- require 'spec'
12
- require 'spec/rake/spectask'
13
- <%- elsif unit? -%>
14
- begin
15
- require 'shoulda'
16
- require 'shoulda/tasks'
17
- rescue LoadError
2
+ require 'gemstub'
3
+
4
+ <% if rspec? -%>
5
+ Gemstub.test_framework = :rspec
6
+ <% elsif unit? -%>
7
+ Gemstub.test_framework = :test_unit
8
+ <% end -%>
9
+
10
+ Gemstub.gem_spec do |s|
11
+ # s.version = "0.0.1"
12
+ # s.rubyforge_project = "<%= app -%>"
13
+ # s.add_dependency('')
18
14
  end
19
- <%- end -%>
20
15
 
21
- @gem_spec = Gem::Specification.new do |s|
22
- s.name = "<%= app %>"
23
- s.version = "<%= version %>"
24
- s.summary = "<%= app %>"
25
- s.description = "<%= app %> was developed by: <%= author %>"
26
- s.author = "<%= author %>"
27
- s.email = ""
28
- s.homepage = ""
29
- s.files = FileList['lib/**/*.*', 'README', 'LICENSE', 'bin/**/*.*']
30
- s.require_paths = ['lib']
31
- s.extra_rdoc_files = ['README', 'LICENSE']
32
- s.has_rdoc = true
33
- s.rubyforge_project = "<%= app %>"
34
- # s.test_files = FileList['spec/**/*']
35
- #s.bindir = "bin"
36
- #s.executables << "<%= app %>"
37
- #s.add_dependency("", "")
38
- #s.add_dependency("", "")
39
- #s.extensions << ""
40
- #s.required_ruby_version = ">= 1.8.6"
41
- #s.default_executable = ""
42
- #s.platform = "Gem::Platform::Ruby"
43
- #s.requirements << "An ice cold beer."
44
- #s.requirements << "Some free time!"
45
- end
46
-
47
- # rake package
48
- Rake::GemPackageTask.new(@gem_spec) do |pkg|
49
- pkg.need_zip = false
50
- pkg.need_tar = false
51
- rm_f FileList['pkg/**/*.*']
52
- end
53
-
54
- <%- if rspec? -%>
55
- # rake
56
- desc 'Run specifications'
57
- Spec::Rake::SpecTask.new(:default) do |t|
58
- opts = File.join(File.dirname(__FILE__), "spec", 'spec.opts')
59
- t.spec_opts << '--options' << opts if File.exists?(opts)
60
- t.spec_files = Dir.glob('spec/**/*_spec.rb')
61
- end
62
- <%- elsif unit? -%>
63
- task :default => :test
64
- Rake::TestTask.new { |t|
65
- t.libs << "test"
66
- t.pattern = 'test/unit/**/test_*.rb'
67
- t.verbose = true
68
- t.warning = true
69
- }
70
- <%- end -%>
71
-
72
- desc 'regenerate the gemspec'
73
- task :gemspec do
74
- @gem_spec.version = "#{@gem_spec.version}.#{Time.now.strftime('%Y%m%d%H%M%S')}"
75
- File.open(File.join(File.dirname(__FILE__), '<%= app %>.gemspec'), 'w') {|f| f.puts @gem_spec.to_ruby}
76
- end
77
-
78
- desc "Install the gem"
79
- task :install => [:package] do |t|
80
- sudo = ENV['SUDOLESS'] == 'true' || RUBY_PLATFORM =~ /win32|cygwin/ ? '' : 'sudo'
81
- puts `#{sudo} gem install #{File.join("pkg", @gem_spec.name)}-#{@gem_spec.version}.gem --no-update-sources --no-ri --no-rdoc`
82
- end
83
-
84
- desc "Release the gem"
85
- task :release => :install do |t|
86
- begin
87
- ac_path = File.join(ENV["HOME"], ".rubyforge", "auto-config.yml")
88
- if File.exists?(ac_path)
89
- fixed = File.open(ac_path).read.gsub(" ~: {}\n\n", '')
90
- fixed.gsub!(/ !ruby\/object:Gem::Version \? \n.+\n.+\n\n/, '')
91
- puts "Fixing #{ac_path}..."
92
- File.open(ac_path, "w") {|f| f.puts fixed}
93
- end
94
- begin
95
- rf = RubyForge.new
96
- rf.configure
97
- rf.login
98
- rf.add_release(@gem_spec.rubyforge_project, @gem_spec.name, @gem_spec.version, File.join("pkg", "#{@gem_spec.name}-#{@gem_spec.version}.gem"))
99
- rescue Exception => e
100
- if e.message.match("Invalid package_id") || e.message.match("no <package_id> configured for")
101
- puts "You need to create the package!"
102
- rf.create_package(@gem_spec.rubyforge_project, @gem_spec.name)
103
- rf.add_release(@gem_spec.rubyforge_project, @gem_spec.name, @gem_spec.version, File.join("pkg", "#{@gem_spec.name}-#{@gem_spec.version}.gem"))
104
- else
105
- raise e
106
- end
107
- end
108
- rescue Exception => e
109
- if e.message == "You have already released this version."
110
- puts e
111
- else
112
- raise e
113
- end
114
- end
115
- end
116
-
117
-
118
- Rake::RDocTask.new do |rd|
119
- rd.main = "README"
120
- files = Dir.glob("**/*.rb")
121
- <%- if rspec? -%>
122
- files = files.collect {|f| f unless f.match("spec/") || f.match("doc/") }.compact
123
- <%- elsif unit? -%>
124
- files = files.collect {|f| f unless f.match("test/") || f.match("doc/") }.compact
125
- <%- end -%>
126
- files << 'README'
127
- files << 'LICENSE'
128
- rd.rdoc_files = files
129
- rd.rdoc_dir = "doc"
130
- rd.options << "--line-numbers"
131
- rd.options << "--inline-source"
132
- rd.title = "<%= app %>"
16
+ Gemstub.rdoc do |rd|
17
+ rd.title = "<%= app -%>"
133
18
  end
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), "..", "test_helper")
2
2
 
3
3
  class Test<%= app.classify %> < Test::Unit::TestCase
4
- context <%= app.classify %> do
4
+ context '<%= app.classify %>' do
5
5
  should "pass" do
6
6
  assert true
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markbates-gemstub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6.20090611142140
4
+ version: 1.5.0.20090722113517
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Bates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-11 00:00:00 -07:00
12
+ date: 2009-07-22 00:00:00 -07:00
13
13
  default_executable: gemstub
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -63,10 +63,6 @@ files:
63
63
  - lib/gemstub/gem_generator/templates/spec/spec_helper.rb.template
64
64
  - lib/gemstub/gem_generator/templates/test/test_app.rb.template
65
65
  - lib/gemstub/gem_generator/templates/test/test_helper.rb.template
66
- - lib/gemstub/tools.rb
67
- - lib/gemstub/yaml_generator/manifest.yml
68
- - lib/gemstub/yaml_generator/templates/gems.yml.template
69
- - lib/gemstub/yaml_generator/yaml_generator.rb
70
66
  - lib/gemstub.rb
71
67
  - README
72
68
  - bin/gemstub
@@ -94,7 +90,7 @@ requirements: []
94
90
  rubyforge_project: gemstub
95
91
  rubygems_version: 1.2.0
96
92
  signing_key:
97
- specification_version: 2
93
+ specification_version: 3
98
94
  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!"
99
95
  test_files: []
100
96
 
data/lib/gemstub/tools.rb DELETED
@@ -1,5 +0,0 @@
1
- module Gemstub
2
- module Tools
3
-
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- template_1:
2
- type: file
3
- template_path: <%= File.join(templates_directory_path, 'gems.yml.template') %>
4
- output_path: <%= File.join(output_dir, 'gems.yml') %>
@@ -1,23 +0,0 @@
1
- # specify an alternate gems repository
2
- # source: http://local_mirror.example.com
3
- # specify a different gem command
4
- # gem_command: 'jruby -S gem'
5
- gems:
6
- # - name: postgres
7
- # # the version to use
8
- # version: '0.7.1'
9
- # # use a specfic source URL
10
- # source: 'http://mongrel.rubyforge.org/releases'
11
- # # load with GemTools.load_gems
12
- # load: true
13
- # # any extra config that needs to be passed to gem install
14
- # config: '--with-pgsql-include-dir=/usr/local/pgsql/include --with-pgsql-lib-dir=/usr/local/pgsql/lib'
15
- # # require name is different than the gem name
16
- # require_name: foo-bar
17
- # - name: mislav-will_paginate
18
- # version: 2.3.2
19
- # require_name:
20
- # - will_paginate
21
- # - will_paginate/collection
22
- # - will_paginate/array
23
- # load: true
@@ -1,7 +0,0 @@
1
- class YamlGenerator < Genosaurus
2
-
3
- def output_dir
4
- param('output_dir') || 'config'
5
- end
6
-
7
- end