ffi-efl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/tasks/setup.rb ADDED
@@ -0,0 +1,129 @@
1
+ # -*- coding: UTF-8 -*-
2
+ #
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/clean'
6
+ require 'ostruct'
7
+
8
+ class OpenStruct; undef :gem; end
9
+
10
+ # TODO: make my own openstruct type object that includes descriptions
11
+ # TODO: use the descriptions to output help on the available bones options
12
+
13
+ PROJ = OpenStruct.new(
14
+ # Project Defaults
15
+ :name => nil,
16
+ :summary => nil,
17
+ :description => nil,
18
+ :changes => nil,
19
+ :authors => nil,
20
+ :email => nil,
21
+ :url => "\000",
22
+ :version => ENV['VERSION'] || '0.0.0',
23
+ :exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
24
+ :release_name => ENV['RELEASE'],
25
+
26
+ # System Defaults
27
+ :ruby_opts => %w(-w),
28
+ :libs => [],
29
+ :history_file => 'Changelog',
30
+ :readme_file => 'README.rdoc',
31
+ :ignore_file => '.bnsignore',
32
+
33
+ # Announce
34
+ :ann => OpenStruct.new(
35
+ :file => 'announcement.txt',
36
+ :text => nil,
37
+ :paragraphs => [],
38
+ :email => {
39
+ :from => nil,
40
+ :to => %w(ruby-talk@ruby-lang.org),
41
+ :server => 'localhost',
42
+ :port => 25,
43
+ :domain => ENV['HOSTNAME'],
44
+ :acct => nil,
45
+ :passwd => nil,
46
+ :authtype => :plain,
47
+ :tls => true,
48
+ }
49
+ ),
50
+
51
+ # Gem Packaging
52
+ :gem => OpenStruct.new(
53
+ :dependencies => [],
54
+ :development_dependencies => [],
55
+ :executables => nil,
56
+ :extensions => FileList['ext/**/extconf.rb'],
57
+ :files => nil,
58
+ :need_tar => true,
59
+ :need_zip => false,
60
+ :extras => {}
61
+ ),
62
+
63
+ # File Annotations
64
+ :notes => OpenStruct.new(
65
+ :exclude => %w(^tasks/setup\.rb$),
66
+ :extensions => %w(.txt .rb .erb .rdoc) << '',
67
+ :tags => %w(FIXME OPTIMIZE TODO)
68
+ ),
69
+
70
+ # Rcov
71
+ :rcov => OpenStruct.new(
72
+ :dir => 'coverage',
73
+ :opts => %w[--sort coverage -T -x lib/rcov],
74
+ :threshold => 90.0,
75
+ :threshold_exact => false
76
+ ),
77
+
78
+ # Rdoc
79
+ :rdoc => OpenStruct.new(
80
+ :opts => [],
81
+ :include => %w(^lib/ ^bin/ ^ext/ \.txt$ \.rdoc$),
82
+ :exclude => %w(extconf\.rb$),
83
+ :main => nil,
84
+ :dir => 'doc',
85
+ :remote_dir => nil
86
+ ),
87
+
88
+ # Rubyforge
89
+ :rubyforge => OpenStruct.new(
90
+ :name => "\000"
91
+ ),
92
+
93
+ # Rspec
94
+ :spec => OpenStruct.new(
95
+ :files => FileList['spec/**/*_spec.rb'],
96
+ :opts => []
97
+ ),
98
+
99
+ # Subversion Repository
100
+ :svn => OpenStruct.new(
101
+ :root => nil,
102
+ :path => '',
103
+ :trunk => 'trunk',
104
+ :tags => 'tags',
105
+ :branches => 'branches'
106
+ ),
107
+
108
+ # Test::Unit
109
+ :test => OpenStruct.new(
110
+ :files => FileList['test/**/test_*.rb'],
111
+ :file => 'test/all.rb',
112
+ :opts => []
113
+ )
114
+ )
115
+
116
+ # Load the other rake files in the tasks folder
117
+ tasks_dir = File.expand_path(File.dirname(__FILE__))
118
+ post_load_fn = File.join(tasks_dir, 'post_load.rake')
119
+ rakefiles = Dir.glob(File.join(tasks_dir, '*.rake')).sort
120
+ rakefiles.unshift(rakefiles.delete(post_load_fn)).compact!
121
+ import(*rakefiles)
122
+
123
+ # Setup the project libraries
124
+ %w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
125
+
126
+ load './tasks/constants.rb'
127
+ load './tasks/helpers.rb'
128
+
129
+ # EOF
data/tasks/spec.rake ADDED
@@ -0,0 +1,44 @@
1
+ # -*- coding: UTF-8 -*-
2
+ #
3
+ #if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
4
+ require 'rspec/core/rake_task'
5
+ #
6
+ namespace :spec do
7
+
8
+ desc 'Run all specs with basic output'
9
+ RSpec::Core::RakeTask.new(:run) do |t,args|
10
+ t.ruby_opts = PROJ.ruby_opts
11
+ t.rspec_opts = PROJ.spec.opts
12
+ t.pattern = ENV['pattern'] if ENV['pattern']
13
+ end
14
+
15
+ desc 'Run all specs with text output'
16
+ RSpec::Core::RakeTask.new(:doc) do |t|
17
+ t.ruby_opts = PROJ.ruby_opts
18
+ t.rspec_opts = PROJ.spec.opts + ['-fs' ]
19
+ t.pattern = ENV['pattern'] if ENV['pattern']
20
+ end
21
+
22
+ desc 'Run all specs with html output'
23
+ RSpec::Core::RakeTask.new(:html) do |t|
24
+ t.ruby_opts = PROJ.ruby_opts
25
+ t.rspec_opts = PROJ.spec.opts + ['-fh' ]
26
+ t.pattern = ENV['pattern'] if ENV['pattern']
27
+ end
28
+
29
+ if HAVE_RCOV
30
+ desc 'Run all specs with RCov'
31
+ RSpec::Core::RakeTask.new(:rcov) do |t|
32
+ t.ruby_opts = PROJ.ruby_opts
33
+ t.rspec_opts = PROJ.spec.opts
34
+ t.rcov = true
35
+ t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
36
+ end
37
+ end
38
+
39
+ end # namespace :spec
40
+
41
+ desc 'Alias to spec:run'
42
+ task :spec => 'spec:run'
43
+
44
+ # EOF
data/tasks/svn.rake ADDED
@@ -0,0 +1,48 @@
1
+ # -*- coding: UTF-8 -*-
2
+ #
3
+ if HAVE_SVN
4
+
5
+ unless PROJ.svn.root
6
+ info = %x/svn info ./
7
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
8
+ PROJ.svn.root = (m.nil? ? '' : m[1])
9
+ end
10
+ PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
11
+
12
+ namespace :svn do
13
+
14
+ # A prerequisites task that all other tasks depend upon
15
+ task :prereqs
16
+
17
+ desc 'Show tags from the SVN repository'
18
+ task :show_tags => 'svn:prereqs' do |t|
19
+ tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
20
+ tags.gsub!(%r/\/$/, '')
21
+ tags = tags.split("\n").sort {|a,b| b <=> a}
22
+ puts tags
23
+ end
24
+
25
+ desc 'Create a new tag in the SVN repository'
26
+ task :create_tag => 'svn:prereqs' do |t|
27
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
28
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
29
+
30
+ svn = PROJ.svn
31
+ trunk = File.join(svn.root, svn.trunk)
32
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
33
+ tag = File.join(svn.root, svn.tags, tag)
34
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
35
+
36
+ puts "Creating SVN tag '#{tag}'"
37
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
38
+ abort "Tag creation failed"
39
+ end
40
+ end
41
+
42
+ end # namespace :svn
43
+
44
+ task 'gem:release' => 'svn:create_tag'
45
+
46
+ end # if PROJ.svn.path
47
+
48
+ # EOF
data/tasks/test.rake ADDED
@@ -0,0 +1,41 @@
1
+ # -*- coding: UTF-8 -*-
2
+ #
3
+ if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
4
+ require 'rake/testtask'
5
+
6
+ namespace :test do
7
+
8
+ Rake::TestTask.new(:run) do |t|
9
+ t.libs = PROJ.libs
10
+ t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
11
+ else PROJ.test.files end
12
+ t.ruby_opts += PROJ.ruby_opts
13
+ t.ruby_opts += PROJ.test.opts
14
+ end
15
+
16
+ if HAVE_RCOV
17
+ desc 'Run rcov on the unit tests'
18
+ task :rcov => :clobber_rcov do
19
+ opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
20
+ opts = opts.join(' ')
21
+ files = if test(?f, PROJ.test.file) then [PROJ.test.file]
22
+ else PROJ.test.files end
23
+ files = files.join(' ')
24
+ sh "#{RCOV} #{files} #{opts}"
25
+ end
26
+
27
+ task :clobber_rcov do
28
+ rm_r 'coverage' rescue nil
29
+ end
30
+ end
31
+
32
+ end # namespace :test
33
+
34
+ desc 'Alias to test:run'
35
+ task :test => 'test:run'
36
+
37
+ task :clobber => 'test:clobber_rcov' if HAVE_RCOV
38
+
39
+ end
40
+
41
+ # EOF
@@ -0,0 +1,38 @@
1
+ #! /usr/bin/env ruby
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ require 'efl/elementary'
5
+ #
6
+ include Efl
7
+ #
8
+ puts Elm.init
9
+
10
+ win_del = Proc.new { |data,evas_object,event_info|
11
+ Efl::API.elm_exit();
12
+ }
13
+
14
+ win = Efl::API.elm_win_add FFI::MemoryPointer::NULL, "App name", :elm_win_basic
15
+ Efl::API.elm_win_title_set win, "Window title"
16
+ Efl::API.evas_object_smart_callback_add win, "delete,request", win_del, FFI::MemoryPointer::NULL
17
+
18
+ bg = Efl::API.elm_bg_add win
19
+ Efl::API.evas_object_size_hint_weight_set bg, 1.0, 1.0
20
+ Efl::API.elm_win_resize_object_add win, bg
21
+ Efl::API.evas_object_show bg
22
+
23
+ lb = Efl::API.elm_label_add win
24
+ Efl::API.elm_label_label_set lb, "Hello World!"
25
+ Efl::API.evas_object_size_hint_weight_set lb, 1.0, 1.0
26
+ Efl::API.elm_win_resize_object_add win, lb
27
+ Efl::API.evas_object_show lb
28
+
29
+ Efl::API.evas_object_move win, 300, 300
30
+ Efl::API.evas_object_resize win, 200, 100
31
+
32
+ Efl::API.evas_object_show win
33
+
34
+ Elm.run
35
+ puts Elm.shutdown
36
+ #
37
+ # EOF
38
+
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ require 'efl/elementary'
5
+ #
6
+ include Efl
7
+ #
8
+ DATA = FFI::MemoryPointer.from_string("my data")
9
+ #
10
+ class MyWin < Elm::ElmWin
11
+ def initialize name, title
12
+ super FFI::MemoryPointer::NULL, name
13
+ title_set title
14
+ feed
15
+ smart_callback_add "delete,request", method(:exit), DATA
16
+ end
17
+ def feed
18
+ # using block
19
+ @bg = add 'bg' do |bg|
20
+ bg.size_hint_weight_set 1.0, 1.0
21
+ bg.show
22
+ end
23
+ resize_object_add @bg.ptr
24
+ @lb = add 'label'do |lb|
25
+ lb.elm_label_label_set "Hello World!" # complete function name
26
+ lb.size_hint_weight_set 1.0, 1.0 # implicit evas_object function name prefix
27
+ end
28
+ @lb.show
29
+ resize_object_add @lb.ptr
30
+ end
31
+ def exit data, evas_object, event_info
32
+ puts "EXIT #{data.read_string}"
33
+ Elm.exit
34
+ end
35
+ end
36
+ #
37
+ Elm.init
38
+ #
39
+ win = MyWin.new "App name", "Window Title" do |w,eo|
40
+ eo.move 300, 300
41
+ eo.resize 200, 100
42
+ eo.show
43
+ end
44
+ #
45
+ Elm.run
46
+ Elm.shutdown
47
+ #
48
+ # EOF
49
+
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ffi-efl
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - "J\xC3\xA9r\xC3\xA9my Zurcher"
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-21 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.8.7
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: bones
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 3.6.5
36
+ type: :development
37
+ version_requirements: *id002
38
+ description: |-
39
+ ffi-efl is a FFI[https://github.com/ffi/ffi/wiki] binding to Enlightenment Foundation Libraries (eina,eet,evas,ecore,edje...)
40
+ base components of the Enlightenment project. (EFL API[http://www.enlightenment.org/p.php?p=docs&l=en])
41
+ email: jeremy@asynk.ch
42
+ executables: []
43
+
44
+ extensions: []
45
+
46
+ extra_rdoc_files:
47
+ - README.rdoc
48
+ files:
49
+ - Changelog
50
+ - MIT-LICENSE
51
+ - README.rdoc
52
+ - Rakefile
53
+ - lib/efl.rb
54
+ - lib/efl/ecore.rb
55
+ - lib/efl/ecore/ecore-ffi.rb
56
+ - lib/efl/ecore/ecore_evas-ffi.rb
57
+ - lib/efl/ecore/ecore_getopt-ffi.rb
58
+ - lib/efl/ecore/ecore_input-ffi.rb
59
+ - lib/efl/ecore_getopt.rb
60
+ - lib/efl/edje.rb
61
+ - lib/efl/edje/edje-ffi.rb
62
+ - lib/efl/eet.rb
63
+ - lib/efl/eet/eet-ffi.rb
64
+ - lib/efl/eina/eina_types-ffi.rb
65
+ - lib/efl/elementary.rb
66
+ - lib/efl/elementary/elementary-ffi.rb
67
+ - lib/efl/evas.rb
68
+ - lib/efl/evas/evas-ffi.rb
69
+ - lib/efl/ffi.rb
70
+ - spec/ecore_getopt_spec.rb
71
+ - spec/ecore_spec.rb
72
+ - spec/edje_spec.rb
73
+ - spec/eet_spec.rb
74
+ - spec/evas_spec.rb
75
+ - tasks/ann.rake
76
+ - tasks/constants.rb
77
+ - tasks/ffi.rake
78
+ - tasks/gem.rake
79
+ - tasks/git.rake
80
+ - tasks/helpers.rb
81
+ - tasks/notes.rake
82
+ - tasks/post_load.rake
83
+ - tasks/rdoc.rake
84
+ - tasks/rubyforge.rake
85
+ - tasks/setup.rb
86
+ - tasks/spec.rake
87
+ - tasks/svn.rake
88
+ - tasks/test.rake
89
+ - test/test_elm_win.rb
90
+ - test/test_elm_win_class.rb
91
+ has_rdoc: true
92
+ homepage: https://github.com/jeremyz/ffi-efl
93
+ licenses: []
94
+
95
+ post_install_message:
96
+ rdoc_options:
97
+ - -x
98
+ - ext
99
+ - --main
100
+ - README.rdoc
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: "0"
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: "0"
115
+ requirements: []
116
+
117
+ rubyforge_project: ffi-efl
118
+ rubygems_version: 1.5.2
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: ffi-efl is a FFI[https://github
122
+ test_files:
123
+ - test/test_elm_win_class.rb
124
+ - test/test_elm_win.rb