-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into danilo-sandbox
Conflicts: app/controllers/projects/repositories/auth_controller.rb app/views/projects/repositories/auth/new.html.erb test/functional/projects/repositories/auth_controller_test.rb test/integration/repository_authentication_test.rb test/test_helper.rb todo.list
- Loading branch information
Showing
32 changed files
with
242 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ config/phpmigration.yml | |
*.swp | ||
Vagrantfile | ||
\.vagrant | ||
*tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard 'ctags-bundler', :src_path => ["app", "lib", "spec/support"] do | ||
watch(/^(app|lib|spec\/support)\/.*\.rb$/) | ||
watch('Gemfile.lock') | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
module ApplicationHelper | ||
def admin_menu(label, link, icon = '') | ||
raw content_tag(:li, link_to(icon + t(".#{label}"), link), class: current_page?(link) ? 'active' : '') if can?('view', 'admin') | ||
def admin_menu(icon_name, title, link, args = {}) | ||
header_menu(icon_name, title, link, args) if can?('view', 'admin') | ||
end | ||
|
||
def icon(name, color = '') | ||
color.size != 0 and color = 'icon-white' | ||
name = %`icon-#{name}` | ||
def header_menu(icon_name, title, link, args = {}) | ||
args.reverse_merge!(:'data-toggle' => 'tooltip', :title => title) | ||
content_tag(:li, link_to(icon(icon_name), link, args)) | ||
end | ||
|
||
content_tag :i, '', :class => %`#{name} #{color}` | ||
def icon(name, color = 'icon-white') | ||
content_tag(:i, '', :class => "icon-#{name} #{color}") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<title>Cranelift</title> | ||
<%= stylesheet_link_tag "application", :media => "all" %> | ||
<%= csrf_meta_tags %> | ||
<link href='http://fonts.googleapis.com/css?family=Skranji' rel='stylesheet' type='text/css'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="row logo bottom-line"> | ||
<div class="span12"> | ||
<%= link_to root_path do %> | ||
<%= image_tag 'logo.png' %> | ||
Cranelift | ||
<% end %> | ||
|
||
<div id="menu"> | ||
<ul class="clearfix"><%= render '/layouts/menu_user' %></ul> | ||
<ul><%= render '/layouts/menu_admin' %></ul> | ||
</div> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%= admin_menu('cog', t('.settings'), admin_settings_path) %> | ||
<%= admin_menu('list-alt', t('.roles'), admin_roles_path) %> | ||
<%= admin_menu('book', t('.logs'), admin_logs_path) %> | ||
<%= admin_menu('filter', t('.ips'), admin_ips_path) %> | ||
<%= admin_menu('user', t('.users'), admin_users_path) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<% if current_user %> | ||
<%= header_menu('off', t('.logout'), logout_path, :method => :delete) %> | ||
<%= header_menu('edit', t('.editaccount'), editaccount_path) %> | ||
<% else %> | ||
<% if Setting.find_or_default('allow_register').value == 'true' %> | ||
<%= header_menu('pencil', t('.register'), new_user_path) %> | ||
<% end %> | ||
<%= header_menu('refresh', t('.login'), login_path) %> | ||
<% end %> | ||
|
||
<%= header_menu('folder-open', t('.projects'), projects_path) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<%= simple_form_for :auth, url: [@project, @repository, :auth], :method => :post, :html => { :class => 'form-horizontal' } do %> | ||
login:<input type='text' name='login'><br> | ||
password:<input type='text' name='pass'><br> | ||
<input type="submit" value="submit" id="submit"> | ||
<h1><%= t('.auth_required') %></h1> | ||
|
||
<%= simple_form_for :auth, url: [@project, @repository, :auth], method: :post, html: { class: 'form-horizontal' } do |f| %> | ||
<% render 'shared/form_errors', :f => f %> | ||
<%= f.input :login, label: t('.login') %> | ||
<%= f.input :pass, as: :password, label: t('.pass') %> | ||
|
||
<div class="form-actions"> | ||
<%= f.button :submit, :class => 'btn-primary', value: t('.submit') %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pt-BR: | ||
projects: | ||
repositories: | ||
auth: | ||
create: | ||
auth_failed: A autenticação falhou | ||
new: | ||
auth_required: Este repositório exige autenticação | ||
login: Login | ||
pass: Senha | ||
submit: Autenticar |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Migrate | ||
class IpsMigrate < Migrate::Base | ||
class Ips < Migrate::Base | ||
def migrate | ||
puts "Migrando ips..." | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module Migrate | ||
class FakeRepository < ::ActiveRecord::Base | ||
self.table_name = 'repositories' | ||
end | ||
|
||
class Projects < Migrate::Base | ||
def migrate | ||
puts "Migrando projetos..." | ||
|
||
phpsvn_projects.each do |reg| | ||
copy_repository_from_php(reg['alias']) | ||
|
||
pj = ::Project.create(name: reg['alias']) | ||
debug_obj(pj) | ||
|
||
repo = FakeRepository.create(name: reg['alias'], | ||
url: reg['nome'], | ||
enable_autoupdate: reg['autoupdate'], | ||
login: reg['co_login'], | ||
password: reg['co_password'], | ||
project_id: pj.id) | ||
|
||
add_users_to_project(pj, reg['id']) | ||
end | ||
end | ||
|
||
def phpsvn_projects | ||
mysql.query('select * from projetos') | ||
end | ||
|
||
def add_users_to_project(cr_project, old_project_id) | ||
regs = mysql.query("select * from user_projetos | ||
where id_projetos = #{old_project_id}") | ||
|
||
users_ids = regs.map{ |reg| ::Migrate::UserMap.new_id(reg['id_user']) } | ||
debugger if users_ids.include?(0) | ||
cr_project.users = ::User.find(users_ids) if users_ids.any? | ||
end | ||
|
||
def copy_repository_from_php(repository) | ||
origin = File.join(config.php_projects_path, repository) | ||
destiny = Rails.root.join('repositories', repository) | ||
|
||
FileUtils.mkdir destiny | ||
FileUtils.cp_r Dir[origin], File.join(destiny, ''), :verbose => true | ||
end | ||
|
||
def create_fake_folders | ||
puts "Criando pastas fakes para desenvolvimento..." | ||
|
||
regs = mysql.query('select * from projetos') | ||
regs.each do |r| | ||
name = r['alias'] | ||
FileUtils.mkpath File.join(config.php_projects_path, name, name) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.