artifacts 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/artifacts/executable.rb +34 -15
- data/lib/artifacts/version.rb +1 -1
- metadata +4 -4
data/lib/artifacts/executable.rb
CHANGED
@@ -31,8 +31,33 @@ class Artifacts
|
|
31
31
|
raise
|
32
32
|
end
|
33
33
|
|
34
|
+
@closed = false
|
35
|
+
@open = true
|
36
|
+
|
37
|
+
unless args.select{|n|n=~/^(?:-c|--closed)$/}.empty?
|
38
|
+
@closed = true
|
39
|
+
@open = false
|
40
|
+
args.delete( '-c' )
|
41
|
+
args.delete( '--closed' )
|
42
|
+
end
|
43
|
+
|
44
|
+
unless args.select{|n|n=~/^(?:-a|--all)$/}.empty?
|
45
|
+
@closed = true
|
46
|
+
@open = true
|
47
|
+
args.delete( '-a' )
|
48
|
+
args.delete( '--all' )
|
49
|
+
end
|
50
|
+
|
51
|
+
unless args.select{|n|n=~/^(?:-v|--verbose)$/}.empty?
|
52
|
+
@verbose = true
|
53
|
+
args.delete( '-v' )
|
54
|
+
args.delete( '--verbose' )
|
55
|
+
end
|
56
|
+
|
34
57
|
@artifacts = []
|
58
|
+
any_artifacts_given = false
|
35
59
|
while match = args.first && args.first.match( /^(?:(\d+)|#(#{Tag::VALID_NAME}))$/ )
|
60
|
+
any_artifacts_given = true
|
36
61
|
if match[1]
|
37
62
|
@artifacts << Artifact[ args.shift.to_i ]
|
38
63
|
elsif match[2]
|
@@ -44,6 +69,13 @@ class Artifacts
|
|
44
69
|
@artifacts.flatten!
|
45
70
|
@artifacts.uniq!
|
46
71
|
|
72
|
+
@artifacts = Artifact.all unless any_artifacts_given
|
73
|
+
|
74
|
+
@artifacts = @artifacts.select do |artifact|
|
75
|
+
( @open && !artifact.closed ) ||
|
76
|
+
( @closed && artifact.closed )
|
77
|
+
end
|
78
|
+
|
47
79
|
command = args.shift
|
48
80
|
command ||= :help
|
49
81
|
|
@@ -74,24 +106,11 @@ class Artifacts
|
|
74
106
|
end
|
75
107
|
|
76
108
|
def list
|
77
|
-
|
78
|
-
puts artifact
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def show( *args )
|
83
|
-
( @artifacts.empty? ? self.class.default_list_filter(Artifact.all) : @artifacts ).each do |artifact|
|
84
|
-
puts artifact.inspect
|
109
|
+
@artifacts.each do |artifact|
|
110
|
+
puts artifact.send( @verbose ? :inspect : :to_s )
|
85
111
|
end
|
86
112
|
end
|
87
113
|
|
88
|
-
def closed
|
89
|
-
@artifacts = @artifacts.select{|n|n.closed}
|
90
|
-
@artifacts = Artifact.select{|a|a.closed} if @artifacts.empty?
|
91
|
-
@artifacts = @artifacts.sort{|a,b|a.closed<=>b.closed}
|
92
|
-
list
|
93
|
-
end
|
94
|
-
|
95
114
|
def create( *args )
|
96
115
|
artifact = Artifact.create( Artifacts.username, args.join(' ') )
|
97
116
|
puts "Created artifact #{artifact.id}."
|
data/lib/artifacts/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
8
|
+
- 3
|
9
|
+
version: 2.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Clive Crous
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
117
|
+
hash: 716821293
|
118
118
|
segments:
|
119
119
|
- 0
|
120
120
|
version: "0"
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
hash:
|
126
|
+
hash: 716821293
|
127
127
|
segments:
|
128
128
|
- 0
|
129
129
|
version: "0"
|