<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Rake tasks for developers > 原文:[https://docs.gitlab.com/ee/development/rake_tasks.html](https://docs.gitlab.com/ee/development/rake_tasks.html) * [Set up database with developer seeds](#set-up-database-with-developer-seeds) * [Environment variables](#environment-variables) * [Seeding issues for all or a given project](#seeding-issues-for-all-or-a-given-project) * [Seeding issues for Insights charts](#seeding-issues-for-insights-charts-ultimate) * [Seeding groups with sub-groups](#seeding-groups-with-sub-groups) * [Seeding custom metrics for the monitoring dashboard](#seeding-custom-metrics-for-the-monitoring-dashboard) * [Automation](#automation) * [Discard `stdout`](#discard-stdout) * [Extra Project seed options](#extra-project-seed-options) * [Run tests](#run-tests) * [Speed up tests, Rake tasks, and migrations](#speed-up-tests-rake-tasks-and-migrations) * [Compile Frontend Assets](#compile-frontend-assets) * [Emoji tasks](#emoji-tasks) * [Update project templates](#update-project-templates) * [Generate route lists](#generate-route-lists) * [Show obsolete `ignored_columns`](#show-obsolete-ignored_columns) * [Update GraphQL documentation and schema definitions](#update-graphql-documentation-and-schema-definitions) * [Update machine-readable schema files](#update-machine-readable-schema-files) # Rake tasks for developers[](#rake-tasks-for-developers "Permalink") Rake 任務適用于開發人員和為 GitLab 做出貢獻的其他人員. ## Set up database with developer seeds[](#set-up-database-with-developer-seeds "Permalink") 請注意,如果您的數據庫用戶沒有高級特權,則必須在運行此命令之前手動創建數據庫. ``` bundle exec rake setup ``` `setup`任務是`gitlab:setup`的別名. 此任務調用`db:reset`創建數據庫,并調用`db:seed_fu`播種數據庫. 注意: `db:setup`調用`db:seed`但這沒有任何作用. ### Environment variables[](#environment-variables "Permalink") **MASS_INSERT** :創建數百萬個用戶(2m),項目(5m)及其關系. 強烈建議將種子與種子一起運行,以在開發過程中捕獲緩慢的查詢. 預計此過程最多可能需要 20 分鐘. 另請參見[批量插入 Rails 模型](mass_insert.html) . **LARGE_PROJECTS** :從一組預定義的 URL 創建大型項目(通過導入). ### Seeding issues for all or a given project[](#seeding-issues-for-all-or-a-given-project "Permalink") 您可以使用`gitlab:seed:issues`任務為所有項目或給定項目`gitlab:seed:issues` : ``` # All projects bin/rake gitlab:seed:issues # A specific project bin/rake "gitlab:seed:issues[group-path/project-path]" ``` 默認情況下,每個項目的最近 5 周平均每周播種 2 個問題. #### Seeding issues for Insights charts[](#seeding-issues-for-insights-charts-ultimate "Permalink") 您可以使用`gitlab:seed:insights:issues`任務為專門用于處理[Insights 圖表](../user/group/insights/index.html)的`gitlab:seed:insights:issues` : ``` # All projects bin/rake gitlab:seed:insights:issues # A specific project bin/rake "gitlab:seed:insights:issues[group-path/project-path]" ``` 默認情況下,每個項目在最近 52 周中平均每周播種 10 個問題. 所有問題還將隨機標記團隊,類型,嚴重性和優先級. #### Seeding groups with sub-groups[](#seeding-groups-with-sub-groups "Permalink") 您可以使用`gitlab:seed:group_seed`任務為包含里程碑/項目/問題的子組播種組: ``` bin/rake "gitlab:seed:group_seed[subgroup_depth, username]" ``` 如果 GitLab 實例具有可用的史詩功能,則該組還會另外添加史詩. #### Seeding custom metrics for the monitoring dashboard[](#seeding-custom-metrics-for-the-monitoring-dashboard "Permalink") 監視儀表板中支持許多不同類型的指標. 要導入這些指標,可以運行: ``` bundle exec rake 'gitlab:seed:development_metrics[your_project_id]' ``` ### Automation[](#automation "Permalink") If you’re very sure that you want to **清除當前數據庫** and refill seeds, you could: ``` echo 'yes' | bundle exec rake setup ``` 使您免于手動回答`yes` . ### Discard `stdout`[](#discard-stdout "Permalink") 由于該腳本會打印很多信息,因此可能會減慢您的終端運行速度,并且如果您將其重定向到文件,則會生成 20G 以上的日志. 如果我們不在乎輸出,則可以將其重定向到`/dev/null` : ``` echo 'yes' | bundle exec rake setup > /dev/null ``` 請注意,由于您看不到`stdout`的問題,因此您可能只想`echo 'yes'`以使其運行. 它仍然會在`stderr`上打印錯誤,因此不必擔心丟失錯誤. ### Extra Project seed options[](#extra-project-seed-options "Permalink") 您可以傳遞一些環境標志來更改項目的種子方式 * `SIZE` :默認為`8` ,最大為`32` . 要創建的項目數量. * `LARGE_PROJECTS` :默認為 false. 如果設置,將克隆 6 個大型項目以幫助進行測試. * `FORK` :默認為 false. 如果設置為`true`將分叉`torvalds/linux`五次. 也可以將其設置為現有項目 full_path,它將代替它. ## Run tests[](#run-tests "Permalink") 為了運行測試,您可以使用以下命令: * `bin/rake spec`運行 RSpec 套件 * `bin/rake spec:unit`僅運行單元測試 * `bin/rake spec:integration`僅運行集成測試 * `bin/rake spec:system`僅運行系統測試 * `bin/rake karma`運行 Karma 測試套件 `bin/rake spec`需要花費大量時間. 無需在本地運行完整的測試套件,而是可以通過運行與更改相關的單個測試或目錄來節省大量時間. 提交合并請求后,CI 將為您運行完整的測試套件. 合并請求中的綠色 CI 狀態表示已通過完整的測試套件. 您不能運行`rspec .` 因為這將嘗試運行它可以找到的所有`_spec.rb`文件,以及`/tmp` 您可以將 RSpec 命令行選項傳遞給`spec:unit` , `spec:integration`和`spec:system`任務. 例如, `bin/rake "spec:unit[--tag ~geo --dry-run]"` . 對于 RSpec 測試,要運行一個測試文件,可以運行: ``` bin/rspec spec/controllers/commit_controller_spec.rb ``` 要在一個目錄中運行多個測試: * 如果僅想測試 API,則對 RSpec 測試使用`bin/rspec spec/requests/api/` ### Speed up tests, Rake tasks, and migrations[](#speed-up-tests-rake-tasks-and-migrations "Permalink") [Spring](https://github.com/rails/spring)是 Rails 應用程序的預加載器. 它通過使應用程序在后臺運行來加快開發速度,因此您無需在每次運行測試,Rake 任務或遷移時都啟動它. 如果要使用它,則需要將`ENABLE_SPRING`環境變量導出為`1` : ``` export ENABLE_SPRING=1 ``` 另外,您可以在每次運行規范時使用以下命令, ``` bundle exec spring rspec some_spec.rb ``` ## Compile Frontend Assets[](#compile-frontend-assets "Permalink") 您永遠不需要在開發中手動編譯前端資產,但是如果您需要測試在生產環境中如何編譯資產,則可以使用以下命令進行: ``` RAILS_ENV=production NODE_ENV=production bundle exec rake gitlab:assets:compile ``` 這將編譯并縮小所有 JavaScript 和 CSS 資產,并將它們與所有其他前端資產(圖像,字體等)一起復制到`/public/assets`中,以便于對其進行輕松檢查. ## Emoji tasks[](#emoji-tasks "Permalink") 要更新表情符號別名文件(用于表情符號自動完成),請運行以下命令: ``` bundle exec rake gemojione:aliases ``` 要更新表情符號摘要文件(用于表情符號自動完成),請運行以下命令: ``` bundle exec rake gemojione:digests ``` 這將根據當前可用的表情`fixtures/emojis/digests.json`更新`fixtures/emojis/digests.json`文件. 要生成包含所有表情符號的 Sprite 文件,請運行: ``` bundle exec rake gemojione:sprite ``` 如果添加了新的表情符號,則子畫面可能會更改大小. 為了補償這種變化,請首先使用上述 Rake 任務生成`emoji.png` Sprite 表,然后檢查新 Sprite 表的`SPRITESHEET_WIDTH`并`SPRITESHEET_HEIGHT`地更新`SPRITESHEET_WIDTH`和`SPRITESHEET_HEIGHT`常量. ## Update project templates[](#update-project-templates "Permalink") 從模板啟動項目需要將該項目導出. 在最新的 master 分支上運行: ``` gdk start bundle exec rake gitlab:update_project_templates git checkout -b update-project-templates git add vendor/project_templates git commit git push -u origin update-project-templates ``` 現在創建一個合并請求并將其合并到主請求. ## Generate route lists[](#generate-route-lists "Permalink") 要查看 API 路由的完整列表,可以運行: ``` bundle exec rake grape:path_helpers ``` 生成的列表包括 API 端點和功能性 RESTful API 動詞的完整列表. 對于 Rails 控制器,運行: ``` bundle exec rake routes ``` 由于創建這些文件需要一些時間,因此將輸出保存到文件以快速參考通常會很有幫助. ## Show obsolete `ignored_columns`[](#show-obsolete-ignored_columns "Permalink") 要查看所有已過時的`ignored_columns`的列表, `ignored_columns`運行: ``` bundle exec rake db:obsolete_ignored_columns ``` 隨時從自己的`ignored_columns`定義中刪除其定義. ## Update GraphQL documentation and schema definitions[](#update-graphql-documentation-and-schema-definitions "Permalink") 要基于 GitLab 模式生成 GraphQL 文檔,請運行: ``` bundle exec rake gitlab:graphql:compile_docs ``` 在當前狀態下,Rake 任務: * 生成 GraphQL 對象的輸出. * 將輸出放置在`doc/api/graphql/reference/index.md` . 這使用了來自`graphql-docs` gem 的一些功能,例如其模式解析器和幫助器方法. docs 生成器代碼來自于我們,為我們提供了更大的靈活性,例如使用 Haml 模板和生成 Markdown 文件. 要編輯使用的模板,請查看`lib/gitlab/graphql/docs/templates/default.md.haml` . 實際的渲染器位于`Gitlab::Graphql::Docs::Renderer` . `@parsed_schema`是`graphql-docs` gem 期望提供的實例變量. `Gitlab::Graphql::Docs::Helper`定義我們當前使用的`object`方法. 您還應該在這里為要顯示的新類型實現任何新方法. ### Update machine-readable schema files[](#update-machine-readable-schema-files "Permalink") 要基于 GitLab 模式生成 GraphQL 模式文件,請運行: ``` bundle exec rake gitlab:graphql:schema:dump ``` 它使用 GraphQL Ruby 的內置 Rake 任務來生成[IDL](https://www.prisma.io/blog/graphql-sdl-schema-definition-language-6755bcb9ce51)和 JSON 格式的文件.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看