launchy 2.0.2 → 2.0.3
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/HISTORY +4 -0
- data/lib/launchy.rb +1 -0
- data/lib/launchy/deprecated.rb +52 -0
- data/lib/launchy/version.rb +1 -1
- metadata +4 -4
- data/.gitignore +0 -6
data/HISTORY
CHANGED
data/lib/launchy.rb
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Launchy
|
|
2
|
+
#
|
|
3
|
+
# This class is deprecated and will be removed
|
|
4
|
+
#
|
|
5
|
+
class Browser
|
|
6
|
+
def self.run( *args )
|
|
7
|
+
Browser.new.visit( args[0] )
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def visit( url )
|
|
11
|
+
_warn "You made a call to a deprecated Launchy API. This call should be changed to 'Launchy.open( uri )'"
|
|
12
|
+
report_caller_context( caller )
|
|
13
|
+
|
|
14
|
+
::Launchy.open( url )
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def find_caller_context( stack )
|
|
20
|
+
caller_file = stack.find do |line|
|
|
21
|
+
not line.index( __FILE__ )
|
|
22
|
+
end
|
|
23
|
+
if caller_file then
|
|
24
|
+
caller_fname, caller_line, _ = caller_file.split(":")
|
|
25
|
+
if File.readable?( caller_fname ) then
|
|
26
|
+
caller_lines = IO.readlines( caller_fname )
|
|
27
|
+
context = [ caller_file ]
|
|
28
|
+
context << caller_lines[(caller_line.to_i)-3, 5]
|
|
29
|
+
return context.flatten
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
return []
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def report_caller_context( stack )
|
|
36
|
+
context = find_caller_context( stack )
|
|
37
|
+
if context.size > 0 then
|
|
38
|
+
_warn "I think I was able to find the location that needs to be fixed. Please go look at:"
|
|
39
|
+
_warn
|
|
40
|
+
context.each do |line|
|
|
41
|
+
_warn line.rstrip
|
|
42
|
+
end
|
|
43
|
+
_warn
|
|
44
|
+
_warn "If this is not the case, please file a bug. #{Launchy.bug_report_message}"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def _warn( msg = "" )
|
|
49
|
+
warn "WARNING: #{msg}"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
data/lib/launchy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: launchy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 9
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 2.0.
|
|
9
|
+
- 3
|
|
10
|
+
version: 2.0.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jeremy Hinegardner
|
|
@@ -150,7 +150,6 @@ extra_rdoc_files:
|
|
|
150
150
|
- README
|
|
151
151
|
- bin/launchy
|
|
152
152
|
files:
|
|
153
|
-
- .gitignore
|
|
154
153
|
- HISTORY
|
|
155
154
|
- LICENSE
|
|
156
155
|
- NOTES
|
|
@@ -161,6 +160,7 @@ files:
|
|
|
161
160
|
- lib/launchy/application.rb
|
|
162
161
|
- lib/launchy/applications/browser.rb
|
|
163
162
|
- lib/launchy/cli.rb
|
|
163
|
+
- lib/launchy/deprecated.rb
|
|
164
164
|
- lib/launchy/descendant_tracker.rb
|
|
165
165
|
- lib/launchy/detect.rb
|
|
166
166
|
- lib/launchy/detect/host_os.rb
|