splat 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +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.
@@ -0,0 +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
@@ -0,0 +1,33 @@
1
+ class Splat
2
+ attr_reader :platform
3
+
4
+ def initialize
5
+ @platform = :unknown
6
+ if Config::CONFIG['host_os'] =~ /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
+ end
13
+ if Config::CONFIG['host_os'] =~ /darwin10/i
14
+ @platform = :macosx
15
+ require 'splat/darwin10_clipboard'
16
+ @clipboard = Splat::Darwin10Clipboard.new
17
+ require 'splat/darwin10_launcher'
18
+ @launcher = Splat::Darwin10Launcher.new
19
+ end
20
+ end
21
+
22
+ def supported?
23
+ @platform != :unknown
24
+ end
25
+
26
+ def clipboard= content
27
+ @clipboard.content = content if @clipboard
28
+ end
29
+
30
+ def launch content
31
+ @launcher.launch content if @launcher
32
+ end
33
+ end
@@ -0,0 +1,5 @@
1
+ class Splat::Darwin10Clipboard
2
+ def content= text
3
+ `echo "#{text}" | pbcopy`
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class Splat::Darwin10Launcher
2
+ def launch text
3
+ `open #{text}`
4
+ end
5
+ end
@@ -0,0 +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
@@ -0,0 +1,5 @@
1
+ class Splat::Win32Launcher
2
+ def launch text
3
+ `start #{text}`
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: splat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mark Ryall
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-31 00:00:00 +11:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: |
17
+ An adapter to get access to the following features across different platforms:
18
+
19
+ * the clipboard
20
+ * an application launcher
21
+
22
+ email: mark@ryall.name
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/splat/darwin10_clipboard.rb
31
+ - lib/splat/darwin10_launcher.rb
32
+ - lib/splat/win32_clipboard.rb
33
+ - lib/splat/win32_launcher.rb
34
+ - lib/splat.rb
35
+ - README.rdoc
36
+ - MIT-LICENSE
37
+ has_rdoc: true
38
+ homepage: http://github.com/markryall/splat
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.3.5
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: cross platform adapter for various os specific features
65
+ test_files: []
66
+