【问题标题】:What is a good .gitignore to use with Rails on Heroku?在 Heroku 上与 Rails 一起使用的好 .gitignore 是什么?
【发布时间】:2011-02-02 07:06:48
【问题描述】:

在 Heroku 上与 Rails 一起使用的好 .gitignore 是什么?

*.log  
*.sqlite3

还有什么?

【问题讨论】:

    标签: ruby-on-rails git heroku


    【解决方案1】:

    这非常类似于:Rails: exclude anything from version control? 这是我的答案。

    DHH 只要posted on Twitter,Rails 3 中就会有一个default .gitignore,其中包括:

    db/*.sqlite3
    log/*.log
    tmp/**/*
    

    这通常是我排除的。有些人还喜欢将 database.yml 文件排除在公共 repo 上并且您不想公开数据库密码时。

    【讨论】:

      【解决方案2】:

      请记住,Heroku 的 slug 编译器使用名为 .slugignore 的文件具有非常相似的功能。此文件语法大致.gitignore 中的相同。

      因此您可以继续照常工作(即:存储 PSD 文件、电子表格和其他常见文件),但在运行时将其删除on Heroku 以减小 slug 的大小(

      【讨论】:

      • 太棒了。但是.slugignore 文件将在它们上传后将其删除。所以你最终还是会提前上传大文件。
      【解决方案3】:

      https://github.com/github/gitignore/blob/master/Rails.gitignore

      *.rbc
      capybara-*.html
      .rspec
      /log
      /tmp
      /db/*.sqlite3
      /db/*.sqlite3-journal
      /public/system
      /coverage/
      /spec/tmp
      **.orig
      rerun.txt
      pickle-email-*.html
      
      # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
      config/initializers/secret_token.rb
      
      # Only include if you have production secrets in this file, which is no longer a Rails default
      # config/secrets.yml
      
      # dotenv
      # TODO Comment out this rule if environment variables can be committed
      .env
      
      ## Environment normalization:
      /.bundle
      /vendor/bundle
      
      # these should all be checked in to normalize the environment:
      # Gemfile.lock, .ruby-version, .ruby-gemset
      
      # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
      .rvmrc
      
      # if using bower-rails ignore default bower_components path bower.json files
      /vendor/assets/bower_components
      *.bowerrc
      bower.json
      
      # Ignore pow environment settings
      .powenv
      
      # Ignore Byebug command history file.
      .byebug_history
      

      【讨论】:

      • 太棒了,很高兴看到一堆我最喜欢的框架!
      【解决方案4】:

      Github 上有一个项目致力于为不同的语言、编辑器等存储准确的 gitignore 文件。虽然该项目目前没有特定于 Heroku 的条目,但您可能仍然会发现它很有用。该项目是here,Rails .gitignore 是here

      仅供参考,我最初是从this Stack Overflow 问题中了解到这个项目的。

      【讨论】:

        【解决方案5】:

        在 Heroku 上,最好的开始选择是:

        db/
        log/
        test/
        tmp/
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-02-12
          • 1970-01-01
          • 2021-02-09
          • 2010-12-11
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-09-06
          相关资源
          最近更新 更多