bio-gem 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -3
- data/Gemfile.lock +3 -4
- data/LICENSE.txt +1 -1
- data/README.rdoc +27 -10
- data/Rakefile +12 -10
- data/Tutorial.rdoc +4 -5
- data/VERSION +1 -1
- data/bin/biogem +9 -1
- data/bio-gem.gemspec +22 -16
- data/doc/biogem-hacking.md +396 -0
- data/lib/bio-gem.rb +2 -1
- data/lib/bio-gem/application.rb +1 -1
- data/lib/bio-gem/generator/render.rb +144 -0
- data/lib/bio-gem/mod/biogem-rails.rb +14 -0
- data/lib/bio-gem/mod/biogem.rb +107 -0
- data/lib/bio-gem/mod/jeweler.rb +33 -185
- data/lib/bio-gem/mod/jeweler/options.rb +5 -1
- data/lib/bio-gem/templates/README.rdoc +40 -0
- data/lib/bio-gem/templates/{bin → bin/bio-plugin} +1 -3
- data/lib/bio-gem/templates/ffi/ext.c +8 -0
- data/lib/bio-gem/templates/ffi/ext.h +10 -0
- data/lib/bio-gem/templates/gitignore +3 -0
- data/lib/bio-gem/templates/lib/bioruby-plugin.rb +18 -0
- data/lib/bio-gem/templates/lib/plugin.rb +3 -0
- data/test/test_bio-gem.rb +7 -8
- metadata +34 -36
- data/lib/bio-gem/templates/lib +0 -17
data/lib/bio-gem.rb
CHANGED
data/lib/bio-gem/application.rb
CHANGED
@@ -46,7 +46,7 @@ module Bio
|
|
46
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
47
|
return {:exit=>1}
|
48
48
|
rescue Jeweler::FileInTheWay
|
49
|
-
$stderr.puts "The directory #{options[:project_name]} already exists. Maybe move it out of the way before continuing?"
|
49
|
+
$stderr.puts "The directory for #{options[:project_name]} already exists. Maybe move it out of the way before continuing?"
|
50
50
|
return {:exit=>1}
|
51
51
|
end
|
52
52
|
end #run!
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module Biogem
|
2
|
+
module Render
|
3
|
+
# new hook for removing stuff
|
4
|
+
def after_render_template(source,buf)
|
5
|
+
if source == 'other_tasks.erb'
|
6
|
+
$stdout.puts "\tremove jeweler rcov lines"
|
7
|
+
# remove rcov related lines from jeweler Rakefile
|
8
|
+
remove = "require 'rcov/rcovtask'"
|
9
|
+
if buf =~ /#{remove}/
|
10
|
+
# $stdout.puts buf,'---'
|
11
|
+
buf1 = buf.split(/\n/)
|
12
|
+
i = buf1.index(remove)
|
13
|
+
buf = (buf1[0..i-1] + buf1[i+7..-1]).join("\n")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
buf
|
17
|
+
end
|
18
|
+
|
19
|
+
def render_template_generic(source, template_dir = template_dir_biogem)
|
20
|
+
template_contents = File.read(path(template_dir, source))
|
21
|
+
template = ERB.new(template_contents, nil, '<>')
|
22
|
+
|
23
|
+
# squish extraneous whitespace from some of the conditionals
|
24
|
+
template.result(binding).gsub(/\n\n\n+/, "\n\n")
|
25
|
+
end
|
26
|
+
|
27
|
+
def output_template_in_target_generic(source, destination = source, template_dir = template_dir_biogem)
|
28
|
+
final_destination = path(target_dir, destination)
|
29
|
+
template_result = render_template_generic(source, template_dir)
|
30
|
+
|
31
|
+
File.open(final_destination, 'w') {|file| file.write(template_result)}
|
32
|
+
$stdout.puts "\tcreate\t#{destination}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def output_template_in_target_generic_append(source, destination = source, template_dir = template_dir_biogem)
|
36
|
+
final_destination = path(target_dir, destination)
|
37
|
+
template_result = render_template_generic(source, template_dir)
|
38
|
+
|
39
|
+
File.open(final_destination, 'a') {|file| file.write(template_result)}
|
40
|
+
|
41
|
+
$stdout.puts "\tappend\t#{destination}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def template_dir_biogem
|
45
|
+
path(File.dirname(__FILE__),'..', 'templates')
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_plugin_files
|
49
|
+
if options[:biogem_meta]
|
50
|
+
create_meta
|
51
|
+
else
|
52
|
+
original_create_files
|
53
|
+
create_lib
|
54
|
+
create_bin if options[:biogem_bin]
|
55
|
+
create_test_data if options[:biogem_test_data]
|
56
|
+
create_ffi_structure if options[:biogem_ffi]
|
57
|
+
create_db_structure if options[:biogem_db]
|
58
|
+
create_rails_engine if options[:biogem_engine]
|
59
|
+
end
|
60
|
+
# Always do these
|
61
|
+
output_template_in_target_generic 'README.rdoc'
|
62
|
+
output_template_in_target_generic_append 'gitignore', '.gitignore'
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_meta
|
66
|
+
# this section is for Biogem META packages only!
|
67
|
+
unless File.exists?(target_dir) || File.directory?(target_dir)
|
68
|
+
FileUtils.mkdir target_dir
|
69
|
+
else
|
70
|
+
raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
|
71
|
+
end
|
72
|
+
output_template_in_target '.gitignore'
|
73
|
+
output_template_in_target 'Rakefile'
|
74
|
+
output_template_in_target 'Gemfile' if should_use_bundler
|
75
|
+
output_template_in_target 'LICENSE.txt'
|
76
|
+
output_template_in_target '.document'
|
77
|
+
end
|
78
|
+
|
79
|
+
def create_lib
|
80
|
+
output_template_in_target_generic path('lib/bioruby-plugin.rb'), path(lib_dir, lib_filename)
|
81
|
+
mkdir_in_target(lib_plugin_dir)
|
82
|
+
output_template_in_target_generic path('lib/plugin.rb'), path(lib_dir, project_name, lib_plugin_filename)
|
83
|
+
end
|
84
|
+
|
85
|
+
def create_bin
|
86
|
+
# create the 'binary' in ./bin
|
87
|
+
mkdir_in_target bin_dir
|
88
|
+
output_template_in_target_generic path('bin/bio-plugin'), path(bin_dir, bin_name)
|
89
|
+
# TODO: set the file as executable (Windows?)
|
90
|
+
File.chmod 0655, path(target_dir, bin_dir, bin_name)
|
91
|
+
end
|
92
|
+
|
93
|
+
def create_test_data
|
94
|
+
mkdir_in_target("test") unless File.exists? "#{target_dir}/test"
|
95
|
+
mkdir_in_target test_data_dir
|
96
|
+
end
|
97
|
+
|
98
|
+
def create_ffi_structure
|
99
|
+
# create ./ext/src and ./ext/include for the .c and .h files
|
100
|
+
mkdir_in_target(ext_dir)
|
101
|
+
src_dir = path(ext_dir,'src')
|
102
|
+
mkdir_in_target(src_dir)
|
103
|
+
# create ./lib/ffi for the Ruby ffi
|
104
|
+
mkdir_in_target(path(lib_dir,"ffi"))
|
105
|
+
# copy C files
|
106
|
+
output_template_in_target_generic path('ffi/ext.c'), path(src_dir, "ext.c" )
|
107
|
+
output_template_in_target_generic path('ffi/ext.h'), path(src_dir, "ext.h" )
|
108
|
+
end
|
109
|
+
|
110
|
+
def create_db_structure
|
111
|
+
migrate_dir = path(db_dir, "migrate")
|
112
|
+
mkdir_in_target(db_dir)
|
113
|
+
mkdir_in_target(migrate_dir)
|
114
|
+
mkdir_in_target("config") unless exists_dir?("config")
|
115
|
+
mkdir_in_target(path("lib/bio"))
|
116
|
+
mkdir_in_target(lib_sub_module)
|
117
|
+
output_template_in_target_generic 'database', path("config/database.yml")
|
118
|
+
output_template_in_target_generic 'migration', path(migrate_dir,"001_create_example.rb" )
|
119
|
+
output_template_in_target_generic 'seeds', path(db_dir, "seeds.rb")
|
120
|
+
output_template_in_target_generic_append 'rakefile', 'Rakefile', template_dir_biogem
|
121
|
+
#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
|
122
|
+
output_template_in_target_generic 'db_connection', path(lib_sub_module,"connect.rb")
|
123
|
+
output_template_in_target_generic 'db_model', path(lib_sub_module,"example.rb")
|
124
|
+
end
|
125
|
+
|
126
|
+
def create_rails_engine
|
127
|
+
# create the structures and files needed to have a ready to go Rails' engine
|
128
|
+
namespace = options[:biogem_engine] # are we using this?
|
129
|
+
engine_dirs.each do |dir|
|
130
|
+
mkdir_in_target(dir) unless exists_dir?(dir)
|
131
|
+
end
|
132
|
+
output_template_in_target_generic 'engine', path('lib', engine_filename )
|
133
|
+
output_template_in_target_generic_append 'library', path('lib', lib_filename)
|
134
|
+
output_template_in_target_generic 'routes', path('config', "routes.rb" )
|
135
|
+
output_template_in_target_generic 'foos_controller', path('app',"controllers", "foos_controller.rb" )
|
136
|
+
output_template_in_target_generic 'foos_view_index', path('app',"views","foos", "index.html.erb" )
|
137
|
+
output_template_in_target_generic 'foos_view_show', path('app',"views","foos", "show.html.erb" )
|
138
|
+
output_template_in_target_generic 'foos_view_example', path('app',"views","foos", "example.html.erb" )
|
139
|
+
output_template_in_target_generic 'foos_view_new', path('app',"views","foos", "new.html.erb" )
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Biogem helpers for templates
|
2
|
+
|
3
|
+
module Biogem
|
4
|
+
module Path
|
5
|
+
|
6
|
+
def path(*items)
|
7
|
+
File.join(*items).gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
|
8
|
+
end
|
9
|
+
|
10
|
+
def exists_dir?(dir)
|
11
|
+
Dir.exists?(path(target_dir,dir))
|
12
|
+
end
|
13
|
+
|
14
|
+
def short_name
|
15
|
+
original_project_name.sub(/^bio-/,'')
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def lib_dir
|
20
|
+
'lib'
|
21
|
+
end
|
22
|
+
|
23
|
+
def lib_filename
|
24
|
+
"#{project_name}.rb"
|
25
|
+
end
|
26
|
+
|
27
|
+
def lib_plugin_dir
|
28
|
+
path(lib_dir, project_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def lib_plugin_filename
|
32
|
+
short_name + ".rb"
|
33
|
+
end
|
34
|
+
|
35
|
+
def require_name
|
36
|
+
project_name
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_data_dir
|
40
|
+
'test/data'
|
41
|
+
end
|
42
|
+
|
43
|
+
def db_dir
|
44
|
+
'db'
|
45
|
+
end
|
46
|
+
|
47
|
+
def bin_dir
|
48
|
+
'bin'
|
49
|
+
end
|
50
|
+
|
51
|
+
def ext_dir
|
52
|
+
'ext'
|
53
|
+
end
|
54
|
+
|
55
|
+
def bin_name
|
56
|
+
"#{original_project_name}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module Naming
|
61
|
+
def engine_dirs
|
62
|
+
%w{app app/controllers app/views app/helpers config app/views/foos}
|
63
|
+
end
|
64
|
+
|
65
|
+
def engine_name
|
66
|
+
"#{project_name}-engine"
|
67
|
+
end
|
68
|
+
|
69
|
+
def engine_filename
|
70
|
+
"#{engine_name}.rb"
|
71
|
+
end
|
72
|
+
|
73
|
+
def engine_module_name
|
74
|
+
module_name = project_name.split('-').map{|module_sub_name| module_sub_name.capitalize}.join
|
75
|
+
module_name.instance_eval do
|
76
|
+
# Handle underscore in routing template
|
77
|
+
def underscore
|
78
|
+
self.gsub(/::/, '/').
|
79
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
80
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
81
|
+
tr("-", "_").
|
82
|
+
downcase
|
83
|
+
end
|
84
|
+
end
|
85
|
+
module_name
|
86
|
+
end
|
87
|
+
|
88
|
+
def engine_name_prefix
|
89
|
+
project_name.split('-').gsub(/-/,'_')<<'_'
|
90
|
+
end
|
91
|
+
|
92
|
+
def engine_namespace
|
93
|
+
"/#{options[:biogem_engine]}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def sub_module
|
97
|
+
project_name.split('-')[1..-1].map{|x| x.capitalize}.join
|
98
|
+
end
|
99
|
+
|
100
|
+
def lib_sub_module
|
101
|
+
path(lib_dir,"bio",sub_module.downcase)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
module Github
|
106
|
+
end
|
107
|
+
end
|
data/lib/bio-gem/mod/jeweler.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
1
|
+
#Override Jeweler's classes for properly configure a BioRuby Development Environment/Layout.
|
2
|
+
# This module should only include methods that are overridden in Jeweler (by
|
3
|
+
# breaking open the Jeweler::Generator class
|
2
4
|
|
3
5
|
require 'bio-gem/mod/jeweler/options'
|
4
6
|
require 'bio-gem/mod/jeweler/github_mixin'
|
5
|
-
|
6
|
-
class String
|
7
|
-
def underscore
|
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
|
-
end
|
7
|
+
require 'bio-gem/mod/biogem'
|
15
8
|
|
16
9
|
class Jeweler
|
17
10
|
class Generator
|
18
11
|
|
12
|
+
include Biogem::Naming
|
13
|
+
include Biogem::Path
|
14
|
+
include Biogem::Render
|
15
|
+
include Biogem::Github
|
16
|
+
|
19
17
|
alias original_initialize initialize
|
20
18
|
def initialize(options = {})
|
21
19
|
original_initialize(options)
|
22
20
|
development_dependencies << ["bio", ">= 1.4.2"]
|
21
|
+
# RCov is not properly supported for Ruby 1.9.2, so we remove it
|
22
|
+
development_dependencies.delete_if { |k,v| k == "rcov" }
|
23
23
|
if options[:biogem_db]
|
24
24
|
development_dependencies << ["activerecord", ">= 3.0.7"]
|
25
25
|
development_dependencies << ["activesupport", ">= 3.0.7"]
|
@@ -29,184 +29,44 @@ class Jeweler
|
|
29
29
|
|
30
30
|
alias original_project_name project_name
|
31
31
|
def project_name
|
32
|
-
|
33
|
-
|
32
|
+
name = original_project_name
|
33
|
+
return 'bio-'+name if name !~ /^bio-/
|
34
|
+
name
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"#{project_name}.rb"
|
37
|
+
alias original_render_template render_template
|
38
|
+
def render_template(source)
|
39
|
+
buf = original_render_template(source)
|
40
|
+
# call hook (returns edited buf)
|
41
|
+
after_render_template(source,buf)
|
42
42
|
end
|
43
43
|
|
44
44
|
def target_dir
|
45
|
-
project_name.
|
45
|
+
project_name.sub('bio','bioruby')
|
46
46
|
end
|
47
47
|
alias github_repo_name target_dir
|
48
48
|
|
49
|
-
def require_name
|
50
|
-
project_name
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_data_dir
|
54
|
-
'test/data'
|
55
|
-
end
|
56
|
-
|
57
|
-
def db_dir
|
58
|
-
'db'
|
59
|
-
end
|
60
|
-
|
61
|
-
def bin_dir
|
62
|
-
'bin'
|
63
|
-
end
|
64
|
-
|
65
|
-
def bin_name
|
66
|
-
"bio#{original_project_name}"
|
67
|
-
end
|
68
|
-
|
69
|
-
def engine_dirs
|
70
|
-
%w{app app/controllers app/views app/helpers config app/views/foos}
|
71
|
-
end
|
72
|
-
|
73
|
-
def engine_name
|
74
|
-
"#{project_name}-engine"
|
75
|
-
end
|
76
|
-
|
77
|
-
def engine_filename
|
78
|
-
"#{engine_name}.rb"
|
79
|
-
end
|
80
|
-
|
81
|
-
def engine_module_name
|
82
|
-
project_name.split('-').map{|module_sub_name| module_sub_name.capitalize}.join
|
83
|
-
end
|
84
|
-
|
85
|
-
def engine_name_prefix
|
86
|
-
project_name.split('-').gsub(/-/,'_')<<'_'
|
87
|
-
end
|
88
|
-
|
89
|
-
def engine_namespace
|
90
|
-
"/#{options[:biogem_engine]}"
|
91
|
-
end
|
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
|
-
|
105
|
-
def render_template_generic(source, template_dir = template_dir_biogem)
|
106
|
-
template_contents = File.read(File.join(template_dir, source))
|
107
|
-
template = ERB.new(template_contents, nil, '<>')
|
108
|
-
|
109
|
-
# squish extraneous whitespace from some of the conditionals
|
110
|
-
template.result(binding).gsub(/\n\n\n+/, "\n\n")
|
111
|
-
end
|
112
|
-
|
113
|
-
def output_template_in_target_generic(source, destination = source, template_dir = template_dir_biogem, write_type='w')
|
114
|
-
final_destination = File.join(target_dir, destination)
|
115
|
-
template_result = render_template_generic(source, template_dir)
|
116
|
-
|
117
|
-
File.open(final_destination, write_type) {|file| file.write(template_result)}
|
118
|
-
status = case write_type
|
119
|
-
when 'w' then 'create'
|
120
|
-
when 'a' then 'update'
|
121
|
-
end
|
122
|
-
$stdout.puts "\t#{status}\t#{destination}"
|
123
|
-
end
|
124
|
-
|
125
|
-
def output_template_in_target_generic_update(source, destination = source, template_dir = template_dir_biogem)
|
126
|
-
final_destination = File.join(target_dir, destination)
|
127
|
-
template_result = render_template_generic(source, template_dir)
|
128
|
-
|
129
|
-
File.open(final_destination, 'a') {|file| file.write(template_result)}
|
130
|
-
|
131
|
-
$stdout.puts "\tcreate\t#{destination}"
|
132
|
-
end
|
133
|
-
|
134
|
-
def template_dir_biogem
|
135
|
-
File.join(File.dirname(__FILE__),'..', 'templates')
|
136
|
-
end
|
137
|
-
|
138
|
-
|
139
|
-
def create_db_structure
|
140
|
-
migrate_dir = File.join(db_dir, "migrate")
|
141
|
-
mkdir_in_target(db_dir)
|
142
|
-
mkdir_in_target(migrate_dir)
|
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")
|
147
|
-
output_template_in_target_generic 'migration', File.join(migrate_dir, "001_create_example.rb" )
|
148
|
-
output_template_in_target_generic 'seeds', File.join(db_dir, "seeds.rb")
|
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")
|
153
|
-
end
|
154
|
-
|
155
49
|
alias original_create_files create_files
|
156
50
|
# this is the default directory for storing library datasets
|
157
51
|
# creates a data directory for every needs.
|
158
52
|
#the options are defined in mod/jeweler/options.rb
|
159
53
|
def create_files
|
160
|
-
|
161
|
-
|
162
|
-
unless File.exists?(target_dir) || File.directory?(target_dir)
|
163
|
-
FileUtils.mkdir target_dir
|
164
|
-
else
|
165
|
-
raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
|
166
|
-
end
|
167
|
-
|
168
|
-
output_template_in_target '.gitignore'
|
169
|
-
output_template_in_target 'Rakefile'
|
170
|
-
output_template_in_target 'Gemfile' if should_use_bundler
|
171
|
-
output_template_in_target 'LICENSE.txt'
|
172
|
-
output_template_in_target 'README.rdoc'
|
173
|
-
output_template_in_target '.document'
|
174
|
-
else
|
175
|
-
original_create_files
|
176
|
-
|
177
|
-
if options[:biogem_test_data]
|
178
|
-
mkdir_in_target("test") unless File.exists? "#{target_dir}/test"
|
179
|
-
mkdir_in_target test_data_dir
|
180
|
-
end
|
181
|
-
create_db_structure if options[:biogem_db]
|
182
|
-
if options[:biogem_bin]
|
183
|
-
mkdir_in_target bin_dir
|
184
|
-
output_template_in_target_generic 'bin', File.join(bin_dir, bin_name)
|
185
|
-
# TODO: set the file as executable
|
186
|
-
File.chmod 0655, File.join(target_dir, bin_dir, bin_name)
|
187
|
-
end
|
188
|
-
|
189
|
-
# Fill lib/bio-plugin.rb with some default comments
|
190
|
-
output_template_in_target_generic 'lib', File.join(lib_dir, lib_filename)
|
54
|
+
create_plugin_files
|
55
|
+
end
|
191
56
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
output_template_in_target_generic 'foos_view_index', File.join('app',"views","foos", "index.html.erb" )
|
202
|
-
output_template_in_target_generic 'foos_view_show', File.join('app',"views","foos", "show.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" )
|
205
|
-
end
|
206
|
-
end #not_bio_gem_meta
|
57
|
+
def puts_template_message(message, length=70, padding=4)
|
58
|
+
puts "*"*(length+padding*2+2)
|
59
|
+
puts "*"+" "*(length+padding*2)+"*"
|
60
|
+
message=message.join("\n") if message.kind_of? Array
|
61
|
+
message.scan(/.{1,70}/).map do |sub_message|
|
62
|
+
puts "*"+" "*padding+sub_message+" "*(length-sub_message.size+padding)+"*"
|
63
|
+
end
|
64
|
+
puts "*"+" "*(length+padding*2)+"*"
|
65
|
+
puts "*"*(length+padding*2+2)
|
207
66
|
end
|
208
67
|
|
209
68
|
def create_and_push_repo
|
69
|
+
return if $UNITTEST # skip github create when testing
|
210
70
|
begin
|
211
71
|
Net::HTTP.post_form URI.parse('http://github.com/api/v2/yaml/repos/create'),
|
212
72
|
'login' => github_username,
|
@@ -221,17 +81,5 @@ class Jeweler
|
|
221
81
|
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
82
|
end
|
223
83
|
end
|
224
|
-
|
225
|
-
|
226
|
-
def puts_template_message(message, length=70, padding=4)
|
227
|
-
puts "*"*(length+padding*2+2)
|
228
|
-
puts "*"+" "*(length+padding*2)+"*"
|
229
|
-
message=message.join("\n") if message.kind_of? Array
|
230
|
-
message.scan(/.{1,70}/).map do |sub_message|
|
231
|
-
puts "*"+" "*padding+sub_message+" "*(length-sub_message.size+padding)+"*"
|
232
|
-
end
|
233
|
-
puts "*"+" "*(length+padding*2)+"*"
|
234
|
-
puts "*"*(length+padding*2+2)
|
235
|
-
end
|
236
84
|
end #Generator
|
237
|
-
end #Jeweler
|
85
|
+
end #Jeweler
|