fresnel 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/fresnel.gemspec +2 -2
- data/lib/fresnel.rb +36 -32
- metadata +2 -2
data/fresnel.gemspec
CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.name = 'fresnel'
|
4
4
|
s.summary = "Fresnel is a console manager to LighthouseApp.com using the official lighthouse api."
|
5
5
|
s.description = s.summary
|
6
|
-
s.version = '0.6.
|
7
|
-
s.date = '2010-01-
|
6
|
+
s.version = '0.6.6'
|
7
|
+
s.date = '2010-01-11'
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Gerard de Brieder", "Wes Oldenbeuving"]
|
10
10
|
s.email = "smeevil@gmail.com"
|
data/lib/fresnel.rb
CHANGED
@@ -53,8 +53,8 @@ class Fresnel
|
|
53
53
|
@@tags=config['tags']
|
54
54
|
@@default_account=config['default_account']
|
55
55
|
@@accounts=config['accounts']
|
56
|
-
|
57
|
-
|
56
|
+
|
57
|
+
|
58
58
|
unless config && config.class==Hash && config.has_key?('default_account') && config.has_key?('user_id') && config.has_key?('tags')
|
59
59
|
puts Frame.new(:header=>"Warning !",:body=>"global config did not validate , recreating")
|
60
60
|
SetupWizard.global(self)
|
@@ -146,26 +146,30 @@ class Fresnel
|
|
146
146
|
options[:selectable]||false
|
147
147
|
projects_data=Hash.new
|
148
148
|
project_ids=Array.new
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
149
|
+
|
150
|
+
print "Fetching projects from multiple accounts : " unless options[:object]
|
151
|
+
warnings = []
|
152
|
+
@@accounts.each do |key,value|
|
153
|
+
print "#{key} "
|
154
|
+
STDOUT.flush
|
155
|
+
Lighthouse.account=value['account']
|
156
|
+
Lighthouse.token=value['token']
|
157
|
+
projects=Lighthouse::Project.find(:all).map {| project|
|
158
|
+
begin
|
159
|
+
project.nr_of_open_tickets_assigned_to_me = Lighthouse::Ticket.find(:all, :params=>{:project_id=>project.id, :q=>'responsible:me state:open'}).size
|
160
|
+
rescue ActiveResource::UnauthorizedAccess => e
|
161
|
+
warnings << [project.name, key]
|
162
|
+
next nil
|
163
|
+
end
|
164
|
+
project
|
165
|
+
}.compact
|
166
166
|
projects_data[Lighthouse.account]=projects
|
167
|
-
puts " [done]"
|
168
167
|
end
|
168
|
+
puts " [done]"
|
169
|
+
warnings.each do |project_name, account_name|
|
170
|
+
puts "Warning:: Token does not give access to project #{project_name} on account #{account_name}."
|
171
|
+
end
|
172
|
+
|
169
173
|
#puts " [done] - data is #{projects_data.age}s old , max is #{@@cache_timeout}s" #no cache for now
|
170
174
|
project_table = table do |t|
|
171
175
|
t.headings=[]
|
@@ -183,7 +187,7 @@ class Fresnel
|
|
183
187
|
t << row
|
184
188
|
i+=1
|
185
189
|
end
|
186
|
-
end
|
190
|
+
end
|
187
191
|
end
|
188
192
|
if options[:object]
|
189
193
|
projects_data[:project_ids]=project_ids
|
@@ -195,14 +199,14 @@ class Fresnel
|
|
195
199
|
puts "action is #{action.inspect}"
|
196
200
|
case action
|
197
201
|
when "c" then create_project
|
198
|
-
when /\d+/ then
|
202
|
+
when /\d+/ then
|
199
203
|
project_ids[action.to_i]=~/(\d+);(\w+)/
|
200
204
|
project_id=$1
|
201
205
|
account=$2
|
202
|
-
|
206
|
+
|
203
207
|
Lighthouse.account=@@accounts[account]["account"]
|
204
208
|
Lighthouse.token=@@accounts[account]["token"]
|
205
|
-
|
209
|
+
|
206
210
|
tickets(:project_id=>project_id)
|
207
211
|
else
|
208
212
|
exit(0)
|
@@ -214,7 +218,7 @@ class Fresnel
|
|
214
218
|
def tickets(options=Hash.new)
|
215
219
|
system("clear")
|
216
220
|
get_tickets_in_bin(self.bin) unless self.bin.blank? || options[:tickets].present?
|
217
|
-
|
221
|
+
|
218
222
|
options[:all] ? print("Fetching all tickets#{" in bin #{options[:bin_name]}" if options[:bin_name].present?}...") : print("Fetching unresolved tickets#{" in bin #{options[:bin_name]}" if options[:bin_name].present?}...")
|
219
223
|
STDOUT.flush
|
220
224
|
@current_project_id=options[:project_id]||self.current_project_id
|
@@ -303,7 +307,7 @@ class Fresnel
|
|
303
307
|
else
|
304
308
|
puts "Fetching tickets in bin : #{bins[bin_id.to_i].name}"
|
305
309
|
self.bin=bin_id.to_i
|
306
|
-
|
310
|
+
|
307
311
|
data=bins[bin_id.to_i].tickets
|
308
312
|
|
309
313
|
def data.age=(seconds)
|
@@ -454,7 +458,7 @@ class Fresnel
|
|
454
458
|
end
|
455
459
|
show_ticket(number)
|
456
460
|
end
|
457
|
-
|
461
|
+
|
458
462
|
def comment(number,state=nil)
|
459
463
|
puts "create comment for #{number}"
|
460
464
|
ticket=get_ticket(number)
|
@@ -508,8 +512,8 @@ class Fresnel
|
|
508
512
|
ticket.save
|
509
513
|
tickets
|
510
514
|
end
|
511
|
-
|
512
|
-
|
515
|
+
|
516
|
+
|
513
517
|
def create
|
514
518
|
system("mate -w /tmp/fresnel_new_ticket")
|
515
519
|
if File.exists?("/tmp/fresnel_new_ticket")
|
@@ -628,17 +632,17 @@ class Fresnel
|
|
628
632
|
end
|
629
633
|
show_ticket(options[:ticket])
|
630
634
|
end
|
631
|
-
|
635
|
+
|
632
636
|
def create_extra_account
|
633
637
|
config=YAML::load_file(self.global_config_file)
|
634
|
-
|
638
|
+
|
635
639
|
puts "should add an extra account !"
|
636
640
|
config['account']=ask("My extra lighthouse account is : ") do |q|
|
637
641
|
q.validate = /^\w+$/
|
638
642
|
q.responses[:not_valid]="\nError :\nThat seems to be incorrect, we would like to have the <account> part in\nhttp://<account>.lighthouseapp.com , please try again"
|
639
643
|
q.responses[:ask_on_error]="My extra account is : "
|
640
644
|
end
|
641
|
-
|
645
|
+
|
642
646
|
config['accounts'][config['account']]={'account'=>config['account']}
|
643
647
|
puts
|
644
648
|
puts "what token would you like to use for the account : #{config['account']} ?"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fresnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerard de Brieder
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-01-
|
13
|
+
date: 2010-01-11 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|