From a1c900e9351bc641fdbb043f8843cb9224f716a6 Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Fri, 15 Apr 2011 16:27:45 +0400 Subject: [PATCH 1/7] don't crreate git repo --- app/models/project.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 0cea88e5c..77491534f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -10,7 +10,7 @@ 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 @@ -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 From 515ca84842ec71a8d4c10c582bef1d3a6ec57d0b Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Fri, 15 Apr 2011 17:20:48 +0400 Subject: [PATCH 2/7] FUCK OFF JUMMIT --- app/views/layouts/_javascripts.html.haml | 4 +++- app/views/layouts/_stylesheets.html.haml | 4 +++- app/views/layouts/sessions.html.haml | 4 +++- config/assets.yml | 1 - config/deploy.rb | 26 ++++++++++++------------ 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/app/views/layouts/_javascripts.html.haml b/app/views/layouts/_javascripts.html.haml index 63f4f7020..08c436a7d 100644 --- a/app/views/layouts/_javascripts.html.haml +++ b/app/views/layouts/_javascripts.html.haml @@ -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 "jrails", "application", "drop_down_menu" -# Append your own using content_for :javascripts = yield :javascripts diff --git a/app/views/layouts/_stylesheets.html.haml b/app/views/layouts/_stylesheets.html.haml index 96ea106a2..6cab6f752 100644 --- a/app/views/layouts/_stylesheets.html.haml +++ b/app/views/layouts/_stylesheets.html.haml @@ -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 \ No newline at end of file diff --git a/app/views/layouts/sessions.html.haml b/app/views/layouts/sessions.html.haml index 0ddff96d8..be5bfb52f 100644 --- a/app/views/layouts/sessions.html.haml +++ b/app/views/layouts/sessions.html.haml @@ -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 diff --git a/config/assets.yml b/config/assets.yml index 979cd78ce..999046ee8 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -1,6 +1,5 @@ javascripts: application: - - public/javascripts/rails.js - public/javascripts/application.js - public/javascripts/drop_down_menu.js diff --git a/config/deploy.rb b/config/deploy.rb index 192fd7488..a4cdaedb2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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 From 9513280874a582da770398f832d90592d763e6be Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Fri, 15 Apr 2011 17:40:40 +0400 Subject: [PATCH 3/7] fixed create_project --- lib/build_server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/build_server.rb b/lib/build_server.rb index 3263cb2d1..517257929 100644 --- a/lib/build_server.rb +++ b/lib/build_server.rb @@ -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 From 31fc10f595156aee0f3a16cf15accd752ba37d44 Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Fri, 15 Apr 2011 17:49:13 +0400 Subject: [PATCH 4/7] fixed repo path --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index 77491534f..9a005106e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -15,7 +15,7 @@ class Project < ActiveRecord::Base # 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, "projects", unixname + ".git") end def path From 6bf3023e2ce8c829bab39d59d2f7fc6e4c886106 Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Fri, 15 Apr 2011 17:53:39 +0400 Subject: [PATCH 5/7] d'oh --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index 9a005106e..b3c531243 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -15,7 +15,7 @@ class Project < ActiveRecord::Base # Redefining a method from Project::HasRepository module to reflect current situation def git_repo_path - @git_repo_path ||= File.join(repository.platform, "projects", unixname + ".git") + @git_repo_path ||= File.join(repository.platform.name, "projects", unixname + ".git") end def path From 64b0e5a9768a9ca9f841b98ed9dba4963b88d56f Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Fri, 15 Apr 2011 17:55:49 +0400 Subject: [PATCH 6/7] oops --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index b3c531243..7b2786006 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -15,7 +15,7 @@ class Project < ActiveRecord::Base # Redefining a method from Project::HasRepository module to reflect current situation def git_repo_path - @git_repo_path ||= File.join(repository.platform.name, "projects", unixname + ".git") + @git_repo_path ||= File.join(repository.platform.path, "projects", unixname + ".git") end def path From fb2808b9e6928e7342a1116e53fbc2b4f3c4094c Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Mon, 18 Apr 2011 16:34:06 +0400 Subject: [PATCH 7/7] crontab generator without translations, because im in fucken ISRAELgit add app/controllers/crontabs_controller.rb app/views/crontabs/show.html.hamlgit add app/controllers/crontabs_controller.rb app/views/crontabs/show.html.haml Shalom LEOLAM --- app/controllers/crontabs_controller.rb | 6 + app/views/crontabs/show.html.haml | 170 +++++++++++++++++++++++ app/views/layouts/_javascripts.html.haml | 2 +- config/routes.rb | 2 + 4 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 app/controllers/crontabs_controller.rb create mode 100644 app/views/crontabs/show.html.haml diff --git a/app/controllers/crontabs_controller.rb b/app/controllers/crontabs_controller.rb new file mode 100644 index 000000000..e31cfe57c --- /dev/null +++ b/app/controllers/crontabs_controller.rb @@ -0,0 +1,6 @@ +class CrontabsController < ApplicationController + + def show + end + +end \ No newline at end of file diff --git a/app/views/crontabs/show.html.haml b/app/views/crontabs/show.html.haml new file mode 100644 index 000000000..776e65c24 --- /dev/null +++ b/app/views/crontabs/show.html.haml @@ -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") diff --git a/app/views/layouts/_javascripts.html.haml b/app/views/layouts/_javascripts.html.haml index 08c436a7d..c700fcbf1 100644 --- a/app/views/layouts/_javascripts.html.haml +++ b/app/views/layouts/_javascripts.html.haml @@ -6,7 +6,7 @@ -#= include_javascripts :application -= javascript_include_tag "jrails", "application", "drop_down_menu" += javascript_include_tag "rails", "application", "drop_down_menu" -# Append your own using content_for :javascripts = yield :javascripts diff --git a/config/routes.rb b/config/routes.rb index cada5fda7..f2a68b78d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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"