Merge pull request #292 from abf/rosa-build:291-frendly-urls
#291: frendly URLs of platform && repositories
This commit is contained in:
commit
6ea24c86f1
5
Gemfile
5
Gemfile
|
@ -24,8 +24,8 @@ gem 'highline', '~> 1.6.11'
|
||||||
gem 'state_machine'
|
gem 'state_machine'
|
||||||
gem 'redis-rails'
|
gem 'redis-rails'
|
||||||
|
|
||||||
gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http'
|
gem 'grack', :git => 'git://github.com/rosa-abf/grack.git', :require => 'git_http'
|
||||||
gem "grit", :git => 'git://github.com/warpc/grit.git' #, :path => '~/Sites/code/grit'
|
gem 'grit', :git => 'git://github.com/warpc/grit.git' #, :path => '~/Sites/code/grit'
|
||||||
gem 'charlock_holmes', '~> 0.6.9' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
|
gem 'charlock_holmes', '~> 0.6.9' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
|
||||||
gem 'github-linguist', '~> 2.3.4', :require => 'linguist'
|
gem 'github-linguist', '~> 2.3.4', :require => 'linguist'
|
||||||
gem 'diff-display', '~> 0.0.1'
|
gem 'diff-display', '~> 0.0.1'
|
||||||
|
@ -51,6 +51,7 @@ gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
|
||||||
gem "haml-rails", '~> 0.3.4'
|
gem "haml-rails", '~> 0.3.4'
|
||||||
gem 'jquery-rails', '~> 2.0.2'
|
gem 'jquery-rails', '~> 2.0.2'
|
||||||
gem 'ruby-haml-js', '~> 0.0.3'
|
gem 'ruby-haml-js', '~> 0.0.3'
|
||||||
|
gem 'friendly_id'
|
||||||
|
|
||||||
gem 'rack-throttle'
|
gem 'rack-throttle'
|
||||||
gem 'rest-client', '~> 1.6.6'
|
gem 'rest-client', '~> 1.6.6'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/rdblue/grack.git
|
remote: git://github.com/rosa-abf/grack.git
|
||||||
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
|
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
|
||||||
specs:
|
specs:
|
||||||
grack (0.2.0)
|
grack (0.2.0)
|
||||||
|
@ -129,6 +129,8 @@ GEM
|
||||||
faraday (0.8.7)
|
faraday (0.8.7)
|
||||||
multipart-post (~> 1.1)
|
multipart-post (~> 1.1)
|
||||||
ffi (1.0.11)
|
ffi (1.0.11)
|
||||||
|
friendly_id (4.0.10.1)
|
||||||
|
activerecord (>= 3.0, < 4.0)
|
||||||
fssm (0.2.10)
|
fssm (0.2.10)
|
||||||
gemoji (1.2.1)
|
gemoji (1.2.1)
|
||||||
github-linguist (2.3.4)
|
github-linguist (2.3.4)
|
||||||
|
@ -447,6 +449,7 @@ DEPENDENCIES
|
||||||
devise (~> 2.2.3)
|
devise (~> 2.2.3)
|
||||||
diff-display (~> 0.0.1)
|
diff-display (~> 0.0.1)
|
||||||
factory_girl_rails (~> 4.0.0)
|
factory_girl_rails (~> 4.0.0)
|
||||||
|
friendly_id
|
||||||
gemoji (~> 1.2.1)
|
gemoji (~> 1.2.1)
|
||||||
github-linguist (~> 2.3.4)
|
github-linguist (~> 2.3.4)
|
||||||
gollum (~> 2.1.3)
|
gollum (~> 2.1.3)
|
||||||
|
|
|
@ -24,6 +24,7 @@ var BuildList = function(atts, dictionary) {
|
||||||
if (self.save_to_platform.personal) {
|
if (self.save_to_platform.personal) {
|
||||||
self.save_to_repository_name += ' (' + self.build_for_platform.name + ')'
|
self.save_to_repository_name += ' (' + self.build_for_platform.name + ')'
|
||||||
}
|
}
|
||||||
|
self.save_to_repository_url = Routes.platform_repository_path(self.save_to_platform.name, self.save_to_repository.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.project) {
|
if (self.project) {
|
||||||
|
@ -38,8 +39,6 @@ var BuildList = function(atts, dictionary) {
|
||||||
self.project.name_with_owner = self.project.owner + '/' + self.project.name;
|
self.project.name_with_owner = self.project.owner + '/' + self.project.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.save_to_platform_id)
|
|
||||||
self.save_to_repository_url = Routes.platform_repository_path(self.save_to_platform_id, self.save_to_repository_id);
|
|
||||||
if (self.user)
|
if (self.user)
|
||||||
self.user.url = Routes.user_path(self.user.uname);
|
self.user.url = Routes.user_path(self.user.uname);
|
||||||
self.url = Routes.build_list_path(self.id);
|
self.url = Routes.build_list_path(self.id);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Platforms::KeyPairsController < ApplicationController
|
class Platforms::KeyPairsController < Platforms::BaseController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
load_and_authorize_resource :platform, :only => [:index]
|
load_and_authorize_resource :platform, :only => [:index]
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Platform < ActiveRecord::Base
|
class Platform < ActiveRecord::Base
|
||||||
|
extend FriendlyId
|
||||||
|
friendly_id :name
|
||||||
|
|
||||||
include Modules::Models::FileStoreClean
|
include Modules::Models::FileStoreClean
|
||||||
include Modules::Models::RegenerationStatus
|
include Modules::Models::RegenerationStatus
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Repository < ActiveRecord::Base
|
class Repository < ActiveRecord::Base
|
||||||
|
extend FriendlyId
|
||||||
|
friendly_id :name
|
||||||
|
|
||||||
LOCK_FILE_NAMES = {:sync => '.sync.lock', :repo => '.repo.lock'}
|
LOCK_FILE_NAMES = {:sync => '.sync.lock', :repo => '.repo.lock'}
|
||||||
SORT = {'base' => 1, 'main' => 2, 'contrib' => 3, 'non-free' => 4, 'restricted' => 5}
|
SORT = {'base' => 1, 'main' => 2, 'contrib' => 3, 'non-free' => 4, 'restricted' => 5}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ Rosa::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :module => 'platforms' do
|
scope :module => 'platforms' do
|
||||||
resources :platforms do
|
resources :platforms, :constraints => {:id => Platform::NAME_PATTERN} do
|
||||||
resources :private_users, :except => [:show, :destroy, :update]
|
resources :private_users, :except => [:show, :destroy, :update]
|
||||||
member do
|
member do
|
||||||
put :regenerate_metadata
|
put :regenerate_metadata
|
||||||
|
|
|
@ -78,7 +78,7 @@ describe Platforms::KeyPairsController do
|
||||||
@create_params = {
|
@create_params = {
|
||||||
:platform_id => @platform,
|
:platform_id => @platform,
|
||||||
:key_pair => {
|
:key_pair => {
|
||||||
:repository_id => @repository,
|
:repository_id => @repository.id,
|
||||||
:public => kp.public,
|
:public => kp.public,
|
||||||
:secret => kp.secret
|
:secret => kp.secret
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ shared_examples_for 'admin user' do
|
||||||
|
|
||||||
it 'should be able to create product' do
|
it 'should be able to create product' do
|
||||||
lambda { post :create, @create_params }.should change{ Product.count }.by(1)
|
lambda { post :create, @create_params }.should change{ Product.count }.by(1)
|
||||||
response.should redirect_to(platform_product_path( Product.last.platform.id, Product.last ))
|
response.should redirect_to(platform_product_path( Product.last.platform, Product.last ))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to update product' do
|
it 'should be able to update product' do
|
||||||
|
@ -31,7 +31,7 @@ describe Platforms::ProductsController do
|
||||||
@product = FactoryGirl.create(:product, :platform => @platform)
|
@product = FactoryGirl.create(:product, :platform => @platform)
|
||||||
@project = FactoryGirl.create(:project)
|
@project = FactoryGirl.create(:project)
|
||||||
|
|
||||||
params = {:platform_id => @platform.id, :src_project => @project.name_with_owner}
|
params = {:platform_id => @platform, :src_project => @project.name_with_owner}
|
||||||
@create_params = params.merge({:product => {:name => 'pro', :time_living => 150}})
|
@create_params = params.merge({:product => {:name => 'pro', :time_living => 150}})
|
||||||
@update_params = params.merge({:product => {:name => 'pro2'}})
|
@update_params = params.merge({:product => {:name => 'pro2'}})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue