Permalink
Browse files

Requests being created textualy, still misses confluence integration …

…(started)
  • Loading branch information...
1 parent be9ff0c commit a3ab5534adea8317296164dc53f39dcfc8a33811 Leonardo Campos committed Mar 14, 2012
Showing with 301 additions and 271 deletions.
  1. +24 −4 app/controllers/chamados_controller.rb
  2. +0 −2 app/helpers/home_helper.rb
  3. +2 −0 app/models/chamado.rb
  4. +30 −2 app/models/project.rb
  5. +7 −5 app/views/chamados/new.html.erb
  6. +5 −0 app/views/chamados/normal.html.erb
  7. +36 −0 app/views/chamados/pilot.html.erb
  8. 0 app/views/chamados/success.html.erb
  9. +12 −5 config/routes.rb
  10. +1 −0 db/migrate/20120313154823_create_projects.rb
  11. +1 −0 db/schema.rb
  12. +7 −7 db/seeds.rb
  13. BIN ericfer@10.170.80.142
  14. +14 −0 lib/scrum_board/confluence_cleint.rb
  15. +0 −241 public/index.html
  16. +1 −0 repositories/abril-id
  17. +1 −0 repositories/concursos
  18. +1 −0 repositories/concursos-dataentry
  19. +1 −0 repositories/editorial-data-entry
  20. +1 −0 repositories/midia-data-entry
  21. +1 −0 repositories/site-tools
  22. +46 −2 spec/controllers/chamados_controller_spec.rb
  23. +34 −0 spec/models/chamado_spec.rb
  24. +69 −3 spec/models/project_spec.rb
  25. BIN vendor/.DS_Store
  26. +7 −0 vendor/atlassian-cli-2.5.0/confluence.sh
  27. BIN vendor/atlassian-cli-2.5.0/lib/activation-1.1.jar
  28. BIN vendor/atlassian-cli-2.5.0/lib/avalon-framework-4.1.3.jar
  29. BIN vendor/atlassian-cli-2.5.0/lib/axis-1.4.jar
  30. BIN vendor/atlassian-cli-2.5.0/lib/axis-jaxrpc-1.4.jar
  31. BIN vendor/atlassian-cli-2.5.0/lib/axis-saaj-1.4.jar
  32. BIN vendor/atlassian-cli-2.5.0/lib/axis-wsdl4j-1.5.1.jar
  33. BIN vendor/atlassian-cli-2.5.0/lib/bamboo-cli-2.5.0.jar
  34. BIN vendor/atlassian-cli-2.5.0/lib/cli-2.5.0.jar
  35. BIN vendor/atlassian-cli-2.5.0/lib/cli-soap-2.5.0.jar
  36. BIN vendor/atlassian-cli-2.5.0/lib/commons-discovery-0.2.jar
  37. BIN vendor/atlassian-cli-2.5.0/lib/commons-lang-2.4.jar
  38. BIN vendor/atlassian-cli-2.5.0/lib/commons-logging-1.1.jar
  39. BIN vendor/atlassian-cli-2.5.0/lib/confluence-cli-2.5.0.jar
  40. BIN vendor/atlassian-cli-2.5.0/lib/confluence-soap-4.0.0.jar
  41. BIN vendor/atlassian-cli-2.5.0/lib/crucible-cli-2.5.0.jar
  42. BIN vendor/atlassian-cli-2.5.0/lib/fisheye-cli-2.5.0.jar
  43. BIN vendor/atlassian-cli-2.5.0/lib/jdbc/postgresql-8.4-702.jdbc3.jar
  44. BIN vendor/atlassian-cli-2.5.0/lib/jira-cli-2.5.0.jar
  45. BIN vendor/atlassian-cli-2.5.0/lib/jira-soap-4.3.2.jar
  46. BIN vendor/atlassian-cli-2.5.0/lib/jsap-2.1.jar
  47. BIN vendor/atlassian-cli-2.5.0/lib/json-simple-1.1.jar
  48. BIN vendor/atlassian-cli-2.5.0/lib/log4j-1.2.12.jar
  49. BIN vendor/atlassian-cli-2.5.0/lib/logkit-1.0.1.jar
  50. BIN vendor/atlassian-cli-2.5.0/lib/mail-1.4.jar
  51. BIN vendor/atlassian-cli-2.5.0/lib/servlet-api-2.3.jar
@@ -8,19 +8,39 @@ def index
def new
end
+ def gerar
+ end
+
+ def create
+ @version = params["qa-version"]
+ @former_version = params["prod-version"]
+
+ hash_part = {:after => @former_version, :upto => @version}
+
+ @motivo = @project.stepup_diff(hash_part, %w[changes features bugfixes])
+ @pre_deploy = @project.stepup_diff(hash_part, %w[pre_deploy])
+ @pos_deploy = @project.stepup_diff(hash_part, %w[pos_deploy])
+
+ if @project.pilot?
+ render 'pilot'
+ else
+ @sha1 = @project.sha1(@version)
+
+ render 'normal'
+ end
+ end
+
def repository
@project.retrieve_repository
render :nothing => true
end
def production_version
- @project.retrieve_production_version
- render :nothing => true
+ render :text => @project.retrieve_production_version
end
def qa_approved_version
- @project.retrieve_qa_approved_version
- render :nothing => true
+ render :text => @project.retrieve_qa_approved_version
end
private
@@ -1,2 +0,0 @@
-module HomeHelper
-end
View
@@ -0,0 +1,2 @@
+class Chamado
+end
View
@@ -19,13 +19,37 @@ def retrieve_repository
def retrieve_production_version
return if production_version_url.blank?
- `curl #{production_version_url}`
+ data = `curl '#{production_version_url}'`
+
+ return data unless data.match /^\{.*?\}$/
+
+ return ActiveSupport::JSON.decode(data)['version']
end
def retrieve_qa_approved_version
return if qa_approved_url.blank?
- `curl #{qa_approved_url}`
+ `curl '#{qa_approved_url}'`
+ end
+
+ def stepup_diff(data, sections=[])
+ data ||= {}
+ command = 'stepup notes'
+
+ data.each_pair do |chave, valor|
+ command += " --#{chave}=#{valor}"
+ end
+
+ unless sections.blank?
+ command += " --sections=#{sections.join(' ')}"
+ end
+
+ clean_stepup_notes `#{command}`
+ end
+
+ def sha1(version)
+ text = `git log --pretty=oneline --no-color -n1 #{version}`
+ text[0,40]
end
private
@@ -36,4 +60,8 @@ def repositories_dir
def retrive_dir_name
File.join(repositories_dir, repository.match(/([^\/]+)\.git/)[1])
end
+
+ def clean_stepup_notes(text)
+ text.gsub(/\A.*?---\r?\n?$/m, '')
+ end
end
@@ -29,6 +29,7 @@ recuperarVersaoProd = function() {
success: function(data){
blnProd = true;
$("#passo-2-status").html(data)
+ $('#prod-version').val(data)
post_if_ready();
}
});
@@ -42,6 +43,7 @@ recuperarVersaoQaApproved = function() {
success: function(data){
blnQA = true;
$("#passo-3-status").html(data)
+ $('#qa-version').val(data)
post_if_ready();
}
});
@@ -51,7 +53,7 @@ post_if_ready = function() {
if(!(blnQA && blnProd && blnRepositorio))
return;
- alert("Deveria postar")
+ document.getElementById("form_chamados").submit()
}
$(document).ready(function() {
@@ -60,7 +62,7 @@ $(document).ready(function() {
recuperarVersaoQaApproved();
});
</script>
-<h1><%=t('titulos.chamados-novo')%></h1>
+<h1><%=t('titulos.chamados-novo')%> (<%=@project.name%>)</h1>
<table id="chamados-novos-status">
<tr id="passo-1">
<td>Recuperando/Atualizando Repositório</td>
@@ -79,7 +81,7 @@ $(document).ready(function() {
<td id="passo-4-status"></td>
</tr>
</table>
-<form id="" action="" method="post">
- <input type="hidden" name="prod-version"/>
- <input type="hidden" name="qa-version"/>
+<form id="form_chamados" action="<%=project_chamados_path%>" method="post">
+ <input type="hidden" name="prod-version" id="prod-version"/>
+ <input type="hidden" name="qa-version" id="qa-version"/>
</form>
@@ -0,0 +1,5 @@
+<form id="form_chamados" action="<%=gerar_project_chamados_path%>" method="post">
+<textarea style="width:90%;height:500px;" name="chamado">
+<%=@version%>
+</textarea>
+</form>
@@ -0,0 +1,36 @@
+<form id="form_chamados" action="<%=gerar_project_chamados_path%>" method="post">
+<textarea style="width:90%;height:500px;" name="chamado">
+1 – Número do Chamado:
+
+
+2 - Você está fazendo deploy de qual sistema/produto?
+<%=@project.name%>
+
+3 - Implementações desta versão:
+
+<%=@motivo%>
+
+4 - Janela desejada (data e horário):
+
+
+5 – Responsável técnico ou seu backup com os telefones de contato:
+<%=@project.team.scrum_master%>
+
+6 – Possíveis Impactos/Indisponibilidades durante o deploy (desse e de outros produtos):
+
+
+7 - Pré-requisitos:
+<%=@pre_deploy%>
+
+8 - Repositório da código da aplicação:
+<%=@project.repository%>
+
+9 - Procedimento de implantação (Deploy Guide):
+TAG=<%=@version%> cap production deploy
+<%=@pos_deploy%>
+
+10 – Plano de Retorno:
+TAG=<%=@former_version%> cap production deploy
+</textarea><br/>
+<input type="submit" value="OK, Criar chamado"/>
+</form>
No changes.
View
@@ -1,11 +1,18 @@
ScrumBoard::Application.routes.draw do
match 'projects/chamados' => 'chamados#index'
- match 'projects/:project_id/chamados/repository' => 'chamados#repository'
- match 'projects/:project_id/chamados/qa_approved_version' => 'chamados#qa_approved_version'
- match 'projects/:project_id/chamados/production_version' => 'chamados#production_version'
+ # match 'projects/:project_id/chamados/repository' => 'chamados#repository'
+ # match 'projects/:project_id/chamados/qa_approved_version' => 'chamados#qa_approved_version'
+ # match 'projects/:project_id/chamados/production_version' => 'chamados#production_version'
- resources :projects do
- resources :chamados, :only => [:new]
+ resources :projects, :only => [:index] do
+ resources :chamados, :only => [:new, :create] do
+ collection do
+ get 'repository'
+ get 'qa_approved_version'
+ get 'production_version'
+ post 'gerar'
+ end
+ end
end
# The priority is based upon order of creation:
@@ -6,6 +6,7 @@ def change
t.integer :team_id
t.string :qa_approved_url
t.string :production_version_url
+ t.boolean :pilot
t.timestamps
end
View
@@ -19,6 +19,7 @@
t.integer "team_id"
t.string "qa_approved_url"
t.string "production_version_url"
+ t.boolean "pilot"
t.datetime "created_at"
t.datetime "updated_at"
end
View
@@ -14,11 +14,11 @@
dst = teams[3]
projects = Project.create([
- {:name => 'SiteTools', :team => maio, :repository => 'git@codebasehq.com:abril/site-tools/site-tools.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Site%20Tools%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://http://sitetools.alexandria.abril.com.br/version'},
- {:name => 'Console', :team => maio, :repository => 'git@codebasehq.com:abril/console/console.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Console%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://alexandria.abril.com.br/version'},
- {:name => 'Editorial', :team => esparta, :repository => 'git@codebasehq.com:abril/editorial/editorial-data-entry.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Editorial%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://editorial.alexandria.abril.com.br/version'},
- {:name => 'Midia', :team => esparta, :repository => 'git@codebasehq.com:abril/midia/midia-data-entry.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Midia%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://midia.alexandria.abril.com.br/version'},
- {:name => 'Concurso Cultural - API', :team => esparta, :repository => 'git@codebasehq.com:abril/dominios/concursos.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Concurso%20Cultural%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://concursos.api.abril.com.br/version'},
- {:name => 'Concurso Cultural - Data Entry', :team => esparta, :repository => 'git@codebasehq.com:abril/dominios/concursos-dataentry.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Concurso%20Cultural%20DataEntry%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://concursos.alexandria.abril.com.br/version'},
- {:name => 'AbrilId', :team => dst, :repository => 'git@codebasehq.com:abril/aapg/abril-id.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Abril%20ID-QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://id.abril.com.br/version'}
+ {:name => 'SiteTools', :pilot => false, :team => maio, :repository => 'git@codebasehq.com:abril/site-tools/site-tools.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Site%20Tools%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://sitetools.alexandria.abril.com.br/version'},
+ {:name => 'Console', :pilot => false, :team => maio, :repository => 'git@codebasehq.com:abril/console/console.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Console%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://alexandria.abril.com.br/version'},
+ {:name => 'Editorial', :pilot => true, :team => esparta, :repository => 'git@codebasehq.com:abril/editorial/editorial-data-entry.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Editorial%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://editorial.alexandria.abril.com.br/version'},
+ {:name => 'Midia', :pilot => true, :team => esparta, :repository => 'git@codebasehq.com:abril/midia/midia-data-entry.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Midia%20-%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://midia.alexandria.abril.com.br/version'},
+ {:name => 'Concurso Cultural - API', :pilot => true, :team => esparta, :repository => 'git@codebasehq.com:abril/dominios/concursos.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Concurso%20Cultural%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://concursos.api.abril.com.br/version'},
+ {:name => 'Concurso Cultural - Data Entry', :pilot => true, :team => esparta, :repository => 'git@codebasehq.com:abril/dominios/concursos-dataentry.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Concurso%20Cultural%20DataEntry%20QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://concursos.alexandria.abril.com.br/version'},
+ {:name => 'AbrilId', :pilot => true, :team => dst, :repository => 'git@codebasehq.com:abril/aapg/abril-id.git', :qa_approved_url => 'http://172.16.1.243/hudson/job/Abril%20ID-QA%20APPROVED/lastSuccessfulBuild/artifact/LAST_VERSION', :production_version_url => 'http://id.abril.com.br/version'}
])
View
Binary file not shown.
@@ -0,0 +1,14 @@
+module ScrumBoard
+ class ConfluenceClient
+ def page_source(title, space='plataforma')
+ title = title.gsub(/\+/, ' ')
+ user = 'plataforma_alexandria'
+ password = 'eu tambem nao sei'
+
+ vendor_confluence_path = "#{::Rails.root}/vendor/atlassian-cli-2.5.0"
+ command = "#{vendor_confluence_path}/confluence.sh --server=https://confluence.abril.com.br --user=#{user} --password='#{password}' --action=getSource --title='#{title}' --space='#{space}'"
+
+ `#{command}`
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit a3ab553

Please sign in to comment.