summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/build.rb8
-rw-r--r--app/models/project.rb2
-rw-r--r--app/views/projects/_form.html.haml11
-rw-r--r--db/migrate/20131023103430_add_allow_git_fetch_to_project.rb5
-rw-r--r--db/schema.rb3
-rw-r--r--lib/api/entities.rb2
6 files changed, 27 insertions, 4 deletions
diff --git a/app/models/build.rb b/app/models/build.rb
index 7e9d418..6732c5b 100644
--- a/app/models/build.rb
+++ b/app/models/build.rb
@@ -139,6 +139,12 @@ class Build < ActiveRecord::Base
def repo_url
project.ssh_url_to_repo
end
-end
+ def timeout
+ project.timeout
+ end
+ def allow_git_fetch
+ project.allow_git_fetch
+ end
+end
diff --git a/app/models/project.rb b/app/models/project.rb
index e324dc5..daa75c4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -21,7 +21,7 @@
class Project < ActiveRecord::Base
attr_accessible :name, :path, :scripts, :timeout, :token,
:default_ref, :gitlab_url, :always_build, :polling_interval,
- :public, :ssh_url_to_repo, :gitlab_id
+ :public, :ssh_url_to_repo, :gitlab_id, :allow_git_fetch
has_many :builds, dependent: :destroy
has_many :runner_projects, dependent: :destroy
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index 164bdec..3d7cb83 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -18,6 +18,17 @@
= f.label :scripts
= f.text_area :scripts, class: 'input-xxlarge', rows: 11, placeholder: "bundle exec rake spec"
+ .field
+ %p Get recent application code by next command:
+ = label_tag do
+ = f.radio_button :allow_git_fetch, 'false'
+ %span git clone
+ %span.light (slower but makes sure you have clean dir before every build)
+ = label_tag do
+ = f.radio_button :allow_git_fetch, 'true'
+ %span git fetch
+ %span.light (faster)
+
%fieldset
%legend Build Schedule
diff --git a/db/migrate/20131023103430_add_allow_git_fetch_to_project.rb b/db/migrate/20131023103430_add_allow_git_fetch_to_project.rb
new file mode 100644
index 0000000..900ea91
--- /dev/null
+++ b/db/migrate/20131023103430_add_allow_git_fetch_to_project.rb
@@ -0,0 +1,5 @@
+class AddAllowGitFetchToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :allow_git_fetch, :boolean, default: true, null: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 0539b28..9ab222f 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130906175737) do
+ActiveRecord::Schema.define(:version => 20131023103430) do
create_table "builds", :force => true do |t|
t.integer "project_id"
@@ -46,6 +46,7 @@ ActiveRecord::Schema.define(:version => 20130906175737) do
t.boolean "public", :default => false, :null => false
t.string "ssh_url_to_repo"
t.integer "gitlab_id"
+ t.boolean "allow_git_fetch", :default => true, :null => false
end
create_table "runner_projects", :force => true do |t|
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 3f65a44..3c8fbcc 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -1,7 +1,7 @@
module API
module Entities
class Build < Grape::Entity
- expose :id, :commands, :path, :ref, :sha, :project_id, :repo_url, :before_sha
+ expose :id, :commands, :path, :ref, :sha, :project_id, :repo_url, :before_sha, :timeout, :allow_git_fetch
end
class Runner < Grape::Entity