gil 0.1.1 → 0.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/Rakefile +1 -1
- data/lib/gil.rb +26 -1
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/gil.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
1
3
|
class Git
|
2
4
|
class << self
|
3
5
|
def get_config_value(value_name)
|
@@ -16,6 +18,12 @@ class LighthouseProject
|
|
16
18
|
validate_state
|
17
19
|
Lighthouse.account = account
|
18
20
|
Lighthouse.token = token
|
21
|
+
|
22
|
+
if File.exist?(cache_file_name)
|
23
|
+
@ticket_cache = YAML.load_file(cache_file_name)
|
24
|
+
else
|
25
|
+
@ticket_cache = {}
|
26
|
+
end
|
19
27
|
end
|
20
28
|
|
21
29
|
def project
|
@@ -32,11 +40,28 @@ class LighthouseProject
|
|
32
40
|
|
33
41
|
def get_tickets(ticketnumbers)
|
34
42
|
ticketnumbers.map do |ticket_num|
|
35
|
-
ticket =
|
43
|
+
ticket = @ticket_cache[ticket_num]
|
44
|
+
if (!ticket)
|
45
|
+
ticket = Ticket.find(ticket_num, :params => {:project_id => project})
|
46
|
+
@ticket_cache[ticket_num] = ticket
|
47
|
+
save_cache
|
48
|
+
end
|
49
|
+
ticket
|
36
50
|
end
|
37
51
|
end
|
38
52
|
|
39
53
|
private
|
54
|
+
def save_cache
|
55
|
+
system("mkdir -p #{File.dirname(cache_file_name)}")
|
56
|
+
File.open(cache_file_name, "w") do |cache_file|
|
57
|
+
YAML.dump(@ticket_cache, cache_file)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def cache_file_name
|
62
|
+
File.expand_path("~/.gil/#{account}.#{project}.cache.yml")
|
63
|
+
end
|
64
|
+
|
40
65
|
def validate_state
|
41
66
|
if project == ''
|
42
67
|
raise "No project was found in .git config."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Jefford
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-20 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|