Commit 5d6fbeea0c8daf4636da81ca61b3e66e0f5a7930

Authored by Fellipe Souto Sampaio
Committed by Rafael Manzo
1 parent aa4d25e2

Added new fields in formulary

Signed-off By: Renan Fichberg <rfichberg@gmail.com>
Signed-off By: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
Signed-off By: Diego Araújo <diegoamc90@gmail.com>
app/helpers/repository_helper.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +module RepositoryHelper
  2 + def periodicity_options
  3 + [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]]
  4 + end
  5 +
  6 + def license_options
  7 + YAML.load_file("config/licenses.yml").split("; ")
  8 + end
  9 +end
0 10 \ No newline at end of file
... ...
app/views/repositories/_form.html.erb
1 1 <%= render :partial => 'shared/form_errors', :locals => {:object => @repository} %>
2 2  
3 3 <div class="form-group">
4   - <%= f.label :name, class: 'control-label' %><br>
  4 + <%= f.label :name, class: 'control-label' %>
5 5 <%= f.text_field :name, class: 'form-control' %>
6   -</div>
  6 +</div></br>
7 7  
8 8 <div class="form-group">
9   - <%= f.label :type, class: 'control-label' %><br>
  9 + <%= f.label :description, class: 'control-label' %>
  10 + <%= f.text_area :description, class: 'form-control' %>
  11 +</div></br>
  12 +
  13 +<div class="form-group">
  14 + <%= f.label :license, 'License', class: 'control-label' %>
  15 + <%= f.select( :license, license_options, {class: 'form-control'} ) %>
  16 +</div></br>
  17 +
  18 +<div class="form-group">
  19 + <%= f.label :type, class: 'control-label' %>
10 20 <%= f.select( :type, @repository_types, {class: 'form-control'} ) %>
11   -</div>
  21 +</div></br>
12 22  
13 23 <div class="form-group">
14   - <%= f.label :address, class: 'control-label' %><br>
  24 + <%= f.label :address, class: 'control-label' %>
15 25 <%= f.text_field :address, class: 'form-control' %>
16   -</div>
  26 +</div></br>
  27 +
  28 +<div class="form-group">
  29 + <%= f.label :process_period, 'Process Period', class: 'control-label' %>
  30 + <%= f.select( :process_period, periodicity_options, {class: 'form-control'} ) %>
  31 +</div></br>
17 32  
18 33 <div class="form-group">
19   - <%= f.label :configuration, class: 'control-label' %><br/>
  34 + <%= f.label :configuration, class: 'control-label' %>
20 35 <% configuration_list = KalibroGem::Entities::Configuration.all.map { |conf| [conf.name, conf.id] } %>
21 36 <%= f.select( :configuration_id, configuration_list, {class: 'form-control'} ) %>
22   -</div>
  37 +</div></br>
23 38  
24 39 -<%= f.submit 'Save', class: 'btn btn-primary' %>
  40 +<%= f.submit 'Save', class: 'btn btn-primary' %>
25 41 \ No newline at end of file
... ...
config/licenses.yml 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +Academic Free License 3.0 (AFL-3.0);
  2 +Affero GNU Public License (AGPL-3.0);
  3 +Adaptive Public License (APL-1.0);
  4 +Apache License 2.0 (Apache-2.0);
  5 +Apple Public Source License (APSL-2.0);
  6 +Artistic license 2.0 (Artistic-2.0);
  7 +Attribution Assurance Licenses (AAL);
  8 +BSD 3-Clause "New" or "Revised" License (BSD-3-Clause);
  9 +BSD 2-Clause "Simplified" or "FreeBSD" License (BSD-2-Clause);
  10 +Boost Software License (BSL-1.0);
  11 +Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1);
  12 +Common Development and Distribution License 1.0 (CDDL-1.0);
  13 +Common Public Attribution License 1.0 (CPAL-1.0);
  14 +CUA Office Public License Version 1.0 (CUA-OPL-1.0);
  15 +EU DataGrid Software License (EUDatagrid);
  16 +Eclipse Public License 1.0 (EPL-1.0);
  17 +Educational Community License, Version 2.0 (ECL-2.0);
  18 +Eiffel Forum License V2.0 (EFL-2.0);
  19 +Entessa Public License (Entessa);
  20 +European Union Public License, Version 1.1 (EUPL-1.1);
  21 +Fair License (FAIR);
  22 +Frameworx License (Frameworx-1.0);
  23 +GNU Affero General Public License v3 (AGPL-3.0);
  24 +GNU General Public License version 2.0 (GPL-2.0);
  25 +GNU General Public License version 3.0 (GPL-3.0);
  26 +GNU Library or "Lesser" General Public License version 2.1 (LGPL-2.1);
  27 +GNU Library or "Lesser" General Public License version 3.0 (LGPL-3.0);
  28 +Historical Permission Notice and Disclaimer (HPND);
  29 +IBM Public License 1.0 (IPL-1.0);
  30 +IPA Font License (IPA);
  31 +ISC License (ISC);
  32 +LaTeX Project Public License 1.3c (LPPL-1.3c);
  33 +Lucent Public License Version 1.02 (LPL-1.02);
  34 +MirOS Licence (MirOS);
  35 +Microsoft Public License (Ms-PL);
  36 +Microsoft Reciprocal License (Ms-RL);
  37 +MIT license (MIT);
  38 +Motosoto License (Motosoto);
  39 +Mozilla Public License 2.0 (MPL-2.0);
  40 +Multics License (Multics);
  41 +NASA Open Source Agreement 1.3 (NASA 1.3);
  42 +NTP License (NTP);
  43 +Naumen Public License (Naumen);
  44 +Nethack General Public License (NGPL);
  45 +Nokia Open Source License (Nokia);
  46 +Non-Profit Open Software License 3.0 (NPOSL-3.0);
  47 +OCLC Research Public License 2.0 (OCLC-2.0);
  48 +Open Font License 1.1 (OFL 1.1);
  49 +Open Group Test Suite License (OGTSL);
  50 +Open Software License 3.0 (OSL-3.0);
  51 +PHP License 3.0 (PHP-3.0);
  52 +The PostgreSQL License (PostgreSQL);
  53 +Python License (Python-2.0);
  54 +CNRI Python license (CNRI-Python);
  55 +Q Public License (QPL-1.0);
  56 +RealNetworks Public Source License V1.0 (RPSL-1.0);
  57 +Reciprocal Public License 1.5 (RPL-1.5);
  58 +Ricoh Source Code Public License (RSCPL);
  59 +Simple Public License 2.0 (SimPL-2.0);
  60 +Sleepycat License (Sleepycat);
  61 +Sun Public License 1.0 (SPL-1.0);
  62 +Sybase Open Watcom Public License 1.0 (Watcom-1.0);
  63 +University of Illinois/NCSA Open Source License (NCSA);
  64 +Vovida Software License v. 1.0 (VSL-1.0);
  65 +W3C License (W3C);
  66 +wxWindows Library License (WXwindows);
  67 +X.Net License (Xnet);
  68 +Zope Public License 2.0 (ZPL-2.0);
  69 +zlib/libpng license (Zlib)
0 70 \ No newline at end of file
... ...
features/repository/create.feature
... ... @@ -3,7 +3,7 @@ Feature: Repository Creation
3 3 As a regular user
4 4 I should be able to create repositories
5 5  
6   -@kalibro_restart
  6 +@kalibro_restart
7 7 Scenario: repository creation
8 8 Given I am a regular user
9 9 And I am signed in
... ... @@ -11,8 +11,11 @@ Scenario: repository creation
11 11 And I have a sample configuration with native metrics
12 12 And I am at the New Repository page
13 13 And I fill the Name field with "Kalibro"
  14 + And I fill the Description field with "Description"
  15 + And I set the select field "License" as "ISC License (ISC)"
14 16 And I set the select field "Type" as "GIT"
15 17 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git"
  18 + And I set the select field "Process Period" as "1 day"
16 19 And I set the select field "repository_configuration_id" as "Java"
17 20 When I press the Save button
18 21 Then I should be in the Sample Project page
... ... @@ -21,20 +24,22 @@ Scenario: repository creation
21 24 And I should see "GIT"
22 25 And I should see "https://github.com/mezuro/kalibro_gem.git"
23 26  
24   -@kalibro_restart
  27 +@kalibro_restart
25 28 Scenario: repository creation blank validations
26 29 Given I am a regular user
27 30 And I am signed in
28 31 And I own a sample project
29 32 And I have a sample configuration with native metrics
30 33 And I am at the New Repository page
  34 + And I set the select field "License" as "ISC License (ISC)"
31 35 And I set the select field "Type" as "GIT"
  36 + And I set the select field "Process Period" as "1 day"
32 37 And I set the select field "repository_configuration_id" as "Java"
33 38 When I press the Save button
34 39 Then I should see "Name can't be blank"
35 40 And I should see "Address can't be blank"
36 41  
37   -@kalibro_restart
  42 +@kalibro_restart
38 43 Scenario: repository creation with name already taken
39 44 Given I am a regular user
40 45 And I am signed in
... ... @@ -43,8 +48,11 @@ Scenario: repository creation with name already taken
43 48 And I have a sample repository within the sample project named "KalibroEntities"
44 49 And I am at the New Repository page
45 50 And I fill the Name field with "KalibroEntities"
  51 + And I fill the Description field with "Description"
  52 + And I set the select field "License" as "ISC License (ISC)"
46 53 And I set the select field "Type" as "GIT"
47 54 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git"
  55 + And I set the select field "Process Period" as "1 day"
48 56 And I set the select field "repository_configuration_id" as "Java"
49 57 When I press the Save button
50 58 Then I should see "There's already"
51 59 \ No newline at end of file
... ...
spec/helpers/repository_helper_spec.rb 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +require 'spec_helper'
  2 +
  3 +describe RepositoryHelper do
  4 +
  5 + describe 'periodicity_options' do
  6 + it 'should return an array with some sample periods' do
  7 + helper.periodicity_options.should eq [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]]
  8 + end
  9 + end
  10 +
  11 + describe 'license_options' do
  12 + it 'should return an array with some sample licenses names' do
  13 + helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ")
  14 + end
  15 + end
  16 +end
0 17 \ No newline at end of file
... ...