launchy 2.0.2-java → 2.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,5 +1,9 @@
1
1
  = Launchy Changlog
2
2
 
3
+ == Version 2.0.3 - 2011-07-17
4
+
5
+ * Add in Deprecated API wrappers that warn the user
6
+
3
7
  == Version 2.0.2 - 2011-07-17
4
8
 
5
9
  * Typo fixes from @mtorrent
data/lib/launchy.rb CHANGED
@@ -112,3 +112,4 @@ require 'launchy/descendant_tracker'
112
112
  require 'launchy/error'
113
113
  require 'launchy/application'
114
114
  require 'launchy/detect'
115
+ require 'launchy/deprecated'
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Launchy
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
 
4
4
  module Version
5
5
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: launchy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.0.2
5
+ version: 2.0.3
6
6
  platform: java
7
7
  authors:
8
8
  - Jeremy Hinegardner
@@ -132,6 +132,7 @@ files:
132
132
  - lib/launchy/application.rb
133
133
  - lib/launchy/applications/browser.rb
134
134
  - lib/launchy/cli.rb
135
+ - lib/launchy/deprecated.rb
135
136
  - lib/launchy/descendant_tracker.rb
136
137
  - lib/launchy/detect.rb
137
138
  - lib/launchy/detect/host_os.rb