|
|
|
|
|
Saturday, 19 March 2011 10:27 |
This reduced launch time of rspec for my rails project in Ubuntu VirtualBox on Win7 host from 35 secs to 2 sec.
sudo gem install spork --prerelease
Or add following to Rails Gemfile:
gem 'spork', '>= 0.9.0.rc'
and run
sudo bundle
Run in your Rails project root.
spork --bootstrap
This will add some code and instructions to spec/spec_helper.rb. Follow the instructions and distribute configuration between sections.
Start spork server:
spork rspec
In another terminal launch specs (first green dot should appear 10 times faster the usual):
rspec --drb spec/controllers/your_controller_spec.rb
 Read more: |
|
Friday, 11 March 2011 15:57 |
An exemple using Nokogiri.
require 'open-uri'
require 'nokogiri'
$url="http://rdoc.info"
$outFile = "RubyFeeds.html"
$result=[]
def get_absract_from_readme_project(no,name,url)
frame = Nokogiri::HTML(open(url))
readme=$url+frame.css('frame')[1]['src']
doc = Nokogiri::HTML(open(readme))
text=doc.css("div#content div#filecontents p")[0..4].map { |c| c.content }.join(" ")
$result << [no,name,readme,text]
rescue
puts $!.to_s
end
################ Explore projects list
# ul class="libraries">
# li>
# a href="/github/mdh/ssm/master/frames">strong>mdh/ssm/a>
# a href="http://github.com/mdh/ssm" title="View this project on Github">...
# /li>
# ......
lth=[]
doc = Nokogiri::HTML(open($url))
doc.css('ul.libraries')[1].css('li').each_with_index do |li,i|
aname,*bidon=*li.css('a')
name=aname.content
url=$url+aname['href']
lth << Thread.new(i,name,url) { |nop,n,u| get_absract_from_readme_project(nop,n,u) }
end
################## Wait all readings is finish.....
lth.each { |th| th.join() }
################## format the list of abstracts in a html file...
File.open($outFile,"w") do |file|
file.puts("project | tagGitHub news")
$result.sort { |a,b| a[0] <=> b[0] }.each do |no,name,url,text|
file.puts("#{no}
#{name} : #{text} ")
end
file.puts("")
end
system("firefox #{$outFile}")
TODO : create a RSS feed and post it to a feedsportal.com ...
. Read more: |
|
|
|
|
|
|
|
Page 1 of 4 |