威尼斯人线上娱乐

Rails上手笔记,安装使用全经过

11 4月 , 2019  

rails框架默许有四个格局development(开发),production(上线),test(测试)

有机遇再试一试Rails了,只是原先接触的是二,以往尘埃落定成为了四,就像未来的设置比原来会快些。。

有时机再试1试Rails了,只是原先接触的是二,未来已然成为了四,就像今后的设置比原来会快些。。

参考原著:http://www.linuxidc.com/Linux/2014-08/105137.htm

Development

 config.cache_classes =
false 每一趟请求都会再次加载,修改代码之后能够直接采取。

 config.consider_all_requests_local =
true 在地面测试的时候能够展现全部的一无可取。

 config.action_controller.perform_caching =
false 

 config.action_mailer.raise_delivery_errors =
false 要是寄信退步,是或不是要丢出分裂。建议足以改成 true。

 config.active_support.deprecation =
:log 随着 Rails
版本的提拔,如若有方法会在后来的版本中移除,deprecation
会提醒您怎么因应。那里的 :log 表示会记录到 log 档案中。

 

Rails 4 安装

Rails 4 安装

1 关于gitlab7

Production 模式

 config.cache_classes =
true 与开发环境不相同,把数量保存在内部存款和储蓄器中,速度越来越快

 config.action_controller.perform_caching =
true 不相同于 development,假设在 production
环境出现分裂错误,不会显示程式 call stack 信息,而是回传 public/500.html
页面。

 config.serve_static_assets =
false “X-Sendfile”
是网页服务器提供的意义,能够让下载档案的动作完全委派给网页服务器,Rails
送出 X-Sendfile 标头后就毋需再佔住财富。

 config.force_ssl =
true 是不是限制全站必须SSL才能利用。 

 config.logger =
ActiveSupport::TaggedLogging.new(SyslogLogger.new) 能够转换掉
Rails 内建的 Logger,例如换来使用 syslog
的 SyslogLogger。

 config.cache_store =
:mem_cache_store 设定不一致的快取储存库,暗中同意是
:memory_store,也即是各个 Rails process
各自用内部存款和储蓄器存放。产业界最常用的则是 memcached 内部存款和储蓄器快取服务器

 config.action_controller.asset_host =
“” 暗中认可的静态档案地方是日前主机的
public 目录,你能够因此修改 asset_host
变更地点。例如你的静态档案放在区别台机器或 CDN(Content delivery network)
上。

 

针对于安装了中华VVM

针对于安装了智跑VM

无论怎么样gitlab是个好东西,可是极难安装和配备。bitnami(

Test 模式

 config.action_dispatch.show_exceptions =
false 分歧于 development 或 production
际遇例外会捕捉例外后,给浏览器彰显出 call stack trace 或 public/500.html
画面,在 test 情势就不处理,让分歧直接报错。

 config.action_mailer.delivery_method =
:test 测试格局下不会真的去寄送email

 config.active_support.deprecation =
:stderr 让 deprecation 消息会间接浮现到视窗之中

 

复制代码 代码如下:

复制代码 代码如下:

首先,bitmami的有个别本子有失水准,不能够得逞在rhel陆.四上成功安装。因而,作者找到了三个较新的能够选拔的本子7.八.一(响应式页面):

gem install rails

gem install rails

ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

从未有过的话应当如此:

并未有的话应当这么:

(我的ftp不会平素提供,请想要的赶紧下载)

复制代码 代码如下:

复制代码 代码如下:

那么,最终安装好的效率就是(点击可访问,第壹遍访问恐怕会相比慢,供给较新本子的firefox或chrome,IE未测试):

sudo gem install rails

sudo gem install rails

设置TiguanVM能够用句

设置奥迪Q5VM能够用句

2 供给描述

复制代码 代码如下:

复制代码 代码如下:

好了,先把须求陈述一下,如若读者的急需与自笔者不一致,作者①筹莫展。要是笔者有1台web主机(笔者那边是pepstack.com),小编在主机前边成立虚拟机(vm-gitlab),在vm-gitlab上设置gitlab7,然后经过配备web主机上的ngnix,能够通过下边包车型地铁url访问到本人的gitlab:

curl -L | bash -s stable

curl -L | bash -s stable

**查看rails版本

**查看rails版本

成立虚拟机vm-gitlab的进度不细说了,假使您使用实体机也是一样的。vm-gitlab安装的是rhel陆.4版本。确定保证在vm内部能够访问外部主机和internet(如ping
www.baidu.com)。

**

**

3 安装gitlab

复制代码 代码如下:

复制代码 代码如下:

ssh 到vm-gitlab:

rails -v
Rails 4.0.3

rails -v
Rails 4.0.3

# ssh root@vm-gitlab

就像那就是时下的新式版本

有如那正是近年来的摩登版本

下载1键式安装包:

Ruby版本

Ruby版本

# wget
ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

复制代码 代码如下:

复制代码 代码如下:

安装:

We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby
1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5.

We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby
1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5.

# chmod a+x bitnami-gitlab-7.8.1-0-linux-x64-installer.run

法定推荐用2.壹.0. 也等于新型版本

合法推荐用二.壹.0. 也便是风靡版本

# ./bitnami-gitlab-7.8.1-0-linux-x64-installer.run

安装SQLite

安装SQLite

安装过程中会提示:

有如那就是比如说Django、Rails那类对于轻量级网址的数据库供给。

就像这正是比如说Django、Rails那类对于轻量级网址的数据库供给。


如果是mac os

如果是mac os

Welcome to the Bitnami Gitlab Stack Setup Wizard.

复制代码 代码如下:

复制代码 代码如下:


brew install sqlite3

brew install sqlite3

Select the components you want to install; clear the components you do
not want
to install. Click Next when you are ready to continue.

其他能够看状态设置,如openSUSE

任何能够看事态设置,如openSUSE

GitLab : Y (Cannot be edited)

复制代码 代码如下:

复制代码 代码如下:

GitLab CI [Y/n] :Y

sudo zypper install sqlite3

sudo zypper install sqlite3

Is the selection above correct? [Y/n]: Y

Rails 4 Hello,World

Rails 4 Hello,World


能够平昔用rails生成

可以一直用rails生成

Installation folder

Rails上手笔记,安装使用全经过。复制代码 代码如下:

复制代码 代码如下:

Please, choose a folder to install Bitnami Gitlab Stack

$rails new hello

$rails new hello

Select a folder [/opt/gitlab-7.8.1-0]:

于是就有了

于是乎就有了


复制代码 代码如下:

复制代码 代码如下:

Create Admin account

  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  lib
  create  lib/tasks
  create  lib/tasks/.keep
  create  lib/assets
  create  lib/assets/.keep
  create  log
  create  log/.keep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.keep
  create  test/controllers
  create  test/controllers/.keep
  create  test/mailers
  create  test/mailers/.keep
  create  test/models
  create  test/models/.keep
  create  test/helpers
  create  test/helpers/.keep
  create  test/integration
  create  test/integration/.keep
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
run  bundle install

  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  lib
  create  lib/tasks
  create  lib/tasks/.keep
  create  lib/assets
  create  lib/assets/.keep
  create  log
  create  log/.keep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.keep
  create  test/controllers
  create  test/controllers/.keep
  create  test/mailers
  create  test/mailers/.keep
  create  test/models
  create  test/models/.keep
  create  test/helpers
  create  test/helpers/.keep
  create  test/integration
  create  test/integration/.keep
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
run  bundle install

Bitnami Gitlab Stack admin user creation

紧接着会安装包注重

随之会设置包注重

Email Address [user@example.com]: cheungmine@qq.com

复制代码 代码如下:

复制代码 代码如下:

Login [user]: master (此处是您登录gitlab用的用户名)

  Fetching gem metadata from ……….
  Fetching additional metadata from ..
  Resolving dependencies…
  Using rake (10.3.1)
  Using i18n (0.6.9)
  Using minitest (4.7.5)
  Using multi_json (1.9.2)
  Using thread_safe (0.3.3)
  Using tzinfo (0.3.39)
  Using activesupport (4.0.3)
  Using builder (3.1.4)
  Using erubis (2.7.0)
  Using rack (1.5.2)
  Using rack-test (0.6.2)
  Using actionpack (4.0.3)
  Using mime-types (1.25.1)
  Using polyglot (0.3.4)
  Using treetop (1.4.15)
  Using mail (2.5.4)
  Using actionmailer (4.0.3)
  Using activemodel (4.0.3)
  Using activerecord-deprecated_finders (1.0.3)
  Using arel (4.0.2)
  Using activerecord (4.0.3)
  Using bundler (1.5.3)
  Using coffee-script-source (1.7.0)
  Using execjs (2.0.2)
  Using coffee-script (2.2.0)
  Using thor (0.19.1)
  Using railties (4.0.3)
  Using coffee-rails (4.0.1)
  Using hike (1.2.3)
  Using jbuilder (1.5.3)
  Using jquery-rails (3.1.0)
  Using json (1.8.1)
  Using tilt (1.4.1)
  Using sprockets (2.11.0)
  Using sprockets-rails (2.0.1)
  Using rails (4.0.3)
  Using rdoc (4.1.1)
  Using sass (3.2.19)
  Using sass-rails (4.0.3)
  Using sdoc (0.4.0)
  Using sqlite3 (1.3.9)
  Using turbolinks (2.2.2)
  Using uglifier (2.5.0)
  Your bundle is complete!
  Use `bundle show [gemname]` to see where a bundled gem is
installed.

  Fetching gem metadata from ……….
  Fetching additional metadata from ..
  Resolving dependencies…
  Using rake (10.3.1)
  Using i18n (0.6.9)
  Using minitest (4.7.5)
  Using multi_json (1.9.2)
  Using thread_safe (0.3.3)
  Using tzinfo (0.3.39)
  Using activesupport (4.0.3)
  Using builder (3.1.4)
  Using erubis (2.7.0)
  Using rack (1.5.2)
  Using rack-test (0.6.2)
  Using actionpack (4.0.3)
  Using mime-types (1.25.1)
  Using polyglot (0.3.4)
  Using treetop (1.4.15)
  Using mail (2.5.4)
  Using actionmailer (4.0.3)
  Using activemodel (4.0.3)
  Using activerecord-deprecated_finders (1.0.3)
  Using arel (4.0.2)
  Using activerecord (4.0.3)
  Using bundler (1.5.3)
  Using coffee-script-source (1.7.0)
  Using execjs (2.0.2)
  Using coffee-script (2.2.0)
  Using thor (0.19.1)
  Using railties (4.0.3)
  Using coffee-rails (4.0.1)
  Using hike (1.2.3)
  Using jbuilder (1.5.3)
  Using jquery-rails (3.1.0)
  Using json (1.8.1)
  Using tilt (1.4.1)
  Using sprockets (2.11.0)
  Using sprockets-rails (2.0.1)
  Using rails (4.0.3)
  Using rdoc (4.1.1)
  Using sass (3.2.19)
  Using sass-rails (4.0.3)
  Using sdoc (0.4.0)
  Using sqlite3 (1.3.9)
  Using turbolinks (2.2.2)
  Using uglifier (2.5.0)
  Your bundle is complete!
  Use `bundle show [gemname]` to see where a bundled gem is
installed.

Password : (输入你登录gitlab时要用的密码)

运行Rails

运行Rails

Please confirm your password :  (输入你登录gitlab时要用的密码)

Hostname that will be used to create internal URLs. If this value is
incorrect,
you may be unable to access your Gitlab installation from other
computers. It is
advisable to use a Domain instead of an IP address for compatibility
with
different browsers.

Domain [127.0.0.1]:

Do you want to configure mail support? [y/N]: Y


Configure SMTP Settings

This is required so your application can send notifications via email.

Default email provider:

[1] GMail
[2] Custom
Please choose an option [1] : 2


Configure SMTP Settings

This data is stored in the application configuration files and may be
visible to
others. For this reason, it is recommended that you do not use your
personal
account credentials.

Username []: cheungmine@qq.com

Password : (输入你的QQ密码)
Re-enter : (输入你的QQ密码)
SMTP Host []: smtp.qq.com

SMTP Port []: 25

Secure connection

[1] None
[2] SSL
[3] TLS
Please choose an option [3] :


Setup is now ready to begin installing Bitnami Gitlab Stack on your
computer.

Do you want to continue? [Y/n]: Y


Please wait while Setup installs Bitnami Gitlab Stack on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################


Setup has finished installing Bitnami Gitlab Stack on your computer.

Info: To access the Bitnami Gitlab Stack, go to
from your browser.
Press [Enter] to continue:

4 配置gitlab
布署更是要小心。下边多少个布局文件要用到:

/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/environments/production.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/initializers/smtp_settings.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/gitlab.yml
/opt/gitlab-7.8.1-0/apps/gitlab/conf/httpd-app.conf
/opt/gitlab-7.8.1-0/apps/gitlab/gitlab-shell/config.yml

上面逐一说明:

4.1 production.rb

……
  # config.action_mailer.delivery_method = :sendmail
  # Defaults to:
  # # config.action_mailer.sendmail_settings = {
  # #  location: ‘/usr/sbin/sendmail’,
  # #  arguments: ‘-i -t’
  # # }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => “smtp.qq.com”,
    :port => “25”,
    :domain => “qq.com”,
    :authentication => :plain,
    :user_name => “cheungmine@qq.com”,
    :password => “********”,
    :enable_starttls_auto => true
  }

  config.eager_load = true
  config.assets.js_compressor = :uglifier

  config.allow_concurrency = false
……

4.2 smtp_settings.rb
# cp smtp_settings.rb.sample smtp_settings.rb

# To enable smtp email delivery for your GitLab instance do the
following:
# 1. Rename smtp_settings.rb.sample to smtp_settings.rb
# 2. Edit settings inside this file
# 3. Restart GitLab instance
#
if Rails.env.production?
  Gitlab::Application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: “smtp.qq.com”,
    port: 25,
    user_name: “cheungmine@qq.com”,
    password: “********”,
    domain: “qq.com”,
    authentication: :login,
    enable_starttls_auto: true,
    openssl_verify_mode: ‘none’
  }
end

4.3 gitlab.yml

# # # # # # # # # # # # # # # # # #
# GitLab application config file  #
# # # # # # # # # # # # # # # # # #
#
# How to use:
# 1. Copy file as gitlab.yml
# 2. Update gitlab -> host with your fully qualified domain name
# 3. Update gitlab -> email_from
# 4. If you installed Git from source, change git -> bin_path to
/usr/local/bin/git
# 5. Review this configuration file for other settings you may want to
adjust

production: &base
  #
威尼斯人线上娱乐,  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include
http://)
    host: pepstack.com
    port: 80                # Set to 443 if using HTTPS, see
installation.md#using-https for additional HTTPS configuration
details
    https: false            # Set to true if using HTTPS, see
installation.md#using-https for additional HTTPS configuration details

    # Uncommment this line below if your ssh host is different from
HTTP/HTTPS one
    # (you’d obviously need to replace ssh.host_example.com with your
own host).
    # Otherwise, ssh host will be set to the `host:` value above
    # ssh_host: ssh.host_example.com

    # WARNING: See config/application.rb under “Relative url support”
for the list of
    # other files that need to be changed for relative url support
    relative_url_root: /gitlab

    # Uncomment and customize if you can’t use the default user to run
GitLab (default: ‘git’)
    # user: git

    ## Date & Time settings
    # Uncomment and customize if you want to change the default time
zone of GitLab application.
    # To see all available zones, run `bundle exec rake time:zones:all
RAILS_ENV=production`
    # time_zone: ‘UTC’

    ## Email settings
    # Uncomment and set to false if you need to disable email sending
from GitLab (default: true)
    # email_enabled: true
    # Email address used in the “From” field in mails sent by GitLab
    email_from: cheungmine@qq.com
    support_email: cheungmine@qq.com

    # Email server smtp settings are in
config/initializers/smtp_settings.rb.sample

    # default_can_create_group: false  # default: true
    # username_changing_enabled: false # default: true – User can
change her username/namespace
    ## Default theme
    ##  BASIC  = 1
    ##  MARS  = 2
    ##  MODERN = 3
    ##  GRAY  = 4
    ##  COLOR  = 5
    # default_theme: 2 # default: 2
……

上边文件改动之处在于:

host: pepstack.com
relative_url_root: /gitlab
email_from: cheungmine@qq.com
support_email: cheungmine@qq.com

上面包车型大巴配备是因为要把gitlab置于nginx前边使用:

4.4 httpd-app.conf

<Directory “/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/public”>
    Options -MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>

    SetEnv RAILS_RELATIVE_URL_ROOT “/gitlab”

    PassengerEnabled on
    PassengerAppRoot “/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/”
    <IfModule pagespeed_module>
        ModPagespeedDisallow “*”
    </IfModule>
    PassengerUser git
    PassengerGroup git
    SetEnv MAGIC
“/opt/gitlab-7.8.1-0/ruby/lib/ruby/gems/2.0.0/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic/magic.mgc”
    SetEnv PATH “/opt/gitlab-7.8.1-0/python/bin:${PATH}”

</Directory>
PassengerPreStart

不一样之处在于:

SetEnv RAILS_RELATIVE_URL_ROOT “/gitlab”
PassengerPreStart

4.5 config.yml


gitlab_url:

那样大家访问gitlab正是遵照下边包车型大巴地方:

5 主机nginx配置

上面包车型大巴布局都以在vm-gitlab上进展的,注意打开80:http端口。上面要给主机nginx扩大计划,配置文件:

/etc/nginx/conf.d/redmine.conf

剧情如下(作者还要还提供了redmine服务):

# 指向内网redmine的web服务(1九二.168.12二.贰一:80)
#
upstream redmine {
    server 192.168.122.21:80;
}

upstream gitlab {
    server 192.168.122.20:80;
}

server {
    server_name pepstack.com;

    # /var/log/nginx 本地目录必须存在
    access_log  /var/log/nginx/redmine_access.log;
    error_log  /var/log/nginx/redmine_error.log;

    location /redmine {
        try_files $uri @red;      # @red 名字是随机的
    }

    location /gitlab {
        try_files $uri @git;
    }

    location @red {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For 
$proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream redmine
    }

    location @git {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For 
$proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream gitlab
    }
}

即注释掉:include /etc/nginx/sites-enabled/*;

6 运营服务

居功至伟告成,在主机运维nginx:

$ sudo nginx -s reload

在vm-gitlab启动gitlab:

# cd /opt/gitlab-7.8.1-0/

# ./ctlscript.sh restart

威尼斯人线上娱乐 1

CentOS源码安装GitLab汉化版 
http://www.linuxidc.com/Linux/2015-10/124648.htm

在 Ubuntu 12.04 上安装
GitLab
http://www.linuxidc.com/Linux/2012-12/75249.htm

GitLab 伍.三 升级注意事项
http://www.linuxidc.com/Linux/2013-06/86473.htm

在 CentOS 上配置 GitLab (自托管的Git项目仓库)
http://www.linuxidc.com/Linux/2013-06/85754.htm

在RHEL6/CentOS6/ScientificLinux6上安装GitLab 6.0.2
http://www.linuxidc.com/Linux/2014-03/97831.htm

CentOS 陆.5安装GitLab教程及连锁难点化解
http://www.linuxidc.com/Linux/2014-05/101526.htm

GitLab
的详尽介绍
:请点那里
GitLab
的下载地址
:请点那里

正文永久更新链接地址:http://www.linuxidc.com/Linux/2015-11/124919.htm

威尼斯人线上娱乐 2

复制代码 代码如下:

复制代码 代码如下:

$rails server

$rails server

那样的话打开 就足以见到,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的马化腾(英文名:Pony)~~

那样的话打开 就能够见见,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的腾讯董事长马化腾~~

威尼斯人线上娱乐 3

威尼斯人线上娱乐 4

创建controller

创建controller

如官方指南所说

如官方指南所说

执行命令:

执行命令:

复制代码 代码如下:

复制代码 代码如下:

$rails generate controller welcome index

$rails generate controller welcome index

就会成立上边那个文件:

就会创建上面这几个文件:

复制代码 代码如下:

复制代码 代码如下:

  create  app/controllers/welcome_controller.rb
   route  get “welcome/index”
  invoke  erb
  create    app/views/welcome
  create    app/views/welcome/index.html.erb
  invoke  test_unit
  create    test/controllers/welcome_controller_test.rb
  invoke  helper
  create    app/helpers/welcome_helper.rb
  invoke    test_unit
  create      test/helpers/welcome_helper_test.rb
  invoke  assets
  invoke    coffee
  create      app/assets/javascripts/welcome.js.coffee
  invoke    scss
  create      app/assets/stylesheets/welcome.css.scss

  create  app/controllers/welcome_controller.rb
   route  get “welcome/index”
  invoke  erb
  create    app/views/welcome
  create    app/views/welcome/index.html.erb
  invoke  test_unit
  create    test/controllers/welcome_controller_test.rb
  invoke  helper
  create    app/helpers/welcome_helper.rb
  invoke    test_unit
  create      test/helpers/welcome_helper_test.rb
  invoke  assets
  invoke    coffee
  create      app/assets/javascripts/welcome.js.coffee
  invoke    scss
  create      app/assets/stylesheets/welcome.css.scss

在config/routes.rb添加暗许页面

在config/routes.rb添加暗许页面

复制代码 代码如下:

复制代码 代码如下:

root ‘welcome#index’

root ‘welcome#index’

再运行

再运行

复制代码 代码如下:

复制代码 代码如下:

rails server

rails server

就会现出

就会冒出

复制代码 代码如下:

复制代码 代码如下:

Welcome#index

Welcome#index

Find me in app/views/welcome/index.html.erb

Find me in app/views/welcome/index.html.erb

壹切来得神速,很突兀。

整个来得相当的慢,很突兀。

您恐怕感兴趣的稿子:

  • 飞快安装Ruby on
    Rails的肯定指南
  • win七安装ruby on
    rails开发条件
  • 在 Ubuntu 1二.04 Server 上安装配置 Ruby on Rails
    应用
  • Windows下Ruby on
    Rails开发环境设置配备图像和文字化教育程
  • CentOS7下搭建ruby on
    rails开发条件
  • Ruby on
    Rails下的图像处理入门教程
  • 多少个加速Ruby on
    Rails的编制程序技巧
  • Ruby on rails安装后去掉DL is deprecated,please use
    Fiddle警告信息的法门【测试可用】

Rails 四 安装 针对于安装了CR-VVM 复制代码…


相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图