ship_it 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/Gemfile +16 -0
- data/MIT-LICENSE +20 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/javascripts/application.js +28 -0
- data/app/assets/javascripts/polling.coffee +44 -0
- data/app/assets/stylesheets/application.css +24 -0
- data/app/controllers/application_controller.rb +34 -0
- data/app/controllers/branches_controller.rb +2 -0
- data/app/controllers/commits_controller.rb +2 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/deploy_options_controller.rb +38 -0
- data/app/controllers/deployments_controller.rb +70 -0
- data/app/controllers/environments_controller.rb +23 -0
- data/app/controllers/projects_controller.rb +51 -0
- data/app/controllers/sessions_controller.rb +31 -0
- data/app/controllers/users_controller.rb +2 -0
- data/app/helpers/application_helper.rb +70 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/branch.rb +15 -0
- data/app/models/commit.rb +8 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/deploy_option.rb +11 -0
- data/app/models/deployment.rb +137 -0
- data/app/models/environment.rb +29 -0
- data/app/models/project.rb +79 -0
- data/app/models/user.rb +18 -0
- data/app/views/deploy_options/new.html.slim +15 -0
- data/app/views/deployments/_current.html.slim +15 -0
- data/app/views/deployments/_deployment.html.slim +15 -0
- data/app/views/deployments/_details.html.slim +26 -0
- data/app/views/deployments/_progress.html.slim +2 -0
- data/app/views/deployments/in_progress.js.erb +1 -0
- data/app/views/deployments/show.html.slim +38 -0
- data/app/views/deployments/show.js.erb +1 -0
- data/app/views/environments/_changes.html.slim +24 -0
- data/app/views/environments/changes.js.erb +1 -0
- data/app/views/environments/show.html.slim +36 -0
- data/app/views/layouts/application.html.slim +30 -0
- data/app/views/layouts/homepage.html.slim +10 -0
- data/app/views/projects/edit.html.slim +27 -0
- data/app/views/projects/index.html.slim +22 -0
- data/app/views/projects/new.html.slim +11 -0
- data/app/views/projects/show.html.slim +29 -0
- data/app/views/sessions/homepage.html.slim +6 -0
- data/app/views/sessions/new.html.slim +7 -0
- data/bin/bundle +3 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/bin/ship_it +44 -0
- data/config.ru +4 -0
- data/config/application.rb +23 -0
- data/config/boot.rb +4 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +29 -0
- data/config/environments/production.rb +80 -0
- data/config/environments/test.rb +36 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/omniauth_providers_patch.rb +16 -0
- data/config/initializers/secret_token.rb +12 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +28 -0
- data/db/migrate/20130828221203_create_projects.rb +9 -0
- data/db/migrate/20130828232058_create_deployments.rb +16 -0
- data/db/migrate/20130828234740_create_users.rb +9 -0
- data/db/migrate/20130828234748_create_deploy_options.rb +11 -0
- data/db/migrate/20130828234808_create_branches.rb +9 -0
- data/db/migrate/20130828234814_create_commits.rb +10 -0
- data/db/migrate/20130828234822_create_environments.rb +9 -0
- data/db/schema.rb +80 -0
- data/db/seeds.rb +7 -0
- data/lib/assets/.keep +0 -0
- data/lib/ship_it.rb +9 -0
- data/lib/ship_it/rails_app.rb +12 -0
- data/lib/ship_it/version.rb +3 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/ship_it.rake +76 -0
- data/log/.keep +0 -0
- data/public/404.html +58 -0
- data/public/422.html +58 -0
- data/public/500.html +57 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- data/ship_it.gemspec +38 -0
- data/templates/project/.gitignore +6 -0
- data/templates/project/Gemfile +6 -0
- data/templates/project/config.ru +8 -0
- data/templates/project/config/database.yml +23 -0
- data/templates/project/db/.gitkeep +0 -0
- data/templates/project/db/schema.rb +75 -0
- data/templates/project/lib/ship_it/railtie.rb +20 -0
- data/templates/project/log/.gitkeep +0 -0
- data/test/controllers/.keep +0 -0
- data/test/controllers/branches_controller_test.rb +7 -0
- data/test/controllers/commits_controller_test.rb +7 -0
- data/test/controllers/configurations_controller_test.rb +7 -0
- data/test/controllers/deploy_options_controller_test.rb +7 -0
- data/test/controllers/deployments_controller_test.rb +7 -0
- data/test/controllers/environments_controller_test.rb +7 -0
- data/test/controllers/projects_controller_test.rb +7 -0
- data/test/controllers/users_controller_test.rb +7 -0
- data/test/fixtures/.keep +0 -0
- data/test/fixtures/branches.yml +11 -0
- data/test/fixtures/commits.yml +11 -0
- data/test/fixtures/configurations.yml +11 -0
- data/test/fixtures/deploy_options.yml +11 -0
- data/test/fixtures/deployments.yml +11 -0
- data/test/fixtures/environments.yml +11 -0
- data/test/fixtures/projects.yml +11 -0
- data/test/fixtures/users.yml +11 -0
- data/test/helpers/.keep +0 -0
- data/test/helpers/branches_helper_test.rb +4 -0
- data/test/helpers/commits_helper_test.rb +4 -0
- data/test/helpers/configurations_helper_test.rb +4 -0
- data/test/helpers/deploy_options_helper_test.rb +4 -0
- data/test/helpers/deployments_helper_test.rb +4 -0
- data/test/helpers/environments_helper_test.rb +4 -0
- data/test/helpers/projects_helper_test.rb +4 -0
- data/test/helpers/users_helper_test.rb +4 -0
- data/test/integration/.keep +0 -0
- data/test/mailers/.keep +0 -0
- data/test/models/.keep +0 -0
- data/test/models/branch_test.rb +7 -0
- data/test/models/commit_test.rb +7 -0
- data/test/models/configuration_test.rb +7 -0
- data/test/models/deploy_option_test.rb +7 -0
- data/test/models/deployment_test.rb +7 -0
- data/test/models/environment_test.rb +7 -0
- data/test/models/project_test.rb +7 -0
- data/test/models/user_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- metadata +431 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
li
|
2
|
+
= link_to [deployment.project, deployment.environment, deployment] do
|
3
|
+
= deployment.project.name
|
4
|
+
| /
|
5
|
+
= deployment.branch.name
|
6
|
+
| ⇒
|
7
|
+
= deployment.environment.name
|
8
|
+
br
|
9
|
+
- if deployment.failed?
|
10
|
+
| Failed at
|
11
|
+
= deployment.finished_at.to_s(:short)
|
12
|
+
- elsif deployment.started?
|
13
|
+
| Started at
|
14
|
+
= deployment.started_at.to_s(:short)
|
15
|
+
= render partial: 'deployments/progress', locals: {deployment: deployment}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
- environment = deployment.environment
|
2
|
+
- project = environment.project
|
3
|
+
|
4
|
+
dl.status.dl-horizontal data-deployment-id=deployment.id data-poll=(deployment.completed? ? nil : polymorphic_path([project, environment, deployment], format: :js))
|
5
|
+
dt Status:
|
6
|
+
dd = deployment.status
|
7
|
+
|
8
|
+
- if deployment.completed?
|
9
|
+
dt Duration:
|
10
|
+
dd = duration_text(deployment.duration)
|
11
|
+
- elsif deployment.started?
|
12
|
+
dt Time remaining:
|
13
|
+
dd = time_remaining(deployment)
|
14
|
+
|
15
|
+
dt Progress:
|
16
|
+
dd = render partial: 'progress', locals: {deployment: deployment}
|
17
|
+
|
18
|
+
- unless deployment.user_terminated?
|
19
|
+
= link_to "Terminate", [:terminate, project, environment, deployment], remote: true, class: 'btn'
|
20
|
+
|
21
|
+
- if deployment.failed?
|
22
|
+
- new_deployment = Deployment.new(branch_id: deployment.branch_id, revision: deployment.revision)
|
23
|
+
= form_for([project, environment, new_deployment], html: {class: 'form form-inline'}) do |form|
|
24
|
+
= form.hidden_field :branch_id
|
25
|
+
= form.hidden_field :revision
|
26
|
+
= form.submit 'Re-deploy', class: 'btn btn-primary'
|
@@ -0,0 +1 @@
|
|
1
|
+
$(".current_deployments").replaceWith("<%= escape_javascript render partial: "deployments/current" %>");
|
@@ -0,0 +1,38 @@
|
|
1
|
+
h1 #{@project.name} : #{@environment.name}
|
2
|
+
|
3
|
+
dl.dl-horizontal
|
4
|
+
dt Branch:
|
5
|
+
dd = @deployment.branch.name
|
6
|
+
|
7
|
+
dt Revision:
|
8
|
+
dd = @deployment.revision
|
9
|
+
|
10
|
+
dt Deployed at:
|
11
|
+
dd = @deployment.created_at.to_s(:short)
|
12
|
+
|
13
|
+
dt Deployed by:
|
14
|
+
dd = @deployment.created_by.andand.name || "unknown"
|
15
|
+
|
16
|
+
= render partial: "details", locals: {deployment: @deployment}
|
17
|
+
|
18
|
+
h3 Commits
|
19
|
+
table.table.table-striped
|
20
|
+
thead
|
21
|
+
tr
|
22
|
+
th Revision
|
23
|
+
th Message
|
24
|
+
tbody
|
25
|
+
- @deployment.commits.each do |commit|
|
26
|
+
tr
|
27
|
+
td = commit.sha[0...8]
|
28
|
+
td = commit.message
|
29
|
+
|
30
|
+
h3 Log
|
31
|
+
|
32
|
+
- if @deployment.completed?
|
33
|
+
pre#log
|
34
|
+
= @deployment.log
|
35
|
+
- else
|
36
|
+
pre#log.uncompleted data-poll-log=polymorphic_path([:log, @project, @environment, @deployment]) data-poll-log-start=(@deployment.log.andand.length || 0)
|
37
|
+
= @deployment.log
|
38
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
$('.status[data-deployment-id="<%= @deployment.id %>"]').replaceWith("<%= escape_javascript render partial: 'details', locals: {deployment: @deployment} %>");
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/ environment
|
2
|
+
/ branch
|
3
|
+
- changes = environment.pending_changes(branch)
|
4
|
+
|
5
|
+
h3 Pending Commits
|
6
|
+
- if changes.present?
|
7
|
+
table.table.table-striped
|
8
|
+
thead
|
9
|
+
tr
|
10
|
+
th Revision
|
11
|
+
th Message
|
12
|
+
tbody
|
13
|
+
- changes.each do |commit|
|
14
|
+
tr
|
15
|
+
td commit.sha[0...8]
|
16
|
+
td commit.message
|
17
|
+
- elsif branch.last_commit
|
18
|
+
p.muted
|
19
|
+
| None.
|
20
|
+
br
|
21
|
+
| Last commit: [#{branch.last_commit.sha[0...8]}] #{branch.last_commit.message}
|
22
|
+
- else
|
23
|
+
p.muted
|
24
|
+
| None.
|
@@ -0,0 +1 @@
|
|
1
|
+
$("#pending_changes").html("<%= escape_javascript render partial: 'changes', locals: {branch: @branch, environment: @environment} %>");
|
@@ -0,0 +1,36 @@
|
|
1
|
+
h1 #{@project.name} : #{@environment.name}
|
2
|
+
|
3
|
+
= form_for [@project, @environment, Deployment.new], html: {class: "form form-inline"} do |form|
|
4
|
+
= form.select :branch_id, @project.branches.map{|b| [b.name, b.id]}, {}, data: {change: polymorphic_path([:changes, @project, @environment])}
|
5
|
+
|
|
6
|
+
= form.submit "Deploy", class: "btn btn-primary"
|
7
|
+
|
8
|
+
#pending_changes
|
9
|
+
= render partial: "changes", locals: {environment: @environment, branch: @environment.current_branch || @project.branches.first}
|
10
|
+
|
11
|
+
h3 Deployment History
|
12
|
+
table.table.table-striped
|
13
|
+
thead
|
14
|
+
tr
|
15
|
+
th Branch
|
16
|
+
th Revision
|
17
|
+
th Deployed at
|
18
|
+
th Deployed by
|
19
|
+
th Status
|
20
|
+
th Duration
|
21
|
+
tbody
|
22
|
+
- @environment.deployments.each do |deployment|
|
23
|
+
tr[class="#{deployment.failed? ? '.text-error' : ''}"]
|
24
|
+
td = deployment.branch.name
|
25
|
+
td = deployment.short_revision
|
26
|
+
td
|
27
|
+
= link_to [@project, @environment, deployment] do
|
28
|
+
= deployment.created_at.to_s(:short)
|
29
|
+
td = deployment.created_by.andand.name
|
30
|
+
td = deployment.status
|
31
|
+
td
|
32
|
+
- if deployment.completed?
|
33
|
+
= duration_text(deployment.duration)
|
34
|
+
- else
|
35
|
+
| ---
|
36
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title Ship It
|
5
|
+
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
|
6
|
+
= javascript_include_tag "application", "data-turbolinks-track" => true
|
7
|
+
= csrf_meta_tags
|
8
|
+
body
|
9
|
+
.navbar.navbar-inverse.navbar-fixed-top
|
10
|
+
.navbar-inner
|
11
|
+
.container
|
12
|
+
a.btn.btn-navbar data-toggle="collapse" data-target=".nav-collapse"
|
13
|
+
span.icon-bar
|
14
|
+
span.icon-bar
|
15
|
+
span.icon-bar
|
16
|
+
= link_to root_path, class: "brand" do
|
17
|
+
| Ship It!
|
18
|
+
.nav-collapse.collapse
|
19
|
+
ul.nav
|
20
|
+
- @projects.each do |project|
|
21
|
+
li
|
22
|
+
= link_to project.name, project
|
23
|
+
li
|
24
|
+
= link_to "Setup", projects_path
|
25
|
+
.container
|
26
|
+
.row-fluid
|
27
|
+
.span9
|
28
|
+
= yield
|
29
|
+
.span3
|
30
|
+
= render partial: "deployments/current"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
h1 Edit Project
|
2
|
+
|
3
|
+
= form_for @project do |form|
|
4
|
+
= form.label :name, "Project name"
|
5
|
+
= form.text_field :name
|
6
|
+
|
7
|
+
= form.label :git_repo_url, "Git repo URL"
|
8
|
+
= form.text_field :git_repo_url
|
9
|
+
|
10
|
+
.form-actions
|
11
|
+
= form.submit "Update", class: "btn btn-primary"
|
12
|
+
|
13
|
+
h2 Deploy Options
|
14
|
+
- if @project.deploy_options.present?
|
15
|
+
dl
|
16
|
+
- @project.deploy_options.each do |option|
|
17
|
+
dt
|
18
|
+
= option.name
|
19
|
+
dd
|
20
|
+
= option.value
|
21
|
+
| -
|
22
|
+
= link_to [@project, option], method: :delete, data: {confirm: "Delete this option?"} do
|
23
|
+
| Delete
|
24
|
+
- else
|
25
|
+
p.muted None.
|
26
|
+
|
27
|
+
= link_to "Add deploy option", [:new, @project, :deploy_option]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
h1 Projects
|
2
|
+
|
3
|
+
table.table.table-striped
|
4
|
+
thead
|
5
|
+
tr
|
6
|
+
th
|
7
|
+
| Name
|
8
|
+
th
|
9
|
+
| Git repo URL
|
10
|
+
th
|
11
|
+
tbody
|
12
|
+
- @projects.each do |project|
|
13
|
+
tr
|
14
|
+
td
|
15
|
+
= project.name
|
16
|
+
td
|
17
|
+
= project.git_repo_url
|
18
|
+
td
|
19
|
+
= link_to "Edit", [:edit, project]
|
20
|
+
|
21
|
+
= link_to new_project_path, class: "btn btn-primary" do
|
22
|
+
| New Project
|
@@ -0,0 +1,11 @@
|
|
1
|
+
h1 New Project
|
2
|
+
|
3
|
+
= form_for @project do |form|
|
4
|
+
= form.label :name, "Project name"
|
5
|
+
= form.text_field :name
|
6
|
+
|
7
|
+
= form.label :git_repo_url, "Git repo URL"
|
8
|
+
= form.text_field :git_repo_url
|
9
|
+
|
10
|
+
.form-actions
|
11
|
+
= form.submit "Create", class: "btn btn-primary"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
h1 #{@project.name}
|
2
|
+
|
3
|
+
table.table.table-striped
|
4
|
+
thead
|
5
|
+
tr
|
6
|
+
th Environment
|
7
|
+
th Branch
|
8
|
+
th Revision
|
9
|
+
th Last deployed
|
10
|
+
th Deployed by
|
11
|
+
tbody
|
12
|
+
- @project.environments.each do |environment|
|
13
|
+
tr
|
14
|
+
td
|
15
|
+
= link_to environment.name, [@project, environment]
|
16
|
+
- if deployment = environment.last_deployment
|
17
|
+
td
|
18
|
+
= deployment.branch.name
|
19
|
+
td
|
20
|
+
= deployment.short_revision
|
21
|
+
td
|
22
|
+
= deployment.started_at
|
23
|
+
td
|
24
|
+
= deployment.created_by.andand.name
|
25
|
+
- else
|
26
|
+
td
|
27
|
+
td
|
28
|
+
td
|
29
|
+
td
|
data/bin/bundle
ADDED
data/bin/rails
ADDED
data/bin/rake
ADDED
data/bin/ship_it
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'cocaine'
|
5
|
+
|
6
|
+
module ShipIt
|
7
|
+
class CLI < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
File.expand_path("../../templates", __FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "new PROJECT_NAME", "Sets up ALL THE THINGS need for your deployment project."
|
15
|
+
def new(name)
|
16
|
+
@name = Thor::Util.snake_case(name)
|
17
|
+
directory :project, @name
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "start", "Starts the thin server"
|
21
|
+
def start(*args)
|
22
|
+
port_option = args.include?('-p')? '' : ' -p 3030'
|
23
|
+
args = args.join(" ")
|
24
|
+
command = "bundle exec thin -R config.ru start #{port_option} #{args}"
|
25
|
+
system(command)
|
26
|
+
end
|
27
|
+
map "s" => :start
|
28
|
+
|
29
|
+
desc "stop", "Stops the thin server"
|
30
|
+
def stop
|
31
|
+
command = "bundle exec thin stop"
|
32
|
+
system(command)
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "runner", "Run the deployment runner"
|
36
|
+
def runner
|
37
|
+
command = "bundle exec rake ship_it:run -f #{File.expand_path("../../Rakefile", __FILE__)}"
|
38
|
+
system(command)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
ShipIt::CLI.start
|
data/config.ru
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env)
|
8
|
+
|
9
|
+
module ShipIt
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
16
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
17
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
18
|
+
|
19
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
20
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
21
|
+
# config.i18n.default_locale = :de
|
22
|
+
end
|
23
|
+
end
|
data/config/boot.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
ShipIt::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|