Commit c9b39d89082b8f446e40c0068b14724561326cf7
Committed by
Paulo Meireles
1 parent
abb1881f
Exists in
master
and in
29 other branches
[Mezuro] Added more methods to project.rb
Showing
1 changed file
with
19 additions
and
1 deletions
Show diff stats
plugins/mezuro/lib/kalibro/project.rb
1 | class Kalibro::Project < Kalibro::Model | 1 | class Kalibro::Project < Kalibro::Model |
2 | + | ||
2 | attr_accessor :name, :license, :description, :repository, :configuration_name, :state, :error | 3 | attr_accessor :name, :license, :description, :repository, :configuration_name, :state, :error |
3 | 4 | ||
4 | def self.all_names | 5 | def self.all_names |
@@ -10,6 +11,23 @@ class Kalibro::Project < Kalibro::Model | @@ -10,6 +11,23 @@ class Kalibro::Project < Kalibro::Model | ||
10 | new attributes | 11 | new attributes |
11 | end | 12 | end |
12 | 13 | ||
14 | + def self.destroy(project_name) | ||
15 | + request(:remove_project, {:project_name => project_name}) | ||
16 | + end | ||
17 | + | ||
18 | + def self.create (content) | ||
19 | + new({ | ||
20 | + :name => content.name, | ||
21 | + :license => content.license, | ||
22 | + :description => content.description, | ||
23 | + :repository => { | ||
24 | + :type => content.repository_type, | ||
25 | + :address => content.repository_url | ||
26 | + }, | ||
27 | + :configuration_name => content.configuration_name | ||
28 | + }) | ||
29 | + end | ||
30 | + | ||
13 | def save | 31 | def save |
14 | self.class.request(:save_project, {:project => to_hash}) | 32 | self.class.request(:save_project, {:project => to_hash}) |
15 | end | 33 | end |
@@ -17,7 +35,7 @@ class Kalibro::Project < Kalibro::Model | @@ -17,7 +35,7 @@ class Kalibro::Project < Kalibro::Model | ||
17 | def repository=(value) | 35 | def repository=(value) |
18 | @repository = (value.kind_of?(Hash)) ? Kalibro::Repository.new(value) : value | 36 | @repository = (value.kind_of?(Hash)) ? Kalibro::Repository.new(value) : value |
19 | end | 37 | end |
20 | - | 38 | + |
21 | private | 39 | private |
22 | 40 | ||
23 | def self.client | 41 | def self.client |