bio-gem 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +52 -1
- data/VERSION +1 -1
- data/bin/biogem +7 -3
- data/bio-gem.gemspec +7 -2
- data/lib/bio-gem.rb +3 -65
- data/lib/bio-gem/application.rb +57 -0
- data/lib/bio-gem/mod/jeweler.rb +95 -0
- data/lib/bio-gem/mod/jeweler/github_mixin.rb +15 -0
- data/lib/bio-gem/mod/jeweler/options.rb +181 -0
- data/lib/bio-gem/templates/bin +88 -0
- metadata +9 -4
data/README.rdoc
CHANGED
@@ -43,6 +43,8 @@ Some of these steps have been condensed:
|
|
43
43
|
* pass just the simple name, it will add bioruby- for the first level directory and for the github repository
|
44
44
|
BUT you'll require the library with bio-mystuff (and this will be the name used on rubygems)
|
45
45
|
* creates a basic gem structure with a default dependencies for bioruby (bio) version 1.4.1
|
46
|
+
|-- bin [optional = --with-bin]
|
47
|
+
| `-- biomystuff (executable)
|
46
48
|
|-- Gemfile
|
47
49
|
|-- Gemfile.lock
|
48
50
|
|-- LICENSE.txt
|
@@ -50,9 +52,10 @@ Some of these steps have been condensed:
|
|
50
52
|
|-- Rakefile
|
51
53
|
|-- lib
|
52
54
|
| `-- bio-mystuff.rb
|
53
|
-
|--
|
55
|
+
|-- db [optional = --with-db]
|
54
56
|
| `-- empty but put here your datasets or database(SQLite3?)
|
55
57
|
`-- test
|
58
|
+
|-- data [optional = --with-test-data]
|
56
59
|
|-- helper.rb
|
57
60
|
`-- test_bio-mystuff.rb
|
58
61
|
|
@@ -70,6 +73,51 @@ Some of these steps have been condensed:
|
|
70
73
|
* $ rake version:bump:(major | minor | patch)
|
71
74
|
the release will be increased by 1 and when you'll release it'll be updated. Note that in GitHub, bumping the version will create a tag with this version and your repository.So for every version you release there is a tag associated.
|
72
75
|
|
76
|
+
== Options
|
77
|
+
These are the available options, they come from biogem and from jeweler. I don't know if in the future I'll keep all of them.
|
78
|
+
|
79
|
+
Usage: biogem [options] reponame
|
80
|
+
e.g. biogem the-perfect-gem
|
81
|
+
--directory [DIRECTORY] specify the directory to generate into
|
82
|
+
These options are for BioGem
|
83
|
+
--with-bin create the bin directory and an executable template script called bioreponame
|
84
|
+
--with-db create the database directory for a db application-library
|
85
|
+
--with-test-data create the data directory inside the test directory if the user need to set up a test with its own dataset
|
86
|
+
These options are for Jeweler
|
87
|
+
--rspec generate rspec code examples
|
88
|
+
--shoulda generate shoulda tests
|
89
|
+
--testunit generate test/unit tests
|
90
|
+
--bacon generate bacon specifications
|
91
|
+
--testspec generate test/spec tests
|
92
|
+
--minitest generate minitest tests
|
93
|
+
--micronaut generate micronaut examples
|
94
|
+
--riot generate riot tests
|
95
|
+
--shindo generate shindo tests
|
96
|
+
|
97
|
+
--[no-]bundler use bundler for managing dependencies
|
98
|
+
--cucumber generate cucumber stories in addition to the other tests
|
99
|
+
|
100
|
+
--reek generate rake task for reek
|
101
|
+
--roodi generate rake task for roodi
|
102
|
+
|
103
|
+
--summary [SUMMARY] specify the summary of the project
|
104
|
+
--description [DESCRIPTION] specify a description of the project
|
105
|
+
|
106
|
+
--user-name [USER_NAME] the user's name, ie that is credited in the LICENSE
|
107
|
+
--user-email [USER_EMAIL] the user's email, ie that is credited in the Gem specification
|
108
|
+
|
109
|
+
--github-username [GITHUB_USERNAME]
|
110
|
+
name of the user on GitHub to set the project up under
|
111
|
+
--github-token [GITHUB_TOKEN]
|
112
|
+
GitHub token to use for interacting with the GitHub API
|
113
|
+
--git-remote [GIT_REMOTE] URI to set the git origin remote to
|
114
|
+
--homepage [HOMEPAGE] the homepage for your project (defaults to the GitHub repo)
|
115
|
+
--create-repo create the repository on GitHub
|
116
|
+
|
117
|
+
--yard use yard for documentation
|
118
|
+
--rdoc use rdoc for documentation
|
119
|
+
-h, --help display this help and exit
|
120
|
+
|
73
121
|
== NoTes For Developers
|
74
122
|
|
75
123
|
* A GitHub Account is required and you MUST create a repository for your new bioruby plugin.
|
@@ -82,6 +130,8 @@ Some of these steps have been condensed:
|
|
82
130
|
* Keep in mind that Jeweler handles everything is under the control of you git repository, so there is no need to modify the Rakefile or the tasks for including some file, directory etc to you project; just git add your_file_or_directory. Remeber to modify .gitignore to exclude files.
|
83
131
|
* Explore the rake tasks with
|
84
132
|
* $ rake -T
|
133
|
+
* Help
|
134
|
+
* please use help $ biogem -h to discover other options for creating rspec or cucumber tests
|
85
135
|
|
86
136
|
Toshiaki Katayama wrote a step by step guide for a bio-foobar plugin @ http://bioruby.open-bio.org/wiki/BiogemInstallation.
|
87
137
|
|
@@ -91,6 +141,7 @@ http://bioruby.open-bio.org/wiki/Plugins
|
|
91
141
|
|
92
142
|
== TODO
|
93
143
|
* better command line, wrap or re-implement some of the funcionalities provided by Bundler and Jeweler
|
144
|
+
* use YAML for database configuration
|
94
145
|
|
95
146
|
== Copyright
|
96
147
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.1
|
data/bin/biogem
CHANGED
@@ -9,11 +9,15 @@ require 'rake'
|
|
9
9
|
|
10
10
|
|
11
11
|
orig_argv = ARGV.clone
|
12
|
-
|
12
|
+
# application_exit[:exit] exists, application_exit[:options] it depends.
|
13
|
+
application_exit = Bio::Gem::Generator::Application.run!(*ARGV)
|
14
|
+
|
15
|
+
if (application_exit[:exit]==0)
|
13
16
|
pwd = FileUtils.pwd
|
14
|
-
FileUtils.cd "bioruby-#{
|
15
|
-
ARGV << "install"
|
17
|
+
FileUtils.cd "bioruby-#{application_exit[:options][:project_name]}"
|
18
|
+
ARGV.clear << "install"
|
16
19
|
Bundler::CLI.start
|
20
|
+
#TODO: call rake directly not from shell
|
17
21
|
sh "rake version:write"
|
18
22
|
sh "rake gemspec"
|
19
23
|
end
|
data/bio-gem.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bio-gem}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Raoul J.P. Bonnal"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-20}
|
13
13
|
s.default_executable = %q{biogem}
|
14
14
|
s.description = %q{BioGem is a scaffold generator for those Bioinformaticans who want to start coding an application or a library for using/extending BioRuby core library and sharing it through rubygems.org .
|
15
15
|
The basic idea is to simplify and promote a modular approach to the BioRuby package.}
|
@@ -30,6 +30,11 @@ Gem::Specification.new do |s|
|
|
30
30
|
"bin/biogem",
|
31
31
|
"bio-gem.gemspec",
|
32
32
|
"lib/bio-gem.rb",
|
33
|
+
"lib/bio-gem/application.rb",
|
34
|
+
"lib/bio-gem/mod/jeweler.rb",
|
35
|
+
"lib/bio-gem/mod/jeweler/github_mixin.rb",
|
36
|
+
"lib/bio-gem/mod/jeweler/options.rb",
|
37
|
+
"lib/bio-gem/templates/bin",
|
33
38
|
"test/helper.rb",
|
34
39
|
"test/test_bio-gem.rb"
|
35
40
|
]
|
data/lib/bio-gem.rb
CHANGED
@@ -1,65 +1,3 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
class Generator
|
5
|
-
module GithubMixin
|
6
|
-
#class Jeweler::Generator::GithubMixin
|
7
|
-
def homepage
|
8
|
-
@homepage ||= "http://github.com/#{github_username}/#{github_repo_name}"
|
9
|
-
end
|
10
|
-
|
11
|
-
#class Jeweler::Generator::GithubMixin
|
12
|
-
def git_remote
|
13
|
-
@git_remote ||= "git@github.com:#{github_username}/#{github_repo_name}.git"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
alias original_initialize initialize
|
18
|
-
def initialize(options = {})
|
19
|
-
original_initialize(options)
|
20
|
-
development_dependencies << ["bio", ">= 1.4.1"]
|
21
|
-
end
|
22
|
-
|
23
|
-
alias original_project_name project_name
|
24
|
-
def project_name
|
25
|
-
"bio-#{original_project_name}"
|
26
|
-
end
|
27
|
-
def lib_filename
|
28
|
-
"#{project_name}.rb"
|
29
|
-
end
|
30
|
-
|
31
|
-
def target_dir
|
32
|
-
project_name.gsub('bio','bioruby')
|
33
|
-
end
|
34
|
-
alias github_repo_name target_dir
|
35
|
-
|
36
|
-
def require_name
|
37
|
-
project_name
|
38
|
-
end
|
39
|
-
|
40
|
-
def data_dir
|
41
|
-
'data'
|
42
|
-
end
|
43
|
-
|
44
|
-
alias original_create_files create_files
|
45
|
-
# this is the defaul directory for storing library datasets
|
46
|
-
# creates a data directory for every needs.
|
47
|
-
def create_files
|
48
|
-
original_create_files
|
49
|
-
mkdir_in_target data_dir
|
50
|
-
end
|
51
|
-
|
52
|
-
def create_and_push_repo
|
53
|
-
Net::HTTP.post_form URI.parse('http://github.com/api/v2/yaml/repos/create'),
|
54
|
-
'login' => github_username,
|
55
|
-
'token' => github_token,
|
56
|
-
'description' => summary,
|
57
|
-
'name' => github_repo_name
|
58
|
-
# TODO do a HEAD request to see when it's ready?
|
59
|
-
@repo.push('origin')
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
1
|
+
#load Jeweler's mod for adapting it to our BioGem Project
|
2
|
+
require 'bio-gem/mod/jeweler'
|
3
|
+
require 'bio-gem/application'
|
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
module Bio
|
3
|
+
class Gem
|
4
|
+
class Generator
|
5
|
+
class Application
|
6
|
+
class << self
|
7
|
+
# Return an hash with :exit=>(0|1) and optionally and :options which is another hash
|
8
|
+
# This function has been stolen from Jeweler and mdified with the return hash, the original class returns just 0|1
|
9
|
+
# the problem is that I need to identify the name of the project_name from outside to use bundler.
|
10
|
+
def run!(*arguments)
|
11
|
+
env_opts = if ENV['JEWELER_OPTS']
|
12
|
+
Jeweler::Generator::Options.new(ENV['JEWELER_OPTS'].split(' '))
|
13
|
+
end
|
14
|
+
options = Jeweler::Generator::Options.new(arguments)
|
15
|
+
options = options.merge(env_opts) if env_opts
|
16
|
+
|
17
|
+
if options[:invalid_argument]
|
18
|
+
$stderr.puts options[:invalid_argument]
|
19
|
+
options[:show_help] = true
|
20
|
+
end
|
21
|
+
|
22
|
+
if options[:show_help]
|
23
|
+
$stderr.puts options.opts
|
24
|
+
return {:exit=>1}
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:project_name].nil? || options[:project_name].squeeze.strip == ""
|
28
|
+
$stderr.puts options.opts
|
29
|
+
return {:exit=>1}
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
generator = Jeweler::Generator.new(options)
|
34
|
+
generator.run
|
35
|
+
return {:exit=>0, :options=>options}
|
36
|
+
rescue Jeweler::NoGitUserName
|
37
|
+
$stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.name "mad voo"}
|
38
|
+
return {:exit=>1}
|
39
|
+
rescue Jeweler::NoGitUserEmail
|
40
|
+
$stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.email mad.vooo@gmail.com}
|
41
|
+
return {:exit=>1}
|
42
|
+
rescue Jeweler::NoGitHubUser
|
43
|
+
$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}
|
44
|
+
return {:exit=>1}
|
45
|
+
rescue Jeweler::NoGitHubToken
|
46
|
+
$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}
|
47
|
+
return {:exit=>1}
|
48
|
+
rescue Jeweler::FileInTheWay
|
49
|
+
$stderr.puts "The directory #{options[:project_name]} already exists. Maybe move it out of the way before continuing?"
|
50
|
+
return {:exit=>1}
|
51
|
+
end
|
52
|
+
end #run!
|
53
|
+
end #self
|
54
|
+
end #Application
|
55
|
+
end #Generator
|
56
|
+
end #Gem
|
57
|
+
end #Bio
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#Overdrive Jeweler's classes for properly configure a BioRuby Development Environment/Layout.
|
2
|
+
|
3
|
+
require 'bio-gem/mod/jeweler/options'
|
4
|
+
require 'bio-gem/mod/jeweler/github_mixin'
|
5
|
+
|
6
|
+
class Jeweler
|
7
|
+
class Generator
|
8
|
+
|
9
|
+
alias original_initialize initialize
|
10
|
+
def initialize(options = {})
|
11
|
+
original_initialize(options)
|
12
|
+
development_dependencies << ["bio", ">= 1.4.1"]
|
13
|
+
end
|
14
|
+
|
15
|
+
alias original_project_name project_name
|
16
|
+
def project_name
|
17
|
+
"bio-#{original_project_name}"
|
18
|
+
end
|
19
|
+
def lib_filename
|
20
|
+
"#{project_name}.rb"
|
21
|
+
end
|
22
|
+
|
23
|
+
def target_dir
|
24
|
+
project_name.gsub('bio','bioruby')
|
25
|
+
end
|
26
|
+
alias github_repo_name target_dir
|
27
|
+
|
28
|
+
def require_name
|
29
|
+
project_name
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_data_dir
|
33
|
+
'test/data'
|
34
|
+
end
|
35
|
+
|
36
|
+
def db_dir
|
37
|
+
'db'
|
38
|
+
end
|
39
|
+
|
40
|
+
def bin_dir
|
41
|
+
'bin'
|
42
|
+
end
|
43
|
+
|
44
|
+
def bin_name
|
45
|
+
"bio#{original_project_name}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def render_template_generic(source, template_dir = template_dir_biogem)
|
49
|
+
template_contents = File.read(File.join(template_dir, source))
|
50
|
+
template = ERB.new(template_contents, nil, '<>')
|
51
|
+
|
52
|
+
# squish extraneous whitespace from some of the conditionals
|
53
|
+
template.result(binding).gsub(/\n\n\n+/, "\n\n")
|
54
|
+
end
|
55
|
+
|
56
|
+
def output_template_in_target_generic(source, destination = source, template_dir = template_dir_biogem)
|
57
|
+
final_destination = File.join(target_dir, destination)
|
58
|
+
template_result = render_template_generic(source, template_dir)
|
59
|
+
|
60
|
+
File.open(final_destination, 'w') {|file| file.write(template_result)}
|
61
|
+
|
62
|
+
$stdout.puts "\tcreate\t#{destination}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def template_dir_biogem
|
66
|
+
File.join(File.dirname(__FILE__),'..', 'templates')
|
67
|
+
end
|
68
|
+
|
69
|
+
alias original_create_files create_files
|
70
|
+
# this is the defaul directory for storing library datasets
|
71
|
+
# creates a data directory for every needs.
|
72
|
+
#the options are defined in mod/jeweler/options.rb
|
73
|
+
def create_files
|
74
|
+
original_create_files
|
75
|
+
mkdir_in_target test_data_dir if options[:biogem_test_data]
|
76
|
+
mkdir_in_target db_dir if options[:biogem_db]
|
77
|
+
if options[:biogem_bin]
|
78
|
+
mkdir_in_target bin_dir
|
79
|
+
output_template_in_target_generic 'bin', File.join(bin_dir, bin_name)
|
80
|
+
# TODO: set the file as executable
|
81
|
+
File.chmod 0655, File.join(target_dir, bin_dir, bin_name)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def create_and_push_repo
|
86
|
+
Net::HTTP.post_form URI.parse('http://github.com/api/v2/yaml/repos/create'),
|
87
|
+
'login' => github_username,
|
88
|
+
'token' => github_token,
|
89
|
+
'description' => summary,
|
90
|
+
'name' => github_repo_name
|
91
|
+
# TODO do a HEAD request to see when it's ready?
|
92
|
+
@repo.push('origin')
|
93
|
+
end
|
94
|
+
end #Generator
|
95
|
+
end #Jeweler
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
module GithubMixin
|
4
|
+
#class Jeweler::Generator::GithubMixin
|
5
|
+
def homepage
|
6
|
+
@homepage ||= "http://github.com/#{github_username}/#{github_repo_name}"
|
7
|
+
end
|
8
|
+
|
9
|
+
#class Jeweler::Generator::GithubMixin
|
10
|
+
def git_remote
|
11
|
+
@git_remote ||= "git@github.com:#{github_username}/#{github_repo_name}.git"
|
12
|
+
end
|
13
|
+
end #GithubMixin
|
14
|
+
end #Generator
|
15
|
+
end #Jeweler
|
@@ -0,0 +1,181 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
class Options < Hash
|
4
|
+
attr_reader :opts, :orig_args
|
5
|
+
|
6
|
+
def initialize(args)
|
7
|
+
super()
|
8
|
+
|
9
|
+
@orig_args = args.clone
|
10
|
+
self[:testing_framework] = :shoulda
|
11
|
+
self[:documentation_framework] = :rdoc
|
12
|
+
self[:use_bundler] = true
|
13
|
+
|
14
|
+
git_config = if Pathname.new("~/.gitconfig").expand_path.exist?
|
15
|
+
Git.global_config
|
16
|
+
else
|
17
|
+
{}
|
18
|
+
end
|
19
|
+
self[:user_name] = ENV['GIT_AUTHOR_NAME'] || ENV['GIT_COMMITTER_NAME'] || git_config['user.name']
|
20
|
+
self[:user_email] = ENV['GIT_AUTHOR_EMAIL'] || ENV['GIT_COMMITTER_EMAIL'] || git_config['user.email']
|
21
|
+
self[:github_username] = git_config['github.user']
|
22
|
+
self[:github_token] = git_config['github.token']
|
23
|
+
|
24
|
+
require 'optparse'
|
25
|
+
@opts = OptionParser.new do |o|
|
26
|
+
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
|
27
|
+
|
28
|
+
o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|
|
29
|
+
self[:directory] = directory
|
30
|
+
end
|
31
|
+
|
32
|
+
o.separator ""
|
33
|
+
|
34
|
+
o.separator "These options are for BioGem"
|
35
|
+
|
36
|
+
#TODO: Scrivere le altre opzioni
|
37
|
+
o.on("--with-bin", 'create the bin directory and an executable template script called bioreponame') do
|
38
|
+
self[:biogem_bin] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
o.on("--with-db", 'create the database directory for a db application-library') do
|
42
|
+
self[:biogem_db] = true
|
43
|
+
end
|
44
|
+
|
45
|
+
o.on("--with-test-data",'create the data directory inside the test directory if the user need to set up a test with its own dataset') do
|
46
|
+
self[:biogem_test_data] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
o.separator ""
|
50
|
+
|
51
|
+
o.separator "These options are for Jeweler"
|
52
|
+
|
53
|
+
o.on('--rspec', 'generate rspec code examples') do
|
54
|
+
self[:testing_framework] = :rspec
|
55
|
+
end
|
56
|
+
|
57
|
+
o.on('--shoulda', 'generate shoulda tests') do
|
58
|
+
self[:testing_framework] = :shoulda
|
59
|
+
end
|
60
|
+
|
61
|
+
o.on('--testunit', 'generate test/unit tests') do
|
62
|
+
self[:testing_framework] = :testunit
|
63
|
+
end
|
64
|
+
|
65
|
+
o.on('--bacon', 'generate bacon specifications') do
|
66
|
+
self[:testing_framework] = :bacon
|
67
|
+
end
|
68
|
+
|
69
|
+
o.on('--testspec', 'generate test/spec tests') do
|
70
|
+
self[:testing_framework] = :testspec
|
71
|
+
end
|
72
|
+
|
73
|
+
o.on('--minitest', 'generate minitest tests') do
|
74
|
+
self[:testing_framework] = :minitest
|
75
|
+
end
|
76
|
+
|
77
|
+
o.on('--micronaut', 'generate micronaut examples') do
|
78
|
+
self[:testing_framework] = :micronaut
|
79
|
+
end
|
80
|
+
|
81
|
+
o.on('--riot', 'generate riot tests') do
|
82
|
+
self[:testing_framework] = :riot
|
83
|
+
end
|
84
|
+
|
85
|
+
o.on('--shindo', 'generate shindo tests') do
|
86
|
+
self[:testing_framework] = :shindo
|
87
|
+
end
|
88
|
+
|
89
|
+
o.separator ""
|
90
|
+
|
91
|
+
o.on('--[no-]bundler', 'use bundler for managing dependencies') do |v|
|
92
|
+
self[:use_bundler] = v
|
93
|
+
end
|
94
|
+
|
95
|
+
o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
|
96
|
+
self[:use_cucumber] = true
|
97
|
+
end
|
98
|
+
|
99
|
+
o.separator ""
|
100
|
+
|
101
|
+
o.on('--reek', 'generate rake task for reek') do
|
102
|
+
self[:use_reek] = true
|
103
|
+
end
|
104
|
+
|
105
|
+
o.on('--roodi', 'generate rake task for roodi') do
|
106
|
+
self[:use_roodi] = true
|
107
|
+
end
|
108
|
+
|
109
|
+
o.separator ""
|
110
|
+
|
111
|
+
o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
|
112
|
+
self[:summary] = summary
|
113
|
+
end
|
114
|
+
|
115
|
+
o.on('--description [DESCRIPTION]', 'specify a description of the project') do |description|
|
116
|
+
self[:description] = description
|
117
|
+
end
|
118
|
+
|
119
|
+
o.separator ""
|
120
|
+
|
121
|
+
o.on('--user-name [USER_NAME]', "the user's name, ie that is credited in the LICENSE") do |user_name|
|
122
|
+
self[:user_name] = user_name
|
123
|
+
end
|
124
|
+
|
125
|
+
o.on('--user-email [USER_EMAIL]', "the user's email, ie that is credited in the Gem specification") do |user_email|
|
126
|
+
self[:user_email] = user_email
|
127
|
+
end
|
128
|
+
|
129
|
+
o.separator ""
|
130
|
+
|
131
|
+
o.on('--github-username [GITHUB_USERNAME]', "name of the user on GitHub to set the project up under") do |github_username|
|
132
|
+
self[:github_username] = github_username
|
133
|
+
end
|
134
|
+
|
135
|
+
o.on('--github-token [GITHUB_TOKEN]', "GitHub token to use for interacting with the GitHub API") do |github_token|
|
136
|
+
self[:github_token] = github_token
|
137
|
+
end
|
138
|
+
|
139
|
+
o.on('--git-remote [GIT_REMOTE]', 'URI to set the git origin remote to') do |git_remote|
|
140
|
+
self[:git_remote] = git_remote
|
141
|
+
end
|
142
|
+
|
143
|
+
o.on('--homepage [HOMEPAGE]', "the homepage for your project (defaults to the GitHub repo)") do |homepage|
|
144
|
+
self[:homepage] = homepage
|
145
|
+
end
|
146
|
+
|
147
|
+
o.on('--create-repo', 'create the repository on GitHub') do
|
148
|
+
self[:create_repo] = true
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
o.separator ""
|
153
|
+
|
154
|
+
o.on('--yard', 'use yard for documentation') do
|
155
|
+
self[:documentation_framework] = :yard
|
156
|
+
end
|
157
|
+
|
158
|
+
o.on('--rdoc', 'use rdoc for documentation') do
|
159
|
+
self[:documentation_framework] = :rdoc
|
160
|
+
end
|
161
|
+
|
162
|
+
o.on_tail('-h', '--help', 'display this help and exit') do
|
163
|
+
self[:show_help] = true
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
begin
|
168
|
+
@opts.parse!(args)
|
169
|
+
self[:project_name] = args.shift
|
170
|
+
rescue OptionParser::InvalidOption => e
|
171
|
+
self[:invalid_argument] = e.message
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def merge(other)
|
176
|
+
self.class.new(@orig_args + other.orig_args)
|
177
|
+
end
|
178
|
+
|
179
|
+
end #Options
|
180
|
+
end #Generator
|
181
|
+
end #Jeweler
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# <%= bin_name %>
|
4
|
+
#
|
5
|
+
# Author:: <%= user_name %>
|
6
|
+
# Copyright:: <%= Time.now.year %>
|
7
|
+
# License:: The Ruby License
|
8
|
+
#
|
9
|
+
|
10
|
+
USAGE = <<EOM
|
11
|
+
|
12
|
+
Describe <%= bin_name %>
|
13
|
+
|
14
|
+
EOM
|
15
|
+
|
16
|
+
rootpath = File.dirname(File.dirname(__FILE__))
|
17
|
+
$: << File.join(rootpath,'lib')
|
18
|
+
|
19
|
+
PROJECT_VERSION = File.new(File.join(rootpath,'VERSION')).read.chomp
|
20
|
+
|
21
|
+
print "<%= bin_name %>(BioRuby <%= project_name %> Plugin) version "+PROJECT_VERSION+" Copyright (C) <%= Time.now.year %> <%= user_name %>\n\n"
|
22
|
+
|
23
|
+
if ARGV.size == 0
|
24
|
+
print USAGE
|
25
|
+
end
|
26
|
+
|
27
|
+
require '<%= project_name %>'
|
28
|
+
require 'optparse'
|
29
|
+
|
30
|
+
# Uncomment when using the bio-logger
|
31
|
+
# require 'bio-logger'
|
32
|
+
# Bio::Log::CLI.logger('stderr')
|
33
|
+
# Bio::Log::CLI.trace('info')
|
34
|
+
|
35
|
+
options = {:example_switch=>false,:show_help=>false}
|
36
|
+
opts = OptionParser.new do |o|
|
37
|
+
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
|
38
|
+
|
39
|
+
o.on('--example_parameter [EXAMPLE_PARAMETER]', 'TODO: put a description for the PARAMETER') do |example_parameter|
|
40
|
+
# TODO: your logic here, below an example
|
41
|
+
options[:example_parameter] = 'this is a parameter'
|
42
|
+
end
|
43
|
+
|
44
|
+
o.separator ""
|
45
|
+
o.on("--switch-example", 'TODO: put a description for the SWITCH') do
|
46
|
+
# TODO: your logic here, below an example
|
47
|
+
self[:example_switch] = true
|
48
|
+
end
|
49
|
+
|
50
|
+
# Uncomment the following when using the bio-logger
|
51
|
+
# o.separator ""
|
52
|
+
# o.on("--logger filename",String,"Log to file (default stderr)") do | name |
|
53
|
+
# Bio::Log::CLI.logger(name)
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# o.on("--trace options",String,"Set log level (default INFO, see bio-logger)") do | s |
|
57
|
+
# Bio::Log::CLI.trace(s)
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# o.on("-q", "--quiet", "Run quietly") do |q|
|
61
|
+
# Bio::Log::CLI.trace('error')
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# o.on("-v", "--verbose", "Run verbosely") do |v|
|
65
|
+
# Bio::Log::CLI.trace('info')
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# o.on("--debug", "Show debug messages") do |v|
|
69
|
+
# Bio::Log::CLI.trace('debug')
|
70
|
+
# end
|
71
|
+
|
72
|
+
o.separator ""
|
73
|
+
o.on_tail('-h', '--help', 'display this help and exit') do
|
74
|
+
options[:show_help] = true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
begin
|
79
|
+
opts.parse!(ARGV)
|
80
|
+
|
81
|
+
# Uncomment the following when using the bio-logger
|
82
|
+
# Bio::Log::CLI.configure('<%= project_name %>')
|
83
|
+
|
84
|
+
# TODO: your code here
|
85
|
+
# use options for your logic
|
86
|
+
rescue OptionParser::InvalidOption => e
|
87
|
+
options[:invalid_argument] = e.message
|
88
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 2
|
7
8
|
- 1
|
8
|
-
|
9
|
-
version: 0.1.1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Raoul J.P. Bonnal
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-20 00:00:00 +01:00
|
18
18
|
default_executable: biogem
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -95,6 +95,11 @@ files:
|
|
95
95
|
- bin/biogem
|
96
96
|
- bio-gem.gemspec
|
97
97
|
- lib/bio-gem.rb
|
98
|
+
- lib/bio-gem/application.rb
|
99
|
+
- lib/bio-gem/mod/jeweler.rb
|
100
|
+
- lib/bio-gem/mod/jeweler/github_mixin.rb
|
101
|
+
- lib/bio-gem/mod/jeweler/options.rb
|
102
|
+
- lib/bio-gem/templates/bin
|
98
103
|
- test/helper.rb
|
99
104
|
- test/test_bio-gem.rb
|
100
105
|
has_rdoc: true
|
@@ -111,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
116
|
requirements:
|
112
117
|
- - ">="
|
113
118
|
- !ruby/object:Gem::Version
|
114
|
-
hash:
|
119
|
+
hash: 4099930860953493832
|
115
120
|
segments:
|
116
121
|
- 0
|
117
122
|
version: "0"
|