Skip to content

Commit 857a7b7

Browse files
committed
WIP subprojects
1 parent c494be6 commit 857a7b7

File tree

8 files changed

+26
-10
lines changed

8 files changed

+26
-10
lines changed

app/controllers/shipit/stacks_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def load_stack
154154
end
155155

156156
def create_params
157-
params.require(:stack).permit(:repo_owner, :repo_name, :environment, :branch, :deploy_url, :ignore_ci)
157+
params.require(:stack).permit(:repo_owner, :repo_name, :environment, :branch, :deploy_url, :ignore_ci, :path)
158158
end
159159

160160
def update_params

app/models/shipit/stack.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def github_repo_name
415415

416416
def github_commits
417417
handle_github_redirections do
418-
github_api.commits(github_repo_name, sha: branch)
418+
github_api.commits(github_repo_name, sha: branch, path: path)
419419
end
420420
rescue Octokit::Conflict
421421
[] # Repository is empty...

app/views/shipit/stacks/_settings_form.erb

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
<span>Branch: <%= stack.branch %></span>
1010
</div>
1111

12+
<% if stack.path.present? %>
13+
<div class="field-wrapper">
14+
<span>Path: <%= stack.path %></span>
15+
</div>
16+
<% end %>
17+
1218
<div class="field-wrapper">
1319
<%= f.label :deploy_url, 'Deploy URL (Where is this stack deployed to?)' %>
1420
<%= f.text_field :deploy_url, placeholder: 'https://' %>

app/views/shipit/stacks/new.html.erb

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
<%= f.label :environment %>
2424
<%= f.text_field :environment, placeholder: 'production' %>
2525
</div>
26+
<div class="field-wrapper">
27+
<%= f.label :path %>
28+
<span class="form-hint"><small>Only track a subpath of this repo?</small></span>
29+
<%= f.text_field :path, placeholder: '/' %>
30+
</div>
2631
<div class="field-wrapper">
2732
<%= f.label :deploy_url %>
2833
<span class="form-hint"><small>Where is this stack deployed to?</small></span>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddPathToStack < ActiveRecord::Migration[7.2]
2+
def change
3+
add_column :stacks, :path, :string
4+
end
5+
end

dev.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ up:
88
- packages:
99
- sqlite
1010
- ruby
11+
- redis
1112
- isogun
1213
- bundler:
1314
without: ci

lib/shipit.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def app_name
9595
end
9696

9797
def redis_url
98-
secrets.redis_url.present? ? URI(secrets.redis_url) : nil
98+
secrets.redis_url.present? ? URI(secrets.redis_url) : ENV["REDIS_URL"]
9999
end
100100

101101
def redis

test/dummy/db/schema.rb

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2023_07_03_181143) do
14-
13+
ActiveRecord::Schema[7.2].define(version: 2024_09_19_171423) do
1514
create_table "api_clients", force: :cascade do |t|
1615
t.text "permissions", limit: 65535
1716
t.integer "creator_id", limit: 4
@@ -197,8 +196,8 @@
197196
t.integer "user_id"
198197
t.text "labels"
199198
t.integer "head_id"
200-
t.datetime "created_at", precision: 6, null: false
201-
t.datetime "updated_at", precision: 6, null: false
199+
t.datetime "created_at", null: false
200+
t.datetime "updated_at", null: false
202201
t.index ["head_id"], name: "index_pull_requests_on_head_id"
203202
t.index ["stack_id", "github_id"], name: "index_pull_requests_on_stack_id_and_github_id", unique: true
204203
t.index ["stack_id", "number"], name: "index_pull_requests_on_stack_id_and_number", unique: true
@@ -223,8 +222,8 @@
223222
create_table "repositories", force: :cascade do |t|
224223
t.string "owner", limit: 39, null: false
225224
t.string "name", limit: 100, null: false
226-
t.datetime "created_at", precision: 6, null: false
227-
t.datetime "updated_at", precision: 6, null: false
225+
t.datetime "created_at", null: false
226+
t.datetime "updated_at", null: false
228227
t.boolean "review_stacks_enabled", default: false
229228
t.string "provisioning_behavior", default: "allow_all"
230229
t.string "provisioning_label_name"
@@ -255,6 +254,7 @@
255254
t.string "provision_status", default: "deprovisioned", null: false
256255
t.string "type", default: "Shipit::Stack"
257256
t.boolean "awaiting_provision", default: false, null: false
257+
t.string "path"
258258
t.index ["archived_since"], name: "index_stacks_on_archived_since"
259259
t.index ["awaiting_provision"], name: "index_stacks_on_awaiting_provision"
260260
t.index ["provision_status"], name: "index_stacks_on_provision_status"
@@ -338,5 +338,4 @@
338338
t.index ["login"], name: "index_users_on_login"
339339
t.index ["updated_at"], name: "index_users_on_updated_at"
340340
end
341-
342341
end

0 commit comments

Comments
 (0)