Skip to content

Commit

Permalink
gemified
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Wotton committed Aug 9, 2009
1 parent dd88cf2 commit e0fafe5
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Manifest.txt
@@ -0,0 +1,21 @@
History.txt
Manifest.txt
PostInstall.txt
README
README.rdoc
Rakefile
bin/jhc_builder.sh
foo.hs
lib/Hubris.rb
sample/Makefile
sample/Test.hs
sample/hsload.rb
script/console
script/destroy
script/generate
spec/Hubris_spec.rb
spec/spec.opts
spec/spec_helper.rb
tasks/rspec.rake
test/test_Hubris.rb
test/test_helper.rb
61 changes: 61 additions & 0 deletions README.rdoc
@@ -0,0 +1,61 @@
= Hubris

* http://github.com/mwotton/Hubris

== DESCRIPTION:

This is a quick and dirty way to call haskell functions from ruby.

== FEATURES/PROBLEMS:

Hubris will wash your car, lie to your boss, and salvage your love life.
If you are very, very lucky, it might also let you get some uber-fast
functional goodness into your ruby programs through the back door.

== SYNOPSIS:

Eventually, we'll integrate with RubyInline or something similar,
so we can write inline Haskell. Until that happy day:

write a haskell file (say sample/foo.hs) with some ccall exports declared
call "jhc_builder.sh foo.hs". This will build "libfoo.so".
write a ruby file similar to sample/hsload.rb in order to call the functions from ruby

if all else fails, mail mwotton@gmail.com with tales of woe.

== REQUIREMENTS:

- jhc <http://repetae.net/computer/jhc/>
- gcc < ... oh, come on. don't tell me you don't have it. >
- ruby 1.8.6 or higher
- linux (mostly because jhc doesn't seem to be working on Mac at the moment.)
- bash

== INSTALL:

* sudo gem install Hubris

== LICENSE:

(The MIT License)

Copyright (c) 2009 Mark Wotton

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 changes: 26 additions & 0 deletions Rakefile
@@ -0,0 +1,26 @@
require 'rubygems'
gem 'hoe', '>= 2.1.0'
require 'hoe'
require 'fileutils'
require './lib/Hubris'

Hoe.plugin :newgem
# Hoe.plugin :website
# Hoe.plugin :cucumberfeatures

# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
$hoe = Hoe.spec 'Hubris' do
self.developer 'FIXME full name', 'FIXME email'
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
self.rubyforge_name = self.name # TODO this is default value
# self.extra_deps = [['activesupport','>= 2.0.2']]

end

require 'newgem/tasks'
Dir['tasks/**/*.rake'].each { |t| load t }

# TODO - want other tests/tasks run by default? Add them to the list
# remove_task :default
# task :default => [:spec, :features]
6 changes: 6 additions & 0 deletions lib/Hubris.rb
@@ -0,0 +1,6 @@
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

module Hubris
VERSION = '0.0.1'
end
10 changes: 10 additions & 0 deletions script/console
@@ -0,0 +1,10 @@
#!/usr/bin/env ruby
# File: script/console
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'

libs = " -r irb/completion"
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
libs << " -r #{File.dirname(__FILE__) + '/../lib/Hubris.rb'}"
puts "Loading Hubris gem"
exec "#{irb} #{libs} --simple-prompt"
14 changes: 14 additions & 0 deletions script/destroy
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/destroy'

ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
RubiGen::Scripts::Destroy.new.run(ARGV)
14 changes: 14 additions & 0 deletions script/generate
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/generate'

ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
RubiGen::Scripts::Generate.new.run(ARGV)
11 changes: 11 additions & 0 deletions spec/Hubris_spec.rb
@@ -0,0 +1,11 @@
require File.dirname(__FILE__) + '/spec_helper.rb'

# Time to add your specs!
# http://rspec.info/
describe "Place your specs here" do

it "find this spec in spec directory" do
# violated "Be sure to write your specs"
end

end
1 change: 1 addition & 0 deletions spec/spec.opts
@@ -0,0 +1 @@
--colour
10 changes: 10 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,10 @@
begin
require 'spec'
rescue LoadError
require 'rubygems' unless ENV['NO_RUBYGEMS']
gem 'rspec'
require 'spec'
end

$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'Hubris'
21 changes: 21 additions & 0 deletions tasks/rspec.rake
@@ -0,0 +1,21 @@
begin
require 'spec'
rescue LoadError
require 'rubygems' unless ENV['NO_RUBYGEMS']
require 'spec'
end
begin
require 'spec/rake/spectask'
rescue LoadError
puts <<-EOS
To use rspec for testing you must install rspec gem:
gem install rspec
EOS
exit(0)
end

desc "Run the specs under spec/models"
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "spec/spec.opts"]
t.spec_files = FileList['spec/**/*_spec.rb']
end

0 comments on commit e0fafe5

Please sign in to comment.