1.1 创建一个Rails应用程序
$ rails app_name
可选项:
-d, database=xxx 指定安装一个数据库(mysql oracle postgresql sqlite2 sqlite3 ), 默认情况下是数据库
-r, ruby-path= 指定Ruby的安装路径,如果没有指定,scripts使用env去找Ruby
-f, freeze (冻结)freezes Rails在vendor/rails目录
1.2 API Documentation
$ gem_server
启动一个WEBrick服务器。这时候你可以通过Http://localhost:8808/ 打开浏览器去查看rails API文档
1.3 Rake
rake db:fixtures:load
# 载入fixtures到当前环境的数据库
# 载入指定的fixtures使用FIXTURES=x,y
rake db:migrate
# 迁移数据库通过在db/migrate目录下的脚本.可以指定版本号通过VERSION=x
rake db:schema:dump
# 创建一个db/schema.rb文件,通过AR能过够支持任何数据库去使用
rake db:schema:load
# 再入一个schema.rb文件进数据库
rake db:sessions:clear
# 清空sessions表
rake db:sessions:create
# 用CGI::Session::ActiveRecordStore创建一个sessions表为用户
rake db:structure:dump
# 导出数据库结构为一个SQL文件
rake db:test:clone
# 重新创建一个测试数据库从当前环境数据库中
rake db:test:clone_structure
# 重新创建测试数据库从开发模式数据库
rake db:test:prepare
# 准备测试数据库并在入schema
rake db:test:purge
# 清空测试数据库
rake doc:app
# 创建HTML文件的API Documentation
rake doc:clobber_app
# 删除Documentation
rake doc:clobber_plugins
# 删除 plugin Documentation
rake doc:clobber_rails
# 删除Documentation
rake doc:plugins
# 产生Documation为所有安装的plugins
rake doc:rails
# 创建HTML文件的API Documentation
rake doc:reapp
# 强制重新创建HTML文件的API Documentation
rake doc:rerails
# 强制重新创建HTML文件的API Documentation
rake log:clear
# 清空目录log/下的所有日志文件
rake rails:freeze:edge
# Lock this application to latest Edge Rails. Lock a specific revision with REVISION=X
rake rails:freeze:gems
# Lock this application to the current gems (by unpacking them into vendor/rails)
rake rails:unfreeze
# Unlock this application from freeze of gems or edge and return to a fluid use of system gems
rake rails:update
# Update both scripts and public/javascripts from Rails
rake rails:update:javascripts
# Update your javascripts from your current rails install
rake rails:update:scripts
# Add new scripts to the application script/ directory
rake stats
# Report code statistics (KLOCs, etc) from the application
rake test
# Test all units and functionals
rake test:functionals
# Run tests for functionalsdb:test:prepare
rake test:integration
# Run tests for integrationdb:test:prepare
rake test:plugins
# Run tests for pluginsenvironment
rake test:recent
# Run tests for recentdb:test:prepare
rake test:uncommitted
# Run tests for uncommitteddb:test:prepare
rake test:units
# Run tests for unitsdb:test:prepare
rake tmp:cache:clear
# 清空tmp/cache目录下的所有文件
rake tmp:clear
# 清空session, cache, 和socket文件从tmp/目录
rake tmp:create
# 为sessions, cache, and sockets创建tmp/目录
rake tmp:sessions:clear
# 清空所有在tmp/sessions目录下的文件
rake tmp:sockets:clear
# 清空所有在tmp/sessions 目录下的ruby_sess.* 文件
1.4 Scripts
script/about
# 输出当前环境信息
script/breakpointer
# 启动断点server
script/console
# 启动交换式的Rails控制台
script/destroy
# 删除通过generators创建的文件
script/generate
# -> generators
script/plugin
# -> Plugins
script/runner
# 执行一个任务在rails上下文中
script/server
# 启动开发模式服务器http://localhost:3000
//以下几个不知道怎么去使用
script/performance/profiler
script/performance/benchmarker
script/process/reaper
script/process/spawner
1.5 Generators
ruby script/generate model ModelName
ruby script/generate controller ListController show edit
ruby script/generate scaffold ModelName ControllerName
ruby script/generate migration AddNewTable
ruby script/generate plugin PluginName
ruby script/generate mailer Notification lost_password signup
ruby script/generate web_service ServiceName api_one api_two
ruby script/generate integration_test TestName
ruby script/generate session_migration
可选项:
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on errors.
-h, --help Show this help message.
-c, --svn Modify files with subversion. (Note: svn must be in path)
1.6 Plugins
script/plugin discover
# discover plugin repositories
script/plugin list
# list all available plugins
script/plugin install where
# install the a€wherea€? plugin
script/plugin install -x where
# install where plugin as SVN external
script/plugin install http://invisible.ch/projects/plugins/where
script/plugin update
# update installed plugins
script/plugin source
# add a source repository
script/plugin unsource
# removes a source repository
script/plugin sources
# lists source repositories
分享到:
相关推荐
跟踪Ruby on Rails命令,方法和错误的简单工具... Ruby版本:2.2.3 Rails版本:4.2.4 数据库: 开发与测试:SQLite3 生产:PostgreSQL 去做 向所有模型添加验证 搜索引擎=> Solr和Sunspot宝石。 使用搜索分支...
rails_best_practices的安装和使用都非常方便,只需简单两条命令就能知道代码中何处需要修改: sudo gem install rails_best_practices --source http://gemcutter.org rails_best_practices . 最新的0.3.3版本中...
基金会::铁路 Foundation :: Rails是一颗宝石,可以在即将到来的Rails项目中非常轻松地使用Foundation。安装将这些行添加到应用程序的Gemfile中: gem ' foundation-rails 'gem ' autoprefixer-rails ' 然后执行: ...
安装及使用 将此添加到您的Gemfile gem 'jquery-rails' gem 'rails_kindeditor' 注意:Rails 5.1已从默认设置中删除了对jQuery的依赖,但是rails_kindeditor需要'jquery-rails'。 运行“捆绑”命令。 bundle ...
您可以使用以下内容更新Rails。 $ gem update rails 安装 以下命令将为该项目安装gems。 $ bundle install 运行集成测试 该项目附带了一些针对REST API的集成测试。 您可以使用以下命令运行它们。 测试期间做出的...
议程上的Ruby联系人议程项目,在Ruby with Rails中实现。运行项目安装了Ruby和Rails后,运行命令```ruby rails sO projeto estará disponível em ```rubylocalhost:3000屏幕截图
可以在Rails控制器中使用响应器DSL,该控制器提供了一个基于事件的接口来处理最终用户发送的消息。 如果您的应用程序要求使用Wechat OAuth 2.0,则建议使用来应用身份验证。 如果在您的项目中使用了腾讯的weui UI...
要创建 Rails 应用程序,请在终端中使用以下命令。 $ rails new rails-heroku --database=postgresql 在这种情况下,我们需要指定将使用哪个数据库,Rails 具有默认的SQLite数据库,目前Heroku 不支持该数据库。 ...
适用于Nova的Rails迁移扩展提供命令以轻松...用法要快速打开最新的迁移,请执行以下操作: 打开命令面板Cmd+Shift+P 选择最新迁移要从列表中选择特定的迁移,请执行以下操作: 打开命令面板Cmd+Shift+P 选择选择迁移
受到的以及我以前使用Webpack / Tailwind CSS的 Rails应用程序的启发。 确保还签出以节省创建下一个Rails应用程序的时间。 克里斯,杰森和我合作。 刚接触Rails? 查看我称为课程或我的,以获取大量免费教程。 随...
使用 Vagrant 快速设置 Ruby on Rails 环境。 用法 安装 >= 1.2。 vagrant plugin install vagrant-berkshelf git clone git@github.com:1000k/rails_sandbox.git cp Vagrantfile.default Vagrantfile 编辑 ...
电源类型 Platanus 团队使用的 Rails 模式强制类型。介绍在 Rails 项目中,Platanus 鼓励使用模型和控制器之外的类来保存应用程序的逻辑。 提议的这些强大的类型是服务、命令、观察者、实用程序和值。 要更深入地...
用于Ruby on Rails核心开发的虚拟机 介绍 请注意,该虚拟机并非为Rails应用程序开发而设计,而仅是为Rails核心开发而设计... 安装完成后,您可以使用以下命令访问虚拟机: host $ vagrant ssh Welcome to Ubuntu 20.10
使用此组合的表单对象/命令对象来组织和验证Rails应用程序的业务逻辑。 目录 安装 将gem添加到应用程序的Gemfile 。 由于gem不是通过RubyGems发布的,因此您需要从GitHub安装它。 gem 'active_actions' , git : '...
编辑命令您可以使用一些额外的编辑命令,这些命令类似于vim-rails提供的命令。 就像vim-rails一样,它们在rails项目文件中被定义为本地缓冲区命令。 如果要全局定义它们,请参见下面的“”部分。 :Eschema <table> ...
要开发Rails应用程序,请使用以下命令。 script/bootstrapdocker-compose exec rails bash 您可以在docker容器中执行任何命令。入门您可以从这样的模板构建Rails应用程序。 git clone https://github.c
弹道 概要 Projectile Rails是用于在GNU Emacs中使用应用程序和引擎的次要模式。...一旦设置了 ,就可以使用package-install命令安装Projectile Rails。 软件包名称为projectile-rails 。 埃尔盖特 的软件包名
2.进入rails目录使用gem命令安装(这一步必须要上一步已经安装成功)。如果安装不成功使用ruby,如下: ruby -S gem install rails-2.2.2.gem 3.复制libmySQL.dll到ruby的安装目录的bin文件夹下,然后使用gem安装...
*的用法首先,使用常规的rails命令创建Ruby on Rails项目,但将其跳过: $ rails new app-name --skip-bundle 最后,启动生成器: $ cd app-name$ yo rails-mithril 对所有“覆盖”操作回答“是”。 如果您使用的...
发电机导轨角度要求 发电机 入门 要运行此版本的yeoman generator。 首先,请确保您已经安装了...首先,使用常规的rails命令创建Ruby on Rails项目,但将其跳过: $ rails new app-name --skip-bundle 最后,启动生