technicalpickles-jeweler 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/ChangeLog.markdown +27 -7
  2. data/README.markdown +9 -3
  3. data/Rakefile +30 -24
  4. data/TODO +2 -2
  5. data/VERSION.yml +2 -2
  6. data/bin/jeweler +1 -77
  7. data/lib/jeweler/commands/build_gem.rb +22 -0
  8. data/lib/jeweler/commands/install_gem.rb +19 -0
  9. data/lib/jeweler/commands/release.rb +45 -0
  10. data/lib/jeweler/commands/validate_gemspec.rb +21 -0
  11. data/lib/jeweler/commands/version/base.rb +30 -0
  12. data/lib/jeweler/commands/version/bump_major.rb +13 -0
  13. data/lib/jeweler/commands/version/bump_minor.rb +12 -0
  14. data/lib/jeweler/commands/version/bump_patch.rb +14 -0
  15. data/lib/jeweler/commands/version/write.rb +12 -0
  16. data/lib/jeweler/commands/write_gemspec.rb +26 -0
  17. data/lib/jeweler/commands.rb +10 -0
  18. data/lib/jeweler/{gemspec.rb → gemspec_helper.rb} +7 -1
  19. data/lib/jeweler/generator/application.rb +45 -0
  20. data/lib/jeweler/generator/options.rb +64 -0
  21. data/lib/jeweler/generator.rb +66 -26
  22. data/lib/jeweler/tasks.rb +11 -29
  23. data/lib/jeweler/templates/.gitignore +3 -1
  24. data/lib/jeweler/templates/LICENSE +1 -1
  25. data/lib/jeweler/templates/README.rdoc +7 -0
  26. data/lib/jeweler/templates/Rakefile +48 -31
  27. data/lib/jeweler/templates/bacon/flunking.rb +1 -1
  28. data/lib/jeweler/templates/bacon/helper.rb +1 -1
  29. data/lib/jeweler/templates/features/support/env.rb +0 -2
  30. data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
  31. data/lib/jeweler/templates/micronaut/helper.rb +17 -0
  32. data/lib/jeweler/templates/minitest/flunking.rb +1 -1
  33. data/lib/jeweler/templates/minitest/helper.rb +1 -0
  34. data/lib/jeweler/templates/rspec/flunking.rb +1 -1
  35. data/lib/jeweler/templates/rspec/helper.rb +1 -1
  36. data/lib/jeweler/templates/shoulda/flunking.rb +2 -2
  37. data/lib/jeweler/templates/shoulda/helper.rb +1 -1
  38. data/lib/jeweler/templates/testunit/flunking.rb +1 -1
  39. data/lib/jeweler/templates/testunit/helper.rb +1 -1
  40. data/lib/jeweler/{version.rb → version_helper.rb} +1 -1
  41. data/lib/jeweler.rb +59 -141
  42. data/test/jeweler/commands/test_build_gem.rb +53 -0
  43. data/{lib/jeweler/templates/features/steps/default_steps.rb → test/jeweler/commands/test_install_gem.rb} +0 -0
  44. data/test/jeweler/commands/test_release.rb +145 -0
  45. data/test/jeweler/commands/test_write_gemspec.rb +58 -0
  46. data/test/jeweler/commands/version/test_bump_major.rb +21 -0
  47. data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
  48. data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
  49. data/test/jeweler/commands/version/test_write.rb +23 -0
  50. data/test/test_application.rb +109 -0
  51. data/test/{test_gemspec.rb → test_gemspec_helper.rb} +9 -5
  52. data/test/test_generator.rb +179 -0
  53. data/test/test_helper.rb +11 -23
  54. data/test/test_jeweler.rb +12 -9
  55. data/test/test_options.rb +90 -0
  56. data/test/test_tasks.rb +3 -4
  57. data/test/{test_version.rb → test_version_helper.rb} +16 -16
  58. metadata +44 -11
  59. data/lib/jeweler/templates/README +0 -9
data/ChangeLog.markdown CHANGED
@@ -1,8 +1,27 @@
1
- # jeweler 0.8.1
1
+ # jeweler x.y.z
2
+
3
+ * Tasks:
4
+ * Fixed populating default spec's extra_rdoc_files
5
+ * Removed redudant gem building/installing tasks. Use rake build and rake install
6
+ * Generator:
7
+ * Added support for micronaut
8
+ * Generate nicer block variable names in Rakefile
9
+ * Cucumber generation now places steps in features/step_features, to follow cucumber standards
10
+
11
+ * shoulda and test/unit test_helpers no longers require mocha
12
+ * Rakefile uses more readable block variable names
13
+ * .gitignore now includes pkg and coverage directories
14
+ * Avoid puts'ing in Rakefile when LoadError occurs. Instead, define a task that aborts with instructions to install.
15
+ * Cucumber is now optional. Generate stories using --cucumber
16
+ * Bacon's 'test' task is now 'spec'
17
+ * Generate README.rdoc instead of just a plain text README
18
+ * Updated year in README.rdoc and COPYRIGHT to be based on the current year instead of hardcoded
19
+
20
+ # jeweler 0.8.1 2009-02-03
2
21
 
3
22
  * Fixed minitest generator
4
23
 
5
- # jeweler 0.8.0
24
+ # jeweler 0.8.0 2009-02-03
6
25
 
7
26
  * Generator:
8
27
  * Supports these new testing frameworks:
@@ -13,26 +32,27 @@
13
32
  * Creating a new gem is now more verbose, and will show files/directories created
14
33
  * Binaries will now be automatically detected in 'bin'
15
34
 
16
- # jeweler 0.7.2
35
+ # jeweler 0.7.2 2009-01-29
17
36
 
18
37
  * Added rake task 'version:bump' which is shorthand for 'version:bump:patch'
19
38
  * Generated projects no longer assume RCov is installed.
20
39
 
21
- # jeweler 0.7.1
40
+ # jeweler 0.7.1 2009-01-26
22
41
 
23
42
  * Fixed yaml not being required
43
+ * Automatically add files in bin as executables in gemspec
24
44
 
25
- # jeweler 0.7.0
45
+ # jeweler 0.7.0 2009-01-19
26
46
 
27
47
  * Added support to generator for specifying a description
28
48
  * Condensed README.markdown to be less novel-like
29
49
  * RDoc is now included in your gemspec
30
50
  * Rescue errors that raise in the generator, and display better error message, and exit with a non-zero exit status
31
51
 
32
- # jeweler 0.6.5
52
+ # jeweler 0.6.5 2009-01-14
33
53
 
34
54
  * `jeweler --create-repo foo` now enables gem creation in addition to creating the repository
35
55
 
36
- # jeweler 0.6.4
56
+ # jeweler 0.6.4 2009-01-13
37
57
 
38
58
  * Added tasks `build` and `install` as shortcuts for `gem:build` and `gem:install`
data/README.markdown CHANGED
@@ -5,10 +5,16 @@ Jeweler provides two things:
5
5
  * Rake tasks for managing gems and versioning of a <a href="http://github.com">GitHub</a> project
6
6
  * A generator for creating kickstarting a new project
7
7
 
8
- ## Setting up in an existing project
8
+ ## Installing
9
9
 
10
- It's easy to get up and running. Update your instantiate a `Jeweler::Tasks`, and give it a block with details about your project.
10
+ # Run the following if you haven't done so before:
11
+ gem sources -a http://gems.github.com
12
+ # Install the gem:
13
+ sudo gem install technicalpickles-jeweler
14
+
15
+ ## Using in an existing project
11
16
 
17
+ It's easy to get up and running. Update your instantiate a `Jeweler::Tasks`, and give it a block with details about your project.
12
18
 
13
19
  begin
14
20
  require 'jeweler'
@@ -26,7 +32,7 @@ It's easy to get up and running. Update your instantiate a `Jeweler::Tasks`, and
26
32
 
27
33
  In this example, `s` is a Gem::Specification object. See the [GemSpec reference](http://www.rubygems.org/read/chapter/20) for values of interest.
28
34
 
29
- ## Kicking off a new project
35
+ ## Using to start a new project
30
36
 
31
37
  Jeweler provides a generator. It requires you to [setup your name and email for git](http://github.com/guides/tell-git-your-user-name-and-email-address) and [your username and token for GitHub](http://github.com/guides/local-github-config).
32
38
 
data/Rakefile CHANGED
@@ -1,33 +1,29 @@
1
1
  require 'rake'
2
- require 'rake/testtask'
3
- begin
4
- require 'hanna/rdoctask'
5
- rescue LoadError
6
- require 'rake/rdoctask'
7
- end
8
2
 
9
-
10
- $:.unshift('lib')
3
+ $LOAD_PATH.unshift('lib')
11
4
 
12
5
  begin
13
6
  require 'jeweler'
14
- Jeweler::Tasks.new do |s|
15
- s.name = "jeweler"
16
- s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
17
- s.email = "josh@technicalpickles.com"
18
- s.homepage = "http://github.com/technicalpickles/jeweler"
19
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
20
- s.authors = ["Josh Nichols"]
21
- s.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*", 'lib/jeweler/templates/.gitignore']
22
- s.add_dependency 'schacon-git'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "jeweler"
9
+ gem.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
10
+ gem.email = "josh@technicalpickles.com"
11
+ gem.homepage = "http://github.com/technicalpickles/jeweler"
12
+ gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
13
+ gem.authors = ["Josh Nichols"]
14
+ gem.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*", 'lib/jeweler/templates/.gitignore']
15
+ gem.add_dependency 'schacon-git'
23
16
  end
24
17
  rescue LoadError
25
18
  puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
26
19
  end
27
20
 
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'test'
24
+ end
28
25
 
29
- Rake::TestTask.new
30
-
26
+ require 'rake/rdoctask'
31
27
  Rake::RDocTask.new do |rdoc|
32
28
  rdoc.rdoc_dir = 'rdoc'
33
29
  rdoc.title = 'jeweler'
@@ -38,17 +34,27 @@ end
38
34
 
39
35
  begin
40
36
  require 'rcov/rcovtask'
41
- Rcov::RcovTask.new
37
+ Rcov::RcovTask.new(:rcov) do |rcov|
38
+ rcov.libs << 'test'
39
+ rcov.pattern = 'test/**/test_*.rb'
40
+ end
42
41
  rescue LoadError
43
- puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
+ task :rcov do
43
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
44
+ end
44
45
  end
45
46
 
46
47
  begin
47
48
  require 'cucumber/rake/task'
48
49
  Cucumber::Rake::Task.new(:features)
49
50
  rescue LoadError
50
- puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
51
+ task :features do
52
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
53
+ end
51
54
  end
52
55
 
53
-
54
- task :default => [:test, :features]
56
+ if ENV["RUN_CODE_RUN"] == "true"
57
+ task :default => [:test, :features]
58
+ else
59
+ task :default => :test
60
+ end
data/TODO CHANGED
@@ -7,5 +7,5 @@
7
7
  * Rails generator for making a plugin that's Jeweler enabled
8
8
  * Change generated test filename (test_foo not foo_test)
9
9
  * Releasing
10
- * Open hasmygembuiltyet.org
11
- * Enable runcoderun by default
10
+ * Have a way to check if the gem is built yet
11
+ * Option for enabling
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :minor: 9
3
+ :patch: 0
3
4
  :major: 0
4
- :minor: 8
data/bin/jeweler CHANGED
@@ -5,80 +5,4 @@ require 'optparse'
5
5
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
6
6
  require 'jeweler'
7
7
 
8
- class JewelerOpts < Hash
9
- attr_reader :opts
10
-
11
- def initialize(args)
12
- super()
13
-
14
- self[:testing_framework] = :shoulda
15
-
16
- @opts = OptionParser.new do |o|
17
- o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
18
-
19
- o.on('--bacon', 'generate bacon specs') do
20
- self[:testing_framework] = :bacon
21
- end
22
-
23
- o.on('--shoulda', 'generate shoulda tests') do
24
- self[:testing_framework] = :shoulda
25
- end
26
-
27
- o.on('--testunit', 'generate test/unit tests') do
28
- self[:testing_framework] = :testunit
29
- end
30
-
31
- o.on('--minitest', 'generate minitest tests') do
32
- self[:testing_framework] = :minitest
33
- end
34
-
35
- o.on('--rspec', 'generate rspec tests') do
36
- self[:testing_framework] = :rspec
37
- end
38
-
39
- o.on('--create-repo', 'create the repository on GitHub') do
40
- self[:create_repo] = true
41
- end
42
-
43
- o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
44
- self[:summary] = summary
45
- end
46
-
47
- o.on_tail('-h', '--help', 'display this help and exit') do
48
- puts o
49
- exit
50
- end
51
- end
52
-
53
- @opts.parse!(args)
54
- end
55
- end
56
-
57
- options = JewelerOpts.new(ARGV)
58
-
59
- unless ARGV.size == 1
60
- puts options.opts
61
- exit 1
62
- end
63
-
64
- github_repo_name = ARGV.first
65
-
66
- begin
67
- generator = Jeweler::Generator.new github_repo_name, options
68
- generator.run
69
- rescue Jeweler::NoGitUserName
70
- $stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.name "mad voo"}
71
- exit 1
72
- rescue Jeweler::NoGitUserEmail
73
- $stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.email mad.vooo@gmail.com}
74
- exit 1
75
- rescue Jeweler::NoGitHubUser
76
- $stderr.puts %Q{No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt}
77
- exit 1
78
- rescue Jeweler::NoGitHubToken
79
- $stderr.puts %Q{No github.token found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.token 6ef8395fecf207165f1a82178ae1b984}
80
- exit 1
81
- rescue Jeweler::FileInTheWay
82
- $stderr.puts "The directory #{github_repo_name} already exists. Maybe move it out of the way before continuing?"
83
- exit 1
84
- end
8
+ Jeweler::Generator::Application.run!(*ARGV)
@@ -0,0 +1,22 @@
1
+ class Jeweler
2
+ module Commands
3
+ class BuildGem
4
+ attr_accessor :base_dir, :gemspec_helper, :file_utils
5
+
6
+ def initialize
7
+ self.file_utils = FileUtils
8
+ end
9
+
10
+ def run
11
+ gemspec = gemspec_helper.parse
12
+ gem_file_name = Gem::Builder.new(gemspec).build
13
+
14
+ pkg_dir = File.join(base_dir, 'pkg')
15
+ file_utils.mkdir_p pkg_dir
16
+
17
+ gem_file_name = File.join(base_dir, gem_file_name)
18
+ file_utils.mv gem_file_name, pkg_dir
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ class Jeweler
2
+ module Commands
3
+ class InstallGem
4
+ attr_accessor :gemspec_helper, :output
5
+
6
+ def initialize
7
+ self.output = $stdout
8
+ end
9
+
10
+
11
+ def run
12
+ command = "sudo gem install #{gemspec_helper.gem_path}"
13
+ output.puts "Executing #{command.inspect}:"
14
+
15
+ sh command # TODO where does sh actually come from!?
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,45 @@
1
+ class Jeweler
2
+ module Commands
3
+ class Release
4
+ attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir
5
+
6
+ def initialize
7
+ self.output = $stdout
8
+ end
9
+
10
+ def run
11
+ repo.checkout('master')
12
+
13
+ raise "Hey buddy, try committing them files first" if any_pending_changes?
14
+
15
+ gemspec_helper.write
16
+
17
+ repo.add(gemspec_helper.path)
18
+ output.puts "Committing #{gemspec_helper.path}"
19
+ repo.commit("Regenerated gemspec for version #{version}")
20
+
21
+ output.puts "Pushing master to origin"
22
+ repo.push
23
+
24
+ output.puts "Tagging #{release_tag}"
25
+ repo.add_tag(release_tag)
26
+
27
+ output.puts "Pushing #{release_tag} to origin"
28
+ repo.push('origin', release_tag)
29
+ end
30
+
31
+ def any_pending_changes?
32
+ !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
33
+ end
34
+
35
+ def release_tag
36
+ "v#{version}"
37
+ end
38
+
39
+ def gemspec_helper
40
+ @gemspec_helper ||= Jeweler::GemSpecHelper.new(self.gemspec, self.base_dir)
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,21 @@
1
+ class Jeweler
2
+ module Commands
3
+ class ValidateGemspec
4
+ attr_accessor :gemspec_helper, :output
5
+
6
+ def initialize
7
+ self.output = $stdout
8
+ end
9
+
10
+ def run
11
+ begin
12
+ gemspec_helper.parse
13
+ output.puts "#{gemspec_helper.path} is valid."
14
+ rescue Exception => e
15
+ output.puts "#{gemspec_helper.path} is invalid. See the backtrace for more details."
16
+ raise
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ class Jeweler
2
+ module Commands
3
+ module Version
4
+ class Base
5
+
6
+ attr_accessor :repo, :version_helper, :gemspec, :commit
7
+
8
+ def run
9
+ update_version
10
+
11
+ self.version_helper.write
12
+ self.gemspec.version = self.version_helper.to_s
13
+
14
+ commit_version if self.repo && self.commit
15
+ end
16
+
17
+ def update_version
18
+ raise "Subclasses should implement this"
19
+ end
20
+
21
+ def commit_version
22
+ if self.repo
23
+ self.repo.add('VERSION.yml')
24
+ self.repo.commit("Version bump to #{self.version_helper.to_s}", 'VERSION.yml')
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,13 @@
1
+ class Jeweler
2
+ module Commands
3
+ module Version
4
+ class BumpMajor < Base
5
+
6
+ def update_version
7
+ self.version_helper.bump_major
8
+ end
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ class Jeweler
2
+ module Commands
3
+ module Version
4
+ class BumpMinor < Base
5
+
6
+ def update_version
7
+ self.version_helper.bump_minor
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class Jeweler
2
+ module Commands
3
+ module Version
4
+ class BumpPatch < Base
5
+
6
+ def update_version
7
+ self.version_helper.bump_patch
8
+ end
9
+
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,12 @@
1
+ class Jeweler
2
+ module Commands
3
+ module Version
4
+ class Write < Base
5
+ attr_accessor :major, :minor, :patch
6
+ def update_version
7
+ version_helper.update_to major, minor, patch
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,26 @@
1
+ class Jeweler
2
+ module Commands
3
+ class WriteGemspec
4
+ attr_accessor :base_dir, :gemspec, :version, :output, :gemspec_helper, :version_helper
5
+
6
+ def initialize
7
+ self.output = $stdout
8
+ end
9
+
10
+ def run
11
+ version_helper.refresh
12
+ gemspec_helper.spec.version = version_helper.to_s
13
+ gemspec_helper.spec.date = Time.now
14
+
15
+ gemspec_helper.write
16
+
17
+ output.puts "Generated: #{gemspec_helper.path}"
18
+ end
19
+
20
+ def gemspec_helper
21
+ @gemspec_helper ||= GemSpecHelper.new(self.gemspec, self.base_dir)
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ require 'jeweler/commands/build_gem'
2
+ require 'jeweler/commands/install_gem'
3
+ require 'jeweler/commands/release'
4
+ require 'jeweler/commands/validate_gemspec'
5
+ require 'jeweler/commands/write_gemspec'
6
+ require 'jeweler/commands/version/base'
7
+ require 'jeweler/commands/version/bump_major'
8
+ require 'jeweler/commands/version/bump_minor'
9
+ require 'jeweler/commands/version/bump_patch'
10
+ require 'jeweler/commands/version/write'
@@ -34,7 +34,13 @@ class Jeweler
34
34
 
35
35
  def parse
36
36
  data = File.read(path)
37
- Thread.new { eval("$SAFE = 3\n#{data}", binding, path) }.join
37
+ parsed_gemspec = nil
38
+ Thread.new { parsed_gemspec = eval("$SAFE = 3\n#{data}", binding, path) }.join
39
+ parsed_gemspec
40
+ end
41
+
42
+ def gem_path
43
+ File.join(@base_dir, 'pkg', parse.file_name)
38
44
  end
39
45
 
40
46
  end
@@ -0,0 +1,45 @@
1
+ class Jeweler
2
+ class Generator
3
+ class Application
4
+ class << self
5
+ def run!(*arguments)
6
+ options = Jeweler::Generator::Options.new(arguments)
7
+
8
+ if options[:show_help]
9
+ $stderr.puts options.opts
10
+ return 1
11
+ end
12
+
13
+ unless arguments.size == 1
14
+ $stderr.puts options.opts
15
+ return 1
16
+ end
17
+
18
+ github_repo_name = arguments.first
19
+
20
+ begin
21
+ generator = Jeweler::Generator.new(github_repo_name, options)
22
+ generator.run
23
+ return 0
24
+ rescue Jeweler::NoGitUserName
25
+ $stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.name "mad voo"}
26
+ return 1
27
+ rescue Jeweler::NoGitUserEmail
28
+ $stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.email mad.vooo@gmail.com}
29
+ return 1
30
+ rescue Jeweler::NoGitHubUser
31
+ $stderr.puts %Q{No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt}
32
+ return 1
33
+ rescue Jeweler::NoGitHubToken
34
+ $stderr.puts %Q{No github.token found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.token 6ef8395fecf207165f1a82178ae1b984}
35
+ return 1
36
+ rescue Jeweler::FileInTheWay
37
+ $stderr.puts "The directory #{github_repo_name} already exists. Maybe move it out of the way before continuing?"
38
+ return 1
39
+ end
40
+ end
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,64 @@
1
+ class Jeweler
2
+ class Generator
3
+ class Options < Hash
4
+ attr_reader :opts
5
+
6
+ def initialize(args)
7
+ super()
8
+
9
+ self[:testing_framework] = :shoulda
10
+
11
+ @opts = OptionParser.new do |o|
12
+ o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
13
+
14
+ o.on('--bacon', 'generate bacon specifications') do
15
+ self[:testing_framework] = :bacon
16
+ end
17
+
18
+ o.on('--shoulda', 'generate shoulda tests') do
19
+ self[:testing_framework] = :shoulda
20
+ end
21
+
22
+ o.on('--testunit', 'generate test/unit tests') do
23
+ self[:testing_framework] = :testunit
24
+ end
25
+
26
+ o.on('--minitest', 'generate minitest tests') do
27
+ self[:testing_framework] = :minitest
28
+ end
29
+
30
+ o.on('--rspec', 'generate rspec code examples') do
31
+ self[:testing_framework] = :rspec
32
+ end
33
+
34
+ o.on('--micronaut', 'generate micronaut examples') do
35
+ self[:testing_framework] = :micronaut
36
+ end
37
+
38
+ o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
39
+ self[:use_cucumber] = true
40
+ end
41
+
42
+ o.on('--create-repo', 'create the repository on GitHub') do
43
+ self[:create_repo] = true
44
+ end
45
+
46
+ o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
47
+ self[:summary] = summary
48
+ end
49
+
50
+ o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|
51
+ self[:directory] = directory
52
+ end
53
+
54
+ o.on_tail('-h', '--help', 'display this help and exit') do
55
+ self[:show_help] = true
56
+ end
57
+ end
58
+
59
+ @opts.parse!(args)
60
+ end
61
+
62
+ end
63
+ end
64
+ end