splat 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2010 Mark Ryall
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2010 Mark Ryall
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,31 +1,31 @@
1
- = splat
2
-
3
- small gem to provide an adapter for various platform specific features
4
-
5
- == installation
6
-
7
- gem install splat
8
-
9
- == instantiate
10
-
11
- splat = Splat.new
12
-
13
- == platform
14
-
15
- puts spat.platform
16
- puts splat.supported? ? 'supported' : 'not supported'
17
-
18
- == clipboard
19
-
20
- splat.clipboard = "some new content"
21
-
22
- this will do nothing if the platform is not supported (win32 and macosx for the moment)
23
-
24
- == launcher
25
-
26
- splat.launch 'http://google.com'
27
-
28
- == Future plans for world domination
29
-
30
- * detect remaining platforms
31
- * determine 1.9 compatibility
1
+ = splat
2
+
3
+ small gem to provide an adapter for various platform specific features
4
+
5
+ == installation
6
+
7
+ gem install splat
8
+
9
+ == instantiate
10
+
11
+ splat = Splat.new
12
+
13
+ == platform
14
+
15
+ puts spat.platform
16
+ puts splat.supported? ? 'supported' : 'not supported'
17
+
18
+ == clipboard
19
+
20
+ splat.clipboard = "some new content"
21
+
22
+ this will do nothing if the platform is not supported (win32 and macosx for the moment)
23
+
24
+ == launcher
25
+
26
+ splat.launch 'http://google.com'
27
+
28
+ == Future plans for world domination
29
+
30
+ * detect remaining platforms
31
+ * determine 1.9 compatibility
@@ -1,5 +1,5 @@
1
- class Splat::Darwin10Clipboard
2
- def content= text
3
- `echo "#{text}" | pbcopy`
4
- end
5
- end
1
+ class Splat::Darwin10Clipboard
2
+ def content= text
3
+ `echo "#{text}" | pbcopy`
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- class Splat::Darwin10Launcher
2
- def launch text
3
- `open #{text}`
4
- end
5
- end
1
+ class Splat::Darwin10Launcher
2
+ def launch text
3
+ `open #{text}`
4
+ end
5
+ end
@@ -1,7 +1,7 @@
1
- require 'win32/clipboard'
2
-
3
- class Splat::Win32Clipboard
4
- def content= text
5
- Win32::Clipboard.set_data(text)
6
- end
7
- end
1
+ require 'win32/clipboard'
2
+
3
+ class Splat::Win32Clipboard
4
+ def content= text
5
+ Win32::Clipboard.set_data(text)
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
- class Splat::Win32Launcher
2
- def launch text
3
- `start #{text}`
4
- end
5
- end
1
+ class Splat::Win32Launcher
2
+ def launch text
3
+ `start #{text}`
4
+ end
5
+ end
data/lib/splat.rb CHANGED
@@ -1,43 +1,59 @@
1
- class Splat
2
- attr_reader :platform
3
-
4
- def initialize
5
- case Config::CONFIG['host_os']
6
- when /mswin|win32|dos|cygwin|mingw/i
7
- @platform = :win32
8
- require 'splat/win32_clipboard'
9
- @clipboard = Splat::Win32Clipboard.new
10
- require 'splat/win32_launcher'
11
- @launcher = Splat::Win32Launcher.new
12
- require 'watir'
13
- @browser_class = Watir::IE
14
- when /darwin10/i
15
- @platform = :macosx
16
- require 'splat/darwin10_clipboard'
17
- @clipboard = Splat::Darwin10Clipboard.new
18
- require 'splat/darwin10_launcher'
19
- @launcher = Splat::Darwin10Launcher.new
20
- require 'safariwatir'
21
- @browser_class = Watir::Safari
22
- else
23
- @platform = :unknown
24
- puts "I have no idea how to cope with \"#{Config::CONFIG['host_os']}\""
25
- end
26
- end
27
-
28
- def supported?
29
- @platform != :unknown
30
- end
31
-
32
- def clipboard= content
33
- @clipboard.content = content if @clipboard
34
- end
35
-
36
- def browser
37
- @browser_class.new if @browser_class
38
- end
39
-
40
- def launch content
41
- @launcher.launch content if @launcher
42
- end
43
- end
1
+ class Splat
2
+ attr_reader :platform
3
+
4
+ def initialize
5
+ case Config::CONFIG['host_os']
6
+ when /mswin|win32|dos|cygwin|mingw/i
7
+ @platform = :win32
8
+ begin
9
+ require 'splat/win32_clipboard'
10
+ @clipboard = Splat::Win32Clipboard.new
11
+ rescue
12
+ puts 'for clipboard with splat on windows:'
13
+ puts ' * gem install win32-clipboard'
14
+ end
15
+ require 'splat/win32_launcher'
16
+ @launcher = Splat::Win32Launcher.new
17
+ begin
18
+ require 'watir'
19
+ @browser_class = Watir::IE
20
+ rescue
21
+ puts 'for browser automation with splat on windows'
22
+ puts ' * gem install watir'
23
+ end
24
+ when /darwin10/i
25
+ @platform = :macosx
26
+ require 'splat/darwin10_clipboard'
27
+ @clipboard = Splat::Darwin10Clipboard.new
28
+ require 'splat/darwin10_launcher'
29
+ @launcher = Splat::Darwin10Launcher.new
30
+ begin
31
+ require 'safariwatir'
32
+ @browser_class = Watir::Safari
33
+ rescue
34
+ puts 'for browser automation with splat on mac os x:'
35
+ puts ' * gem install safariwatir'
36
+ puts ' * gem install rb-appscript'
37
+ end
38
+ else
39
+ @platform = :unknown
40
+ puts "I have no idea how to cope with \"#{Config::CONFIG['host_os']}\""
41
+ end
42
+ end
43
+
44
+ def supported?
45
+ @platform != :unknown
46
+ end
47
+
48
+ def clipboard= content
49
+ @clipboard.content = content if @clipboard
50
+ end
51
+
52
+ def browser
53
+ @browser_class.new if @browser_class
54
+ end
55
+
56
+ def launch content
57
+ @launcher.launch content if @launcher
58
+ end
59
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Ryall
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-06 00:00:00 +11:00
12
+ date: 2010-02-21 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies: []
15
15