rswt 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ -
2
+ ChangeLog.*
3
+ LICENSE.txt
File without changes
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
@@ -0,0 +1 @@
1
+ --markup markdown --title "rswt Documentation" --protected
@@ -0,0 +1,4 @@
1
+ ### 0.1.0 / 2011-03-30
2
+
3
+ * Initial release:
4
+
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source :rubygems
2
+
3
+ #gemspec
4
+
5
+ group :development do
6
+ gem 'rake', '~> 0.8.7'
7
+ gem 'ore-tasks', '~> 0.4'
8
+ gem 'rspec', '~> 2.5'
9
+ gem 'kramdown'
10
+ gem 'yard', '~> 0.6.0'
11
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Patrik Sundberg
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,63 @@
1
+ # rswt
2
+
3
+ * [Homepage](https://github.com/sundbp/rswt)
4
+ * [Documentation](http://rubydoc.info/gems/rswt/frames)
5
+
6
+ ## Description
7
+
8
+ A simple jruby wrapper around the java library [SWT](http://www.eclipse.org/swt/).
9
+ All it does is provide a structured way to require the jar files. The user refers to the java
10
+ classes as usual (i.e. org.eclipse.swt.widgets.Shell).
11
+
12
+ Potentially some utilities to enhance productivity and make it more ruby friendly will be added
13
+ later as well.
14
+
15
+ ## Examples
16
+
17
+ This is an excerpts of examples/hello_world.rb:
18
+
19
+ display = Display.new
20
+ shell = Shell.new(display)
21
+ shell.setText("First Example")
22
+
23
+ shell.setLayout(RowLayout.new)
24
+ button = Button.new(shell, SWT::PUSH)
25
+ button.setText("Click me!")
26
+ button.add_selection_listener do
27
+ puts "You clicked the button - well done!"
28
+ end
29
+ shell.pack
30
+
31
+ primary = display.getPrimaryMonitor()
32
+ bounds = primary.getBounds()
33
+ rect = shell.getBounds()
34
+
35
+ x = bounds.x + (bounds.width - rect.width) / 2
36
+ y = bounds.y + (bounds.height - rect.height) / 2
37
+
38
+ shell.setLocation(x, y)
39
+ shell.open
40
+
41
+ while (!shell.isDisposed) do
42
+ display.sleep unless display.readAndDispatch
43
+ end
44
+ display.dispose
45
+
46
+ ## Requirements
47
+
48
+ * SWT jars
49
+ * setting the environment variable **RSWT_JAR_PATH** as described below
50
+
51
+ ## Install
52
+
53
+ $ gem install rswt
54
+
55
+ Download and unpack [SWT](http://www.eclipse.org/swt/), and
56
+ set the environment variable **RSWT_JAR_PATH** to the path containg the
57
+ SWT jars.
58
+
59
+ ## Copyright
60
+
61
+ Copyright (c) 2011 Patrik Sundberg
62
+
63
+ See {file:LICENSE.txt} for details.
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'bundler'
5
+ rescue LoadError => e
6
+ STDERR.puts e.message
7
+ STDERR.puts "Run `gem install bundler` to install Bundler."
8
+ exit e.status_code
9
+ end
10
+
11
+ begin
12
+ Bundler.setup(:development)
13
+ rescue Bundler::BundlerError => e
14
+ STDERR.puts e.message
15
+ STDERR.puts "Run `bundle install` to install missing gems."
16
+ exit e.status_code
17
+ end
18
+
19
+ require 'rake'
20
+
21
+ require 'ore/tasks'
22
+ Ore::Tasks.new
23
+
24
+ require 'rspec/core/rake_task'
25
+ RSpec::Core::RakeTask.new
26
+
27
+ task :test => :spec
28
+ task :default => :spec
29
+
30
+
31
+ require 'yard'
32
+ YARD::Rake::YardocTask.new
33
+ task :doc => :yard
@@ -0,0 +1,35 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
2
+ require 'rswt'
3
+
4
+ java_import org.eclipse.swt.widgets.Display
5
+ java_import org.eclipse.swt.widgets.Shell
6
+ java_import org.eclipse.swt.layout.RowLayout
7
+ java_import org.eclipse.swt.widgets.Button
8
+ java_import org.eclipse.swt.SWT
9
+
10
+ display = Display.new
11
+ shell = Shell.new(display)
12
+ shell.setText("First Example")
13
+
14
+ shell.setLayout(RowLayout.new)
15
+ button = Button.new(shell, SWT::PUSH)
16
+ button.setText("Click me!")
17
+ button.add_selection_listener do
18
+ puts "You clicked the button - well done!"
19
+ end
20
+ shell.pack
21
+
22
+ primary = display.getPrimaryMonitor()
23
+ bounds = primary.getBounds()
24
+ rect = shell.getBounds()
25
+
26
+ x = bounds.x + (bounds.width - rect.width) / 2
27
+ y = bounds.y + (bounds.height - rect.height) / 2
28
+
29
+ shell.setLocation(x, y)
30
+ shell.open
31
+
32
+ while (!shell.isDisposed) do
33
+ display.sleep unless display.readAndDispatch
34
+ end
35
+ display.dispose
@@ -0,0 +1,11 @@
1
+ name: rswt
2
+ summary: "A thin jruby wrapper for SWT"
3
+ description: "A thin jruby wrapper for SWT (mainly just for loading the jars in a structured way)"
4
+ license: MIT
5
+ authors: Patrik Sundberg
6
+ homepage: http://rubygems.org/gems/rswt
7
+ has_yard: true
8
+
9
+ development_dependencies:
10
+ bundler: ~> 1.0.0
11
+ yard: ~> 0.6.0
@@ -0,0 +1,23 @@
1
+ require 'rswt/version'
2
+
3
+ require 'java'
4
+
5
+ module Rswt
6
+
7
+ def self.jars
8
+ [
9
+ 'swt'
10
+ ]
11
+ end
12
+
13
+ Rswt.jars.each do |jar|
14
+ raise "You must set RSWT_JAR_PATH!" if ENV['RSWT_JAR_PATH'].nil?
15
+ begin
16
+ require File.join(ENV['RSWT_JAR_PATH'], jar)
17
+ rescue LoadError => e
18
+ STDERR.puts e.message
19
+ STDERR.puts "Make sure you have set RSWT_JAR_PATH to the path where your swt jars are stored."
20
+ exit -1
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ module Rswt
2
+ # rswt version
3
+ VERSION = "0.1.0"
4
+ end
@@ -0,0 +1,15 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ begin
4
+ Ore::Specification.new do |gemspec|
5
+ # custom logic here
6
+ end
7
+ rescue NameError
8
+ begin
9
+ require 'ore/specification'
10
+ retry
11
+ rescue LoadError
12
+ STDERR.puts "The '#{__FILE__}' file requires Ore."
13
+ STDERR.puts "Run `gem install ore-core` to install Ore."
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'rswt'
3
+
4
+ describe Rswt do
5
+ it "should have a VERSION constant" do
6
+ subject.const_get('VERSION').should_not be_empty
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ require 'rspec'
2
+ require 'rswt/version'
3
+
4
+ include Rswt
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rswt
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Patrik Sundberg
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-31 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ requirement: *id001
25
+ prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.6.0
35
+ requirement: *id002
36
+ prerelease: false
37
+ type: :development
38
+ description: A thin jruby wrapper for SWT (mainly just for loading the jars in a structured way)
39
+ email: []
40
+
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files:
46
+ - README.md
47
+ - ChangeLog.md
48
+ - LICENSE.txt
49
+ files:
50
+ - .document
51
+ - .gemtest
52
+ - .rspec
53
+ - .yardopts
54
+ - ChangeLog.md
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - examples/hello_world.rb
60
+ - gemspec.yml
61
+ - lib/rswt.rb
62
+ - lib/rswt/version.rb
63
+ - rswt.gemspec
64
+ - spec/rswt_spec.rb
65
+ - spec/spec_helper.rb
66
+ has_rdoc: yard
67
+ homepage: http://rubygems.org/gems/rswt
68
+ licenses:
69
+ - MIT
70
+ post_install_message:
71
+ rdoc_options: []
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 1.3.6
87
+ requirements: []
88
+
89
+ rubyforge_project: rswt
90
+ rubygems_version: 1.6.2
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: A thin jruby wrapper for SWT
94
+ test_files:
95
+ - spec/rswt_spec.rb