bio-gem 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +52 -43
- data/Rakefile +1 -0
- data/Tutorial.rdoc +436 -0
- data/VERSION +1 -1
- data/bio-gem.gemspec +6 -2
- data/lib/bio-gem/mod/jeweler.rb +56 -34
- data/lib/bio-gem/mod/jeweler/options.rb +3 -3
- data/lib/bio-gem/templates/db_connection +13 -0
- data/lib/bio-gem/templates/db_model +6 -0
- data/lib/bio-gem/templates/foos_controller +18 -0
- data/lib/bio-gem/templates/foos_view_example +13 -1
- data/lib/bio-gem/templates/foos_view_new +4 -0
- data/lib/bio-gem/templates/lib +7 -0
- data/lib/bio-gem/templates/library +3 -0
- data/lib/bio-gem/templates/migration +4 -4
- data/lib/bio-gem/templates/rakefile +5 -2
- data/lib/bio-gem/templates/routes +3 -3
- metadata +23 -19
data/README.rdoc
CHANGED
@@ -7,7 +7,7 @@ listed at http://biogems.info
|
|
7
7
|
|
8
8
|
The basic idea is to simplify and promote a modular approach to the BioRuby package.
|
9
9
|
|
10
|
-
BioGem is not reinventing the wheel just putting together different tools like Jeweler and Bundler
|
10
|
+
BioGem is not reinventing the wheel just putting together different tools like Jeweler and Bundler modifying their original behavior when needed. Jeweler is used to create the initial scaffold, setting up git for versioning, releasing it to github.com and/or rubygems.org and packaging. Bundler is used used for setting up a predefined developing environment.
|
11
11
|
|
12
12
|
Remind that
|
13
13
|
* Jeweler is based on rake
|
@@ -18,8 +18,17 @@ Remind that
|
|
18
18
|
are two different services and you need to create different accounts for them
|
19
19
|
if you already use GitHub.com you are already all set for using BioGem
|
20
20
|
|
21
|
-
==
|
22
|
-
|
21
|
+
== BioGems Official Plugin Archive
|
22
|
+
|
23
|
+
* http://biogems.info/
|
24
|
+
|
25
|
+
== Biogem Tutorial
|
26
|
+
|
27
|
+
The latest version is on https://github.com/helios/bioruby-gem/blob/master/Tutorial.rdoc
|
28
|
+
|
29
|
+
./file.Tutorial.html
|
30
|
+
|
31
|
+
== Contributing to bioruby-gem
|
23
32
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
24
33
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
25
34
|
* Fork the project
|
@@ -45,24 +54,24 @@ Some of these steps have been condensed:
|
|
45
54
|
* pass just the simple name, it will add bioruby- for the first level directory and for the github repository
|
46
55
|
BUT you'll require the library with bio-mystuff (and this will be the name used on rubygems)
|
47
56
|
* creates a basic gem structure with a default dependencies for bioruby (bio) version 1.4.2
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
57
|
+
|-- bin [optional = --with-bin]
|
58
|
+
| `-- biomystuff (executable)
|
59
|
+
|-- Gemfile
|
60
|
+
|-- Gemfile.lock
|
61
|
+
|-- LICENSE.txt
|
62
|
+
|-- README.rdoc
|
63
|
+
|-- Rakefile
|
64
|
+
|-- lib
|
65
|
+
| `-- bio-mystuff.rb
|
66
|
+
|-- conf[optional = --with-db]
|
67
|
+
| `-- database.yml put here the configuration of your database like in a rails app
|
68
|
+
|-- db [optional = --with-db] empty but put here your datasets or database(SQLite3?)
|
69
|
+
| |-- seeds.rb a file containing the preloaded datasets, they will be loaded during db setup process
|
70
|
+
| `-- migrate directory for migration, you must create migrations by hand, there is a template inside.
|
71
|
+
`-- test
|
72
|
+
|-- data [optional = --with-test-data]
|
73
|
+
|-- helper.rb
|
74
|
+
`-- test_bio-mystuff.rb
|
66
75
|
|
67
76
|
* $ cd bioruby-mystuff
|
68
77
|
* $ rake version:write (Initial Updated version: 0.0.0)
|
@@ -119,7 +128,7 @@ These options are for Jeweler
|
|
119
128
|
GitHub token to use for interacting with the GitHub API
|
120
129
|
--git-remote [GIT_REMOTE] URI to set the git origin remote to
|
121
130
|
--homepage [HOMEPAGE] the homepage for your project (defaults to the GitHub repo)
|
122
|
-
--create-repo create the repository on GitHub
|
131
|
+
--no-create-repo create the repository on GitHub (repo is created by default)
|
123
132
|
|
124
133
|
--yard use yard for documentation
|
125
134
|
--rdoc use rdoc for documentation
|
@@ -146,7 +155,7 @@ These options are for Jeweler
|
|
146
155
|
rake gemcutter:release # Release gem to Gemcutter
|
147
156
|
rake gemspec # Generate and validate gemspec
|
148
157
|
rake gemspec:debug # Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)
|
149
|
-
rake gemspec:generate #
|
158
|
+
rake gemspec:generate # Regenerate the gemspec on the filesystem
|
150
159
|
rake gemspec:release # Regenerate and validate gemspec, and then commits and pushes to git
|
151
160
|
rake gemspec:validate # Validates the gemspec on the filesystem
|
152
161
|
rake git:release # Tag and push release to git.
|
@@ -181,17 +190,17 @@ on your local directory you will see bioruby-mystuff but on rubygems you will pu
|
|
181
190
|
Is a best practices, at least for me, to have a dummy class which establishes the connection with the database and inherit that class by the models. The benefit of this approach is to have multiple connections available at the same time in case you are developing/using multiple gems with different databases. This file is located in lib/bio/kb
|
182
191
|
|
183
192
|
module Bio
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
193
|
+
module KB
|
194
|
+
class DummyMySpecialDB < ActiveRecord::Base
|
195
|
+
self.abstract_class = true
|
196
|
+
establish_connection(:adapter =>'sqlite3',:database =>"#{File.dirname(__FILE__)}/../../../db/yourdb.sqlite3")
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
192
201
|
or you can use the configuration file db/database.yml and add this code to the module above. Note I don't like very much to add every time this code so in a future release I'll find out a way to add it automatically, probably overwriting the configurations call.
|
193
202
|
|
194
|
-
|
203
|
+
root_path = File.join(File.dirname(__FILE__),"../../../")
|
195
204
|
configurations = YAML.load_file(File.join(root_path,"conf/database.yml"))
|
196
205
|
configurations.each_pair do |key, db_info|
|
197
206
|
db_info["database"] = File.join(root_path, db_info["database"]) if db_info["adapter"]=='sqlite3'
|
@@ -203,21 +212,21 @@ This code is necessary because the db is inside the gem and you can't know where
|
|
203
212
|
The model must be located in a directory structure like lib/bio/kb/yourclass this is important because ActiveRecord can map the namespace with the directory tree.
|
204
213
|
|
205
214
|
module Bio
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
215
|
+
module KB
|
216
|
+
module MySpecialDB
|
217
|
+
class Mytable < Bio::KB::DummyMySpecialDB
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
213
222
|
|
214
223
|
=== Seeds
|
215
224
|
Before populate you seeds.rb file you must declare a model. The model is declared in the usual Rails' way, see above.
|
216
225
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
226
|
+
#Use this file to load a default dataset into your database
|
227
|
+
%w(Raoul Toshiaki Francesco).each do |coder|
|
228
|
+
Bio::KB::MySpecialDB::Example.create(:name=>coder, :tag=>"bioruby", :type=>"developer")
|
229
|
+
end
|
221
230
|
|
222
231
|
=== StepByStep
|
223
232
|
Toshiaki Katayama wrote a step by step guide for a bio-foobar plugin @ http://bioruby.open-bio.org/wiki/BiogemInstallation.
|
data/Rakefile
CHANGED
data/Tutorial.rdoc
ADDED
@@ -0,0 +1,436 @@
|
|
1
|
+
= Biogem Tutorial
|
2
|
+
|
3
|
+
The latest version is on https://github.com/helios/bioruby-gem/blob/master/Tutorial.rdoc
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
=== Pre-requisites
|
7
|
+
* Ruby: at least 1.9.x, current tested version is 1.9.2
|
8
|
+
* [RVM]: RVM is optional but kindly suggested. RVM allows multiple ruby interpreters in your home directory in a very straightforward way
|
9
|
+
* GitHub & RubyGems: In order to use Biogem to its fullest potential, you must create a regular GitHub http://github.com and RubyGems http://rubygems.org account. Why? Because for sharing and keeping track of source code we (currenlty) use github and for distributing the plugin we rely on RubyGems, the reference Ruby gem repository. To configure github and automate most of Biogem's tasks:
|
10
|
+
$ git config --global user.name "Firstname Lastname" Sets the name of the user for all git instances on the system
|
11
|
+
$ git config --global user.email "your_email@youremail.com"
|
12
|
+
$ git config --global github.user "user_id"
|
13
|
+
$ git config --global github.token "TOKEN ASSIGNED BY GITHUB"
|
14
|
+
|
15
|
+
Note: another Ruby version management system used in BioRuby community is https://github.com/sstephenson/rbenv but for now we can not provide support for it.
|
16
|
+
|
17
|
+
=== Download
|
18
|
+
|
19
|
+
Install the biogem toolset with
|
20
|
+
|
21
|
+
$ gem install bio-gem
|
22
|
+
|
23
|
+
all the required dependencies will be downloaded and installed automatically.
|
24
|
+
|
25
|
+
== Create your first BioRuby Plugin
|
26
|
+
=== Standard
|
27
|
+
|
28
|
+
To create a BioRuby plugin named bio-foo in the bioruby-foo directory
|
29
|
+
|
30
|
+
$ Biogem foo
|
31
|
+
|
32
|
+
create .gitignore
|
33
|
+
create Rakefile
|
34
|
+
create Gemfile
|
35
|
+
create LICENSE.txt
|
36
|
+
create README.rdoc
|
37
|
+
create .document
|
38
|
+
create lib
|
39
|
+
create lib/bio-foo.rb
|
40
|
+
create test
|
41
|
+
create test/helper.rb
|
42
|
+
create test/test_bio-foo.rb
|
43
|
+
create lib/bio-foo.rb
|
44
|
+
Jeweler has prepared your gem in bioruby-foo
|
45
|
+
Jeweler has pushed your repo to http://github.com/helios/bioruby-foo
|
46
|
+
Fetching source index for http://rubygems.org/
|
47
|
+
Using rake (0.9.2.2)
|
48
|
+
Using bio (1.4.2)
|
49
|
+
Using bundler (1.0.21)
|
50
|
+
Using git (1.2.5)
|
51
|
+
Using jeweler (1.6.4)
|
52
|
+
Using rcov (0.9.11)
|
53
|
+
Using shoulda (2.11.3)
|
54
|
+
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
|
55
|
+
rake version:write
|
56
|
+
Generated: bio-foo.gemspec
|
57
|
+
bio-foo.gemspec is valid.
|
58
|
+
|
59
|
+
In case you are not connected to internet the following message will appear:
|
60
|
+
|
61
|
+
Seems you are not connected to Internet, can't create a remote repository.
|
62
|
+
Do not forget to create it by hand, from GitHub, and sync it with this project.
|
63
|
+
|
64
|
+
Note the name of the plugin is important. Plugins are published as Ruby gems on http://rubygems.org/. All plugins that start with the name bio dash (bio-) are automatically listed on the Biogems website http://biogems.info/ !
|
65
|
+
|
66
|
+
The first step is to open Rakefile and modify the gem.summary and gem.description. These parameters are necessary, because they describe your gem and its importance. If you let them as default the gem, will not publish. Examples of summary and description can be found on http://biogems.info/
|
67
|
+
|
68
|
+
|
69
|
+
=== With a DataBase
|
70
|
+
If you want to distribute a library which uses a local database Biogem creates for you a database template and add features coming from Ruby on Rails to manage the database. You can define Models, Fixtures and Migrations like a regular Rails application. SQLite3 is the default database engine in order to have a portable library, is also possible to configure the library to use different RDBMS like PostgreSQL, MySQL; please refer to ActiveRecord for further details.
|
71
|
+
|
72
|
+
$ Biogem --with-db foo
|
73
|
+
create .gitignore
|
74
|
+
create Rakefile
|
75
|
+
create Gemfile
|
76
|
+
create LICENSE.txt
|
77
|
+
create README.rdoc
|
78
|
+
create .document
|
79
|
+
create lib
|
80
|
+
create lib/bio-foo.rb
|
81
|
+
create test
|
82
|
+
create test/helper.rb
|
83
|
+
create test/test_bio-foo.rb
|
84
|
+
+ create db
|
85
|
+
+ create db/migrate
|
86
|
+
+ create config
|
87
|
+
+ create config/database.yml
|
88
|
+
+ create db/migrate/001_create_example.rb
|
89
|
+
+ create db/seeds.rb
|
90
|
+
update Rakefile
|
91
|
+
+ create lib/foo/connect.rb
|
92
|
+
+ create lib/foo/example.rb
|
93
|
+
create lib/bio-foo.rb
|
94
|
+
Jeweler has prepared your gem in bioruby-foo
|
95
|
+
Jeweler has pushed your repo to http://github.com/helios/bioruby-foo
|
96
|
+
Fetching source index for http://rubygems.org/
|
97
|
+
Using rake (0.9.2.2)
|
98
|
+
+ Using multi_json (1.0.3)
|
99
|
+
+ Using activesupport (3.1.1)
|
100
|
+
+ Using builder (3.0.0)
|
101
|
+
+ Using i18n (0.6.0)
|
102
|
+
+ Using activemodel (3.1.1)
|
103
|
+
+ Using arel (2.2.1)
|
104
|
+
+ Using tzinfo (0.3.31)
|
105
|
+
+ Using activerecord (3.1.1)
|
106
|
+
Using bio (1.4.2)
|
107
|
+
Using bundler (1.0.21)
|
108
|
+
Using git (1.2.5)
|
109
|
+
Using jeweler (1.6.4)
|
110
|
+
Using rcov (0.9.11)
|
111
|
+
Using shoulda (2.11.3)
|
112
|
+
+ Using sqlite3 (1.3.4)
|
113
|
+
|
114
|
+
Rows with symbol + are differences between the standard command
|
115
|
+
|
116
|
+
|
117
|
+
==== DataBaseConnection
|
118
|
+
Is a best practice, at least for me, to have a dummy class which establishes the connection with the database and then inherit that class by models. The benefit of this approach is to have multiple connections available at the same time, just in case you are developing/using multiple gems with different databases. This file is located in lib/bio/your_module/connect.rb
|
119
|
+
|
120
|
+
module Bio
|
121
|
+
module YourModule
|
122
|
+
class DummyMySpecialDB < ActiveRecord::Base
|
123
|
+
self.abstract_class = true
|
124
|
+
establish_connection(:adapter =>'sqlite3',:database =>"#{File.dirname(__FILE__)}/../../../db/yourdb.sqlite3")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
or you can use configuration file located in config/database.yml and add the following code to the module above:
|
130
|
+
|
131
|
+
root_path = File.join(File.dirname(__FILE__),"../../../")
|
132
|
+
configurations = YAML.load_file(File.join(root_path,"conf/database.yml"))
|
133
|
+
configurations.each_pair do |key, db_info|
|
134
|
+
db_info["database"] = File.join(root_path, db_info["database"]) if db_info["adapter"]=='sqlite3'
|
135
|
+
end
|
136
|
+
establish_connection(configurations["default"])
|
137
|
+
|
138
|
+
Note: The latter is the default method.
|
139
|
+
|
140
|
+
===== DBConfiguration
|
141
|
+
In file config/database.yml
|
142
|
+
|
143
|
+
# SQLite version 3.x
|
144
|
+
# gem install sqlite3
|
145
|
+
default:
|
146
|
+
adapter: sqlite3
|
147
|
+
database: db/bio-foo.sqlite3
|
148
|
+
pool: 5
|
149
|
+
timeout: 5000
|
150
|
+
|
151
|
+
===== Create the database
|
152
|
+
bundle exec rake db:create
|
153
|
+
Create the database from config/database.yml for the current default (use db:create:all to create all dbs in the config
|
154
|
+
|
155
|
+
==== Create A Table Using Migration
|
156
|
+
In file db/migrate/001_create_example.rb
|
157
|
+
|
158
|
+
The code below create a table name example. As best practice name this file with a prefix index like 001_create_example.rb and the next migration 002.... and so on, this will help you to keep track over the time.
|
159
|
+
Please refer to Rails' documentation
|
160
|
+
|
161
|
+
class CreateExample < ActiveRecord::Migration
|
162
|
+
def self.up
|
163
|
+
#primary key id is created automatically by ActiveRecord::Migration
|
164
|
+
create_table :example do |t|
|
165
|
+
t.string :name
|
166
|
+
t.string :tag
|
167
|
+
t.string :type
|
168
|
+
end
|
169
|
+
|
170
|
+
add_index :example, :name
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.down
|
174
|
+
drop_table :example
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
Once you have defined the table you can create it
|
179
|
+
$ bundle exec rake db:migrate
|
180
|
+
Migrate the database (options: VERSION=x, VERBOSE=false)
|
181
|
+
|
182
|
+
===== Defining a Model
|
183
|
+
The model must be located in a directory structure like lib/bio/your_module/your_class this is important because ActiveRecord map the namespace with the directory tree.
|
184
|
+
|
185
|
+
module Bio
|
186
|
+
module YourModule
|
187
|
+
class Mytable < Bio::YourModule::DummyMySpecialDB
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
Then using the
|
192
|
+
|
193
|
+
===== Seeds
|
194
|
+
Before populate your databse file you must declare a model. The model is declared in the usual Rails' way, see above.
|
195
|
+
Use file db/seeds.rb to load a default dataset into your database
|
196
|
+
|
197
|
+
%w(Raoul Toshiaki Francesco).each do |coder|
|
198
|
+
Bio::YourModule::Example.create(:name=>coder, :tag=>"bioruby", :type=>"developer")
|
199
|
+
end
|
200
|
+
|
201
|
+
=== Rails Engine With Database a BioPlugin
|
202
|
+
Biogem is intended to help you also in advanced task like create a gem that can be reused in multiple rails applications, serving for instance a database, libraries and/or controllers,models,views.
|
203
|
+
==== Why Rails Engine
|
204
|
+
In bioinformatics is very common to presents data using a web application, and often you find are re using the same libraries and database for the same purpose, with a just a small difference in applications or your need to put together different functionalities which are spread along multiple database and libraries.
|
205
|
+
==== HowToEngines
|
206
|
+
To example this Biogem's features we want to create a Rails application which provides a form to users. Data submitted are submitted to TogoWS and the result is returned in a web page. In the mean time we want to store suers queries and return them in the page of TogoWS' result. We'll create a Rails application and a separated Biogem to store queries and provide connection to TogoWS, following "man in the middle" pattern.
|
207
|
+
|
208
|
+
$ biogem --with-engine Foo foo
|
209
|
+
Note: a database is automatically configure for the newly created gem
|
210
|
+
|
211
|
+
$ rails new Webfoo
|
212
|
+
|
213
|
+
You can test your application just inserting into Rails application Gemfile the newly created gem:
|
214
|
+
gem 'bio-foo', :path=>'path_gem_dir'
|
215
|
+
|
216
|
+
update the installation running:
|
217
|
+
cd Webfoo
|
218
|
+
bundle install
|
219
|
+
|
220
|
+
Enable the route for the added gem (in biouby-foo/config/routes.rb) uncomment:
|
221
|
+
yourPathToTheControllerFiles = 'foopath'
|
222
|
+
controllerName = :foos
|
223
|
+
otherControllerName = :samples
|
224
|
+
#---
|
225
|
+
scope mount_at, yourPathToTheControllerFiles do
|
226
|
+
resources controllerName do
|
227
|
+
member do
|
228
|
+
get :example
|
229
|
+
end
|
230
|
+
end
|
231
|
+
resources otherControllerName, :only =>[:index, :show]
|
232
|
+
end #scope
|
233
|
+
|
234
|
+
In bioruby-foo/lib/bio/foo/example.rb be sure the example class is uncommented:
|
235
|
+
module Bio
|
236
|
+
module Foo
|
237
|
+
class Example < DummyConn
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
Create and migrate bioruby-foo database:
|
243
|
+
cd bioruby-foo
|
244
|
+
bundle exec rake db:create
|
245
|
+
bundle exec rake db:migrate
|
246
|
+
|
247
|
+
Run your Rails server and load the web page
|
248
|
+
cd Webfoo
|
249
|
+
rails s
|
250
|
+
|
251
|
+
open your browser to http://localhost:3000/foos/new
|
252
|
+
|
253
|
+
Controller,Views and Module are located in bioruby-foo:
|
254
|
+
* app/controllers
|
255
|
+
* app/views
|
256
|
+
* app/helpers
|
257
|
+
* lib/bio/your_module/your_table.rb
|
258
|
+
|
259
|
+
The latter path has modified by purpose from standard Rails configuration to keep a consistency with a normal ruby/gem library, in case developer wants to use a database but not a rails engine.
|
260
|
+
|
261
|
+
=== A Meta Plugin
|
262
|
+
A meta package or plugin is a very simple gem, essentially a configuration's gem. This particular plugin is used to aggregate other plugins or gems taking advantage of RubyGems dependencies. An example of this feature are: bio-core, bio-ext, bio-biollinux plugins which have different purposes and they can contain the same plugins but in different versions.
|
263
|
+
|
264
|
+
$ Biogem --meta foo
|
265
|
+
|
266
|
+
create .gitignore
|
267
|
+
create Rakefile
|
268
|
+
create Gemfile
|
269
|
+
create LICENSE.txt
|
270
|
+
create README.rdoc
|
271
|
+
create .document
|
272
|
+
|
273
|
+
Those are the only files created by Biogem and are the only required to work as a meta-package. The user can add its libraries to the Gemfile and update information in Rakefile
|
274
|
+
|
275
|
+
===== Gemfile
|
276
|
+
This is Gemfile's content
|
277
|
+
source "http://rubygems.org"
|
278
|
+
# Add dependencies required to use your gem here.
|
279
|
+
# Example:
|
280
|
+
# gem "activesupport", ">= 2.3.5"
|
281
|
+
|
282
|
+
# Add dependencies to develop your gem here.
|
283
|
+
# Include everything needed to run rake, tests, features, etc.
|
284
|
+
group :development do
|
285
|
+
gem "shoulda", ">= 0"
|
286
|
+
gem "bundler", "~> 1.0.0"
|
287
|
+
gem "jeweler", "~> 1.6.4"
|
288
|
+
gem "rcov", ">= 0"
|
289
|
+
gem "bio", ">= 1.4.2"
|
290
|
+
end
|
291
|
+
|
292
|
+
In general if you add gems to the development section that gems will be installed only if you want to contribute the the original plugin source code. Otherwise you must add your gem requirements outside development group.
|
293
|
+
Note: because this file is used by bundler as well, you can specify multiple source. For development purposes is also possible to specify different location than rubygems, local or github:
|
294
|
+
gem "the_perfect_gem", :path=>"your_local_path_on_your_hard_drive"
|
295
|
+
gem "JohnDoe_perfect_gem", :git=>"http://github.com/johndow/the_perfect_gem"
|
296
|
+
|
297
|
+
== Manage Plugin Versions
|
298
|
+
$ rake version:bump:(major | minor | patch)
|
299
|
+
will increase the level of your actual version by 1. A version is composed by X.Y.Z where X = major, Y = minor, Z = patch and we suggest the following approach for bumping the version:
|
300
|
+
* major: new features or modifications which introduce incompatibilities with older version
|
301
|
+
* minor: new features which keep backward compatibility
|
302
|
+
* patch: fix a bug keeping backward compatibility
|
303
|
+
Note: every time you want to publish your plugin on RubyGems the version must be bumped by 1 in at least one of the X.Y.Z otherwise RubyGems will give your an error. If you want to remove a specific version from RubyGems you must yank it but remember that version number, will not be available anymore
|
304
|
+
gem yank GEM -v VERSION [-p PLATFORM] [--undo] [options]
|
305
|
+
=== Bumping Minor Version
|
306
|
+
$ bundle exec rake version:bump:minor
|
307
|
+
Current version: 0.0.0
|
308
|
+
Updated version: 0.1.0
|
309
|
+
|
310
|
+
== Releasing the Plugin
|
311
|
+
After hack, git add and commit you may be ready to distribute the plugin and now you have two ways
|
312
|
+
* Only GitHub
|
313
|
+
* GitHub and RubyGems
|
314
|
+
=== Only on GitHub
|
315
|
+
$ bundle exec rake git:release
|
316
|
+
=== GitHub and Rubygems at the same time
|
317
|
+
$ bundle exec rake release
|
318
|
+
|
319
|
+
|
320
|
+
== Options
|
321
|
+
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.
|
322
|
+
|
323
|
+
Usage: Biogem [options] reponame, e.g.
|
324
|
+
$ Biogem the-perfect-gem
|
325
|
+
|
326
|
+
|
327
|
+
--directory [DIRECTORY] specify the directory to generate into
|
328
|
+
These options are for Biogem
|
329
|
+
--meta create a meta package, just the Rakefile, Gemfile, Licence, Readme. This options takes the precedence over every other option.
|
330
|
+
--with-bin create the bin directory and an executable template script called bioreponame
|
331
|
+
--with-db create the database directory for a db application-library
|
332
|
+
--with-test-data create the data directory inside the test directory if the user need to set up a test with its own dataset
|
333
|
+
--with-engine [NAMESPACE] create a Rails engine with the namespace given in input. Dy default set up the environment to use an SQLite3 database
|
334
|
+
These options are for Jeweler
|
335
|
+
--rspec generate rspec code examples
|
336
|
+
--shoulda generate shoulda tests
|
337
|
+
--testunit generate test/unit tests
|
338
|
+
--bacon generate bacon specifications
|
339
|
+
--testspec generate test/spec tests
|
340
|
+
--minitest generate minitest tests
|
341
|
+
--micronaut generate micronaut examples
|
342
|
+
--riot generate riot tests
|
343
|
+
--shindo generate shindo tests
|
344
|
+
|
345
|
+
--[no-]bundler use bundler for managing dependencies
|
346
|
+
--cucumber generate cucumber stories in addition to the other tests
|
347
|
+
|
348
|
+
--reek generate rake task for reek
|
349
|
+
--roodi generate rake task for roodi
|
350
|
+
|
351
|
+
--summary [SUMMARY] specify the summary of the project
|
352
|
+
--description [DESCRIPTION] specify a description of the project
|
353
|
+
|
354
|
+
--user-name [USER_NAME] the user's name, ie that is credited in the LICENSE
|
355
|
+
--user-email [USER_EMAIL] the user's email, ie that is credited in the Gem specification
|
356
|
+
|
357
|
+
--github-username [GITHUB_USERNAME]
|
358
|
+
name of the user on GitHub to set the project up under
|
359
|
+
--github-token [GITHUB_TOKEN]
|
360
|
+
GitHub token to use for interacting with the GitHub API
|
361
|
+
--git-remote [GIT_REMOTE] URI to set the git origin remote to
|
362
|
+
--homepage [HOMEPAGE] the homepage for your project (defaults to the GitHub repo)
|
363
|
+
--no-create-repo create the repository on GitHub (repo is created by default)
|
364
|
+
|
365
|
+
--yard use yard for documentation
|
366
|
+
--rdoc use rdoc for documentation
|
367
|
+
-h, --help display this help and exit
|
368
|
+
|
369
|
+
== Tasks
|
370
|
+
Biogems, like other frameworks, offers a bunch of predefined and common operations for the developers. These are so called tasks and can be listed simply typing:
|
371
|
+
$ rake -T
|
372
|
+
but because we are in a "development environment" is strongly suggested to use a very similar command
|
373
|
+
$ bundle exec rake -T
|
374
|
+
which guarantees that all the called programs/tasks will be executed inside the current development environment (bound to specific libraries versions). Follows the list of all available tasks for Biogem
|
375
|
+
|
376
|
+
rake build # Build gem into pkg/
|
377
|
+
rake clobber_rcov # Remove rcov products for rcov
|
378
|
+
rake clobber_rdoc # Remove rdoc products
|
379
|
+
rake console[script] # Start IRB with all runtime dependencies loaded
|
380
|
+
rake db:create # Create the database from config/database.yml for the current default (use db:create:all to create all dbs in the config)
|
381
|
+
rake db:drop # Drops the database for the current default (use db:drop:all to drop all databases)
|
382
|
+
rake db:fixtures:load # Load fixtures into the current environment's database.
|
383
|
+
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
|
384
|
+
rake db:migrate:status # Display status of migrations
|
385
|
+
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
|
386
|
+
rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
|
387
|
+
rake db:schema:load # Load a schema.rb file into the database
|
388
|
+
rake db:seed # Load the seed data from db/seeds.rb
|
389
|
+
rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
|
390
|
+
rake db:structure:dump # Dump the database structure to an SQL file
|
391
|
+
rake db:version # Retrieves the current schema version number
|
392
|
+
rake gemcutter:release # Release gem to Gemcutter
|
393
|
+
rake gemspec # Generate and validate gemspec
|
394
|
+
rake gemspec:debug # Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)
|
395
|
+
rake gemspec:generate # Regenreate the gemspec on the filesystem
|
396
|
+
rake gemspec:release # Regenerate and validate gemspec, and then commits and pushes to git
|
397
|
+
rake gemspec:validate # Validates the gemspec on the filesystem
|
398
|
+
rake git:release # Tag and push release to git.
|
399
|
+
rake install # Build and install gem using `gem install`
|
400
|
+
rake rcov # Analyze code coverage with tests
|
401
|
+
rake rdoc # Build the rdoc HTML Files
|
402
|
+
rake release # Release gem
|
403
|
+
rake rerdoc # Force a rebuild of the RDOC files
|
404
|
+
rake test # Run tests
|
405
|
+
rake version # Displays the current version
|
406
|
+
rake version:bump:major # Bump the major version by 1
|
407
|
+
rake version:bump:minor # Bump the a minor version by 1
|
408
|
+
rake version:bump:patch # Bump the patch version by 1
|
409
|
+
rake version:write # Writes out an explicit version.
|
410
|
+
|
411
|
+
|
412
|
+
== Advanced Developers
|
413
|
+
|
414
|
+
* Remember to modify .gitignore to exclude unwanted files.
|
415
|
+
|
416
|
+
== BioRuby's Wiki Official Documentation
|
417
|
+
|
418
|
+
* http://bioruby.open-bio.org/wiki/Plugins
|
419
|
+
=== StepByStep
|
420
|
+
Toshiaki Katayama wrote a step by step guide for a bio-foobar plugin @ http://bioruby.open-bio.org/wiki/BiogemInstallation; note this information could be older than this.
|
421
|
+
|
422
|
+
|
423
|
+
== Biogems Official Plugin Archive
|
424
|
+
|
425
|
+
* http://Biogems.info/
|
426
|
+
|
427
|
+
|
428
|
+
== TODO
|
429
|
+
* better command line, wrap or re-implement some of the funcionalities provided by Bundler and Jeweler
|
430
|
+
* use YAML for database configuration
|
431
|
+
|
432
|
+
== Copyright
|
433
|
+
|
434
|
+
Copyright (c) 2010 Raoul J.P. Bonnal, Toshiaki Katayama, and Pjotr Prins. See LICENSE.txt for
|
435
|
+
further details.
|
436
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
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 = "1.1.
|
8
|
+
s.version = "1.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Raoul J.P. Bonnal}]
|
12
|
-
s.date = %q{2011-11-
|
12
|
+
s.date = %q{2011-11-29}
|
13
13
|
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 .
|
14
14
|
The basic idea is to simplify and promote a modular approach to the BioRuby package.}
|
15
15
|
s.email = %q{ilpuccio.febo@gmail.com}
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"LICENSE.txt",
|
26
26
|
"README.rdoc",
|
27
27
|
"Rakefile",
|
28
|
+
"Tutorial.rdoc",
|
28
29
|
"VERSION",
|
29
30
|
"bin/biogem",
|
30
31
|
"bio-gem.gemspec",
|
@@ -35,10 +36,13 @@ Gem::Specification.new do |s|
|
|
35
36
|
"lib/bio-gem/mod/jeweler/options.rb",
|
36
37
|
"lib/bio-gem/templates/bin",
|
37
38
|
"lib/bio-gem/templates/database",
|
39
|
+
"lib/bio-gem/templates/db_connection",
|
40
|
+
"lib/bio-gem/templates/db_model",
|
38
41
|
"lib/bio-gem/templates/engine",
|
39
42
|
"lib/bio-gem/templates/foos_controller",
|
40
43
|
"lib/bio-gem/templates/foos_view_example",
|
41
44
|
"lib/bio-gem/templates/foos_view_index",
|
45
|
+
"lib/bio-gem/templates/foos_view_new",
|
42
46
|
"lib/bio-gem/templates/foos_view_show",
|
43
47
|
"lib/bio-gem/templates/lib",
|
44
48
|
"lib/bio-gem/templates/library",
|
data/lib/bio-gem/mod/jeweler.rb
CHANGED
@@ -5,12 +5,12 @@ require 'bio-gem/mod/jeweler/github_mixin'
|
|
5
5
|
|
6
6
|
class String
|
7
7
|
def underscore
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
self.gsub(/::/, '/').
|
9
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
10
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
11
|
+
tr("-", "_").
|
12
|
+
downcase
|
13
|
+
end
|
14
14
|
end
|
15
15
|
|
16
16
|
class Jeweler
|
@@ -27,7 +27,7 @@ class Jeweler
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
alias original_project_name project_name
|
31
31
|
def project_name
|
32
32
|
prj_name = original_project_name=~/^bio-/ ? original_project_name : "bio-#{original_project_name}"
|
33
33
|
prj_name
|
@@ -65,31 +65,43 @@ class Jeweler
|
|
65
65
|
def bin_name
|
66
66
|
"bio#{original_project_name}"
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
def engine_dirs
|
70
70
|
%w{app app/controllers app/views app/helpers config app/views/foos}
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
def engine_name
|
74
74
|
"#{project_name}-engine"
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
def engine_filename
|
78
78
|
"#{engine_name}.rb"
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
def engine_module_name
|
82
82
|
project_name.split('-').map{|module_sub_name| module_sub_name.capitalize}.join
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
def engine_name_prefix
|
86
86
|
project_name.split('-').gsub(/-/,'_')<<'_'
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def engine_namespace
|
90
90
|
"/#{options[:biogem_engine]}"
|
91
91
|
end
|
92
92
|
|
93
|
+
def sub_module
|
94
|
+
project_name.split('-')[1..-1].map{|x| x.capitalize}.join
|
95
|
+
end
|
96
|
+
|
97
|
+
def lib_sub_module
|
98
|
+
File.join(lib_dir,"bio",sub_module.downcase)
|
99
|
+
end
|
100
|
+
|
101
|
+
def exists_dir?(dir)
|
102
|
+
Dir.exists?(File.join(target_dir,dir))
|
103
|
+
end
|
104
|
+
|
93
105
|
def render_template_generic(source, template_dir = template_dir_biogem)
|
94
106
|
template_contents = File.read(File.join(template_dir, source))
|
95
107
|
template = ERB.new(template_contents, nil, '<>')
|
@@ -109,7 +121,7 @@ class Jeweler
|
|
109
121
|
end
|
110
122
|
$stdout.puts "\t#{status}\t#{destination}"
|
111
123
|
end
|
112
|
-
|
124
|
+
|
113
125
|
def output_template_in_target_generic_update(source, destination = source, template_dir = template_dir_biogem)
|
114
126
|
final_destination = File.join(target_dir, destination)
|
115
127
|
template_result = render_template_generic(source, template_dir)
|
@@ -128,11 +140,16 @@ class Jeweler
|
|
128
140
|
migrate_dir = File.join(db_dir, "migrate")
|
129
141
|
mkdir_in_target(db_dir)
|
130
142
|
mkdir_in_target(migrate_dir)
|
131
|
-
mkdir_in_target("
|
132
|
-
|
143
|
+
mkdir_in_target("config") unless exists_dir?("config")
|
144
|
+
mkdir_in_target("lib/bio")
|
145
|
+
mkdir_in_target(lib_sub_module)
|
146
|
+
output_template_in_target_generic 'database', File.join("config", "database.yml")
|
133
147
|
output_template_in_target_generic 'migration', File.join(migrate_dir, "001_create_example.rb" )
|
134
148
|
output_template_in_target_generic 'seeds', File.join(db_dir, "seeds.rb")
|
135
149
|
output_template_in_target_generic 'rakefile', 'Rakefile', template_dir_biogem, 'a' #need to spec all the option to enable the append option
|
150
|
+
#TODO I'd like to have a parameter from command like with defines the Namespace of the created bio-gem to automatically costruct directory structure
|
151
|
+
output_template_in_target_generic 'db_connection', File.join(lib_sub_module,"connect.rb")
|
152
|
+
output_template_in_target_generic 'db_model', File.join(lib_sub_module,"example.rb")
|
136
153
|
end
|
137
154
|
|
138
155
|
alias original_create_files create_files
|
@@ -147,7 +164,7 @@ class Jeweler
|
|
147
164
|
else
|
148
165
|
raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
|
149
166
|
end
|
150
|
-
|
167
|
+
|
151
168
|
output_template_in_target '.gitignore'
|
152
169
|
output_template_in_target 'Rakefile'
|
153
170
|
output_template_in_target 'Gemfile' if should_use_bundler
|
@@ -156,7 +173,7 @@ class Jeweler
|
|
156
173
|
output_template_in_target '.document'
|
157
174
|
else
|
158
175
|
original_create_files
|
159
|
-
|
176
|
+
|
160
177
|
if options[:biogem_test_data]
|
161
178
|
mkdir_in_target("test") unless File.exists? "#{target_dir}/test"
|
162
179
|
mkdir_in_target test_data_dir
|
@@ -168,39 +185,44 @@ class Jeweler
|
|
168
185
|
# TODO: set the file as executable
|
169
186
|
File.chmod 0655, File.join(target_dir, bin_dir, bin_name)
|
170
187
|
end
|
171
|
-
|
188
|
+
|
172
189
|
# Fill lib/bio-plugin.rb with some default comments
|
173
190
|
output_template_in_target_generic 'lib', File.join(lib_dir, lib_filename)
|
174
|
-
|
191
|
+
|
175
192
|
#creates the strutures and files needed to have a ready to go Rails' engine
|
176
193
|
if namespace=options[:biogem_engine]
|
177
194
|
engine_dirs.each do |dir|
|
178
|
-
mkdir_in_target dir
|
195
|
+
mkdir_in_target(dir) unless exists_dir?(dir)
|
179
196
|
end
|
180
197
|
output_template_in_target_generic 'engine', File.join('lib', engine_filename )
|
181
198
|
output_template_in_target_generic_update 'library', File.join('lib', lib_filename)
|
182
199
|
output_template_in_target_generic 'routes', File.join('config', "routes.rb" )
|
183
200
|
output_template_in_target_generic 'foos_controller', File.join('app',"controllers", "foos_controller.rb" )
|
184
|
-
output_template_in_target_generic 'foos_view_index', File.join('app',"views","foos", "
|
201
|
+
output_template_in_target_generic 'foos_view_index', File.join('app',"views","foos", "index.html.erb" )
|
185
202
|
output_template_in_target_generic 'foos_view_show', File.join('app',"views","foos", "show.html.erb" )
|
186
|
-
output_template_in_target_generic 'foos_view_example', File.join('app',"views","foos", "example.html.erb" )
|
203
|
+
output_template_in_target_generic 'foos_view_example', File.join('app',"views","foos", "example.html.erb" )
|
204
|
+
output_template_in_target_generic 'foos_view_new', File.join('app',"views","foos", "new.html.erb" )
|
187
205
|
end
|
188
206
|
end #not_bio_gem_meta
|
189
207
|
end
|
190
208
|
|
191
209
|
def create_and_push_repo
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
210
|
+
begin
|
211
|
+
Net::HTTP.post_form URI.parse('http://github.com/api/v2/yaml/repos/create'),
|
212
|
+
'login' => github_username,
|
213
|
+
'token' => github_token,
|
214
|
+
'description' => summary,
|
215
|
+
'name' => github_repo_name
|
216
|
+
# BY DEFAULT THE REPO IS CREATED
|
217
|
+
# DO NOT PUSH THE REPO BECAUSE USER MUST ADD INFO TO CONFIGURATION FILES
|
218
|
+
# TODO do a HEAD request to see when it's ready?
|
219
|
+
#@repo.push('origin')
|
220
|
+
rescue SocketError => se
|
221
|
+
puts_template_message("Seems you are not connected to Internet, can't create a remote repository. Do not forget to create it by hand, from GitHub, and sync it with this project.")
|
222
|
+
end
|
201
223
|
end
|
202
|
-
|
203
|
-
|
224
|
+
|
225
|
+
|
204
226
|
def puts_template_message(message, length=70, padding=4)
|
205
227
|
puts "*"*(length+padding*2+2)
|
206
228
|
puts "*"+" "*(length+padding*2)+"*"
|
@@ -10,7 +10,7 @@ class Jeweler
|
|
10
10
|
self[:testing_framework] = :shoulda
|
11
11
|
self[:documentation_framework] = :rdoc
|
12
12
|
self[:use_bundler] = true
|
13
|
-
self[:create_repo] = true
|
13
|
+
self[:create_repo] = self[:create_repo] || true
|
14
14
|
|
15
15
|
git_config = if Pathname.new("~/.gitconfig").expand_path.exist?
|
16
16
|
Git.global_config
|
@@ -156,8 +156,8 @@ class Jeweler
|
|
156
156
|
self[:homepage] = homepage
|
157
157
|
end
|
158
158
|
|
159
|
-
o.on('--create-repo', 'create the repository on GitHub') do
|
160
|
-
self[:create_repo] =
|
159
|
+
o.on('--no-create-repo', 'create the repository on GitHub') do
|
160
|
+
self[:create_repo] = false
|
161
161
|
end
|
162
162
|
|
163
163
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Bio
|
2
|
+
module <%= sub_module.capitalize %>
|
3
|
+
class DummyConn < ActiveRecord::Base
|
4
|
+
self.abstract_class = true
|
5
|
+
root_path = File.join(File.dirname(__FILE__),"../../../")
|
6
|
+
configurations = YAML.load_file(File.join(root_path,"config/database.yml"))
|
7
|
+
configurations.each_pair do |key, db_info|
|
8
|
+
db_info["database"] = File.join(root_path, db_info["database"]) if db_info["adapter"]=='sqlite3'
|
9
|
+
end
|
10
|
+
establish_connection(configurations["default"])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
class FoosController < ApplicationController
|
2
2
|
def example
|
3
|
+
@example = Bio::Foo::Example.find(params["id"])
|
4
|
+
@examples = Bio::Foo:Example.all
|
5
|
+
@togo=TOGOWS.entry('genbank', @example.gene_name)
|
3
6
|
@shuttle = "TEST CASE"
|
4
7
|
end
|
5
8
|
|
@@ -10,4 +13,19 @@ class FoosController < ApplicationController
|
|
10
13
|
def show
|
11
14
|
@item = "It's me"
|
12
15
|
end
|
16
|
+
|
17
|
+
def new
|
18
|
+
@example = Bio::Foo::Example.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
@example = Bio::Foo::Example.new(params[:example])
|
23
|
+
if @example.save
|
24
|
+
redirect_to example_url(@example)
|
25
|
+
else
|
26
|
+
# This line overrides the default rendering behavior, which
|
27
|
+
# would have been to render the "create" view.
|
28
|
+
render :action => "new"
|
29
|
+
end
|
30
|
+
end
|
13
31
|
end
|
@@ -1 +1,13 @@
|
|
1
|
-
This is just an example of a call from a controller <%%= @shuttle
|
1
|
+
<p>This is just an example of a call from a controller <%%= @shuttle %></p>
|
2
|
+
|
3
|
+
<p>Your query was <%%= @example.gene_name %></p>
|
4
|
+
|
5
|
+
<p>I found on TOGOWS this answer: <%%= @togo %></p>
|
6
|
+
|
7
|
+
<p>In the past you asked for all this things</p>
|
8
|
+
<table>
|
9
|
+
<tr><th>Questions</th></tr>
|
10
|
+
<%% @examples.each do |example|%>
|
11
|
+
<tr><td><%%= example.gene_name%></td></tr>
|
12
|
+
<%% end %>
|
13
|
+
</table>
|
data/lib/bio-gem/templates/lib
CHANGED
@@ -8,3 +8,10 @@
|
|
8
8
|
# and put your plugin's code there. It is bad practice to write other code
|
9
9
|
# directly into this file, because doing so causes confusion if this biogem
|
10
10
|
# was ever to get merged into the main bioruby tree.
|
11
|
+
|
12
|
+
<% if options[:biogem_db] %>
|
13
|
+
require '<%= File.join("bio",sub_module.downcase,"connect") %>'
|
14
|
+
<% unless options[:biogem_engine] %>
|
15
|
+
require '<%= File.join("bio",sub_module.downcase,"example") %>'
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -5,16 +5,16 @@
|
|
5
5
|
# class CreateExample < ActiveRecord::Migration
|
6
6
|
# def self.up
|
7
7
|
# #primary key id is created automatically by ActiveRecord::Migration
|
8
|
-
# create_table :
|
9
|
-
# t.string :
|
8
|
+
# create_table :examples do |t|
|
9
|
+
# t.string :gene_name
|
10
10
|
# t.string :tag
|
11
11
|
# t.string :type
|
12
12
|
# end
|
13
13
|
#
|
14
|
-
# add_index :
|
14
|
+
# add_index :examples, :gene_name
|
15
15
|
# end
|
16
16
|
#
|
17
17
|
# def self.down
|
18
|
-
# drop_table :
|
18
|
+
# drop_table :examples
|
19
19
|
# end
|
20
20
|
# end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
Encoding.default_external = Encoding::UTF_8
|
3
|
+
Encoding.default_internal = Encoding::UTF_8
|
1
4
|
|
2
5
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'lib')
|
3
6
|
require 'active_support'
|
@@ -9,7 +12,7 @@ require 'active_record'
|
|
9
12
|
namespace :db do
|
10
13
|
task :load_config do
|
11
14
|
require 'active_record'
|
12
|
-
ActiveRecord::Base.configurations = YAML.load_file("
|
15
|
+
ActiveRecord::Base.configurations = YAML.load_file("config/database.yml")
|
13
16
|
end
|
14
17
|
|
15
18
|
task :environment => :load_config do
|
@@ -303,7 +306,7 @@ namespace :db do
|
|
303
306
|
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
304
307
|
|
305
308
|
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir["#{fixtures_dir}/**/*.{yml,csv}"]).each do |fixture_file|
|
306
|
-
Fixtures.create_fixtures(fixtures_dir, fixture_file[(fixtures_dir.size + 1)..-5])
|
309
|
+
ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file[(fixtures_dir.size + 1)..-5])
|
307
310
|
end
|
308
311
|
end
|
309
312
|
|
@@ -22,10 +22,10 @@ Rails.application.routes.draw do
|
|
22
22
|
## mount <%= engine_module_name %>::Engine=>"your_mount_point", :as=>'your_personal_engine_name' # but is better to redefine the mount point in the Rails application.
|
23
23
|
# yourPathToTheControllerFiles = 'foopath'
|
24
24
|
# controllerName = :foos
|
25
|
-
# otherControllerName = :
|
26
|
-
|
25
|
+
# otherControllerName = :samples
|
26
|
+
## ---
|
27
27
|
# scope mount_at, yourPathToTheControllerFiles do
|
28
|
-
# resources controllerName
|
28
|
+
# resources controllerName do #, :only => [ :index, :show, :new] do
|
29
29
|
# member do
|
30
30
|
# get :example
|
31
31
|
# end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154015700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.18
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154015700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jeweler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154015180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.6.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154015180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154014540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154014540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: shoulda
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154013740 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154013740
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154012940 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.18
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154012940
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &2154012100 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2154012100
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rcov
|
82
|
-
requirement: &
|
82
|
+
requirement: &2154011320 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2154011320
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdoc
|
93
|
-
requirement: &
|
93
|
+
requirement: &2154003500 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2154003500
|
102
102
|
description: ! "BioGem is a scaffold generator for those Bioinformaticans who want
|
103
103
|
to start coding an application or a library for using/extending BioRuby core library
|
104
104
|
and sharing it through rubygems.org .\n The basic idea is to simplify and promote
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- LICENSE.txt
|
118
118
|
- README.rdoc
|
119
119
|
- Rakefile
|
120
|
+
- Tutorial.rdoc
|
120
121
|
- VERSION
|
121
122
|
- bin/biogem
|
122
123
|
- bio-gem.gemspec
|
@@ -127,10 +128,13 @@ files:
|
|
127
128
|
- lib/bio-gem/mod/jeweler/options.rb
|
128
129
|
- lib/bio-gem/templates/bin
|
129
130
|
- lib/bio-gem/templates/database
|
131
|
+
- lib/bio-gem/templates/db_connection
|
132
|
+
- lib/bio-gem/templates/db_model
|
130
133
|
- lib/bio-gem/templates/engine
|
131
134
|
- lib/bio-gem/templates/foos_controller
|
132
135
|
- lib/bio-gem/templates/foos_view_example
|
133
136
|
- lib/bio-gem/templates/foos_view_index
|
137
|
+
- lib/bio-gem/templates/foos_view_new
|
134
138
|
- lib/bio-gem/templates/foos_view_show
|
135
139
|
- lib/bio-gem/templates/lib
|
136
140
|
- lib/bio-gem/templates/library
|
@@ -155,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
159
|
version: '0'
|
156
160
|
segments:
|
157
161
|
- 0
|
158
|
-
hash:
|
162
|
+
hash: 823213589522284135
|
159
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
164
|
none: false
|
161
165
|
requirements:
|