Merge branch 'master' of github.com:evilmartians/rosa-build

This commit is contained in:
Alexey Nayden 2011-04-19 20:43:18 +04:00
commit 40e8ac1bda
10 changed files with 203 additions and 24 deletions

View File

@ -0,0 +1,6 @@
class CrontabsController < ApplicationController
def show
end
end

View File

@ -10,12 +10,12 @@ class Project < ActiveRecord::Base
scope :recent, order("name ASC")
#before_create :create_directory, :create_git_repo
before_create :xml_rpc_create, :create_git_repo
before_create :xml_rpc_create
before_destroy :xml_rpc_destroy
# Redefining a method from Project::HasRepository module to reflect current situation
def git_repo_path
@git_repo_path ||= File.join(path, unixname + ".git")
@git_repo_path ||= File.join(repository.platform.path, "projects", unixname + ".git")
end
def path
@ -54,10 +54,6 @@ class Project < ActiveRecord::Base
end
end
def create_git_repo
Git::Repository.create(git_repo_path)
end
def xml_rpc_create
result = BuildServer.create_project unixname, repository.platform.unixname, repository.unixname
if result == BuildServer::SUCCESS

View File

@ -0,0 +1,170 @@
- content_for :javascripts do
:javascript
$(function(){
$(".chooser").click(function() {
var for_element = this.name.replace(/_chooser/,"");
$("#" + for_element).attr("disabled", (this.value !== "1"));
});
$("#crontab_generator").submit(function() {
var minute, hour, day, month, weekday;
minute = getSelected('minute');
hour = getSelected('hour');
day = getSelected('day');
month = getSelected('month');
weekday = getSelected('weekday');
var command = $("#command").attr("value");
$("#cron").attr("value", minute + "\t" + hour + "\t" + day + "\t" + month + "\t" + weekday + "\t" + command);
return false;
});
});
function getSelected(name) {
var chosen;
if ($("#" + name + "_chooser_every").attr("checked")) {
chosen = '*';
} else {
var all_selected = [];
$("#" + name + " option:selected").each(function(i, ele) { all_selected.push($(ele).attr("value")); });
if (all_selected.length) {
chosen = all_selected.join(",");
} else {
chosen = '*';
}
}
return chosen;
}
.block
.content
%h2.title= t("layout.crontabs.new_header")
.inner
= form_tag "", :class => :form, :id => "crontab_generator" do
.group
= label_tag :command, "Comman", :class => :label
= text_field_tag :command, "", :class => :text_field
.columns.wat-cf
.column.left
%h3.title Minutes
.group
= label_tag :minute_chooser_every, "Every minute", :class => :label
= radio_button_tag :minute_chooser, 0, true, :id => :minute_chooser_every, :class => :chooser
= label_tag :minute_chooser_choose, "Choose", :class => :label
= radio_button_tag :minute_chooser, 1, false, :id => :minute_chooser_choose, :class => :chooser
.group
-#= select_tag :minute, options_from_collection_for_select((0..59)), :id => :minute, :multiple => true, :disabled => true
%select{ :name => :minute, :id => :minute, :multiple => true, :disabled => true }
- (0..59).each do |min|
%option{ :value => min }= min
.column.right
%h3.title Hour
.group
= label_tag :hour_chooser_every, "Every hour", :class => :label
= radio_button_tag :hour_chooser, 0, true, :id => :minute_chooser_every, :class => :chooser
= label_tag :hour_chooser_choose, "Choose", :class => :label
= radio_button_tag :hour_chooser, 1, false, :id => :minute_chooser_choose, :class => :chooser
.group
%select{ :name => :hour, :id => :hour, :multiple => true, :disabled => true }
%option{ :value => "0" } 12 Midnight
%option{ :value => "1" } 1 AM
%option{ :value => "2" } 2 AM
%option{ :value => "3" } 3 AM
%option{ :value => "4" } 4 AM
%option{ :value => "5" } 5 AM
%option{ :value => "6" } 6 AM
%option{ :value => "7" } 7 AM
%option{ :value => "8" } 8 AM
%option{ :value => "9" } 9 AM
%option{ :value => "10" } 10 AM
%option{ :value => "11" } 11 AM
%option{ :value => "12" } 12 Noon
%option{ :value => "13" } 1 PM
%option{ :value => "14" } 2 PM
%option{ :value => "15" } 3 PM
%option{ :value => "16" } 4 PM
%option{ :value => "17" } 5 PM
%option{ :value => "18" } 6 PM
%option{ :value => "19" } 7 PM
%option{ :value => "20" } 8 PM
%option{ :value => "21" } 9 PM
%option{ :value => "22" } 10 PM
%option{ :value => "23" } 11 PM
.columns.wat-cf
.column.left
%h3.title Day
.group
= label_tag :day_chooser_every, "Every day", :class => :label
= radio_button_tag :day_chooser, 0, true, :id => :day_chooser_every, :class => :chooser
= label_tag :day_chooser_choose, "Choose", :class => :label
= radio_button_tag :day_chooser, 1, false, :id => :day_chooser_choose, :class => :chooser
.group
-#= select_tag :day, options_from_collection_for_select((0..31)), :id => :day, :multiple => true, :disabled => true
%select{ :name => "day", :id => "day", :multiple => true, :disabled => true }
- (1..31).each do |day|
%option{ :value => day }= day
.column.right
%h3.title Month
.group
= label_tag :month_chooser_every, "Every month", :class => :label
= radio_button_tag :month_chooser, 0, true, :id => :month_chooser_every, :class => :chooser
= label_tag :month_chooser_choose, "Choose", :class => :label
= radio_button_tag :month_chooser, 1, false, :id => :month_chooser_choose, :class => :chooser
.group
%select{ :name => "month", :id => "month", :multiple => true, :disabled => true }
%option{ :value => "1" } January
%option{ :value => "2" } February
%option{ :value => "3" } March
%option{ :value => "4" } April
%option{ :value => "5" } May
%option{ :value => "6" } June
%option{ :value => "7" } July
%option{ :value => "8" } August
%option{ :value => "9" } September
%option{ :value => "10" } October
%option{ :value => "11" } November
%option{ :value => "12" } December
.columns.wat-cf
.column.left
%h3.title Weekday
.group
= label_tag :weekday_chooser_every, "Every weekday", :class => :label
= radio_button_tag :weekday_chooser, 0, true, :id => :weekday_chooser_every, :class => :chooser
= label_tag :weekday_chooser_choose, "Choose", :class => :label
= radio_button_tag :weekday_chooser, 1, false, :id => :weekday_chooser_choose, :class => :chooser
.group
%select{ :name => "weekday", :id => "weekday", :multiple => true, :disabled => "disabled" }
%option{ :value => "0" } Sunday
%option{ :value => "1" } Monday
%option{ :value => "2" } Tuesday
%option{ :value => "3" } Wednesday
%option{ :value => "4" } Thursday
%option{ :value => "5" } Friday
%option{ :value => "6" } Saturday
.group
%textarea{ :name => "cron", :id => "cron", :rows => "3", :cols => "70" }
.group.navform.wat-cf
%button.button{ :type => "submit" }= t("layout.crontabs.generate_crontab_line")

View File

@ -4,7 +4,9 @@
:javascript
!window.jQuery && document.write(unescape('%3Cscript src="/javascripts/jquery.min.js"%3E%3C/script%3E'))
= include_javascripts :application
-#= include_javascripts :application
= javascript_include_tag "rails", "application", "drop_down_menu"
-# Append your own using content_for :javascripts
= yield :javascripts

View File

@ -1,3 +1,5 @@
= include_stylesheets :application
-#= include_stylesheets :application
= stylesheet_link_tag "web-app-theme/base.css", "web-app-theme/themes/default/style.css", "web-app-theme/override.css", "git/style.css"
= yield :stylesheets

View File

@ -2,7 +2,9 @@
%html
%head
%title= t("layout.global_header")
= include_stylesheets :sessions
-#= include_stylesheets :sessions
= stylesheet_link_tag "web-app-theme/base.css", "web-app-theme/themes/default/style.css", "web-app-theme/override.css"
= csrf_meta_tag
%body
#container

View File

@ -1,6 +1,5 @@
javascripts:
application:
- public/javascripts/rails.js
- public/javascripts/application.js
- public/javascripts/drop_down_menu.js

View File

@ -60,21 +60,21 @@ namespace :deploy do
run "cd #{deploy_to}/current ; pkill unicorn; sleep 0.5; pkill -9 unicorn; sleep 0.5 ; unicorn_rails -c config/unicorn.rb -E production -D "
end
desc 'Bundle and minify the JS and CSS files'
task :build_assets, :roles => :app do
root_path = File.expand_path(File.dirname(__FILE__) + '/..')
assets_path = "#{root_path}/public/assets"
envs = "RAILS_ENV=production"
# Precaching assets
run_locally "bash -c '#{envs} jammit'"
# Uploading prechached assets
top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true
end
# desc 'Bundle and minify the JS and CSS files'
# task :build_assets, :roles => :app do
# root_path = File.expand_path(File.dirname(__FILE__) + '/..')
# assets_path = "#{root_path}/public/assets"
# envs = "RAILS_ENV=production"
#
# # Precaching assets
# run_locally "bash -c '#{envs} jammit'"
#
# # Uploading prechached assets
# top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true
# end
after "deploy:update_code", :roles => :web do
build_assets
# build_assets
symlink_config_files
end

View File

@ -35,6 +35,8 @@ Rosa::Application.routes.draw do
resources :users
match 'crontabs', :to => 'crontabs#show'
match 'build_lists/status_build', :to => "build_lists#status_build"
match 'build_lists/post_build', :to => "build_lists#post_build"
match 'build_lists/circle_build', :to => "build_lists#circle_build"

View File

@ -57,7 +57,7 @@ class BuildServer
end
def self.create_project name, platform_name, repo_name
self.client.call('create_project', name, platform_name, repo_name)
self.client.call('create_project', name, repo_name, platform_name)
end
def self.delete_project name, platform_name