splat 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -8
- data/lib/splat.rb +10 -2
- data/lib/splat/linux_browser.rb +7 -0
- data/lib/splat/linux_clipboard.rb +5 -0
- data/lib/splat/linux_launcher.rb +5 -0
- data/lib/splat/linux_player.rb +5 -0
- data/lib/splat/linux_tts.rb +5 -0
- metadata +53 -12
data/README.rdoc
CHANGED
@@ -24,19 +24,19 @@ This is done by adding the following methods to String:
|
|
24
24
|
|
25
25
|
'current content'.to_editor
|
26
26
|
|
27
|
-
|
27
|
+
Defaults to notepad on windows and vim everywhere else. Set "EDITOR" environment variable to override this.
|
28
28
|
|
29
29
|
== browser automation
|
30
30
|
|
31
31
|
'http://www.google.com'.to_browser
|
32
32
|
|
33
|
-
Returns a watir compatible browser - uses safariwatir on mac os x
|
33
|
+
Returns a watir compatible browser - uses safariwatir on mac os x, watir (ie) on windows and firewatir on linux.
|
34
34
|
|
35
35
|
== clipboard
|
36
36
|
|
37
37
|
'some new content'.to_clipboard
|
38
38
|
|
39
|
-
Copies the string to the os clipboard
|
39
|
+
Copies the string to the os clipboard. Requires 'xclip' on linux.
|
40
40
|
|
41
41
|
== default application launcher
|
42
42
|
|
@@ -44,19 +44,19 @@ Copies the string to the os clipboard
|
|
44
44
|
'textfile.txt'.to_launcher
|
45
45
|
'audiofile.mp3'.to_launcher
|
46
46
|
|
47
|
-
Launches the referenced content with the default system application
|
47
|
+
Launches the referenced content with the default system application. Requires 'gnome-open' on linux.
|
48
48
|
|
49
49
|
== audio player
|
50
50
|
|
51
51
|
'audio.mp3'.to_player
|
52
52
|
|
53
|
-
Uses 'afplay' on mac os x and
|
53
|
+
Uses 'afplay' on mac os x, 'mpg123' on windows and 'mplayer' on linux.
|
54
54
|
|
55
55
|
== text to speech
|
56
56
|
|
57
57
|
"I'm afraid. I'm afraid, Dave. Dave, my mind is going.".to_speech
|
58
58
|
|
59
|
-
Uses 'say' on mac os x
|
59
|
+
Uses 'say' on mac os x, win32 sapi on windows and espeak on linux.
|
60
60
|
|
61
61
|
== path cleaning
|
62
62
|
|
@@ -64,9 +64,10 @@ Uses 'say' on mac os x and win32 sapi on windows
|
|
64
64
|
|
65
65
|
This will simply replace '/' characters with '\' on windows and otherwise leave the path as is.
|
66
66
|
|
67
|
-
Note that this is only necessary for passing a path to native windows applications
|
67
|
+
Note that this is only necessary for passing a path to native windows applications on windows.
|
68
68
|
|
69
69
|
== Future plans for world domination
|
70
70
|
|
71
|
-
* detect
|
71
|
+
* detect other platforms
|
72
|
+
* more configurable
|
72
73
|
* determine 1.9 compatibility
|
data/lib/splat.rb
CHANGED
@@ -17,7 +17,8 @@ class String
|
|
17
17
|
tmp_file.close
|
18
18
|
begin
|
19
19
|
File.open(tmp_file.path, 'w') { |out| out.print self }
|
20
|
-
|
20
|
+
default_editor = Splat.platform == :win32 ? 'notepad' : 'vim'
|
21
|
+
editor = ENV["EDITOR"] || default_editor
|
21
22
|
system("#{editor} #{tmp_file.path}")
|
22
23
|
return unless $?.to_i == 0
|
23
24
|
File.read(tmp_file.path)
|
@@ -59,8 +60,15 @@ module Splat
|
|
59
60
|
try_load 'launcher'
|
60
61
|
try_load 'player'
|
61
62
|
try_load 'browser', 'rb-appscript' => 'appscript', 'safariwatir' => 'safariwatir'
|
63
|
+
when /linux/i
|
64
|
+
@platform = :linux
|
65
|
+
try_load 'tts'
|
66
|
+
try_load 'clipboard'
|
67
|
+
try_load 'launcher'
|
68
|
+
try_load 'player'
|
69
|
+
try_load 'browser', 'firewatir' => 'firewatir'
|
62
70
|
else
|
63
71
|
@platform = :unknown
|
64
72
|
puts "I have no idea how to cope with \"#{Config::CONFIG['host_os']}\""
|
65
73
|
end
|
66
|
-
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Mark Ryall
|
@@ -14,10 +15,41 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-24 00:00:00 +10:00
|
18
19
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rake
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 49
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 8
|
33
|
+
- 7
|
34
|
+
version: 0.8.7
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: gemesis
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
- 4
|
50
|
+
version: 0.0.4
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
21
53
|
description: |
|
22
54
|
An adapter to get access to the following features across different platforms:
|
23
55
|
|
@@ -34,18 +66,23 @@ extensions: []
|
|
34
66
|
extra_rdoc_files: []
|
35
67
|
|
36
68
|
files:
|
37
|
-
- lib/splat
|
38
|
-
- lib/splat/darwin_clipboard.rb
|
69
|
+
- lib/splat.rb
|
39
70
|
- lib/splat/darwin_launcher.rb
|
71
|
+
- lib/splat/win32_browser.rb
|
72
|
+
- lib/splat/darwin_browser.rb
|
40
73
|
- lib/splat/darwin_player.rb
|
74
|
+
- lib/splat/linux_tts.rb
|
75
|
+
- lib/splat/linux_player.rb
|
41
76
|
- lib/splat/darwin_tts.rb
|
42
|
-
- lib/splat/win32_browser.rb
|
43
77
|
- lib/splat/win32_clipboard.rb
|
44
|
-
- lib/splat/win32_launcher.rb
|
45
|
-
- lib/splat/win32_os_path.rb
|
46
78
|
- lib/splat/win32_player.rb
|
79
|
+
- lib/splat/linux_clipboard.rb
|
80
|
+
- lib/splat/linux_launcher.rb
|
81
|
+
- lib/splat/linux_browser.rb
|
82
|
+
- lib/splat/win32_os_path.rb
|
47
83
|
- lib/splat/win32_tts.rb
|
48
|
-
- lib/splat.rb
|
84
|
+
- lib/splat/win32_launcher.rb
|
85
|
+
- lib/splat/darwin_clipboard.rb
|
49
86
|
- README.rdoc
|
50
87
|
- MIT-LICENSE
|
51
88
|
has_rdoc: true
|
@@ -58,23 +95,27 @@ rdoc_options: []
|
|
58
95
|
require_paths:
|
59
96
|
- lib
|
60
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
61
99
|
requirements:
|
62
100
|
- - ">="
|
63
101
|
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
64
103
|
segments:
|
65
104
|
- 0
|
66
105
|
version: "0"
|
67
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
68
108
|
requirements:
|
69
109
|
- - ">="
|
70
110
|
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
71
112
|
segments:
|
72
113
|
- 0
|
73
114
|
version: "0"
|
74
115
|
requirements: []
|
75
116
|
|
76
117
|
rubyforge_project:
|
77
|
-
rubygems_version: 1.3.
|
118
|
+
rubygems_version: 1.3.7
|
78
119
|
signing_key:
|
79
120
|
specification_version: 3
|
80
121
|
summary: cross platform adapter for various os specific features
|