push
travis-ci
1 of 1 new or added line in 1 file covered. (100.0%)
555 of 676 relevant lines covered (82.1%)
14.74 hits per line
1 |
module GitWrapper |
1✔ |
2 |
module Commands |
1✔ |
3 |
class Tag < Git |
1✔ |
4 |
|
|
5 |
def create(name) |
1✔ |
6 |
@mode = :create |
3✔ |
7 |
@name = name
|
3✔ |
8 |
self
|
3✔ |
9 |
end
|
|
10 |
|
|
11 |
def from(commit) |
1✔ |
12 |
@commit = commit
|
1✔ |
13 |
self
|
1✔ |
14 |
end
|
|
15 |
|
|
16 |
def remove(name) |
1✔ |
17 |
@mode = :remove |
× |
18 |
@name = name
|
× |
19 |
self
|
× |
20 |
end
|
|
21 |
|
|
22 |
def list |
1✔ |
23 |
@mode = :list |
1✔ |
24 |
self
|
1✔ |
25 |
end
|
|
26 |
|
|
27 |
def command |
1✔ |
28 |
command = 'tag '
|
8✔ |
29 |
|
|
30 |
if @mode == :create |
8✔ |
31 |
command += "#{@name} #{@commit.nil? ? '' : @commit}"
|
6✔ |
32 |
elsif @mode == :remove |
|
33 |
command += "-d #{@name}"
|
× |
34 |
elsif @mode == :list |
|
35 |
#Nothing to add
|
|
36 |
else
|
|
37 |
raise 'Unespecified tag mode'
|
× |
38 |
end
|
|
39 |
|
|
40 |
command |
8✔ |
41 |
end
|
|
42 |
|
|
43 |
def result |
1✔ |
44 |
return result_list if @mode == :list |
4✔ |
45 |
super
|
3✔ |
46 |
end
|
|
47 |
|
|
48 |
def result_list |
1✔ |
49 |
output.split("\n")
|
1✔ |
50 |
end
|
|
51 |
|
|
52 |
end
|
|
53 |
end
|
|
54 |
end
|