Parent

Methods

Class Index [+]

Quicksearch

Jeweler::Generator::Options

Attributes

opts[R]
orig_args[R]

Public Class Methods

new(args) click to toggle source
     # File lib/jeweler/generator/options.rb, line 7
  7:       def initialize(args)
  8:         super()
  9: 
 10:         @orig_args = args.clone
 11:         self[:testing_framework]       = :shoulda
 12:         self[:documentation_framework] = :rdoc
 13:         self[:gemcutter]               = true
 14: 
 15:         git_config = Git.global_config
 16:         self[:user_name]       = git_config['user.name']
 17:         self[:user_email]      = git_config['user.email']
 18:         self[:github_username] = git_config['github.user']
 19:         self[:github_token]    = git_config['github.token']
 20: 
 21:         require 'optparse'
 22:         @opts = OptionParser.new do |o|
 23:           o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
 24: 
 25:           o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|
 26:             self[:directory] = directory
 27:           end
 28: 
 29:           o.separator ""
 30: 
 31:           o.on('--rspec', 'generate rspec code examples') do
 32:             self[:testing_framework] = :rspec
 33:           end
 34: 
 35:           o.on('--shoulda', 'generate shoulda tests') do
 36:             self[:testing_framework] = :shoulda
 37:           end
 38: 
 39:           o.on('--testunit', 'generate test/unit tests') do
 40:             self[:testing_framework] = :testunit
 41:           end
 42: 
 43:           o.on('--bacon', 'generate bacon specifications') do
 44:             self[:testing_framework] = :bacon
 45:           end
 46: 
 47:           o.on('--testspec', 'generate test/spec tests') do
 48:             self[:testing_framework] = :testspec
 49:           end
 50: 
 51:           o.on('--minitest', 'generate minitest tests') do
 52:             self[:testing_framework] = :minitest
 53:           end
 54: 
 55:           o.on('--micronaut', 'generate micronaut examples') do
 56:             self[:testing_framework] = :micronaut
 57:           end
 58: 
 59:           o.on('--riot', 'generate riot tests') do
 60:             self[:testing_framework] = :riot
 61:           end
 62: 
 63:           o.separator ""
 64: 
 65:           o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
 66:             self[:use_cucumber] = true
 67:           end
 68: 
 69:           o.separator ""
 70: 
 71:           o.on('--reek', 'generate rake task for reek') do
 72:             self[:use_reek] = true
 73:           end
 74: 
 75:           o.on('--roodi', 'generate rake task for roodi') do
 76:             self[:use_roodi] = true
 77:           end
 78: 
 79:           o.separator ""
 80: 
 81:           o.on('--[no-]gemcutter', 'setup project for gemcutter') do |v|
 82:             self[:gemcutter] = v
 83:           end
 84: 
 85:           o.on('--rubyforge', 'setup project for rubyforge') do
 86:             self[:rubyforge] = true
 87:           end
 88: 
 89:           o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
 90:             self[:summary] = summary
 91:           end
 92: 
 93:           o.on('--description [DESCRIPTION]', 'specify a description of the project') do |description|
 94:             self[:description] = description
 95:           end
 96: 
 97:           o.separator ""
 98: 
 99:           o.on('--user-name [USER_NAME]', "the user's name, ie that is credited in the LICENSE") do |user_name|
100:             self[:user_name] = user_name
101:           end
102: 
103:           o.on('--user-email [USER_EMAIL]', "the user's email, ie that is credited in the Gem specification") do |user_email|
104:             self[:user_email] = user_email
105:           end
106: 
107:           o.separator ""
108: 
109:           o.on('--github-username [GITHUB_USERNAME]', "name of the user on GitHub to set the project up under") do |github_username|
110:             self[:github_username] = github_username
111:           end
112: 
113:           o.on('--github-token [GITHUB_TOKEN]', "GitHub token to use for interacting with the GitHub API") do |github_token|
114:             self[:github_token] = github_token
115:           end
116: 
117:           o.on('--git-remote [GIT_REMOTE]', 'URI to set the git origin remote to') do |git_remote|
118:             self[:git_remote] = git_remote
119:           end
120: 
121:           o.on('--homepage [HOMEPAGE]', "the homepage for your project (defaults to the GitHub repo)") do |homepage|
122:             self[:homepage] = homepage
123:           end
124: 
125:           o.on('--create-repo', 'create the repository on GitHub') do
126:             self[:create_repo] = true
127:           end
128: 
129: 
130:           o.separator ""
131: 
132:           o.on('--yard', 'use yard for documentation') do
133:             self[:documentation_framework] = :yard
134:           end
135: 
136:           o.on('--rdoc', 'use rdoc for documentation') do
137:             self[:documentation_framework] = :rdoc
138:           end
139: 
140:           o.on_tail('-h', '--help', 'display this help and exit') do
141:             self[:show_help] = true
142:           end
143:         end
144: 
145:         begin
146:           @opts.parse!(args)
147:           self[:project_name] = args.shift
148:         rescue OptionParser::InvalidOption => e
149:           self[:invalid_argument] = e.message
150:         end
151:       end

Public Instance Methods

merge(other) click to toggle source
     # File lib/jeweler/generator/options.rb, line 153
153:       def merge(other)
154:         self.class.new(@orig_args + other.orig_args)
155:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.