Thanks wordpress.com so far
It’s very easy to use Haml and Sass in JRuby.
Download JRuby from here. http://jruby.org/
And,
Get bundler.
$ tar xfz jruby-bin-x.x.x.tar.gz
$ JRUBY_HOME=jruby-bin-x.x.x
$ PATH=$JRUBY_HOME/bin:$PATH
$ jruby -S gem install bundler --no-ri --no-rdoc
Prepare Gemfile.
cat > Gemfile
source "http://rubygems.org"
gem "sinatra"
gem "haml"
gem "sass"
CTRL+D
Install gems.
$ jruby -S bundle install
Write a Rack configuration for sinatra.
cat > config.ru
require "bundler"
Bundler.require
get '/' do
haml :index
end
run Sinatra::Application
CTRL+D
And also, write index in Haml.
$ mkdir views
cat > views/index.haml
%html
%body
Hello!!!
CTRL+D
Launch rack application.
jruby -S rackup
Open http://localhost:9292
And browse it.
It’s simple.
Rails3.1.1 + Spork + Guard + Cucumber / RSpec
Finally I got fast BDD environment for RoR on Ruby v1.9.2-p290 + Rails-3.1.1.
There are a few points to run well.
Initially, add some required gems into your Gemfile specifying version.
group :test do gem 'turn', '< 0.8.3' gem 'spork', '0.9.0rc9' gem 'rspec' gem 'rspec-rails' gem 'guard-rspec', '0.5.2' gem 'cucumber' gem 'cucumber-rails' gem 'guard-cucumber', '0.7.3' gem 'database_cleaner' gem 'rb-fsevent' gem 'growl' end
Install gems.
$ bundle install vendor/bundle
Generate Guardfile.
$ guard init spork
$ guard init rspec
$ guard init cucumber
And, once you open Guardfile, append :cli options like following.
…
guard ‘rspec’, :version => 2, :cli => ‘–drb’ do…
guard ‘cucumber’, :cli => ‘–drb’ do
…
Generate template for RSpec and Cucumber.
$ rails g rspec:install –spork
$ rails g cucumber:install –spork
Configure for spork.
$ spork –bootstrap
For now, you can start guard.
$ guard start
Guard is now watching at ‘/private/tmp/blog’
Starting Spork for Test::Unit & RSpec & Cucumber
Couldn’t find a supported test framework that begins with ‘testunit’Supported test frameworks:
(*) Cucumber
(*) RSpecLegend: ( ) – not detected in project (*) – detected
Using Cucumber
Using RSpec
Preloading Rails environment
Preloading Rails environment
Loading Spork.prefork block…
Loading Spork.prefork block…
Spork is ready and listening on 8989!
Spork is ready and listening on 8990!
ERROR: Could not start Spork server for Test::Unit & RSpec & Cucumber. Make sure you can use it manually first.
Guard::RSpec is running, with RSpec 2!
Running all specs
Running tests with args [“–color”, “–format”, “progress”, “–forma……
An ERROR is going to happen, but it’s only a way to avoid this error only with a WORKAROUND to sleep process for a few seconds. It’s ugly. I don’t write it here because this error is not important.
Try to add a spec.
$ rails g rspec:model blog title:string
Guard will detects the addition, and run it.
And also create a file at features/blog.feature
$ echo “Feature: Post an entry” > features/blog.feature
Guard will detects, too.
Congrats!
Enjoy quick BDD!
git-upload-pack: command not found
If you face to the blow error,
$ git fetch bash: git-upload-pack: command not found fatal: The remote end hung up unexpectedly
you can fix it to add a one line into .git/config like following:
[remote "origin"]
url =
fetch = +refs/heads/*:refs/remotes/origin/*
uploadpack = /opt/local/bin/git-upload-pack
zlib problem for gem of ruby-1.9.2 on ubuntu-11.04
I stacked to install gem of ruby-1.9.2 facing zlib Load error.
Telling the result, at first, we have to install zlib1g-dev with apt-get like this:
$ sudo apt-get install zlib1g-dev
After then, you can install with rvm or from a source tarball.
HtmlUnit
I’ve searched a library like HtmlUnit, and autoeasyb is obsolete due to it…
I think it’s interesting for smart-object of autoeasyb, and I’ll extract it as a library without aim.
To update all for Macports
sudo port selfupdate
sudo port sync
sudo port upgrade installed
sudo port -u uninstall
autoeasyb-0.1.7.2 RELEASE
v0.1.7.2 was released.
- Easy to see JavaScript error.
- Load JavaScript libraries from local.
autoeasyb-0.1.7.1 RELEASE
I released v0.1.7.1 for minor bug fixes.
http://github.com/tmtk75/autoeasyb/tree/v0.1.7.1
