fresnel 0.5.4 → 0.5.5
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/README.markdown +48 -27
- data/fresnel.gemspec +3 -3
- data/lib/fresnel.rb +20 -35
- data/lib/fresnel/input_detector.rb +50 -0
- data/lib/fresnel/string.rb +14 -0
- metadata +4 -2
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Fresnel
|
1
|
+
Fresnel
|
2
2
|
--------------
|
3
3
|
|
4
4
|
A console manager to LighthouseApp.com using the official lighthouse api
|
@@ -20,7 +20,13 @@ Current features :
|
|
20
20
|
How to install
|
21
21
|
==============
|
22
22
|
|
23
|
-
|
23
|
+
Fresnel is available from gemcutter.org, so a 'gem install fresnel' should just work.
|
24
|
+
|
25
|
+
When you want to help develop Fresnel, look at the following rake tasks:
|
26
|
+
|
27
|
+
* rake gem
|
28
|
+
* rake install
|
29
|
+
* rake reinstall
|
24
30
|
|
25
31
|
Cache
|
26
32
|
=====
|
@@ -69,36 +75,36 @@ Problems, Comments and Suggestions
|
|
69
75
|
Please post them on https://govannon.lighthouseapp.com/projects/42260-fresnel/
|
70
76
|
or mail it to : ticket+govannon.42260-7vwej7yr@lighthouseapp.com
|
71
77
|
|
72
|
-
|
73
|
-
|
74
78
|
Examples
|
75
79
|
========
|
76
80
|
|
77
81
|
fresnel help
|
78
82
|
|
79
|
-
|
80
|
-
| Fresnel - A lighthouseapp console manager - help
|
81
|
-
|
82
|
-
|
|
83
|
-
| Fresnel is a Console App that helps manage Lighthouse (LH).
|
84
|
-
| You can find LH at http://lighthouseapp.com
|
85
|
-
|
|
86
|
-
| fresnel help This screen
|
87
|
-
| fresnel bins Show all ticket bins
|
88
|
-
| fresnel bin <id> Show ticket in bin <id>
|
89
|
-
| fresnel projects Show all projects
|
90
|
-
| fresnel <id> comment Show comments for ticket
|
91
|
-
| fresnel <id> Show ticket details
|
92
|
-
| fresnel <id> assign Assign ticket to user
|
93
|
-
| fresnel <id> claim Assign ticket to self
|
94
|
-
| fresnel <id>
|
95
|
-
|
|
96
|
-
| fresnel
|
97
|
-
| fresnel
|
98
|
-
|
|
99
|
-
|
100
|
-
|
|
101
|
-
|
83
|
+
+---------------------------------------------------------------------------------------------------+
|
84
|
+
| Fresnel - A lighthouseapp console manager - help |
|
85
|
+
+---------------------------------------------------------------------------------------------------+
|
86
|
+
| |
|
87
|
+
| Fresnel is a Console App that helps manage Lighthouse (LH). |
|
88
|
+
| You can find LH at http://lighthouseapp.com |
|
89
|
+
| |
|
90
|
+
| fresnel help This screen |
|
91
|
+
| fresnel bins Show all ticket bins |
|
92
|
+
| fresnel bin <id> Show ticket in bin <id> |
|
93
|
+
| fresnel projects Show all projects |
|
94
|
+
| fresnel <id> comment Show comments for ticket |
|
95
|
+
| fresnel <id> Show ticket details |
|
96
|
+
| fresnel <id> assign Assign ticket to user |
|
97
|
+
| fresnel <id> claim Assign ticket to self |
|
98
|
+
| fresnel <id> links Extract all links from the ticket and its |
|
99
|
+
| comment and open one in your browser. |
|
100
|
+
| fresnel <id> online Open browser for ticket |
|
101
|
+
| fresnel <id> [open|closed|hold|resolved|invalid] Change ticket state |
|
102
|
+
| fresnel tickets Show all tickets |
|
103
|
+
| fresnel create Create a ticket |
|
104
|
+
| |
|
105
|
+
+---------------------------------------------------------------------------------------------------+
|
106
|
+
| Created by Narnach & Smeevil - licence : mit |
|
107
|
+
+---------------------------------------------------------------------------------------------------+
|
102
108
|
|
103
109
|
fresnel projects
|
104
110
|
|
@@ -149,3 +155,18 @@ fresnel 6
|
|
149
155
|
Assignment changed 02-12-09 22:10 => Smeevil by Smeevil
|
150
156
|
|
151
157
|
Current state : open
|
158
|
+
|
159
|
+
fresnel 10 links
|
160
|
+
|
161
|
+
+---+------------------------------------------------------------------------------------------------------+
|
162
|
+
| # | link |
|
163
|
+
+---+------------------------------------------------------------------------------------------------------+
|
164
|
+
| 0 | http://upnextinsports.com/wp-content/uploads/2009/11/sports-pictures-baseball-tractor-beam.jpg |
|
165
|
+
| 1 | http://upnextinsports.com/wp-content/uploads/2009/10/sports-pictures-HHH-orton-miracle-superglue.jpg |
|
166
|
+
| 2 | http://www2.printshop.co.uk/Weebl/Shop/Plushies/Magical_Trevor_Plushie/Product.html |
|
167
|
+
| 3 | http://bit.ly/4wZKb |
|
168
|
+
| 4 | http://media.photobucket.com/image/fail/penguinking3/fail.jpg |
|
169
|
+
| 5 | http://www.realfreewebsites.com/blog/img/fail.jpg |
|
170
|
+
| 6 | www.illwillpress.com |
|
171
|
+
| 7 | www.govannon.nl/portfolio |
|
172
|
+
+---+------------------------------------------------------------------------------------------------------+
|
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.5.
|
7
|
-
s.date = '2009-12-
|
6
|
+
s.version = '0.5.5'
|
7
|
+
s.date = '2009-12-07'
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Gerard de Brieder", "Wes Oldenbeuving"]
|
10
10
|
s.email = "smeevil@gmail.com"
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
# Files
|
14
14
|
root_files = %w[README.markdown Rakefile fresnel.gemspec]
|
15
15
|
bin_files = %w[fresnel]
|
16
|
-
fresnel_files = %w[cache cli date_parser frame lighthouse setup_wizard]
|
16
|
+
fresnel_files = %w[cache cli date_parser frame lighthouse setup_wizard string input_detector]
|
17
17
|
lib_files = %w[fresnel] + fresnel_files.map {|f| "fresnel/#{f}"}
|
18
18
|
s.bindir = "bin"
|
19
19
|
s.require_path = "lib"
|
data/lib/fresnel.rb
CHANGED
@@ -7,20 +7,11 @@ require "fresnel/date_parser"
|
|
7
7
|
require "fresnel/cache"
|
8
8
|
require "fresnel/setup_wizard"
|
9
9
|
require "fresnel/frame"
|
10
|
+
require "fresnel/string"
|
11
|
+
require "fresnel/input_detector"
|
10
12
|
|
11
13
|
HighLine.track_eof = false
|
12
14
|
|
13
|
-
class String
|
14
|
-
def wrap(col = 80)
|
15
|
-
self.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/,
|
16
|
-
"\\1\\3\n")
|
17
|
-
end
|
18
|
-
|
19
|
-
def truncate(size)
|
20
|
-
"#{self.strip[0..size]}#{"..." if self.size>size}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
15
|
class Fresnel
|
25
16
|
attr_reader :global_config_file, :project_config_file, :app_description
|
26
17
|
attr_accessor :lighthouse, :current_project_id, :cache, :cache_timeout, :current_user_id
|
@@ -82,19 +73,6 @@ class Fresnel
|
|
82
73
|
lighthouse.token
|
83
74
|
end
|
84
75
|
|
85
|
-
def ask_for_action(actions_available="")
|
86
|
-
if actions_available.present?
|
87
|
-
puts actions_available.wrap
|
88
|
-
regexp="^(#{actions_available.scan(/\[(.*?)\]/).flatten.join("|")}|[0-9]+)$"
|
89
|
-
else
|
90
|
-
regexp="^(q|[0-9]+)$"
|
91
|
-
end
|
92
|
-
ask("Action : ") do |q|
|
93
|
-
q.default="q"
|
94
|
-
q.validate=/#{regexp}/
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
76
|
def create_project
|
99
77
|
puts "create project is not implemented yet"
|
100
78
|
end
|
@@ -123,11 +101,13 @@ class Fresnel
|
|
123
101
|
else
|
124
102
|
puts(project_table)
|
125
103
|
unless options[:setup]
|
126
|
-
action=
|
104
|
+
action=InputDetector.new("[q]uit, [c]reate or project #",(0..(projects_data.size-1)).to_a).answer
|
105
|
+
puts "action is #{action.inspect}"
|
127
106
|
case action
|
128
107
|
when "c" then create_project
|
129
108
|
when /\d+/ then tickets(:project_id=>projects_data[action.to_i].id)
|
130
109
|
else
|
110
|
+
puts "dont know what to do with #{action.inspect} class #{action.class}"
|
131
111
|
exit(0)
|
132
112
|
end
|
133
113
|
end
|
@@ -172,7 +152,7 @@ class Fresnel
|
|
172
152
|
end
|
173
153
|
end
|
174
154
|
puts tickets_table
|
175
|
-
action=
|
155
|
+
action=InputDetector.new("[q]uit, [b]ins, [p]rojects, #{options[:all] ? "[u]nresolved" : "[a]ll"}, [c]reate or ticket #",tickets.map(&:number)).answer
|
176
156
|
case action
|
177
157
|
when "b" then get_bins
|
178
158
|
when "c" then create
|
@@ -185,7 +165,7 @@ class Fresnel
|
|
185
165
|
end
|
186
166
|
else
|
187
167
|
puts Frame.new(:header=>"Notice",:body=>"no #{"unresolved " unless options[:all]}tickets #{"in bin #{options[:bin_name]}"}...")
|
188
|
-
action=
|
168
|
+
action=InputDetector.new("[q]uit, [b]ins, [p]rojects, [u]nresolved, [a]ll, [c]reate").answer
|
189
169
|
case action
|
190
170
|
when "b" then get_bins
|
191
171
|
when "c" then create
|
@@ -214,12 +194,21 @@ class Fresnel
|
|
214
194
|
end
|
215
195
|
end
|
216
196
|
puts bins_table
|
217
|
-
bin_id=
|
197
|
+
bin_id=InputDetector.new("[q]uit or Bin #: ",(0..(bins.size-1)).to_a).answer
|
218
198
|
if bin_id=="q"
|
219
199
|
exit(0)
|
220
200
|
else
|
221
201
|
puts "Fetching tickets in bin : #{bins[bin_id.to_i].name}"
|
222
|
-
|
202
|
+
data=bins[bin_id.to_i].tickets
|
203
|
+
|
204
|
+
def data.age=(seconds)
|
205
|
+
@age_in_seconds=seconds
|
206
|
+
end
|
207
|
+
def data.age
|
208
|
+
@age_in_seconds
|
209
|
+
end
|
210
|
+
data.age=0
|
211
|
+
tickets(:tickets=>data)
|
223
212
|
def tickets.age=(seconds)
|
224
213
|
@age_in_seconds=seconds
|
225
214
|
end
|
@@ -289,7 +278,7 @@ class Fresnel
|
|
289
278
|
end
|
290
279
|
end
|
291
280
|
puts "Current state : #{ticket.versions.last.state}"
|
292
|
-
action=
|
281
|
+
action=InputDetector.new("[q]uit, [t]ickets, [b]ins, [c]omment, [a]ssign, [r]esolve, [s]elf, [o]pen, [h]old, [w]eb, [l]inks").answer
|
293
282
|
case action
|
294
283
|
when "t" then tickets
|
295
284
|
when "b" then get_bins
|
@@ -308,11 +297,7 @@ class Fresnel
|
|
308
297
|
|
309
298
|
def links(number)
|
310
299
|
ticket = get_ticket(number)
|
311
|
-
links = ticket.versions.map{ |version|
|
312
|
-
version.body.to_s.scan(/(http|https)(:\/\/)([a-zA-Z0-9.\/_-]+)| (www\.[a-zA-Z0-9.\/_-]+)/).map{ |url|
|
313
|
-
url.join
|
314
|
-
}
|
315
|
-
}.flatten.uniq
|
300
|
+
links = ticket.versions.map{ |version| version.body.to_s.scrape_urls }.flatten.uniq
|
316
301
|
if links.size == 0
|
317
302
|
puts "No links found"
|
318
303
|
sleep 1
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class InputDetector
|
2
|
+
attr_accessor :question, :possible_answers, :collection, :answer
|
3
|
+
|
4
|
+
def initialize(question,*answers)
|
5
|
+
@question=question
|
6
|
+
@possible_answers=Array.new
|
7
|
+
@possible_answers+=question.scan(/\[(.*?)\]/).flatten
|
8
|
+
@possible_answers+=answers.flatten
|
9
|
+
@collection=""
|
10
|
+
@answer=""
|
11
|
+
print question
|
12
|
+
detect_answer
|
13
|
+
end
|
14
|
+
|
15
|
+
def detect_answer
|
16
|
+
loop do
|
17
|
+
begin
|
18
|
+
system("stty raw -echo")
|
19
|
+
str = STDIN.getc
|
20
|
+
ensure
|
21
|
+
system("stty -raw echo")
|
22
|
+
end
|
23
|
+
print str.chr
|
24
|
+
if str == 13
|
25
|
+
possible_options = possible_answers.select{|option| option == collection}
|
26
|
+
else
|
27
|
+
self.collection+=str.chr
|
28
|
+
possible_options = possible_answers.select{|option| option.to_s =~ /^#{collection}/}
|
29
|
+
end
|
30
|
+
if possible_options.size == 0
|
31
|
+
if str==3
|
32
|
+
puts
|
33
|
+
puts "exiting due to ^c"
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
puts
|
37
|
+
puts "Invalid choice: #{collection}, choises are #{possible_answers.inspect}"
|
38
|
+
print question
|
39
|
+
self.collection=""
|
40
|
+
elsif possible_options.size == 1
|
41
|
+
collection = possible_options.first
|
42
|
+
self.answer=collection.to_s
|
43
|
+
puts
|
44
|
+
break
|
45
|
+
else
|
46
|
+
next
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class String
|
2
|
+
def wrap(col = 80)
|
3
|
+
self.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/,
|
4
|
+
"\\1\\3\n")
|
5
|
+
end
|
6
|
+
|
7
|
+
def truncate(size)
|
8
|
+
"#{self.strip[0..size]}#{"..." if self.size>size}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def scrape_urls
|
12
|
+
scan(/(http|https)(:\/\/)([a-zA-Z0-9.\/_-]+)| (www\.[a-zA-Z0-9.\/_-]+)/).map{ |url| url.join}
|
13
|
+
end
|
14
|
+
end
|
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.5.
|
4
|
+
version: 0.5.5
|
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: 2009-12-
|
13
|
+
date: 2009-12-07 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,8 @@ files:
|
|
63
63
|
- lib/fresnel/frame.rb
|
64
64
|
- lib/fresnel/lighthouse.rb
|
65
65
|
- lib/fresnel/setup_wizard.rb
|
66
|
+
- lib/fresnel/string.rb
|
67
|
+
- lib/fresnel/input_detector.rb
|
66
68
|
has_rdoc: true
|
67
69
|
homepage: http://www.github.com/smeevil/fresnel
|
68
70
|
licenses: []
|