launchy 2.0.2 → 2.0.3

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
@@ -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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launchy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 2
10
- version: 2.0.2
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
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *~
2
- *.swo
3
- *.swp
4
- doc/
5
- coverage/
6
- pkg/