diff --git a/app/helpers/repository_helper.rb b/app/helpers/repository_helper.rb new file mode 100644 index 0000000..0ad378b --- /dev/null +++ b/app/helpers/repository_helper.rb @@ -0,0 +1,9 @@ +module RepositoryHelper + def periodicity_options + [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] + end + + def license_options + YAML.load_file("config/licenses.yml").split("; ") + end +end \ No newline at end of file diff --git a/app/views/repositories/_form.html.erb b/app/views/repositories/_form.html.erb index 08008ae..fa86a08 100644 --- a/app/views/repositories/_form.html.erb +++ b/app/views/repositories/_form.html.erb @@ -1,24 +1,39 @@ <%= render :partial => 'shared/form_errors', :locals => {:object => @repository} %>
- <%= f.label :name, class: 'control-label' %>
+ <%= f.label :name, class: 'control-label' %> <%= f.text_field :name, class: 'form-control' %> -
+
- <%= f.label :type, class: 'control-label' %>
+ <%= f.label :description, class: 'control-label' %> + <%= f.text_area :description, class: 'form-control' %> +

+ +
+ <%= f.label :license, 'License', class: 'control-label' %> + <%= f.select( :license, license_options, {class: 'form-control'} ) %> +

+ +
+ <%= f.label :type, class: 'control-label' %> <%= f.select( :type, @repository_types, {class: 'form-control'} ) %> -
+
- <%= f.label :address, class: 'control-label' %>
+ <%= f.label :address, class: 'control-label' %> <%= f.text_field :address, class: 'form-control' %> -
+
+ +
+ <%= f.label :process_period, 'Process Period', class: 'control-label' %> + <%= f.select( :process_period, periodicity_options, {class: 'form-control'} ) %> +

- <%= f.label :configuration, class: 'control-label' %>
+ <%= f.label :configuration, class: 'control-label' %> <% configuration_list = KalibroGem::Entities::Configuration.all.map { |conf| [conf.name, conf.id] } %> <%= f.select( :configuration_id, configuration_list, {class: 'form-control'} ) %> -
+
-<%= f.submit 'Save', class: 'btn btn-primary' %> +<%= f.submit 'Save', class: 'btn btn-primary' %> \ No newline at end of file diff --git a/config/licenses.yml b/config/licenses.yml new file mode 100644 index 0000000..5ecf635 --- /dev/null +++ b/config/licenses.yml @@ -0,0 +1,69 @@ +Academic Free License 3.0 (AFL-3.0); +Affero GNU Public License (AGPL-3.0); +Adaptive Public License (APL-1.0); +Apache License 2.0 (Apache-2.0); +Apple Public Source License (APSL-2.0); +Artistic license 2.0 (Artistic-2.0); +Attribution Assurance Licenses (AAL); +BSD 3-Clause "New" or "Revised" License (BSD-3-Clause); +BSD 2-Clause "Simplified" or "FreeBSD" License (BSD-2-Clause); +Boost Software License (BSL-1.0); +Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1); +Common Development and Distribution License 1.0 (CDDL-1.0); +Common Public Attribution License 1.0 (CPAL-1.0); +CUA Office Public License Version 1.0 (CUA-OPL-1.0); +EU DataGrid Software License (EUDatagrid); +Eclipse Public License 1.0 (EPL-1.0); +Educational Community License, Version 2.0 (ECL-2.0); +Eiffel Forum License V2.0 (EFL-2.0); +Entessa Public License (Entessa); +European Union Public License, Version 1.1 (EUPL-1.1); +Fair License (FAIR); +Frameworx License (Frameworx-1.0); +GNU Affero General Public License v3 (AGPL-3.0); +GNU General Public License version 2.0 (GPL-2.0); +GNU General Public License version 3.0 (GPL-3.0); +GNU Library or "Lesser" General Public License version 2.1 (LGPL-2.1); +GNU Library or "Lesser" General Public License version 3.0 (LGPL-3.0); +Historical Permission Notice and Disclaimer (HPND); +IBM Public License 1.0 (IPL-1.0); +IPA Font License (IPA); +ISC License (ISC); +LaTeX Project Public License 1.3c (LPPL-1.3c); +Lucent Public License Version 1.02 (LPL-1.02); +MirOS Licence (MirOS); +Microsoft Public License (Ms-PL); +Microsoft Reciprocal License (Ms-RL); +MIT license (MIT); +Motosoto License (Motosoto); +Mozilla Public License 2.0 (MPL-2.0); +Multics License (Multics); +NASA Open Source Agreement 1.3 (NASA 1.3); +NTP License (NTP); +Naumen Public License (Naumen); +Nethack General Public License (NGPL); +Nokia Open Source License (Nokia); +Non-Profit Open Software License 3.0 (NPOSL-3.0); +OCLC Research Public License 2.0 (OCLC-2.0); +Open Font License 1.1 (OFL 1.1); +Open Group Test Suite License (OGTSL); +Open Software License 3.0 (OSL-3.0); +PHP License 3.0 (PHP-3.0); +The PostgreSQL License (PostgreSQL); +Python License (Python-2.0); +CNRI Python license (CNRI-Python); +Q Public License (QPL-1.0); +RealNetworks Public Source License V1.0 (RPSL-1.0); +Reciprocal Public License 1.5 (RPL-1.5); +Ricoh Source Code Public License (RSCPL); +Simple Public License 2.0 (SimPL-2.0); +Sleepycat License (Sleepycat); +Sun Public License 1.0 (SPL-1.0); +Sybase Open Watcom Public License 1.0 (Watcom-1.0); +University of Illinois/NCSA Open Source License (NCSA); +Vovida Software License v. 1.0 (VSL-1.0); +W3C License (W3C); +wxWindows Library License (WXwindows); +X.Net License (Xnet); +Zope Public License 2.0 (ZPL-2.0); +zlib/libpng license (Zlib) \ No newline at end of file diff --git a/features/repository/create.feature b/features/repository/create.feature index 1fdf9ee..900ecc5 100644 --- a/features/repository/create.feature +++ b/features/repository/create.feature @@ -3,7 +3,7 @@ Feature: Repository Creation As a regular user I should be able to create repositories -@kalibro_restart +@kalibro_restart Scenario: repository creation Given I am a regular user And I am signed in @@ -11,8 +11,11 @@ Scenario: repository creation And I have a sample configuration with native metrics And I am at the New Repository page And I fill the Name field with "Kalibro" + And I fill the Description field with "Description" + And I set the select field "License" as "ISC License (ISC)" And I set the select field "Type" as "GIT" And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" + And I set the select field "Process Period" as "1 day" And I set the select field "repository_configuration_id" as "Java" When I press the Save button Then I should be in the Sample Project page @@ -21,20 +24,22 @@ Scenario: repository creation And I should see "GIT" And I should see "https://github.com/mezuro/kalibro_gem.git" -@kalibro_restart +@kalibro_restart Scenario: repository creation blank validations Given I am a regular user And I am signed in And I own a sample project And I have a sample configuration with native metrics And I am at the New Repository page + And I set the select field "License" as "ISC License (ISC)" And I set the select field "Type" as "GIT" + And I set the select field "Process Period" as "1 day" And I set the select field "repository_configuration_id" as "Java" When I press the Save button Then I should see "Name can't be blank" And I should see "Address can't be blank" -@kalibro_restart +@kalibro_restart Scenario: repository creation with name already taken Given I am a regular user And I am signed in @@ -43,8 +48,11 @@ Scenario: repository creation with name already taken And I have a sample repository within the sample project named "KalibroEntities" And I am at the New Repository page And I fill the Name field with "KalibroEntities" + And I fill the Description field with "Description" + And I set the select field "License" as "ISC License (ISC)" And I set the select field "Type" as "GIT" And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" + And I set the select field "Process Period" as "1 day" And I set the select field "repository_configuration_id" as "Java" When I press the Save button Then I should see "There's already" \ No newline at end of file diff --git a/spec/helpers/repository_helper_spec.rb b/spec/helpers/repository_helper_spec.rb new file mode 100644 index 0000000..3c81eee --- /dev/null +++ b/spec/helpers/repository_helper_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe RepositoryHelper do + + describe 'periodicity_options' do + it 'should return an array with some sample periods' do + helper.periodicity_options.should eq [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] + end + end + + describe 'license_options' do + it 'should return an array with some sample licenses names' do + helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ") + end + end +end \ No newline at end of file -- libgit2 0.21.2