genomer 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.mkd +9 -0
- data/README.mkd +7 -1
- data/features/cli/help.feature +38 -2
- data/features/cli/init.feature +11 -17
- data/features/cli/man.feature +6 -3
- data/lib/genomer/runtime.rb +52 -26
- data/lib/genomer/version.rb +1 -1
- data/spec/genomer/runtime_spec.rb +174 -133
- data/spec/spec_helper.rb +5 -8
- metadata +4 -3
data/.gitignore
CHANGED
data/CHANGELOG.mkd
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
== 0.0.9 ==
|
2
|
+
|
3
|
+
* Genomer now has different behaviour dependent on whether inside or outside
|
4
|
+
a genomer project directory. These differences are as follows:
|
5
|
+
* The 'init' command cannot be called inside an existing genomer project.
|
6
|
+
* All other commands cannot be when not inside a genomer project.
|
7
|
+
* Genomer no long throws an error when not inside a genomer project
|
8
|
+
directory, since a Gemfile is no longer attempted to be loaded.
|
9
|
+
* Version number can be shown using --version flag
|
data/README.mkd
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
![Genomer: A swiss army knife for genome projects](http://genomer.s3.amazonaws.com/icon/genomer.png)
|
1
|
+
![Genomer: A swiss army knife for genome projects](http://genomer.s3.amazonaws.com/icon/genomer/genomer.png)
|
2
2
|
|
3
3
|
## About
|
4
4
|
|
@@ -33,6 +33,12 @@ reproducible.
|
|
33
33
|
[plasmid]: https://github.com/michaelbarton/chromosome-pfluorescens-r124-plasmid
|
34
34
|
[genome]: https://github.com/michaelbarton/chromosome-pfluorescens-r124-genome
|
35
35
|
|
36
|
+
## Screencasts
|
37
|
+
|
38
|
+
* [Installing Genomer](http://www.youtube.com/watch?v=bXws8RnBsUU)
|
39
|
+
* [Genomer example usage](http://www.youtube.com/watch?v=HfsdJOELFjs)
|
40
|
+
* [Generating Genbank upload files for a simple plasmid](http://www.youtube.com/watch?v=jVn62pMnIRA)
|
41
|
+
|
36
42
|
## Installing
|
37
43
|
|
38
44
|
Ruby and RubyGems are required to use genomer and related plugins. Genomer is
|
data/features/cli/help.feature
CHANGED
@@ -3,7 +3,29 @@ Feature: Listing available commands
|
|
3
3
|
A user can use the help command
|
4
4
|
To list the available options to the console
|
5
5
|
|
6
|
-
|
6
|
+
@disable-bundler
|
7
|
+
Scenario: Running genomer with no commands outside a project
|
8
|
+
When I run the genomer command with no arguments
|
9
|
+
Then the exit status should be 0
|
10
|
+
And the output should contain:
|
11
|
+
"""
|
12
|
+
Use `genomer init NAME` to create a new genomer project called NAME
|
13
|
+
|
14
|
+
"""
|
15
|
+
|
16
|
+
@disable-bundler
|
17
|
+
Scenario: Running genomer with the --version flag outside a project
|
18
|
+
When I run the genomer command with the arguments "--version"
|
19
|
+
Then the exit status should be 0
|
20
|
+
And the output should match:
|
21
|
+
"""
|
22
|
+
Genomer version \d+.\d+.\d+
|
23
|
+
"""
|
24
|
+
|
25
|
+
@disable-bundler
|
26
|
+
Scenario: Running genomer with no commands inside a project
|
27
|
+
Given I run the genomer command with the arguments "init project"
|
28
|
+
And I cd to "project"
|
7
29
|
When I run the genomer command with no arguments
|
8
30
|
Then the exit status should be 0
|
9
31
|
And the output should contain:
|
@@ -13,7 +35,21 @@ Feature: Listing available commands
|
|
13
35
|
|
14
36
|
"""
|
15
37
|
|
16
|
-
|
38
|
+
@disable-bundler
|
39
|
+
Scenario: Running genomer with the --version flag inside a project
|
40
|
+
Given I run the genomer command with the arguments "init project"
|
41
|
+
And I cd to "project"
|
42
|
+
When I run the genomer command with the arguments "--version"
|
43
|
+
Then the exit status should be 0
|
44
|
+
And the output should match:
|
45
|
+
"""
|
46
|
+
Genomer version \d+.\d+.\d+
|
47
|
+
"""
|
48
|
+
|
49
|
+
@disable-bundler
|
50
|
+
Scenario: Running the genomer help command inside a genomer project
|
51
|
+
Given I run the genomer command with the arguments "init project"
|
52
|
+
And I cd to "project"
|
17
53
|
When I run the genomer command with the arguments "help"
|
18
54
|
Then the exit status should be 0
|
19
55
|
And the output should contain:
|
data/features/cli/init.feature
CHANGED
@@ -57,23 +57,7 @@ Feature: Creating a new genomer project
|
|
57
57
|
|
58
58
|
"""
|
59
59
|
|
60
|
-
|
61
|
-
Scenario: Using the files generated in a new project
|
62
|
-
Given I run the genomer command with the arguments "init project"
|
63
|
-
And I cd to "project"
|
64
|
-
And I overwrite "Gemfile" with:
|
65
|
-
"""
|
66
|
-
gem 'genomer', :path => '../../../'
|
67
|
-
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
68
|
-
"""
|
69
|
-
When I run the genomer command with the arguments "simple describe"
|
70
|
-
Then the exit status should be 0
|
71
|
-
And the output should contain:
|
72
|
-
"""
|
73
|
-
The scaffold contains 1 entries
|
74
|
-
"""
|
75
|
-
|
76
|
-
Scenario: Creating a new project where the directory already exists
|
60
|
+
Scenario: Creating a new project when the directory already exists
|
77
61
|
Given a directory named "project"
|
78
62
|
When I run the genomer command with the arguments "init project"
|
79
63
|
Then the exit status should be 1
|
@@ -81,3 +65,13 @@ Feature: Creating a new genomer project
|
|
81
65
|
"""
|
82
66
|
Error. Directory 'project' already exists.
|
83
67
|
"""
|
68
|
+
|
69
|
+
Scenario: Creating a new project when already inside a genomer project
|
70
|
+
Given I run the genomer command with the arguments "init project"
|
71
|
+
And I cd to "project"
|
72
|
+
When I run the genomer command with the arguments "init another_project"
|
73
|
+
Then the exit status should be 1
|
74
|
+
And the stderr should contain:
|
75
|
+
"""
|
76
|
+
Error. This directory contains a 'Gemfile' and already appears to be a genomer project.
|
77
|
+
"""
|
data/features/cli/man.feature
CHANGED
@@ -8,8 +8,7 @@ Feature: Showing man pages for available commands
|
|
8
8
|
Then the exit status should be 0
|
9
9
|
And the output should contain:
|
10
10
|
"""
|
11
|
-
genomer
|
12
|
-
run `genomer help` for a list of available commands
|
11
|
+
Use `genomer init NAME` to create a new genomer project called NAME
|
13
12
|
|
14
13
|
"""
|
15
14
|
|
@@ -74,4 +73,8 @@ Feature: Showing man pages for available commands
|
|
74
73
|
Scenario: Getting the man page for init
|
75
74
|
When I run the genomer command with the arguments "man init"
|
76
75
|
Then the exit status should be 0
|
77
|
-
And the output should contain
|
76
|
+
And the output should contain:
|
77
|
+
"""
|
78
|
+
Use `genomer init NAME` to create a new genomer project called NAME
|
79
|
+
|
80
|
+
"""
|
data/lib/genomer/runtime.rb
CHANGED
@@ -2,12 +2,37 @@ require 'unindent'
|
|
2
2
|
require 'tempfile'
|
3
3
|
require 'md2man'
|
4
4
|
|
5
|
+
require 'genomer/version'
|
6
|
+
|
5
7
|
class Genomer::Runtime
|
6
8
|
|
7
9
|
attr :command
|
8
10
|
attr :arguments
|
9
11
|
attr :flags
|
10
12
|
|
13
|
+
MESSAGES = {
|
14
|
+
:error => {
|
15
|
+
:init_again =>
|
16
|
+
"This directory contains a 'Gemfile' and already appears to be a genomer project."
|
17
|
+
},
|
18
|
+
:output => {
|
19
|
+
:version => "Genomer version #{Genomer::VERSION}",
|
20
|
+
:not_project =>
|
21
|
+
"Use `genomer init NAME` to create a new genomer project called NAME",
|
22
|
+
:simple_help =>
|
23
|
+
"genomer COMMAND [options]\nrun `genomer help` for a list of available commands",
|
24
|
+
:man =>
|
25
|
+
"genomer man COMMAND\nrun `genomer help` for a list of available commands"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
def message(type,msg)
|
31
|
+
content = MESSAGES[type][msg]
|
32
|
+
type == :error ? raise(Genomer::Error, content) : content
|
33
|
+
end
|
34
|
+
|
35
|
+
|
11
36
|
def initialize(settings)
|
12
37
|
@command = settings.rest.shift
|
13
38
|
@arguments = settings.rest
|
@@ -15,23 +40,24 @@ class Genomer::Runtime
|
|
15
40
|
end
|
16
41
|
|
17
42
|
def execute!
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
43
|
+
return message :output, :version if flags[:version]
|
44
|
+
|
45
|
+
if genomer_project?
|
46
|
+
case command
|
47
|
+
when nil then message :output, :simple_help
|
48
|
+
when "help" then help
|
49
|
+
when "init" then message :error, :init_again
|
50
|
+
when "man" then man
|
51
|
+
else run_plugin
|
52
|
+
end
|
53
|
+
else
|
54
|
+
case command
|
55
|
+
when "init" then init
|
56
|
+
else message :output, :not_project
|
57
|
+
end
|
24
58
|
end
|
25
59
|
end
|
26
60
|
|
27
|
-
def short_help
|
28
|
-
msg =<<-EOF
|
29
|
-
genomer COMMAND [options]
|
30
|
-
run `genomer help` for a list of available commands
|
31
|
-
EOF
|
32
|
-
msg.unindent
|
33
|
-
end
|
34
|
-
|
35
61
|
def help
|
36
62
|
msg =<<-EOF
|
37
63
|
genomer COMMAND [options]
|
@@ -42,11 +68,13 @@ class Genomer::Runtime
|
|
42
68
|
EOF
|
43
69
|
msg.unindent!
|
44
70
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
71
|
+
if File.exists?('Gemfile')
|
72
|
+
msg << Genomer::Plugin.plugins.inject(String.new) do |str,p|
|
73
|
+
str << ' '
|
74
|
+
str << p.name.gsub("genomer-plugin-","").ljust(12)
|
75
|
+
str << p.summary
|
76
|
+
str << "\n"
|
77
|
+
end
|
50
78
|
end
|
51
79
|
msg.strip
|
52
80
|
end
|
@@ -65,12 +93,7 @@ class Genomer::Runtime
|
|
65
93
|
|
66
94
|
Kernel.exec "man #{groffed_man_file(location).path}"
|
67
95
|
else
|
68
|
-
|
69
|
-
genomer man COMMAND
|
70
|
-
run `genomer help` for a list of available commands
|
71
|
-
EOF
|
72
|
-
msg.unindent!
|
73
|
-
msg.strip
|
96
|
+
message :output, :man
|
74
97
|
end
|
75
98
|
end
|
76
99
|
|
@@ -110,11 +133,14 @@ class Genomer::Runtime
|
|
110
133
|
end
|
111
134
|
|
112
135
|
"Genomer project '#{project_name}' created.\n"
|
113
|
-
|
114
136
|
end
|
115
137
|
|
116
138
|
def run_plugin
|
117
139
|
Genomer::Plugin[command].new(arguments,flags).run
|
118
140
|
end
|
119
141
|
|
142
|
+
def genomer_project?
|
143
|
+
File.exists?('Gemfile')
|
144
|
+
end
|
145
|
+
|
120
146
|
end
|
data/lib/genomer/version.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Genomer::Runtime do
|
4
|
-
include FakeFS::SpecHelpers
|
5
4
|
|
6
5
|
subject do
|
7
6
|
Genomer::Runtime.new MockSettings.new arguments, flags
|
@@ -10,141 +9,62 @@ describe Genomer::Runtime do
|
|
10
9
|
let(:flags){ {} }
|
11
10
|
let(:arguments){ [] }
|
12
11
|
|
13
|
-
describe "
|
12
|
+
describe "run" do
|
14
13
|
|
15
|
-
|
14
|
+
context "inside a genomer project" do
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
genomer COMMAND [options]
|
20
|
-
run `genomer help` for a list of available commands
|
21
|
-
EOF
|
22
|
-
subject.execute!.should == msg.unindent
|
16
|
+
before do
|
17
|
+
stub.instance_of(described_class).genomer_project?{ true }
|
23
18
|
end
|
24
19
|
|
25
|
-
|
20
|
+
describe "passed no arguments" do
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
it "should print an error message" do
|
32
|
-
error = <<-EOF
|
33
|
-
Unknown command or plugin 'unknown.'
|
22
|
+
it "should print the short help description" do
|
23
|
+
msg = <<-EOF
|
24
|
+
genomer COMMAND [options]
|
34
25
|
run `genomer help` for a list of available commands
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "init" do
|
42
|
-
|
43
|
-
let(:arguments){ %w|init project_name| }
|
26
|
+
EOF
|
27
|
+
subject.execute!.should == msg.unindent.strip
|
28
|
+
end
|
44
29
|
|
45
|
-
after do
|
46
|
-
FileUtils.rm_rf('project_name') if File.exists?('project_name')
|
47
30
|
end
|
48
31
|
|
49
|
-
describe "
|
32
|
+
describe "passed the --version flag" do
|
50
33
|
|
51
|
-
|
52
|
-
|
34
|
+
let(:flags) do
|
35
|
+
{:version => true}
|
53
36
|
end
|
54
37
|
|
55
|
-
it "should print
|
56
|
-
|
38
|
+
it "should print the version information" do
|
39
|
+
msg = "Genomer version #{Genomer::VERSION}"
|
40
|
+
subject.execute!.should == msg.unindent
|
57
41
|
end
|
58
42
|
|
59
|
-
|
60
|
-
File.exists?('project_name').should be_true
|
61
|
-
end
|
43
|
+
end
|
62
44
|
|
63
|
-
|
64
|
-
File.exists?(File.join('project_name','assembly')).should be_true
|
65
|
-
end
|
45
|
+
describe "passed an unknown command" do
|
66
46
|
|
67
|
-
|
68
|
-
file = File.join('project_name','assembly','scaffold.yml')
|
69
|
-
File.exists?(file).should be_true
|
70
|
-
File.read(file).should == <<-EOF.unindent
|
71
|
-
# Specify your genome scaffold in YAML format here. Reference nucleotide
|
72
|
-
# sequences in the 'sequences.fna' file using the first space delimited
|
73
|
-
# word of each fasta header.
|
74
|
-
#
|
75
|
-
# Go to http://next.gs/getting-started/ to start writing genome scaffold
|
76
|
-
# files.
|
77
|
-
#
|
78
|
-
# A simple one contig example is also provided below. Delete this as you
|
79
|
-
# start writing your own scaffold.
|
80
|
-
---
|
81
|
-
-
|
82
|
-
sequence:
|
83
|
-
source: "contig1"
|
84
|
-
EOF
|
85
|
-
end
|
47
|
+
let(:arguments){ %w|unknown| }
|
86
48
|
|
87
|
-
it "should
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
; Add your assembled contigs and scaffolds sequences to this file.
|
92
|
-
; These sequences can be referenced in the 'scaffold.yml' file
|
93
|
-
; using the first space delimited word in each fasta header.
|
94
|
-
> contig1
|
95
|
-
ATGC
|
96
|
-
EOF
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should create a 'annotations.gff' file" do
|
100
|
-
file = File.join('project_name','assembly','annotations.gff')
|
101
|
-
|
102
|
-
File.exists?(file).should be_true
|
103
|
-
File.read(file).should == <<-EOF.unindent
|
104
|
-
##gff-version 3
|
105
|
-
## Add your gff3 formatted annotations to this file
|
49
|
+
it "should print an error message" do
|
50
|
+
error = <<-EOF
|
51
|
+
Unknown command or plugin 'unknown.'
|
52
|
+
run `genomer help` for a list of available commands
|
106
53
|
EOF
|
54
|
+
lambda{ subject.execute! }.should raise_error(Genomer::Error,error.unindent)
|
107
55
|
end
|
108
56
|
|
109
|
-
it "should create a 'Gemfile' file" do
|
110
|
-
file = File.join('project_name','Gemfile')
|
111
|
-
version = Genomer::VERSION.split('.')[0..1] << '0'
|
112
|
-
|
113
|
-
|
114
|
-
File.exists?(file).should be_true
|
115
|
-
File.read(file).should == <<-EOF.unindent
|
116
|
-
source :rubygems
|
117
|
-
|
118
|
-
gem 'genomer', '~> #{version.join('.')}'
|
119
|
-
EOF
|
120
|
-
end
|
121
57
|
end
|
122
58
|
|
123
|
-
describe "
|
59
|
+
describe "passed help command with no available plugins" do
|
124
60
|
|
125
|
-
|
126
|
-
Dir.mkdir('project_name')
|
127
|
-
end
|
61
|
+
let(:arguments){ %w|help| }
|
128
62
|
|
129
|
-
|
130
|
-
|
131
|
-
|
63
|
+
before do
|
64
|
+
mock(Genomer::Plugin).plugins{ gems }
|
65
|
+
mock(File).exists?('Gemfile'){ true }
|
132
66
|
end
|
133
67
|
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
describe "help" do
|
139
|
-
|
140
|
-
before do
|
141
|
-
mock(Genomer::Plugin).plugins{ gems }
|
142
|
-
end
|
143
|
-
|
144
|
-
let(:arguments){ %w|help| }
|
145
|
-
|
146
|
-
describe "with no available plugins" do
|
147
|
-
|
148
68
|
let(:gems) do
|
149
69
|
[]
|
150
70
|
end
|
@@ -165,9 +85,16 @@ describe Genomer::Runtime do
|
|
165
85
|
it "should show the man command" do
|
166
86
|
subject.execute!.should include "man View man page for the specified plugin"
|
167
87
|
end
|
168
|
-
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "passed help command with one available plugin" do
|
91
|
+
|
92
|
+
let(:arguments){ %w|help| }
|
169
93
|
|
170
|
-
|
94
|
+
before do
|
95
|
+
mock(Genomer::Plugin).plugins{ gems }
|
96
|
+
mock(File).exists?('Gemfile'){ true }
|
97
|
+
end
|
171
98
|
|
172
99
|
let(:gems) do
|
173
100
|
[Gem::Specification.new do |s|
|
@@ -182,15 +109,7 @@ describe Genomer::Runtime do
|
|
182
109
|
|
183
110
|
end
|
184
111
|
|
185
|
-
|
186
|
-
|
187
|
-
describe "man" do
|
188
|
-
|
189
|
-
before do
|
190
|
-
stub(Genomer::Plugin).plugins{ gems }
|
191
|
-
end
|
192
|
-
|
193
|
-
describe "and no command specified" do
|
112
|
+
describe "passed the man command with no arguments" do
|
194
113
|
|
195
114
|
let(:arguments){ %w|man| }
|
196
115
|
|
@@ -202,9 +121,9 @@ describe Genomer::Runtime do
|
|
202
121
|
subject.execute!.should include msg.unindent.strip
|
203
122
|
end
|
204
123
|
|
205
|
-
|
124
|
+
end
|
206
125
|
|
207
|
-
describe "
|
126
|
+
describe "passed the man command with an argument" do
|
208
127
|
|
209
128
|
let(:arguments){ %w|man simple| }
|
210
129
|
let(:man_file){ 'a' }
|
@@ -223,7 +142,7 @@ describe Genomer::Runtime do
|
|
223
142
|
|
224
143
|
end
|
225
144
|
|
226
|
-
describe "
|
145
|
+
describe "passed the man command with the argument 'init'" do
|
227
146
|
|
228
147
|
let(:arguments){ %w|man init| }
|
229
148
|
let(:man_file){ File.expand_path File.dirname(__FILE__) + '/../../man/genomer-init.1.ronn' }
|
@@ -242,7 +161,7 @@ describe Genomer::Runtime do
|
|
242
161
|
|
243
162
|
end
|
244
163
|
|
245
|
-
describe "
|
164
|
+
describe "passed the man command for a plugin" do
|
246
165
|
|
247
166
|
let(:arguments){ %w|man simple subcommand| }
|
248
167
|
let(:man_file){ 'a' }
|
@@ -261,23 +180,145 @@ describe Genomer::Runtime do
|
|
261
180
|
|
262
181
|
end
|
263
182
|
|
264
|
-
|
183
|
+
describe "passed the man command with an unknown plugin argument" do
|
265
184
|
|
266
|
-
|
267
|
-
|
185
|
+
let(:arguments){ %w|man simple subcommand| }
|
186
|
+
let(:man_file){ 'a' }
|
187
|
+
|
188
|
+
before do
|
189
|
+
mock(subject).man_file(['simple','subcommand']){ man_file }
|
190
|
+
mock(File).exists?(man_file){false}
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should raise a genomer error" do
|
194
|
+
lambda{ subject.execute! }.
|
195
|
+
should raise_error(Genomer::Error,"No manual entry for command 'simple subcommand'")
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "passed the init command" do
|
201
|
+
|
202
|
+
after do
|
203
|
+
FileUtils.rm_rf('project_name') if File.exists?('project_name')
|
204
|
+
end
|
205
|
+
|
206
|
+
let(:arguments){ %w|init project_name| }
|
207
|
+
|
208
|
+
it "should raise a genomer error" do
|
209
|
+
lambda{ subject.execute! }.
|
210
|
+
should raise_error(Genomer::Error,"This directory contains a 'Gemfile' and already appears to be a genomer project.")
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
context "outside a genomer project" do
|
217
|
+
|
218
|
+
before do
|
219
|
+
stub.instance_of(described_class).genomer_project?{ false }
|
220
|
+
end
|
221
|
+
|
222
|
+
describe "passed no arguments" do
|
223
|
+
|
224
|
+
it "should print the short help description" do
|
225
|
+
msg = <<-EOF
|
226
|
+
Use `genomer init NAME` to create a new genomer project called NAME
|
227
|
+
EOF
|
228
|
+
subject.execute!.should == msg.unindent.strip
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
describe "passed the init command with a project name argument" do
|
234
|
+
|
235
|
+
let(:arguments){ %w|init project_name| }
|
236
|
+
|
237
|
+
after do
|
238
|
+
FileUtils.rm_rf('project_name') if File.exists?('project_name')
|
239
|
+
end
|
268
240
|
|
269
241
|
before do
|
270
|
-
|
271
|
-
mock(File).exists?(man_file){false}
|
242
|
+
@msg = subject.execute!
|
272
243
|
end
|
273
244
|
|
274
|
-
it "should
|
275
|
-
|
276
|
-
should raise_error(Genomer::Error,"No manual entry for command 'simple subcommand'")
|
245
|
+
it "should print message that project has been created" do
|
246
|
+
@msg.should == "Genomer project 'project_name' created.\n"
|
277
247
|
end
|
278
248
|
|
249
|
+
it "should create the expected directories" do
|
250
|
+
File.exists?('project_name').should be_true
|
251
|
+
File.exists?(File.join('project_name','assembly')).should be_true
|
252
|
+
end
|
253
|
+
|
254
|
+
it "should create a 'scaffold.yml' file" do
|
255
|
+
file = File.join('project_name','assembly','scaffold.yml')
|
256
|
+
File.exists?(file).should be_true
|
257
|
+
File.read(file).should == <<-EOF.unindent
|
258
|
+
# Specify your genome scaffold in YAML format here. Reference nucleotide
|
259
|
+
# sequences in the 'sequences.fna' file using the first space delimited
|
260
|
+
# word of each fasta header.
|
261
|
+
#
|
262
|
+
# Go to http://next.gs/getting-started/ to start writing genome scaffold
|
263
|
+
# files.
|
264
|
+
#
|
265
|
+
# A simple one contig example is also provided below. Delete this as you
|
266
|
+
# start writing your own scaffold.
|
267
|
+
---
|
268
|
+
-
|
269
|
+
sequence:
|
270
|
+
source: "contig1"
|
271
|
+
EOF
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should create a 'sequence.fna' file" do
|
275
|
+
file = File.join('project_name','assembly','sequence.fna')
|
276
|
+
File.exists?(file).should be_true
|
277
|
+
File.read(file).should == <<-EOF.unindent
|
278
|
+
; Add your assembled contigs and scaffolds sequences to this file.
|
279
|
+
; These sequences can be referenced in the 'scaffold.yml' file
|
280
|
+
; using the first space delimited word in each fasta header.
|
281
|
+
> contig1
|
282
|
+
ATGC
|
283
|
+
EOF
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should create a 'annotations.gff' file" do
|
287
|
+
file = File.join('project_name','assembly','annotations.gff')
|
288
|
+
|
289
|
+
File.exists?(file).should be_true
|
290
|
+
File.read(file).should == <<-EOF.unindent
|
291
|
+
##gff-version 3
|
292
|
+
## Add your gff3 formatted annotations to this file
|
293
|
+
EOF
|
294
|
+
end
|
295
|
+
|
296
|
+
it "should create a 'Gemfile' file" do
|
297
|
+
file = File.join('project_name','Gemfile')
|
298
|
+
version = Genomer::VERSION.split('.')[0..1] << '0'
|
299
|
+
|
300
|
+
|
301
|
+
File.exists?(file).should be_true
|
302
|
+
File.read(file).should == <<-EOF.unindent
|
303
|
+
source :rubygems
|
304
|
+
|
305
|
+
gem 'genomer', '~> #{version.join('.')}'
|
306
|
+
EOF
|
307
|
+
end
|
279
308
|
end
|
280
309
|
|
310
|
+
describe "passed the --version flag" do
|
311
|
+
|
312
|
+
let(:flags) do
|
313
|
+
{:version => true}
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should print the version information" do
|
317
|
+
msg = "Genomer version #{Genomer::VERSION}"
|
318
|
+
subject.execute!.should == msg.unindent
|
319
|
+
end
|
320
|
+
|
321
|
+
end
|
281
322
|
end
|
282
323
|
|
283
324
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,7 @@ require 'fakefs/spec_helpers'
|
|
5
5
|
require 'scaffolder/test/helpers'
|
6
6
|
|
7
7
|
require 'genomer'
|
8
|
+
require 'genomer/version'
|
8
9
|
|
9
10
|
# Requires supporting files with custom matchers and macros, etc,
|
10
11
|
# in ./support/ and its subdirectories.
|
@@ -22,17 +23,13 @@ RSpec.configure do |config|
|
|
22
23
|
|
23
24
|
attr :rest
|
24
25
|
|
25
|
-
def initialize(rest = [],
|
26
|
+
def initialize(rest = [], args = {})
|
26
27
|
@rest = rest
|
27
|
-
@args =
|
28
|
+
@args = args
|
28
29
|
end
|
29
30
|
|
30
|
-
def
|
31
|
-
@args
|
32
|
-
end
|
33
|
-
|
34
|
-
def flags
|
35
|
-
@args
|
31
|
+
def method_missing(method, *args, &block)
|
32
|
+
@args.send(method, *args, &block)
|
36
33
|
end
|
37
34
|
|
38
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genomer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- .document
|
231
231
|
- .gitignore
|
232
232
|
- .travis.yml
|
233
|
+
- CHANGELOG.mkd
|
233
234
|
- Gemfile
|
234
235
|
- LICENSE.txt
|
235
236
|
- README.mkd
|
@@ -274,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
274
275
|
version: '0'
|
275
276
|
segments:
|
276
277
|
- 0
|
277
|
-
hash: -
|
278
|
+
hash: -2610476547918174305
|
278
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
280
|
none: false
|
280
281
|
requirements:
|