fumoffu 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +28 -0
- data/Gemfile.lock +31 -0
- data/LICENSE.txt +20 -0
- data/README.md +91 -0
- data/Rakefile +71 -0
- data/VERSION +1 -0
- data/bin/fumoffu +64 -0
- data/lib/fumoffu/controller.rb +15 -0
- data/lib/fumoffu/generators/fumoffu_config_generator.rb +17 -0
- data/lib/fumoffu/generators/fumoffu_generator.rb +30 -0
- data/lib/fumoffu/generators/fumoffu_lib_generator.rb +22 -0
- data/lib/fumoffu/generators/fumoffu_src_generator.rb +23 -0
- data/lib/fumoffu/generators/tasks/install.rake +9 -0
- data/lib/fumoffu/generators/tasks/package.rake +71 -0
- data/lib/fumoffu/generators/templates/Gemfile +17 -0
- data/lib/fumoffu/generators/templates/Rakefile +54 -0
- data/lib/fumoffu/generators/templates/build_configuration.rb +89 -0
- data/lib/fumoffu/generators/templates/lib/java/AbsoluteLayout.jar +0 -0
- data/lib/fumoffu/generators/templates/lib/java/swing-layout.jar +0 -0
- data/lib/fumoffu/generators/templates/scripts/package.sh +6 -0
- data/lib/fumoffu/generators/templates/scripts/start.sh +3 -0
- data/lib/fumoffu/generators/templates/src/java/org/github/bouba/fumoffu/ActionManager.java +11 -0
- data/lib/fumoffu/generators/templates/src/java/org/github/bouba/fumoffu/UIActions.java +11 -0
- data/lib/fumoffu/generators/templates/src/java/org/rubyforge/rawr/Main.java +67 -0
- data/lib/fumoffu/generators/templates/src/ruby/app/actions/controllers/application_controller.rb +2 -0
- data/lib/fumoffu/generators/templates/src/ruby/app/actions/handlers/application_handler.rb +27 -0
- data/lib/fumoffu/generators/templates/src/ruby/app/main.rb +11 -0
- data/lib/fumoffu/generators/templates/src/ruby/app/setup.rb +45 -0
- data/lib/fumoffu/generators/templates/src/ruby/app/utils/component_search.rb +22 -0
- data/lib/fumoffu/generators/templates/src/ruby/config/configuration.rb +3 -0
- data/lib/fumoffu/generators/templates/src/ruby/config/initializers/app_classes.rb +42 -0
- data/lib/fumoffu/generators/templates/src/ruby/config/initializers/init.rb +6 -0
- data/lib/fumoffu/generators/templates/src/ruby/config/initializers/java_classes.rb +11 -0
- data/lib/fumoffu/generators/templates/src/ruby/config/initializers/ruby_classes.rb +12 -0
- data/lib/fumoffu/handler.rb +16 -0
- data/lib/fumoffu/java_mapping.rb +22 -0
- data/lib/fumoffu/utils/component_search.rb +23 -0
- data/lib/fumoffu.rb +48 -0
- data/test/coverage/index.html +234 -0
- data/test/coverage/jquery-1.3.2.min.js +19 -0
- data/test/coverage/jquery.tablesorter.min.js +15 -0
- data/test/coverage/lib-fumoffu-controller_rb.html +153 -0
- data/test/coverage/lib-fumoffu-generators-fumoffu_config_generator_rb.html +165 -0
- data/test/coverage/lib-fumoffu-generators-fumoffu_generator_rb.html +243 -0
- data/test/coverage/lib-fumoffu-generators-fumoffu_lib_generator_rb.html +195 -0
- data/test/coverage/lib-fumoffu-generators-fumoffu_src_generator_rb.html +201 -0
- data/test/coverage/lib-fumoffu-handler_rb.html +159 -0
- data/test/coverage/lib-fumoffu-java_mapping_rb.html +195 -0
- data/test/coverage/lib-fumoffu-utils-component_search_rb.html +201 -0
- data/test/coverage/lib-fumoffu_rb.html +351 -0
- data/test/coverage/print.css +12 -0
- data/test/coverage/rcov.js +42 -0
- data/test/coverage/screen.css +270 -0
- data/test/fumoffu/fumoffu_controller_test.rb +18 -0
- data/test/fumoffu/fumoffu_test.rb +17 -0
- data/test/fumoffu/generators/fumoffu_config_generator_test.rb +22 -0
- data/test/fumoffu/generators/fumoffu_generator_test.rb +47 -0
- data/test/fumoffu/generators/fumoffu_lib_generator_test.rb +22 -0
- data/test/fumoffu/generators/fumoffu_src_generator_test.rb +46 -0
- data/test/fumoffu/handler_test.rb +36 -0
- data/test/fumoffu/helper/generator_test_helper.rb +27 -0
- data/test/fumoffu/helper.rb +15 -0
- data/test/fumoffu/java_mapping_test.rb +30 -0
- data/test/fumoffu/utils/component_search_test.rb +58 -0
- metadata +187 -0
data/Gemfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
platforms :jruby do
|
4
|
+
gem "bundler", "~> 1.0.10"
|
5
|
+
|
6
|
+
# gem "activerecord-jdbcsqlite3-adapter"
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "ruby-debug", ">= 0.10.3"
|
10
|
+
gem "jeweler", "~> 1.5.2"
|
11
|
+
end
|
12
|
+
# This is needed by now to let tests work on JRuby
|
13
|
+
# TODO: When the JRuby guys merge jruby-openssl in
|
14
|
+
# jruby this will be removed
|
15
|
+
gem "jruby-openssl"
|
16
|
+
|
17
|
+
group :test do
|
18
|
+
gem "rcov", ">= 0.9.9"
|
19
|
+
gem "shoulda"
|
20
|
+
end
|
21
|
+
# group :db do
|
22
|
+
# gem "activerecord-jdbcmysql-adapter"
|
23
|
+
# gem "activerecord-jdbcpostgresql-adapter"
|
24
|
+
# end
|
25
|
+
|
26
|
+
# gem "rawr"
|
27
|
+
# gem "log4r"
|
28
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
bouncy-castle-java (1.5.0145.2)
|
5
|
+
columnize (0.3.2)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.5.2)
|
8
|
+
bundler (~> 1.0.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
jruby-openssl (0.7.3)
|
12
|
+
bouncy-castle-java
|
13
|
+
rake (0.8.7)
|
14
|
+
rcov (0.9.9-java)
|
15
|
+
ruby-debug (0.10.4)
|
16
|
+
columnize (>= 0.1)
|
17
|
+
ruby-debug-base (~> 0.10.4.0)
|
18
|
+
ruby-debug-base (0.10.4-java)
|
19
|
+
shoulda (2.11.3)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
java
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler (~> 1.0.10)
|
27
|
+
jeweler (~> 1.5.2)
|
28
|
+
jruby-openssl
|
29
|
+
rcov (>= 0.9.9)
|
30
|
+
ruby-debug (>= 0.10.3)
|
31
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Lionel Abderemane
|
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.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Fumoffu
|
2
|
+
|
3
|
+
Lionel Abderemane aka Bouba
|
4
|
+
|
5
|
+
http://github.com/bouba/fumoffu
|
6
|
+
|
7
|
+
I just started a month ago so the whole thing is still pretty fresh and VERY unstable ^_^.
|
8
|
+
|
9
|
+
So I hope you will be able to enjoy it. I will try may best documenting the project progressively.
|
10
|
+
|
11
|
+
## Description
|
12
|
+
|
13
|
+
Fumoffu is a [JRuby][jruby] / Java Swing Framework which enabling users to easily design and create crossplatform desktop application.
|
14
|
+
|
15
|
+
**The framework goal primary goals are:**
|
16
|
+
|
17
|
+
* Develop a cross-platform UI (Windows, OSX, Linux)
|
18
|
+
* Easily and quickly package and deploy the application
|
19
|
+
* Easily setup the development environment
|
20
|
+
|
21
|
+
You can see a tutorial of a sample application made with this framework [here](http://github.com/bouba/fumoffu_example).
|
22
|
+
|
23
|
+
|
24
|
+
* * *
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
- **Setup your [JRuby][jruby] environment**
|
29
|
+
|
30
|
+
_First download and install [JRuby][jruby] if do not have it_
|
31
|
+
__On a terminal__
|
32
|
+
To load your [JRuby][jruby] environment in a terminal just make a quick export
|
33
|
+
|
34
|
+
export PATH=/your/local/path/jruby-X.X.X/bin:$PATH
|
35
|
+
|
36
|
+
- **Download and setup the Fumoffu gem**
|
37
|
+
|
38
|
+
_Since I still did put the gem on ruby forge to install it you to download and generate the gem manually to install it_
|
39
|
+
|
40
|
+
|
41
|
+
git clone git://github.com/bouba/fumoffu.git
|
42
|
+
cd fumoffu
|
43
|
+
bundle install
|
44
|
+
rake install
|
45
|
+
cd pkg
|
46
|
+
gem i fumoffu-0.0.1.gem --local
|
47
|
+
|
48
|
+
|
49
|
+
- **Setup your project files**
|
50
|
+
|
51
|
+
New project install the gem.
|
52
|
+
Then create a new project
|
53
|
+
|
54
|
+
mkdir MyApp
|
55
|
+
cd MyApp
|
56
|
+
fumoffu -i
|
57
|
+
|
58
|
+
Switch the boolean in the rake file to enable the rawr tasks then execute
|
59
|
+
|
60
|
+
rake rawr:get:current-stable-jruby
|
61
|
+
|
62
|
+
- **Setup your IDE**
|
63
|
+
|
64
|
+
Currently this step is still in my opinion it is still way too complicated to do.
|
65
|
+
(I personally use Netbeans.)
|
66
|
+
|
67
|
+
Here is the basic idea of how I setup my development environment.
|
68
|
+
I create 2 Projects:
|
69
|
+
|
70
|
+
* A Java Project
|
71
|
+
* A Ruby Project (where I switch the compiler to JRuby and add the root folder to the sources to be
|
72
|
+
able to access to my Rake tasks using my IDE)
|
73
|
+
|
74
|
+
_I think will make a video or something regarding the IDE setup, until I script the setup._
|
75
|
+
|
76
|
+
|
77
|
+
* * *
|
78
|
+
## Packaging
|
79
|
+
|
80
|
+
To package your application first you need to create a jar of all the bundled
|
81
|
+
|
82
|
+
|
83
|
+
bundle install lib/ruby
|
84
|
+
rake pkg:rawr:bundle_jar
|
85
|
+
rake rawr:jar
|
86
|
+
rake rawr:bundle:app
|
87
|
+
|
88
|
+
|
89
|
+
Then configure the rake file in config/tasks/package.rake
|
90
|
+
|
91
|
+
[jruby]: http://jruby.org/download "[JRuby][jruby]"
|
data/Rakefile
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development, :test)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'rake'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = "fumoffu"
|
17
|
+
gem.homepage = "http://github.com/bouba/fumoffu"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{A JRuby / Java Swing framework to easily build portable GUI application}
|
20
|
+
gem.description = %Q{I will make the description later}
|
21
|
+
gem.email = "alionel@gmail.com"
|
22
|
+
gem.authors = ["Lionel Abderemane"]
|
23
|
+
gem.files = FileList[
|
24
|
+
'lib/**/*.rb',
|
25
|
+
'lib/**/*.java',
|
26
|
+
'lib/**/*.jar',
|
27
|
+
'lib/**/*.rake',
|
28
|
+
'lib/**/*.sh',
|
29
|
+
'lib/**/Gemfile',
|
30
|
+
'lib/**/Rakefile',
|
31
|
+
'bin/*',
|
32
|
+
'[A-Z]*',
|
33
|
+
'test/**/*'].to_a
|
34
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
35
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
36
|
+
#gem.add_runtime_dependency 'log4r', '>= 1.1.9'
|
37
|
+
#gem.add_runtime_dependency 'rawr', '>= 1.4.5'
|
38
|
+
#gem.add_runtime_dependency 'bundler', '>= 1.0.10'
|
39
|
+
|
40
|
+
gem.add_development_dependency 'shoulda'
|
41
|
+
end
|
42
|
+
Jeweler::RubygemsDotOrgTasks.new
|
43
|
+
|
44
|
+
require 'rake/testtask'
|
45
|
+
Rake::TestTask.new(:test) do |test|
|
46
|
+
test.libs << 'lib' << 'test'
|
47
|
+
test.pattern = 'test/**/*_test.rb'
|
48
|
+
test.verbose = true
|
49
|
+
end
|
50
|
+
|
51
|
+
require 'rcov/rcovtask'
|
52
|
+
Rcov::RcovTask.new do |test|
|
53
|
+
test.libs << 'lib' << 'test'
|
54
|
+
test.pattern = 'test/fumoffu/**/*_test.rb'
|
55
|
+
test.verbose = true
|
56
|
+
test.output_dir = "test/coverage/"
|
57
|
+
test.rcov_opts = %w{-x osx\/objc,gems\/,spec\/,\(eval\) --text-report }
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
task :default => :test
|
62
|
+
|
63
|
+
require 'rake/rdoctask'
|
64
|
+
Rake::RDocTask.new do |rdoc|
|
65
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
66
|
+
|
67
|
+
rdoc.rdoc_dir = 'rdoc'
|
68
|
+
rdoc.title = "fumoffu #{version}"
|
69
|
+
rdoc.rdoc_files.include('README*')
|
70
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
71
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
data/bin/fumoffu
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: iso-8859-1 -*-
|
3
|
+
# fumoffu Copyright (c) 2011 Lionel Abderemane <alionel@gmail.com>
|
4
|
+
#
|
5
|
+
# See LEGAL and LICENSE for additional licensing information.
|
6
|
+
#
|
7
|
+
|
8
|
+
# A script that will pretend to resize a number of images
|
9
|
+
require 'optparse'
|
10
|
+
require 'rubygems'
|
11
|
+
require 'fumoffu'
|
12
|
+
require 'rake'
|
13
|
+
options = {}
|
14
|
+
|
15
|
+
optparse = OptionParser.new do|opts|
|
16
|
+
# Set a banner, displayed at the top
|
17
|
+
# of the help screen.
|
18
|
+
opts.banner = "Usage: fumoffu [options] dir_name"
|
19
|
+
|
20
|
+
# Define the options, and what they do
|
21
|
+
options[:verbose] = false
|
22
|
+
opts.on( '-v', '--verbose', 'Output more information' ) do
|
23
|
+
options[:verbose] = true
|
24
|
+
end
|
25
|
+
|
26
|
+
options[:install] = false
|
27
|
+
opts.on( '-i', '--install', 'Install the skeleton of the fumoffu App' ) do
|
28
|
+
options[:install] = true
|
29
|
+
end
|
30
|
+
|
31
|
+
options[:logfile] = nil
|
32
|
+
opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) do|file|
|
33
|
+
options[:logfile] = file
|
34
|
+
end
|
35
|
+
|
36
|
+
# This displays the help screen, all programs are
|
37
|
+
# assumed to have this option.
|
38
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
39
|
+
puts opts
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
optparse.parse!
|
45
|
+
|
46
|
+
puts "Being verbose" if options[:verbose]
|
47
|
+
puts "Being quick" if options[:quick]
|
48
|
+
puts "Logging to file #{options[:logfile]}" if options[:logfile]
|
49
|
+
|
50
|
+
begin
|
51
|
+
if options[:install] then
|
52
|
+
app = Fumoffu::Application.new
|
53
|
+
Fumoffu::Generators::Application.generate
|
54
|
+
# we add the missing gems
|
55
|
+
puts "Installing default packages ..."
|
56
|
+
sh "bundle install"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
#
|
60
|
+
# Sample to handle argument
|
61
|
+
#
|
62
|
+
#ARGV.each do|f|
|
63
|
+
# puts "Resizing image #{f}..."
|
64
|
+
#end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fumoffu
|
2
|
+
class Controller
|
3
|
+
attr_accessor :action_name
|
4
|
+
attr_reader :controller_name
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@controller_name = extract_controller_name
|
8
|
+
end
|
9
|
+
|
10
|
+
def extract_controller_name
|
11
|
+
name = self.class.to_s
|
12
|
+
name.scan(/^(\w+)Controller$/).first.first.downcase
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Fumoffu
|
2
|
+
module Generators
|
3
|
+
class Configuration
|
4
|
+
def self.generate
|
5
|
+
source_dir = File.dirname(__FILE__)
|
6
|
+
# We generate the containers
|
7
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/config/tasks", :verbose => false
|
8
|
+
|
9
|
+
# We include the default files
|
10
|
+
cp "#{source_dir}/tasks/package.rake", "#{Fumoffu::Application.app_dir}/config/tasks", :verbose => false
|
11
|
+
cp "#{source_dir}/templates/build_configuration.rb", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
12
|
+
cp "#{source_dir}/templates/Gemfile", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
13
|
+
cp "#{source_dir}/templates/Rakefile", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Dir[File.dirname(__FILE__).concat("/*.rb")].each {|file| require file }
|
2
|
+
|
3
|
+
module Fumoffu
|
4
|
+
module Generators
|
5
|
+
class Application
|
6
|
+
def self.generate
|
7
|
+
# we generate the configuration
|
8
|
+
Configuration.generate
|
9
|
+
Lib.generate
|
10
|
+
Source.generate
|
11
|
+
|
12
|
+
cp_r "#{File.dirname(__FILE__)}/templates/scripts", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
13
|
+
|
14
|
+
# We generate the sources from where it is executed
|
15
|
+
@dir_structure = [
|
16
|
+
"dist",
|
17
|
+
"log",
|
18
|
+
"resources/medias",
|
19
|
+
"scripts",
|
20
|
+
"test/java",
|
21
|
+
"test/ruby/spec"
|
22
|
+
]
|
23
|
+
|
24
|
+
@dir_structure.each do |dir|
|
25
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/#{dir}", :verbose => false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fumoffu
|
2
|
+
module Generators
|
3
|
+
class Lib
|
4
|
+
def self.generate
|
5
|
+
@@source_dir = File.dirname(__FILE__)
|
6
|
+
generate_dirs
|
7
|
+
copy_libraries
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.generate_dirs
|
11
|
+
# We generate the containers
|
12
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/lib/java/generated", :verbose => false
|
13
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/lib/ruby", :verbose => false
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def self.copy_libraries
|
18
|
+
cp_r "#{@@source_dir}/templates/lib/java", "#{Fumoffu::Application.app_dir}/lib/", :verbose => false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fumoffu
|
2
|
+
module Generators
|
3
|
+
class Source
|
4
|
+
def self.generate
|
5
|
+
@@source_dir = File.dirname(__FILE__)
|
6
|
+
copy_sources
|
7
|
+
generate_dirs
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.generate_dirs
|
11
|
+
# We generate the containers
|
12
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/src/java", :verbose => false
|
13
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/src/ruby/app/actions/helpers", :verbose => false
|
14
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/src/ruby/app/commons", :verbose => false
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def self.copy_sources
|
19
|
+
cp_r "#{@@source_dir}/templates/src/", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
|
4
|
+
BUILD_DIR="build" # the directory used for the compilation
|
5
|
+
TARGET_DIRS=[ "lib", "config"] # The list of folders containing the sources that require compilation
|
6
|
+
GEM_DIR="#{ROOT_DIR}/lib/ruby/jruby/1.8/gems"
|
7
|
+
JRUBY_COMPLETE="#{ROOT_DIR}/lib/java/jruby-complete.jar"
|
8
|
+
|
9
|
+
def create_dir dir
|
10
|
+
if File.exist?(dir) then
|
11
|
+
puts dir+" already exists: skip"
|
12
|
+
else
|
13
|
+
sh "mkdir #{dir}";
|
14
|
+
puts dir+" has been created"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup_other_files dir
|
19
|
+
# we copy the resources and dependencies
|
20
|
+
puts "Copy the resources and dependencies"
|
21
|
+
create_dir "#{dir}/config"
|
22
|
+
create_dir "#{dir}/log"
|
23
|
+
|
24
|
+
sh "cp -R config/*.yml #{dir}/config/"
|
25
|
+
sh "cp -R config/templates #{dir}/config/"
|
26
|
+
sh "cp scripts/start.sh #{dir}/start.sh"
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :pkg do
|
30
|
+
namespace :rawr do
|
31
|
+
desc "create gems bundle pacakage"
|
32
|
+
task "bundle_jar" do
|
33
|
+
# we setup the building directory
|
34
|
+
create_dir BUILD_DIR
|
35
|
+
|
36
|
+
# compile vendor dependencies
|
37
|
+
puts "Compiling vendor"
|
38
|
+
current_dir = ROOT_DIR
|
39
|
+
Dir.foreach(GEM_DIR) do |d|
|
40
|
+
Dir.chdir(GEM_DIR+"/"+d) do
|
41
|
+
puts "Dir: "+d
|
42
|
+
sh "jrubyc lib -t #{current_dir}/#{BUILD_DIR}"
|
43
|
+
end unless [".", "..", ".DS_Store"].include? d
|
44
|
+
end
|
45
|
+
puts "Done"
|
46
|
+
|
47
|
+
# we create the jar in the package dir
|
48
|
+
dependencies = "#{ROOT_DIR}/lib/java/generated/"
|
49
|
+
|
50
|
+
puts "Create the bundled gem jar"
|
51
|
+
sh "jar cvf bundled_gems.jar -C #{BUILD_DIR} ."
|
52
|
+
sh "mv bundled_gems.jar #{dependencies}"
|
53
|
+
#sh "cp #{JRUBY_COMPLETE} #{dependencies}"
|
54
|
+
puts "Done ..."
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Add files conf,image ..."
|
58
|
+
task "add_files" do
|
59
|
+
setup_other_files "dist/jar"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
desc "Clean the build dir"
|
66
|
+
task "clean" do
|
67
|
+
puts "Cleaning up the build directory"
|
68
|
+
sh "rm -Rf #{BUILD_DIR}/"
|
69
|
+
puts "Done ..."
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# FIXME Fix the class conflict between rawr bundler and bundler we currently cannot use both at the same time
|
4
|
+
PACKAGE = false
|
5
|
+
|
6
|
+
if PACKAGE then
|
7
|
+
require 'rawr'
|
8
|
+
else
|
9
|
+
require 'bundler'
|
10
|
+
begin
|
11
|
+
Bundler.setup(:default, :development, :test, :pkg)
|
12
|
+
rescue Bundler::BundlerError => e
|
13
|
+
$stderr.puts e.message
|
14
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
15
|
+
exit e.status_code
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake'
|
20
|
+
require 'rake/clean'
|
21
|
+
require 'rake/gempackagetask'
|
22
|
+
require 'rake/rdoctask'
|
23
|
+
require 'rake/testtask'
|
24
|
+
require 'rspec/core/rake_task'
|
25
|
+
#require 'spec/rake/spectask'
|
26
|
+
require 'yaml'
|
27
|
+
|
28
|
+
Rake::RDocTask.new do |rdoc|
|
29
|
+
files =['README', 'LICENSE', 'lib/**/*.rb']
|
30
|
+
rdoc.rdoc_files.add(files)
|
31
|
+
rdoc.main = "README" # page to start on
|
32
|
+
rdoc.title = "Your project Docs"
|
33
|
+
rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
|
34
|
+
rdoc.options << '--line-numbers'
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::TestTask.new do |t|
|
38
|
+
t.test_files = FileList['test/**/*.rb']
|
39
|
+
end
|
40
|
+
|
41
|
+
RSpec::Core::RakeTask.new do |t|
|
42
|
+
t.pattern = 'test/ruby/spec/**/*_spec.rb'
|
43
|
+
t.rspec_opts = nil
|
44
|
+
end
|
45
|
+
|
46
|
+
# Setup default global constant
|
47
|
+
env ||= ENV['env']
|
48
|
+
env = "development" unless env
|
49
|
+
|
50
|
+
APP_ENV = env
|
51
|
+
ROOT_DIR = File.dirname(__FILE__)
|
52
|
+
|
53
|
+
# import custom rake tasks
|
54
|
+
Dir.glob(File.dirname(__FILE__)+"/config/tasks/*.rake").each {|file| import file }
|
@@ -0,0 +1,89 @@
|
|
1
|
+
configuration do |c|
|
2
|
+
# The name for your resulting application file (e.g., if the project_name is 'foo' then you'll get foo.jar, foo.exe, etc.)
|
3
|
+
# default value: "YourProjectName"
|
4
|
+
#
|
5
|
+
c.project_name = "YourProjectName"
|
6
|
+
|
7
|
+
# Undocumented option 'output_dir'
|
8
|
+
# default value: "package"
|
9
|
+
#
|
10
|
+
c.output_dir = "dist"
|
11
|
+
|
12
|
+
# The main ruby file to invoke, minus the .rb extension
|
13
|
+
# default value: "main"
|
14
|
+
#
|
15
|
+
c.main_ruby_file = "app/main"
|
16
|
+
|
17
|
+
# The fully-qualified name of the main Java file used to initiate the application.
|
18
|
+
# default value: "org.rubyforge.rawr.Main"
|
19
|
+
#
|
20
|
+
#c.main_java_file = "org.rubyforge.rawr.Main"
|
21
|
+
|
22
|
+
# A list of directories where source files reside
|
23
|
+
# default value: ["src"]
|
24
|
+
#
|
25
|
+
c.source_dirs = ["src/ruby", "src/java","resources"]
|
26
|
+
|
27
|
+
# A list of regexps of files to exclude
|
28
|
+
# default value: []
|
29
|
+
#
|
30
|
+
#c.source_exclude_filter = []
|
31
|
+
|
32
|
+
# Whether Ruby source files should be compiled into .class files
|
33
|
+
# default value: true
|
34
|
+
#
|
35
|
+
#c.compile_ruby_files = true
|
36
|
+
|
37
|
+
# A list of individual Java library files to include.
|
38
|
+
# default value: []
|
39
|
+
#
|
40
|
+
c.java_lib_files = ["lib/java/generated/bundled_gems.jar", "lib/java/jruby-complete.jar", "lib/java/swing-layout.jar", "lib/java/AbsoluteLayout.jar"]
|
41
|
+
|
42
|
+
# A list of directories for rawr to include . All files in the given directories get bundled up.
|
43
|
+
# default value: ["lib/java"]
|
44
|
+
#
|
45
|
+
c.java_lib_dirs = []
|
46
|
+
|
47
|
+
# Undocumented option 'files_to_copy'
|
48
|
+
# default value: []
|
49
|
+
#
|
50
|
+
#c.files_to_copy = []
|
51
|
+
|
52
|
+
# Undocumented option 'target_jvm_version'
|
53
|
+
# default value: 1.6
|
54
|
+
#
|
55
|
+
#c.target_jvm_version = 1.6
|
56
|
+
|
57
|
+
# Undocumented option 'jvm_arguments'
|
58
|
+
# default value: ""
|
59
|
+
#
|
60
|
+
#c.jvm_arguments = ""
|
61
|
+
|
62
|
+
# Undocumented option 'java_library_path'
|
63
|
+
# default value: ""
|
64
|
+
#
|
65
|
+
#c.java_library_path = ""
|
66
|
+
|
67
|
+
# Undocumented option 'extra_user_jars'
|
68
|
+
# default value: {}
|
69
|
+
#
|
70
|
+
#c.extra_user_jars[:data] = { :directory => 'resources/medias',
|
71
|
+
# :location_in_jar => 'medias'}
|
72
|
+
# :exclude => /*.bak$/
|
73
|
+
|
74
|
+
# Undocumented option 'mac_do_not_generate_plist'
|
75
|
+
# default value: nil
|
76
|
+
#
|
77
|
+
#c.mac_do_not_generate_plist = nil
|
78
|
+
|
79
|
+
# Undocumented option 'mac_icon_path'
|
80
|
+
# default value: nil
|
81
|
+
#
|
82
|
+
#c.mac_icon_path = nil
|
83
|
+
|
84
|
+
# Undocumented option 'windows_icon_path'
|
85
|
+
# default value: nil
|
86
|
+
#
|
87
|
+
#c.windows_icon_path = nil
|
88
|
+
|
89
|
+
end
|
Binary file
|
Binary file
|