天天红玉世界

Rails Ruby Erlang 。。。创新来自于刻苦的实践和勤奋的思考... www.hhtong.com

www.lycom.de

Rails世界:源代码分析工具Excellent

Gudao Luo2009-08-06 at 21:05发表的

Rails世界:源代码分析工具Excellent
  • 说明
    • Excellent是一个针对于Rails的源代码分析工具;
    • Excellent集成了 roodireekflog ,并且还增加了Rails本身检查;
    • Excellent输出一个源代码的HTML分析文件;
    • Excellent输出HTML分析文件可以说是对代码的一种“评论”,如代码是否太复杂了,能否简化一下,这是工具flog的功能;有时候是代码真的有问题,如 “if x=y”,运行过程没有出现错误,但是结果是错误的 ;
    • 还有另外一个完全类似的工具:metric_fu ,可以参考的。
  • 使用方法
    1. 安装工具:Excellent。一次性工作;所有人都需要这样做。
      • gem sources -a http://gems.github.com
      • sudo gem install simplabs-excellent
    2. 确定分析源代码目标。多次性工作;在Rails根目录下运行,但是这个命令是千变万化的。
      • excellent html:doc/out.html app/models
    3. 查看分析结果。完全重复工作;方法是一样的。
      • open doc/out.html

Rails实例世界(No 4):REST_in_Place on Rails编辑器

Gudao Luo2009-02-11 at 21:34发表的

REST_in_Place on Rails编辑器
使用REST_in_Place命令和代码清单
rails demo_rest-in-place && cd demo_rest-in-place
ruby script/plugin install git://github.com/janv/rest_in_place.git
wget -O public/javascripts/jquery-1.2.6.min.js http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js
ruby script/generate scaffold user name:string
vim app/views/layouts/users.html.erb
# 在users.html.erb增加下面所有代码
<title>Users: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= javascript_include_tag "jquery-1.2.6.min" , "jquery.rest_in_place" %>
<script type="text/javascript">
rails_authenticity_token = '<%= form_authenticity_token %>'
</script>
vim app/controllers/users_controller.rb
# 在users_controller.rb增加一行代码
def show
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
format.js { render :json => @user }
end
end
vim app/views/users/show.html.erb
# 在show.html.erb增加下面所有代码
<div id="<%= dom_id @user %>">
ID: <%= @user.id %><br />
Name: <span class="rest_in_place" attribute="name"><%= @user.name %></span>
</div>
rake db:drop && rake db:migrate && rake db:fixtures:load
ruby script/server
open http://localhost:3000/users/<show_id>

Rails实例世界(No 3):关于Textile的可视化编辑插件textile_toolbar

Gudao Luo2008-11-27 at 11:23发表的

关于Textile的可视化编辑插件textile_toolbar

注:好像Firefox不能够访问上面图的链接,而使用浏览器Safari是可以的。
 
使用关于Textile的可视化插件textile_toolbar方法
rails textile_toolbar_demo && cd textile_toolbar_demo
 
ruby script/plugin install git://github.com/pelargir/textile_toolbar.git
rake textile_toolbar:install
 
ruby script/generate scaffold post title:string body:text published:boolean
 
vi app/views/posts/edit.html.erb
<%#= f.text_area :body %>
<%= f.textile_area :body, :rows => 5, :cols => 20 %>
 
vi app/views/layouts/posts.html.erb
<%= stylesheet_link_tag 'scaffold' %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag "textile_toolbar.js" %>
 
rake db:migrate && rake db:fixtures:load
 
ruby script/server
 
# http://localhost:3000/posts/<post.id>/edit

Rails世界:Ruby软件包和Rails插件的使用趋势

Gudao Luo2008-11-20 at 06:05发表的

免费无限存放图片在slide.com!免费无限存放图片在slide.com!

Rails框架:知道什么是ActivePresenter?

Gudao Luo2008-07-30 at 00:03发表的

免费无限存放图片在slide.com!
  • 翻译(English » Chinese):

In its simplest form, a presenter is an object that wraps up several other objects to display, and manipulate them on the front end.

在其最简单的形式,主讲人是一个对象,结束其他几个对象要显示,和操纵他们就前端。—Google

用最简单语言可以这样说明,呈送(presenter)是一个对象,它封装了其它几个对象,以达到在前端显示和处理它们。—天天红玉

Rails框架插件系列:增加标记input的属性class

Gudao Luo2008-05-25 at 12:12发表的

增加标记input的属性class

  • 说明
    • 插件class_inputs的作用在于增加标记input的属性class,以便更好地显示页面。这里介绍这个插件的目的是让大家把它作为学习Rails插件的实例。
  • 安装方法
ruby script/plugin install http://svn.jcoglan.com/classyinputs/trunk/classy_inputs

Rails框架:组件理念是否重返Rails框架

Gudao Luo2008-02-14 at 22:53发表的

组件理念是否重返Rails框架
  • 说明
    • 看看什么时候Rails应用程序的根目录下面的目录components开始被使用?还是一直让它空着?

Rails插件:创建自己的导航系统Geokit

Gudao Luo2008-01-18 at 10:10发表的

创建自己的导航系统Geokit
  • 说明
    • Rails插件Geokit提供了地理编码(geocoding),路线寻找和距离计算等功能。这个插件不仅提供Google地图API还提供Yahoo地图和Geocoder.us 等其他地图。
    • Geokit项目首页:http://geokit.rubyforge.org/
    • 图中链接是借助于Google 地图 API 实现瑞士火车实时运行网站。

Ruby语言:重要的软件包BackgroundFu

Gudao Luo2007-12-19 at 21:46发表的

Host unlimited photos at slide.com for FREE!
  • 参考文献
    • http://trix.pl/blog/ruby-on-rails/running-long-background-tasks-in-ruby-on-rails-made-dead-simple
    • http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails
    • http://agilewebdevelopment.com/plugins/backgroundfu
  • 说明
    • BackgroundFu是Rails框架插件;
    • BackgroundFu是后台任务执行工具;
    • BackgroundFu是执行任意的长时间运行的任务工具;

Rails框架插件:使得网络链接变得容易理解

Gudao Luo2007-11-28 at 20:52发表的

使得网络链接变得容易理解
  • 说明
    • 如何使得网络链接成为更为可读的网址?
    • 如何使得网络链接成为中文的可读网址?

Rails框架技术:如何处理Rails框架的日期显示

Gudao Luo2007-06-25 at 20:22发表的

Rails框架技术:如何处理Rails框架的日期显示

  • 说明
    • 上面的图是利用这里列出的参考资料3实现的。

Rails框架插件:文件上传大全

Gudao Luo2007-06-21 at 20:43发表的

Rails框架插件:文件上传大全

Rails框架网站推荐:Rails框架插件库

Gudao Luo2007-06-05 at 21:06发表的

Rails框架插件(200705)

Gudao Luo2007-04-30 at 16:26发表的

Rails框架插件:Shoulda

Gudao Luo2007-04-22 at 07:32发表的

Ruby语言软件包:创建命令行风格的命令cmdparse

Gudao Luo2007-04-01 at 23:11发表的

  • 说明:软件包cmdparse可以被用来创建命令行内包含命令的接口。如RubyGems软件,其命令“gem『软件包命令』 install『这是软件包内的命令』 cmdparse『这是命令install要求的参数』”。
评论: (disabled) 标记: Ruby, cmd, cmdparse, plugins

Rails框架的数据库平滑迁移插件Smooth Migration

Gudao Luo2007-03-25 at 13:12发表的

  • 说明:在Rails框架中要是在我们执行迁移命令时出现错误时,该插件能够不会因为有错而停止你的命令执行。这样能够在再次执行你的迁移命令时保证能再顺利执行。要是没有它,你就会有麻烦了。