Commit 08c7da4169d7b206b66d786ae3ab390f8cf589eb
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'AI3269_link-article' into rails3_stable
Showing
230 changed files
with
557 additions
and
8334 deletions
Show diff stats
Gemfile.lock
| @@ -111,6 +111,8 @@ GEM | @@ -111,6 +111,8 @@ GEM | ||
| 111 | thor (>= 0.14.6, < 2.0) | 111 | thor (>= 0.14.6, < 2.0) |
| 112 | rake (0.9.2.2) | 112 | rake (0.9.2.2) |
| 113 | rdoc (3.9.4) | 113 | rdoc (3.9.4) |
| 114 | + rest-client (1.6.7) | ||
| 115 | + mime-types (>= 1.16) | ||
| 114 | rmagick (2.13.1) | 116 | rmagick (2.13.1) |
| 115 | rspec (2.10.0) | 117 | rspec (2.10.0) |
| 116 | rspec-core (~> 2.10.0) | 118 | rspec-core (~> 2.10.0) |
| @@ -175,6 +177,7 @@ DEPENDENCIES | @@ -175,6 +177,7 @@ DEPENDENCIES | ||
| 175 | rails | 177 | rails |
| 176 | rails_autolink | 178 | rails_autolink |
| 177 | rake | 179 | rake |
| 180 | + rest-client | ||
| 178 | rmagick | 181 | rmagick |
| 179 | rspec | 182 | rspec |
| 180 | rspec-rails | 183 | rspec-rails |
app/controllers/my_profile/cms_controller.rb
| @@ -188,7 +188,18 @@ class CmsController < MyProfileController | @@ -188,7 +188,18 @@ class CmsController < MyProfileController | ||
| 188 | end | 188 | end |
| 189 | if request.post? && params[:uploaded_files] | 189 | if request.post? && params[:uploaded_files] |
| 190 | params[:uploaded_files].each do |file| | 190 | params[:uploaded_files].each do |file| |
| 191 | - @uploaded_files << UploadedFile.create({:uploaded_data => file, :profile => profile, :parent => @parent, :last_changed_by => user}, :without_protection => true) unless file == '' | 191 | + unless file == '' |
| 192 | + @uploaded_files << UploadedFile.create( | ||
| 193 | + { | ||
| 194 | + :uploaded_data => file, | ||
| 195 | + :profile => profile, | ||
| 196 | + :parent => @parent, | ||
| 197 | + :last_changed_by => user, | ||
| 198 | + :created_by => user, | ||
| 199 | + }, | ||
| 200 | + :without_protection => true | ||
| 201 | + ) | ||
| 202 | + end | ||
| 192 | end | 203 | end |
| 193 | @errors = @uploaded_files.select { |f| f.errors.any? } | 204 | @errors = @uploaded_files.select { |f| f.errors.any? } |
| 194 | if @errors.any? | 205 | if @errors.any? |
app/controllers/public/profile_controller.rb
| @@ -202,7 +202,8 @@ class ProfileController < PublicController | @@ -202,7 +202,8 @@ class ProfileController < PublicController | ||
| 202 | end | 202 | end |
| 203 | 203 | ||
| 204 | def more_comments | 204 | def more_comments |
| 205 | - activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity], :user_id => @profile}) | 205 | + profile_filter = @profile.person? ? {:user_id => @profile} : {:target_id => @profile} |
| 206 | + activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity]}.merge(profile_filter)) | ||
| 206 | comments_count = activity.comments.count | 207 | comments_count = activity.comments.count |
| 207 | comment_page = (params[:comment_page] || 1).to_i | 208 | comment_page = (params[:comment_page] || 1).to_i |
| 208 | comments_per_page = 5 | 209 | comments_per_page = 5 |
app/helpers/application_helper.rb
| @@ -1223,8 +1223,8 @@ module ApplicationHelper | @@ -1223,8 +1223,8 @@ module ApplicationHelper | ||
| 1223 | end | 1223 | end |
| 1224 | 1224 | ||
| 1225 | def add_zoom_to_images | 1225 | def add_zoom_to_images |
| 1226 | - stylesheet_link_tag('fancybox') + | ||
| 1227 | - javascript_include_tag('jquery.fancybox-1.3.4.pack') + | 1226 | + stylesheet_link_tag('jquery.fancybox') + |
| 1227 | + javascript_include_tag('jquery.fancybox.pack') + | ||
| 1228 | javascript_tag("jQuery(function($) { | 1228 | javascript_tag("jQuery(function($) { |
| 1229 | $(window).load( function() { | 1229 | $(window).load( function() { |
| 1230 | $('#article .article-body img').each( function(index) { | 1230 | $('#article .article-body img').each( function(index) { |
app/models/approve_article.rb
| @@ -22,6 +22,7 @@ class ApproveArticle < Task | @@ -22,6 +22,7 @@ class ApproveArticle < Task | ||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | settings_items :closing_statment, :article_parent_id, :highlighted | 24 | settings_items :closing_statment, :article_parent_id, :highlighted |
| 25 | + settings_items :create_link, :type => :boolean, :default => false | ||
| 25 | 26 | ||
| 26 | def article_parent | 27 | def article_parent |
| 27 | Article.find_by_id article_parent_id.to_i | 28 | Article.find_by_id article_parent_id.to_i |
| @@ -48,7 +49,11 @@ class ApproveArticle < Task | @@ -48,7 +49,11 @@ class ApproveArticle < Task | ||
| 48 | end | 49 | end |
| 49 | 50 | ||
| 50 | def perform | 51 | def perform |
| 51 | - article.copy!(:name => name, :abstract => abstract, :body => body, :profile => target, :reference_article => article, :parent => article_parent, :highlighted => highlighted, :source => article.source, :last_changed_by_id => article.last_changed_by_id, :created_by_id => article.created_by_id) | 52 | + if create_link |
| 53 | + LinkArticle.create!(:reference_article => article, :profile => target) | ||
| 54 | + else | ||
| 55 | + article.copy!(:name => name, :abstract => abstract, :body => body, :profile => target, :reference_article => article, :parent => article_parent, :highlighted => highlighted, :source => article.source, :last_changed_by_id => article.last_changed_by_id, :created_by_id => article.created_by_id) | ||
| 56 | + end | ||
| 52 | end | 57 | end |
| 53 | 58 | ||
| 54 | def title | 59 | def title |
app/models/article.rb
| @@ -96,6 +96,11 @@ class Article < ActiveRecord::Base | @@ -96,6 +96,11 @@ class Article < ActiveRecord::Base | ||
| 96 | self.activity.destroy if self.activity | 96 | self.activity.destroy if self.activity |
| 97 | end | 97 | end |
| 98 | 98 | ||
| 99 | + after_destroy :destroy_link_article | ||
| 100 | + def destroy_link_article | ||
| 101 | + Article.where(:reference_article_id => self.id, :type => LinkArticle).destroy_all | ||
| 102 | + end | ||
| 103 | + | ||
| 99 | xss_terminate :only => [ :name ], :on => 'validation', :with => 'white_list' | 104 | xss_terminate :only => [ :name ], :on => 'validation', :with => 'white_list' |
| 100 | 105 | ||
| 101 | scope :in_category, lambda { |category| | 106 | scope :in_category, lambda { |category| |
app/models/block.rb
app/models/environment.rb
| @@ -287,7 +287,7 @@ class Environment < ActiveRecord::Base | @@ -287,7 +287,7 @@ class Environment < ActiveRecord::Base | ||
| 287 | www.youtube.com | 287 | www.youtube.com |
| 288 | ] + ('a' .. 'z').map{|i| "#{i}.yimg.com"} | 288 | ] + ('a' .. 'z').map{|i| "#{i}.yimg.com"} |
| 289 | 289 | ||
| 290 | - settings_items :enabled_plugins, :type => Array, :default => [] | 290 | + settings_items :enabled_plugins, :type => Array, :default => Noosfero::Plugin.available_plugin_names |
| 291 | 291 | ||
| 292 | settings_items :disabled_blocks, :type => Array, :default => [] | 292 | settings_items :disabled_blocks, :type => Array, :default => [] |
| 293 | 293 |
app/models/product.rb
| @@ -11,7 +11,7 @@ class Product < ActiveRecord::Base | @@ -11,7 +11,7 @@ class Product < ActiveRecord::Base | ||
| 11 | 11 | ||
| 12 | SEARCH_DISPLAYS = %w[map full] | 12 | SEARCH_DISPLAYS = %w[map full] |
| 13 | 13 | ||
| 14 | - attr_accessible :name, :product_category, :highlighted, :price, :enterprise, :image_builder, :description, :available, :qualifiers | 14 | + attr_accessible :name, :product_category, :highlighted, :price, :enterprise, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs |
| 15 | 15 | ||
| 16 | def self.default_search_display | 16 | def self.default_search_display |
| 17 | 'full' | 17 | 'full' |
app/models/product_categories_block.rb
| @@ -17,7 +17,7 @@ class ProductCategoriesBlock < Block | @@ -17,7 +17,7 @@ class ProductCategoriesBlock < Block | ||
| 17 | profile = owner | 17 | profile = owner |
| 18 | proc do | 18 | proc do |
| 19 | if @categories.nil? or @categories.length == 0 | 19 | if @categories.nil? or @categories.length == 0 |
| 20 | - categories = ProductCategory.on_level().order(:name) | 20 | + categories = ProductCategory.on_level(nil).order(:name) |
| 21 | if @categories and @categories.length == 0 | 21 | if @categories and @categories.length == 0 |
| 22 | notice = _('There are no sub-categories for %s') % @category.name | 22 | notice = _('There are no sub-categories for %s') % @category.name |
| 23 | end | 23 | end |
app/models/profile.rb
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | # which by default is the one returned by Environment:default. | 3 | # which by default is the one returned by Environment:default. |
| 4 | class Profile < ActiveRecord::Base | 4 | class Profile < ActiveRecord::Base |
| 5 | 5 | ||
| 6 | - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time | 6 | + attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, :redirection_after_login |
| 7 | 7 | ||
| 8 | # use for internationalizable human type names in search facets | 8 | # use for internationalizable human type names in search facets |
| 9 | # reimplement on subclasses | 9 | # reimplement on subclasses |
app/models/profile_list_block.rb
| 1 | class ProfileListBlock < Block | 1 | class ProfileListBlock < Block |
| 2 | 2 | ||
| 3 | - attr_accessible :limit, :prioritize_profiles_with_image | 3 | + attr_accessible :prioritize_profiles_with_image |
| 4 | 4 | ||
| 5 | settings_items :limit, :type => :integer, :default => 6 | 5 | settings_items :limit, :type => :integer, :default => 6 |
| 6 | settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true | 6 | settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true |
| @@ -18,13 +18,13 @@ class ProfileListBlock < Block | @@ -18,13 +18,13 @@ class ProfileListBlock < Block | ||
| 18 | result = nil | 18 | result = nil |
| 19 | visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment]) | 19 | visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment]) |
| 20 | if !prioritize_profiles_with_image | 20 | if !prioritize_profiles_with_image |
| 21 | - result = visible_profiles.all(:limit => limit, :order => 'profiles.updated_at DESC').sort_by{ rand } | ||
| 22 | - elsif profiles.visible.with_image.count >= limit | ||
| 23 | - result = visible_profiles.with_image.all(:limit => limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand } | 21 | + result = visible_profiles.all(:limit => get_limit, :order => 'profiles.updated_at DESC').sort_by{ rand } |
| 22 | + elsif profiles.visible.with_image.count >= get_limit | ||
| 23 | + result = visible_profiles.with_image.all(:limit => get_limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand } | ||
| 24 | else | 24 | else |
| 25 | - result = visible_profiles.with_image.sort_by{ rand } + visible_profiles.without_image.all(:limit => limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand } | 25 | + result = visible_profiles.with_image.sort_by{ rand } + visible_profiles.without_image.all(:limit => get_limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand } |
| 26 | end | 26 | end |
| 27 | - result.slice(0..limit-1) | 27 | + result.slice(0..get_limit-1) |
| 28 | end | 28 | end |
| 29 | 29 | ||
| 30 | def profile_count | 30 | def profile_count |
app/models/recent_documents_block.rb
| @@ -33,7 +33,7 @@ class RecentDocumentsBlock < Block | @@ -33,7 +33,7 @@ class RecentDocumentsBlock < Block | ||
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | def docs | 35 | def docs |
| 36 | - self.limit.nil? ? owner.recent_documents(nil, {}, false) : owner.recent_documents(self.limit, {}, false) | 36 | + self.limit.nil? ? owner.recent_documents(nil, {}, false) : owner.recent_documents(self.get_limit, {}, false) |
| 37 | end | 37 | end |
| 38 | 38 | ||
| 39 | def self.expire_on | 39 | def self.expire_on |
app/views/profile/index.html.erb
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <table class='profile'> | 19 | <table class='profile'> |
| 20 | <tr> | 20 | <tr> |
| 21 | <td colspan='2'> | 21 | <td colspan='2'> |
| 22 | - <% plugins_tabs = @plugins.dispatch(:profile_tabs).map { |tab| {:title => tab[:title], :id => tab[:id], :content => instance_exec(&tab[:content]), :start => tab[:title]} }%> | 22 | + <% plugins_tabs = @plugins.dispatch(:profile_tabs).map { |tab| {:title => tab[:title], :id => tab[:id], :content => instance_exec(&tab[:content]), :start => tab[:start]} }%> |
| 23 | 23 | ||
| 24 | <% tabs = plugins_tabs.select { |tab| tab[:start] } %> | 24 | <% tabs = plugins_tabs.select { |tab| tab[:start] } %> |
| 25 | 25 |
app/views/tasks/_approve_article_accept_details.html.erb
| 1 | <%= render :file => 'shared/tiny_mce' %> | 1 | <%= render :file => 'shared/tiny_mce' %> |
| 2 | 2 | ||
| 3 | +<%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> | ||
| 4 | + | ||
| 3 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> | 5 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> |
| 4 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> | 6 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> |
| 5 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> | 7 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
config/plugins/people_block
debian/control
debian/noosfero.install
| @@ -21,6 +21,7 @@ config/locales usr/share/noosfero/config | @@ -21,6 +21,7 @@ config/locales usr/share/noosfero/config | ||
| 21 | config.ru usr/share/noosfero | 21 | config.ru usr/share/noosfero |
| 22 | 22 | ||
| 23 | plugins usr/share/noosfero | 23 | plugins usr/share/noosfero |
| 24 | +baseplugins usr/share/noosfero | ||
| 24 | 25 | ||
| 25 | debian/dbinstall usr/lib/noosfero | 26 | debian/dbinstall usr/lib/noosfero |
| 26 | debian/dbupgrade usr/lib/noosfero | 27 | debian/dbupgrade usr/lib/noosfero |
lib/feed_handler.rb.orig
| @@ -1,110 +0,0 @@ | @@ -1,110 +0,0 @@ | ||
| 1 | -require 'feedparser' | ||
| 2 | -require 'open-uri' | ||
| 3 | - | ||
| 4 | -# This class is responsible for processing feeds and pass the items to the | ||
| 5 | -# respective container. | ||
| 6 | -# | ||
| 7 | -# The <tt>max_errors</tt> attribute controls how many times it will retry in | ||
| 8 | -# case of failure. If a feed fails for <tt>max_errors+1</tt> times, it will be | ||
| 9 | -# disabled and the last error message will be recorder in the container. | ||
| 10 | -# The default value is *6*, if you need to change it you can do that in your | ||
| 11 | -# config/local.rb file like this: | ||
| 12 | -# | ||
| 13 | -# FeedHandler.max_errors = 10 | ||
| 14 | -# | ||
| 15 | -# For the update interval, see FeedUpdater. | ||
| 16 | -class FeedHandler | ||
| 17 | - | ||
| 18 | - # The maximum number | ||
| 19 | - cattr_accessor :max_errors | ||
| 20 | - cattr_accessor :disabled_period | ||
| 21 | - | ||
| 22 | - self.max_errors = 6 | ||
| 23 | - self.disabled_period = 1.week | ||
| 24 | - | ||
| 25 | - def parse(content) | ||
| 26 | - raise FeedHandler::ParseError, "Content is nil" if content.nil? | ||
| 27 | - begin | ||
| 28 | - return FeedParser::Feed::new(content) | ||
| 29 | - rescue Exception => ex | ||
| 30 | - raise FeedHandler::ParseError, "Invalid feed format." | ||
| 31 | - end | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - def fetch(address) | ||
| 35 | - begin | ||
| 36 | - content = "" | ||
| 37 | - block = lambda { |s| content = s.read } | ||
| 38 | - content = | ||
| 39 | - if Rails.env == 'test' && File.exists?(address) | ||
| 40 | - File.read(address) | ||
| 41 | - else | ||
| 42 | - if !valid_url?(address) | ||
| 43 | - raise InvalidUrl.new("\"%s\" is not a valid URL" % address) | ||
| 44 | - end | ||
| 45 | - open(address, "User-Agent" => "Noosfero/#{Noosfero::VERSION}", &block) | ||
| 46 | - end | ||
| 47 | - return content | ||
| 48 | - rescue Exception => ex | ||
| 49 | - raise FeedHandler::FetchError, ex.message | ||
| 50 | - end | ||
| 51 | - end | ||
| 52 | - | ||
| 53 | - def process(container) | ||
| 54 | -<<<<<<< HEAD | ||
| 55 | - Rails.logger.info("Processing %s with id = %d" % [container.class.name, container.id]) | ||
| 56 | -======= | ||
| 57 | ->>>>>>> rails235 | ||
| 58 | - begin | ||
| 59 | - container.class.transaction do | ||
| 60 | - if container.update_errors > FeedHandler.max_errors && container.fetched_at < (Time.now - FeedHandler.disabled_period) | ||
| 61 | - container.enabled = true | ||
| 62 | - container.update_errors = 0 | ||
| 63 | - container.save | ||
| 64 | - end | ||
| 65 | - next unless container.enabled | ||
| 66 | - actually_process_container(container) | ||
| 67 | - container.update_errors = 0 | ||
| 68 | - container.finish_fetch | ||
| 69 | - end | ||
| 70 | - rescue Exception => exception | ||
| 71 | - Rails.logger.warn("Unknown error from %s ID %d\n%s" % [container.class.name, container.id, exception.to_s]) | ||
| 72 | - Rails.logger.warn("Backtrace:\n%s" % exception.backtrace.join("\n")) | ||
| 73 | - container.reload | ||
| 74 | - container.update_errors += 1 | ||
| 75 | - container.error_message = exception.to_s | ||
| 76 | - if container.update_errors > FeedHandler.max_errors | ||
| 77 | - container.fetched_at = Time.now | ||
| 78 | - container.enabled = false | ||
| 79 | - end | ||
| 80 | - begin | ||
| 81 | - container.finish_fetch | ||
| 82 | - rescue Exception => finish_fetch_exception | ||
| 83 | - Rails.logger.warn("Unable to finish fetch from %s ID %d\n%s" % [container.class.name, container.id, finish_fetch_exception.to_s]) | ||
| 84 | - Rails.logger.warn("Backtrace:\n%s" % finish_fetch_exception.backtrace.join("\n")) | ||
| 85 | - end | ||
| 86 | - end | ||
| 87 | - end | ||
| 88 | - | ||
| 89 | - class InvalidUrl < Exception; end | ||
| 90 | - class ParseError < Exception; end | ||
| 91 | - class FetchError < Exception; end | ||
| 92 | - | ||
| 93 | - protected | ||
| 94 | - | ||
| 95 | - def actually_process_container(container) | ||
| 96 | - container.clear | ||
| 97 | - content = fetch(container.address) | ||
| 98 | - container.fetched_at = Time.now | ||
| 99 | - parsed_feed = parse(content) | ||
| 100 | - container.feed_title = parsed_feed.title | ||
| 101 | - parsed_feed.items[0..container.limit-1].reverse.each do |item| | ||
| 102 | - container.add_item(item.title, item.link, item.date, item.content) | ||
| 103 | - end | ||
| 104 | - end | ||
| 105 | - | ||
| 106 | - def valid_url?(url) | ||
| 107 | - url =~ URI.regexp('http') || url =~ URI.regexp('https') | ||
| 108 | - end | ||
| 109 | - | ||
| 110 | -end |
lib/noosfero/plugin.rb
| @@ -104,7 +104,7 @@ class Noosfero::Plugin | @@ -104,7 +104,7 @@ class Noosfero::Plugin | ||
| 104 | 104 | ||
| 105 | def available_plugins | 105 | def available_plugins |
| 106 | unless @available_plugins | 106 | unless @available_plugins |
| 107 | - path = File.join(Rails.root, 'config', 'plugins', '*') | 107 | + path = File.join(Rails.root, '{baseplugins,config/plugins}', '*') |
| 108 | @available_plugins = Dir.glob(path).select{ |i| File.directory?(i) } | 108 | @available_plugins = Dir.glob(path).select{ |i| File.directory?(i) } |
| 109 | if Rails.env.test? && !@available_plugins.include?(File.join(Rails.root, 'config', 'plugins', 'foo')) | 109 | if Rails.env.test? && !@available_plugins.include?(File.join(Rails.root, 'config', 'plugins', 'foo')) |
| 110 | @available_plugins << File.join(Rails.root, 'plugins', 'foo') | 110 | @available_plugins << File.join(Rails.root, 'plugins', 'foo') |
| @@ -113,6 +113,10 @@ class Noosfero::Plugin | @@ -113,6 +113,10 @@ class Noosfero::Plugin | ||
| 113 | @available_plugins | 113 | @available_plugins |
| 114 | end | 114 | end |
| 115 | 115 | ||
| 116 | + def available_plugin_names | ||
| 117 | + available_plugins.map { |f| File.basename(f).camelize } | ||
| 118 | + end | ||
| 119 | + | ||
| 116 | def all | 120 | def all |
| 117 | @all ||= available_plugins.map{ |dir| (File.basename(dir) + "_plugin").camelize } | 121 | @all ||= available_plugins.map{ |dir| (File.basename(dir) + "_plugin").camelize } |
| 118 | end | 122 | end |
lib/tasks/plugins.rake
| 1 | require 'active_record' | 1 | require 'active_record' |
| 2 | #require_dependency 'active_record/migration' | 2 | #require_dependency 'active_record/migration' |
| 3 | 3 | ||
| 4 | -class ActiveRecord::Migrator | ||
| 5 | - alias_method :orig_initialize, :initialize | ||
| 6 | - def initialize *args | ||
| 7 | - orig_initialize *args | ||
| 8 | - @migrations_paths = ["db/migrate", "config/plugins/*/db/migrate"] | ||
| 9 | - end | ||
| 10 | -end | ||
| 11 | - | ||
| 12 | namespace :noosfero do | 4 | namespace :noosfero do |
| 13 | namespace :plugins do | 5 | namespace :plugins do |
| 14 | - plugin_migration_dirs = Dir.glob(Rails.root.join('config', 'plugins', '*', 'db', 'migrate')) | 6 | + |
| 7 | + plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate')) | ||
| 8 | + | ||
| 9 | + task :load_config do | ||
| 10 | + dirs = Dir.glob("{baseplugins,config/plugins}/*/db/migrate") | ||
| 11 | + dirs.each do |dir| | ||
| 12 | + ActiveRecord::Migrator.migrations_paths << dir | ||
| 13 | + end | ||
| 14 | + end | ||
| 15 | + | ||
| 15 | task :migrate do | 16 | task :migrate do |
| 16 | plugin_migration_dirs.each do |path| | 17 | plugin_migration_dirs.each do |path| |
| 17 | ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? | 18 | ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? |
| @@ -20,3 +21,6 @@ namespace :noosfero do | @@ -20,3 +21,6 @@ namespace :noosfero do | ||
| 20 | end | 21 | end |
| 21 | end | 22 | end |
| 22 | end | 23 | end |
| 24 | + | ||
| 25 | +task 'db:migrate' => 'noosfero:plugins:load_config' | ||
| 26 | +task 'db:schema:load' => 'noosfero:plugins:load_config' |
lib/tasks/plugins_tests.rake
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium] | 3 | @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium] |
| 4 | 4 | ||
| 5 | def enabled_plugins | 5 | def enabled_plugins |
| 6 | - Dir.glob('config/plugins/*').map { |f| File.basename(f) } - ['README'] | 6 | + Dir.glob('{baseplugins,config/plugins}/*').map { |f| File.basename(f) } - ['README'] |
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | @original_enabled_plugins = enabled_plugins | 9 | @original_enabled_plugins = enabled_plugins |
| @@ -51,7 +51,7 @@ def plugin_name(plugin) | @@ -51,7 +51,7 @@ def plugin_name(plugin) | ||
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | def plugin_enabled?(plugin) | 53 | def plugin_enabled?(plugin) |
| 54 | - File.exist?(File.join('config', 'plugins', plugin)) | 54 | + File.exist?(File.join('config', 'plugins', plugin)) || File.exist?(File.join('baseplugins', plugin)) |
| 55 | end | 55 | end |
| 56 | 56 | ||
| 57 | def plugin_disabled_warning(plugin) | 57 | def plugin_disabled_warning(plugin) |
plugins/mezuro/AUTHORS
| @@ -1,42 +0,0 @@ | @@ -1,42 +0,0 @@ | ||
| 1 | -Mezuro Authors | ||
| 2 | -============== | ||
| 3 | - | ||
| 4 | -Copyright 2010-2013 | ||
| 5 | -------------------- | ||
| 6 | - | ||
| 7 | - Almir Alves Pereira (almir.sne at gmail.com) | ||
| 8 | - Alessandro Palmeira (alessandro.palmeira at gmail.com) | ||
| 9 | - Andre Casimiro (ah.casimiro at gmail.com) | ||
| 10 | - Antonio Terceiro (terceiro at colivre.coop.br) | ||
| 11 | - Caio Salgado (caio.csalgado at gmail.com) | ||
| 12 | - Carlos Morais (carlos88morais at gmail.com) | ||
| 13 | - Daniel Alves (danpaulalves at gmail.com) | ||
| 14 | - Daniela Feitosa (daniela at colivre.coop.br) | ||
| 15 | - Diego Araújo (diegoamc90 at gmail.com) | ||
| 16 | - Everton Santos (everton2x4 at gmail.com) | ||
| 17 | - Guilherme Rojas (guilhermehrojas at gmail.com) | ||
| 18 | - Jefferson Fernandes (jeffs.fernandes at gmail.com) | ||
| 19 | - Joao Machini (joao.machini at gmail.com) | ||
| 20 | - João da Silva (jaodsilv@linux.ime.usp.br) | ||
| 21 | - Paulo Meirelles (paulo at softwarelivre.org) | ||
| 22 | - Pedro Leal (pedrombl at gmail.com) | ||
| 23 | - Rafael Manso (rr.manzo at gmail.com) | ||
| 24 | - Rafael Messias (rmmartins at gmail.com) | ||
| 25 | - Renan Teruo (renanteruoc at gmail.com) | ||
| 26 | - Rodrigo Souto (rodrigo at colivre.coop.br) | ||
| 27 | - | ||
| 28 | -Collaborators (from USP Lab XP course 2010 on another code) | ||
| 29 | ------------------------------------------------------------ | ||
| 30 | - | ||
| 31 | - Ana Paula Oliveira dos Santos (anapaulao.santos at gmail.com) | ||
| 32 | - Lucianna Almeida (lucianna.th at gmail.com) | ||
| 33 | - Thiago Colucci (ticolucci at gmail.com) | ||
| 34 | - Vinicius Daros (vinicius.k.daros at gmail.com) | ||
| 35 | - Viviane Almeida Santos (viviane.almeida at gmail.com) | ||
| 36 | - | ||
| 37 | -Advisors | ||
| 38 | --------- | ||
| 39 | - | ||
| 40 | - Fabio Kon (fabio.kon at ime.usp.br) | ||
| 41 | - Alfredo Goldman (gold at ime.usp.br) | ||
| 42 | - |
plugins/mezuro/README.md
| @@ -1,144 +0,0 @@ | @@ -1,144 +0,0 @@ | ||
| 1 | -README - Mezuro Plugin | ||
| 2 | -====================== | ||
| 3 | - | ||
| 4 | -Mezuro is a source code tracking platform based on Noosfero social networking | ||
| 5 | -platform with Mezuro Plugin actived to access Kalibro Web Service. | ||
| 6 | - | ||
| 7 | - | ||
| 8 | -INSTALL | ||
| 9 | -======= | ||
| 10 | - | ||
| 11 | -Dependences | ||
| 12 | ------------ | ||
| 13 | - | ||
| 14 | -See the Noosfero INSTALL (and HACKING) file. After install Noosfero, you must | ||
| 15 | -install Mezuro dependences: | ||
| 16 | - | ||
| 17 | -$ gem install --no-ri --no-rdoc nokogiri -v 1.5.0 | ||
| 18 | -$ gem install --no-ri --no-rdoc wasabi -v 2.0.0 | ||
| 19 | -$ gem install --no-ri --no-rdoc savon -v 0.9.7 | ||
| 20 | -$ gem install --no-ri --no-rdoc googlecharts | ||
| 21 | - | ||
| 22 | -$ gem uninstall rack | ||
| 23 | -$ gem install --no-ri --no-rdoc rack -v 1.0.1 | ||
| 24 | - | ||
| 25 | - | ||
| 26 | -*with RVM* | ||
| 27 | - | ||
| 28 | -if you want to use RVM (Ruby Version Manager) environment, just run: | ||
| 29 | - | ||
| 30 | -$ plugins/mezuro/script/install/install-rvm.sh | ||
| 31 | - | ||
| 32 | - | ||
| 33 | -Enable Mezuro Plugin | ||
| 34 | --------------------- | ||
| 35 | - | ||
| 36 | -Also, you need to enable Mezuro Plugin at your Noosfero installation: | ||
| 37 | - | ||
| 38 | -cd <your_noosfero_dir> | ||
| 39 | -./script/noosfero-plugins enable mezuro | ||
| 40 | - | ||
| 41 | - | ||
| 42 | -Install Service | ||
| 43 | ---------------- | ||
| 44 | - | ||
| 45 | -To run Mezuro (Noosfero with Mezuro Plugin), you need to install the Kalibro | ||
| 46 | -Service. For that, see: | ||
| 47 | -https://gitorious.org/kalibro/kalibro/blobs/master/INSTALL | ||
| 48 | - | ||
| 49 | - | ||
| 50 | -Configure Service Address | ||
| 51 | -------------------------- | ||
| 52 | - | ||
| 53 | -Addictionaly, copy service.yml.example to service.yml and define your Kalibro | ||
| 54 | -Service address: | ||
| 55 | - | ||
| 56 | -$ cd <your_noosfero_dir>/plugin/mezuro | ||
| 57 | -$ cp service.yml.example service.yml | ||
| 58 | - | ||
| 59 | -If you install Kalibro Service at localhost, just keep the default | ||
| 60 | -adress: | ||
| 61 | - | ||
| 62 | -http://localhost:8080/KalibroService/ | ||
| 63 | - | ||
| 64 | - | ||
| 65 | -Set Licences list | ||
| 66 | ------------------ | ||
| 67 | - | ||
| 68 | -$ cd <your_noosfero_dir>/plugin/mezuro | ||
| 69 | -$ cp licence.yml.example licence.yml | ||
| 70 | - | ||
| 71 | - | ||
| 72 | -Apply Mezuro Theme | ||
| 73 | ---------------------- | ||
| 74 | - | ||
| 75 | -(Our RVM install script already do that) | ||
| 76 | - | ||
| 77 | -If you want, you can use the Mezuro default theme: | ||
| 78 | - | ||
| 79 | -$ cd public/designs/themes && rm -f default | ||
| 80 | -$ git clone git://gitorious.org/mezuro/mezuro-theme.git | ||
| 81 | -$ ln -s mezuro-theme/ default && cd ../../../ | ||
| 82 | - | ||
| 83 | - | ||
| 84 | -Active Mezuro Plugin on Noosfero Environment | ||
| 85 | --------------------------------------------- | ||
| 86 | - | ||
| 87 | -As a Noosfero administrator user, go to administrator panel: | ||
| 88 | - | ||
| 89 | -- Click on "Enable/disable plugins" option | ||
| 90 | -- Click on "Mezuro Plugin" check-box | ||
| 91 | - | ||
| 92 | - | ||
| 93 | -DEVELOPMENT | ||
| 94 | -=========== | ||
| 95 | - | ||
| 96 | -Get the Mezuro (Noosfero with Mezuro Plugin) development repository: | ||
| 97 | - | ||
| 98 | -$ git clone https://gitorious.org/+mezuro/noosfero/mezuro | ||
| 99 | -$ cd mezuro | ||
| 100 | -$ git checkout mezuro | ||
| 101 | - | ||
| 102 | -Running Mezuro tests | ||
| 103 | --------------------- | ||
| 104 | - | ||
| 105 | -$ rake test:noosfero_plugins:mezuro | ||
| 106 | - | ||
| 107 | -or just: | ||
| 108 | - | ||
| 109 | -$ rake test:noosfero_plugin_mezuro:units | ||
| 110 | -$ rake test:noosfero_plugin:mezuro:functionals | ||
| 111 | - | ||
| 112 | - | ||
| 113 | -Get Involved | ||
| 114 | -============ | ||
| 115 | - | ||
| 116 | -If you found any bug and/or want to collaborate, please send an e-mail to | ||
| 117 | -paulo@softwarelivre.org | ||
| 118 | - | ||
| 119 | - | ||
| 120 | -LICENSE | ||
| 121 | -======= | ||
| 122 | - | ||
| 123 | -Copyright (c) The Author developers. | ||
| 124 | - | ||
| 125 | -See Noosfero license. | ||
| 126 | - | ||
| 127 | - | ||
| 128 | -AUTHORS | ||
| 129 | -======= | ||
| 130 | - | ||
| 131 | -Please, see the Mezuro AUTHORS file. | ||
| 132 | - | ||
| 133 | - | ||
| 134 | -ACKNOWLEDGMENTS | ||
| 135 | -=============== | ||
| 136 | - | ||
| 137 | -The authors have been supported by organizations: | ||
| 138 | - | ||
| 139 | -University of São Paulo (USP) | ||
| 140 | -FLOSS Competence Center | ||
| 141 | -http://ccsl.ime.usp.br | ||
| 142 | - | ||
| 143 | -Brazilian National Research Council (CNPQ) | ||
| 144 | -http://www.cnpq.br/ |
plugins/mezuro/TODO
| @@ -1,73 +0,0 @@ | @@ -1,73 +0,0 @@ | ||
| 1 | -README/TODO do branch cucumber_tests | ||
| 2 | - | ||
| 3 | -Tarefas: | ||
| 4 | -- Escrever uma história (procurar uma já escrita) para isso | ||
| 5 | -- Descobrir o porquê dos erros nos testes do mezuro (repository_url) | ||
| 6 | -- Dar rebase com o mezuro-dev (os tais testes passam no mezuro-dev) | ||
| 7 | -- Fazer mais testes | ||
| 8 | -- Ver como/quando o selenium pode ser integrado ao projeto (conversar com noosfero/ talvez até tentar implementar alguma coisa??) | ||
| 9 | - | ||
| 10 | - | ||
| 11 | -Testes de aceitação a serem feitos: (* já feito) | ||
| 12 | - | ||
| 13 | -Projetos: | ||
| 14 | - Criar | ||
| 15 | - * correto | ||
| 16 | - * errado | ||
| 17 | - duplicado | ||
| 18 | - Editar | ||
| 19 | - correto | ||
| 20 | - errado | ||
| 21 | - Deletar(não precisa fazer - problema do noosfero) | ||
| 22 | - | ||
| 23 | -Configurações: | ||
| 24 | - criar | ||
| 25 | - *correta | ||
| 26 | - *errado (sem titulo) | ||
| 27 | - *duplicada | ||
| 28 | - editar - verificar se mantem as metricas | ||
| 29 | - correto | ||
| 30 | - não é possível mudar o titulo | ||
| 31 | - deletar (não precisa fazer - problema do noosfero) | ||
| 32 | - metricas: | ||
| 33 | - criar | ||
| 34 | - nativa: | ||
| 35 | - *correta | ||
| 36 | - *errada | ||
| 37 | - duplicada (é pra funcionar?) | ||
| 38 | - composta: | ||
| 39 | - *correta | ||
| 40 | - errada | ||
| 41 | - duplicada | ||
| 42 | - editar | ||
| 43 | - para metrica correta | ||
| 44 | - para metrica errada | ||
| 45 | - *deletar | ||
| 46 | - ranges: | ||
| 47 | - criar | ||
| 48 | - *range correto | ||
| 49 | - range errado | ||
| 50 | - todos os casos | ||
| 51 | - editar | ||
| 52 | - para range correto | ||
| 53 | - para range errado | ||
| 54 | - deletar | ||
| 55 | - | ||
| 56 | -Testes falhando: | ||
| 57 | - | ||
| 58 | -Arquivo adding_metric_configuration.feature: | ||
| 59 | - Scenario: adding a native metric configuration without code | ||
| 60 | - Precisa do selenium para ver em qual página está. | ||
| 61 | - Scenario: adding a compound metric configuration | ||
| 62 | - Scenario: adding a compound metric configuration with invalid script | ||
| 63 | - As métricas compostas não estão salvando direito. | ||
| 64 | - | ||
| 65 | - | ||
| 66 | -Arquivo creating_project.feature: | ||
| 67 | - Scenario: I create a Kalibro project with valid attributes | ||
| 68 | - ás vezes falha por erro de já existir na Kalibro. Esse erro teóricamente já havia sido resolvido. | ||
| 69 | - | ||
| 70 | - | ||
| 71 | -Arquivo adding_ranges.feature: | ||
| 72 | - Scenario: adding a range to a metric configuration | ||
| 73 | - Precisa do selenium para esperar a página carregar. |
plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb
| @@ -1,109 +0,0 @@ | @@ -1,109 +0,0 @@ | ||
| 1 | -class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileController | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | - def choose_metric | ||
| 6 | - @configuration_content = profile.articles.find(params[:id]) | ||
| 7 | - @base_tools = Kalibro::BaseTool.all | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - def new_native | ||
| 11 | - @configuration_content = profile.articles.find(params[:id]) | ||
| 12 | - @reading_group_names_and_ids = reading_group_names_and_ids | ||
| 13 | - @metric = Kalibro::BaseTool.find_by_name(params[:base_tool_name]).metric params[:metric_name] | ||
| 14 | - @metric_configuration = Kalibro::MetricConfiguration.new :base_tool_name => params[:base_tool_name], :metric => @metric | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def edit_native | ||
| 18 | - params_to_edit_view | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - def new_compound | ||
| 22 | - @configuration_content = profile.articles.find(params[:id]) | ||
| 23 | - @metric_configurations = @configuration_content.metric_configurations | ||
| 24 | - @reading_group_names_and_ids = reading_group_names_and_ids | ||
| 25 | - metric = Kalibro::Metric.new :compound => true | ||
| 26 | - @metric_configuration = Kalibro::MetricConfiguration.new :metric => metric | ||
| 27 | - if configuration_content_has_errors? | ||
| 28 | - redirect_to_error_page @configuration_content.errors[:base] | ||
| 29 | - end | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def edit_compound | ||
| 33 | - params_to_edit_view | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - def create | ||
| 37 | - configuration_content = profile.articles.find(params[:id]) | ||
| 38 | - metric_configuration = Kalibro::MetricConfiguration.create(params[:metric_configuration]) | ||
| 39 | - | ||
| 40 | - if metric_configuration_has_errors? metric_configuration | ||
| 41 | - redirect_to_error_page metric_configuration.errors[0].message | ||
| 42 | - else | ||
| 43 | - redirect_to(metric_configuration_url(configuration_content, metric_configuration.id)) | ||
| 44 | - end | ||
| 45 | - end | ||
| 46 | - | ||
| 47 | - def update | ||
| 48 | - @configuration_content = profile.articles.find(params[:id]) | ||
| 49 | - metric_configurations = @configuration_content.metric_configurations | ||
| 50 | - metric_configuration = find_metric_configuration(metric_configurations, params[:metric_configuration][:id].to_i) | ||
| 51 | - metric_configuration.update_attributes params[:metric_configuration] | ||
| 52 | - if metric_configuration_has_errors? metric_configuration | ||
| 53 | - redirect_to_error_page metric_configuration.errors[0].message | ||
| 54 | - else | ||
| 55 | - redirect_to @configuration_content.view_url | ||
| 56 | - end | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | - def remove | ||
| 60 | - configuration_content = profile.articles.find(params[:id]) | ||
| 61 | - configuration_id = configuration_content.configuration_id | ||
| 62 | - metric_configuration = Kalibro::MetricConfiguration.new({:id => params[:metric_configuration_id].to_i}) | ||
| 63 | - metric_configuration.destroy | ||
| 64 | - if metric_configuration_has_errors? metric_configuration | ||
| 65 | - redirect_to_error_page metric_configuration.errors[0].message | ||
| 66 | - else | ||
| 67 | - redirect_to configuration_content.view_url | ||
| 68 | - end | ||
| 69 | - end | ||
| 70 | - | ||
| 71 | - private | ||
| 72 | - | ||
| 73 | - def find_metric_configuration (metric_configurations, metric_configuration_id) | ||
| 74 | - metric_configurations.select {|metric_configuration| metric_configuration.id == metric_configuration_id }.first | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | - def reading_group_names_and_ids | ||
| 78 | - array = Kalibro::ReadingGroup.all.map { |reading_group| [reading_group.name, reading_group.id] } | ||
| 79 | - array.sort { |x,y| x.first.downcase <=> y.first.downcase } | ||
| 80 | - end | ||
| 81 | - | ||
| 82 | - def metric_configuration_has_errors? metric_configuration | ||
| 83 | - not metric_configuration.errors.empty? | ||
| 84 | - end | ||
| 85 | - | ||
| 86 | - def configuration_content_has_errors? | ||
| 87 | - not @configuration_content.errors[:base].nil? | ||
| 88 | - end | ||
| 89 | - | ||
| 90 | - def metric_configuration_url(configuration_content, metric_configuration_id) | ||
| 91 | - url = configuration_content.view_url | ||
| 92 | - url[:controller] = controller_name | ||
| 93 | - url[:id] = configuration_content.id | ||
| 94 | - url[:metric_configuration_id] = metric_configuration_id | ||
| 95 | - url[:action] = (params[:metric_configuration][:metric][:compound] == "true" ? "edit_compound" : "edit_native") | ||
| 96 | - url | ||
| 97 | - end | ||
| 98 | - | ||
| 99 | - def params_to_edit_view | ||
| 100 | - @configuration_content = profile.articles.find(params[:id]) | ||
| 101 | - @metric_configurations = @configuration_content.metric_configurations | ||
| 102 | - @metric_configuration = find_metric_configuration(@metric_configurations, params[:metric_configuration_id].to_i) | ||
| 103 | - @metric = @metric_configuration.metric | ||
| 104 | - @reading_group_names_and_ids = reading_group_names_and_ids | ||
| 105 | - @ranges = Kalibro::Range.ranges_of(@metric_configuration.id) | ||
| 106 | - end | ||
| 107 | - | ||
| 108 | -end | ||
| 109 | - |
plugins/mezuro/controllers/myprofile/mezuro_plugin_myprofile_controller.rb
| @@ -1,29 +0,0 @@ | @@ -1,29 +0,0 @@ | ||
| 1 | -class MezuroPluginMyprofileController < ProfileController #MyprofileController? | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | -# rescue_from Exception do |exception| | ||
| 6 | -# @message = process_error_message exception.message | ||
| 7 | -# render :partial => "error_page" | ||
| 8 | -# end | ||
| 9 | - | ||
| 10 | - def error_page | ||
| 11 | - @message = params[:message] | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - protected | ||
| 15 | - | ||
| 16 | - def redirect_to_error_page(message) | ||
| 17 | - message = URI.escape(CGI.escape(process_error_message(message)),'.') | ||
| 18 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - def process_error_message message #FIXME | ||
| 22 | - if message =~ /bla/ | ||
| 23 | - message | ||
| 24 | - else | ||
| 25 | - message | ||
| 26 | - end | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | -end |
plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb
| @@ -1,66 +0,0 @@ | @@ -1,66 +0,0 @@ | ||
| 1 | -class MezuroPluginRangeController < MezuroPluginMyprofileController | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | - def new | ||
| 6 | - params_to_range_form | ||
| 7 | - params_to_redirect | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - def edit | ||
| 11 | - params_to_range_form | ||
| 12 | - ranges = Kalibro::Range.ranges_of params[:metric_configuration_id].to_i | ||
| 13 | - @range = (ranges.select { |range| range.id == params[:range_id].to_i }).first | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def create | ||
| 17 | - params_to_redirect | ||
| 18 | - save_range | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - def update | ||
| 22 | - save_range | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | - def remove | ||
| 26 | - configuration_content = profile.articles.find(params[:id]) | ||
| 27 | - Kalibro::Range.new({:id => params[:range_id].to_i}).destroy | ||
| 28 | - redirect_to(metric_configuration_url(configuration_content)) | ||
| 29 | - end | ||
| 30 | - | ||
| 31 | - private | ||
| 32 | - | ||
| 33 | - def metric_configuration_url configuration_content | ||
| 34 | - url = configuration_content.view_url | ||
| 35 | - url[:controller] = "mezuro_plugin_metric_configuration" | ||
| 36 | - url[:id] = configuration_content.id | ||
| 37 | - url[:metric_configuration_id] = params[:metric_configuration_id].to_i | ||
| 38 | - url[:action] = (params[:compound] ? "edit_compound" : "edit_native") | ||
| 39 | - url | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - def reading_labels_and_ids | ||
| 43 | - Kalibro::Reading.readings_of(params[:reading_group_id].to_i).map { |reading| [reading.label, reading.id] } | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - def save_range | ||
| 47 | - metric_configuration_id = params[:metric_configuration_id].to_i | ||
| 48 | - @range = Kalibro::Range.new params[:range] | ||
| 49 | - @range.save metric_configuration_id | ||
| 50 | - if !@range.errors.empty? | ||
| 51 | - @error = @range.errors[0].message | ||
| 52 | - end | ||
| 53 | - end | ||
| 54 | - | ||
| 55 | - def params_to_range_form | ||
| 56 | - @content_id = params[:id].to_i | ||
| 57 | - @metric_configuration_id = params[:metric_configuration_id].to_i | ||
| 58 | - @reading_labels_and_ids = reading_labels_and_ids | ||
| 59 | - end | ||
| 60 | - | ||
| 61 | - def params_to_redirect | ||
| 62 | - @reading_group_id = params[:reading_group_id].to_i | ||
| 63 | - @compound = params[:compound] | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | -end |
plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb
| @@ -1,48 +0,0 @@ | @@ -1,48 +0,0 @@ | ||
| 1 | -class MezuroPluginReadingController < MezuroPluginMyprofileController | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | - def new | ||
| 6 | - @reading_group_content = profile.articles.find(params[:id]) | ||
| 7 | - | ||
| 8 | - readings = Kalibro::Reading.readings_of @reading_group_content.reading_group_id | ||
| 9 | - @parser="|*|" | ||
| 10 | - @labels_and_grades = readings.map {|reading| "#{reading.label}#{@parser}#{reading.grade}#{@parser}"} | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def save | ||
| 14 | - reading_group_content = profile.articles.find(params[:id]) | ||
| 15 | - reading = Kalibro::Reading.new params[:reading] | ||
| 16 | - | ||
| 17 | - if( reading.save ) | ||
| 18 | - redirect_to reading_group_content.view_url | ||
| 19 | - else | ||
| 20 | - redirect_to_error_page reading.errors[0].message | ||
| 21 | - end | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def edit | ||
| 25 | - @reading_group_content = profile.articles.find(params[:id]) | ||
| 26 | - @reading = Kalibro::Reading.find params[:reading_id] | ||
| 27 | - | ||
| 28 | - readings = Kalibro::Reading.readings_of @reading_group_content.reading_group_id | ||
| 29 | - readings = readings.select {|reading| (reading.id != @reading.id)} | ||
| 30 | - @parser="|*|" | ||
| 31 | - @labels_and_grades = readings.map do |reading| | ||
| 32 | - if(reading.id != @reading.id) | ||
| 33 | - "#{reading.label}#{@parser}#{reading.grade}#{@parser}" | ||
| 34 | - end | ||
| 35 | - end | ||
| 36 | - end | ||
| 37 | - | ||
| 38 | - def destroy | ||
| 39 | - reading_group_content = profile.articles.find(params[:id]) | ||
| 40 | - reading = Kalibro::Reading.find params[:reading_id] | ||
| 41 | - reading.destroy | ||
| 42 | - if( reading.errors.empty? ) | ||
| 43 | - redirect_to reading_group_content.view_url | ||
| 44 | - else | ||
| 45 | - redirect_to_error_page reading.errors[0].message | ||
| 46 | - end | ||
| 47 | - end | ||
| 48 | -end |
plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb
| @@ -1,21 +0,0 @@ | @@ -1,21 +0,0 @@ | ||
| 1 | -class MezuroPluginModuleResultController < MezuroPluginProfileController | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | - def module_result | ||
| 6 | - @module_result = Kalibro::ModuleResult.find(params[:module_result_id].to_i) | ||
| 7 | - @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id) | ||
| 8 | - render :partial => 'module_result' | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def metric_result_history | ||
| 12 | - @history = Kalibro::MetricResult.history_of(params[:metric_name], params[:module_result_id].to_i) | ||
| 13 | - render :partial => 'score_history' | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def module_result_history | ||
| 17 | - @history = Kalibro::ModuleResult.history_of(params[:module_result_id].to_i) | ||
| 18 | - render :partial => 'score_history' | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | -end |
plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb
| @@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
| 1 | -class MezuroPluginProcessingController < MezuroPluginProfileController | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | - def state | ||
| 6 | - processing = processing_for_date(params[:repository_id].to_i, params[:date]) | ||
| 7 | - if processing.error.nil? | ||
| 8 | - render :text => processing.state | ||
| 9 | - else | ||
| 10 | - render :text => 'ERROR' | ||
| 11 | - end | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - def processing | ||
| 15 | - @processing = processing_for_date(params[:repository_id].to_i, params[:date]) | ||
| 16 | - if @processing.error.nil? | ||
| 17 | - render :partial => 'processing' | ||
| 18 | - else | ||
| 19 | - render :partial => 'processing_error' | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - private | ||
| 24 | - | ||
| 25 | - def processing_for_date(repository_id, date = nil) | ||
| 26 | - processing_class = Kalibro::Processing | ||
| 27 | - if date.nil? | ||
| 28 | - processing_class.processing_of(repository_id) | ||
| 29 | - else | ||
| 30 | - processing_class.processing_with_date_of(repository_id, date) | ||
| 31 | - end | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | -end |
plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb
| @@ -1,36 +0,0 @@ | @@ -1,36 +0,0 @@ | ||
| 1 | -#TODO Ver quais metodos precisam estar aqui e fazer os testes | ||
| 2 | -class MezuroPluginProfileController < ProfileController | ||
| 3 | - | ||
| 4 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 5 | - | ||
| 6 | -=begin | ||
| 7 | - rescue_from Exception do |exception| | ||
| 8 | - @message = process_error_message exception.message | ||
| 9 | - render :partial => "error_page" | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - def error_page | ||
| 13 | - @message = params[:message] | ||
| 14 | - end | ||
| 15 | -=end | ||
| 16 | - protected | ||
| 17 | - | ||
| 18 | - def process_error_message message | ||
| 19 | - if message =~ /undefined method `module' for nil:NilClass/ | ||
| 20 | - "Kalibro did not return any result. Verify if the selected configuration is correct." | ||
| 21 | - else | ||
| 22 | - message | ||
| 23 | - end | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def project_content_has_errors? | ||
| 27 | - not @content.errors[:base].nil? | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | - def redirect_to_error_page(message) | ||
| 31 | - message = URI.escape(CGI.escape(process_error_message(message)),'.') | ||
| 32 | - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | -end | ||
| 36 | - |
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
| @@ -1,65 +0,0 @@ | @@ -1,65 +0,0 @@ | ||
| 1 | -class MezuroPluginRepositoryController < MezuroPluginProfileController | ||
| 2 | - | ||
| 3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | ||
| 4 | - | ||
| 5 | - def new | ||
| 6 | - params_repository_form | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def edit | ||
| 10 | - params_repository_form | ||
| 11 | - @repository = @project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_i }.first | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - def save | ||
| 15 | - project_content = profile.articles.find(params[:id]) | ||
| 16 | - repository = Kalibro::Repository.new( params[:repository] ) | ||
| 17 | - | ||
| 18 | - if( repository.save ) | ||
| 19 | - repository.process | ||
| 20 | - redirect_to(repository_url(project_content, repository.id)) | ||
| 21 | - else | ||
| 22 | - redirect_to_error_page repository.errors[0].message | ||
| 23 | - end | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def show | ||
| 27 | - @project_content = profile.articles.find(params[:id]) | ||
| 28 | - @repository = @project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_i }.first | ||
| 29 | - @configuration_name = Kalibro::Configuration.find(@repository.configuration_id).name | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def destroy | ||
| 33 | - project_content = profile.articles.find(params[:id]) | ||
| 34 | - repository = Kalibro::Repository.new :id => params[:repository_id] | ||
| 35 | - repository.destroy | ||
| 36 | - if( repository.errors.empty? ) | ||
| 37 | - redirect_to project_content.view_url | ||
| 38 | - else | ||
| 39 | - redirect_to_error_page repository.errors[0].message | ||
| 40 | - end | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - private | ||
| 44 | - | ||
| 45 | - def repository_url(project_content, repository_id) | ||
| 46 | - url = project_content.view_url | ||
| 47 | - url[:controller] = controller_name | ||
| 48 | - url[:id] = project_content.id | ||
| 49 | - url[:repository_id] = repository_id | ||
| 50 | - url[:action] = "show" | ||
| 51 | - url | ||
| 52 | - end | ||
| 53 | - | ||
| 54 | - def params_repository_form | ||
| 55 | - @project_content = profile.articles.find(params[:id]) | ||
| 56 | - @repository_types = Kalibro::Repository.repository_types | ||
| 57 | - | ||
| 58 | - configurations = Kalibro::Configuration.all | ||
| 59 | - configurations = [] if (configurations.nil?) | ||
| 60 | - @configuration_select = configurations.map do |configuration| | ||
| 61 | - [configuration.name,configuration.id] | ||
| 62 | - end | ||
| 63 | - end | ||
| 64 | - | ||
| 65 | -end |
plugins/mezuro/dependencies.rb
plugins/mezuro/features/configuration.feature
| @@ -1,158 +0,0 @@ | @@ -1,158 +0,0 @@ | ||
| 1 | -Feature: Configuration | ||
| 2 | - As a mezuro user | ||
| 3 | - I want to create, edit and remove a Mezuro configuration | ||
| 4 | - | ||
| 5 | - Background: | ||
| 6 | - Given the following users | ||
| 7 | - | login | name | | ||
| 8 | - | joaosilva | Joao Silva | | ||
| 9 | - Given I am logged in as "joaosilva" | ||
| 10 | - And "Mezuro" plugin is enabled | ||
| 11 | - | ||
| 12 | - Scenario: I see Mezuro configurantion's input form | ||
| 13 | - Given I am on joaosilva's control panel | ||
| 14 | - When I follow "Mezuro configuration" | ||
| 15 | - Then I should see "Title" | ||
| 16 | - And I should see "Description" | ||
| 17 | - And I should see "Clone Configuration" | ||
| 18 | - | ||
| 19 | - @selenium @kalibro_restart | ||
| 20 | - Scenario: I create a Mezuro configuration with valid attributes without cloning | ||
| 21 | - Given I am on joaosilva's control panel | ||
| 22 | - And I follow "Mezuro configuration" | ||
| 23 | - When I fill the fields with the new following data | ||
| 24 | - | article_name | Sample Configuration | | ||
| 25 | - | article_description | Sample Description | | ||
| 26 | - | article_configuration_to_clone_id | None | | ||
| 27 | - And I press "Save" | ||
| 28 | - Then I should see "Sample Configuration" | ||
| 29 | - And I should see "Sample Description" | ||
| 30 | - And I should see "Add Metric" | ||
| 31 | - | ||
| 32 | - @selenium @kalibro_restart | ||
| 33 | - Scenario: I create a Mezuro configuration with valid attributes with cloning | ||
| 34 | - Given I have a Mezuro configuration with the following data | ||
| 35 | - | name | Sample Configuration| | ||
| 36 | - | description | Sample Description | | ||
| 37 | - | user | joaosilva | | ||
| 38 | - And I have a Mezuro reading group with the following data | ||
| 39 | - | name | Sample Reading group | | ||
| 40 | - | description | Sample Description | | ||
| 41 | - | user | joaosilva | | ||
| 42 | - And I have a Mezuro metric configuration with previous created configuration and reading group | ||
| 43 | - And I am on joaosilva's control panel | ||
| 44 | - And I follow "Mezuro configuration" | ||
| 45 | - When I fill the fields with the new following data | ||
| 46 | - | article_name | Another Configuration | | ||
| 47 | - | article_description | Another Description | | ||
| 48 | - | article_configuration_to_clone_id | Sample Configuration | | ||
| 49 | - And I press "Save" | ||
| 50 | - Then I should see "Another Configuration" | ||
| 51 | - And I should see "Another Description" | ||
| 52 | - And I should see "Total Coupling Factor" | ||
| 53 | - And I should see "Add Metric" | ||
| 54 | - | ||
| 55 | - Scenario: I try to create a Mezuro configuration without title | ||
| 56 | - Given I am on joaosilva's control panel | ||
| 57 | - And I follow "Mezuro configuration" | ||
| 58 | - And the field "article_name" is empty | ||
| 59 | - When I press "Save" | ||
| 60 | - Then I should see "Title can't be blank" | ||
| 61 | - | ||
| 62 | - @kalibro_restart | ||
| 63 | - Scenario: I try to create a Mezuro configuration with title already in use | ||
| 64 | - Given I have a Mezuro configuration with the following data | ||
| 65 | - | name | Sample Configuration | | ||
| 66 | - | description | Sample Description | | ||
| 67 | - | user | joaosilva | | ||
| 68 | - And I am on joaosilva's control panel | ||
| 69 | - When I create a Mezuro configuration with the following data | ||
| 70 | - | Title | Sample Configuration | | ||
| 71 | - | Description | Sample Description | | ||
| 72 | - | Clone | None | | ||
| 73 | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 74 | - | ||
| 75 | - @selenium @kalibro_restart | ||
| 76 | - Scenario: I see a Mezuro configuration edit form | ||
| 77 | - Given I have a Mezuro configuration with the following data | ||
| 78 | - | name | Sample Configuration | | ||
| 79 | - | description | Sample Description | | ||
| 80 | - | user | joaosilva | | ||
| 81 | - And I am on article "Sample Configuration" | ||
| 82 | - When I follow "Edit" | ||
| 83 | - Then I should see "Sample Configuration" in the "article_name" | ||
| 84 | - And I should see "Sample Description" in the "article_description" | ||
| 85 | - And I should see "Save" button | ||
| 86 | - | ||
| 87 | - @selenium @kalibro_restart | ||
| 88 | - Scenario: I edit a Mezuro configuration with valid attributes | ||
| 89 | - Given I have a Mezuro configuration with the following data | ||
| 90 | - | name | Sample Configuration | | ||
| 91 | - | description | Sample Description | | ||
| 92 | - | user | joaosilva | | ||
| 93 | - And I am on article "Sample Configuration" | ||
| 94 | - And I follow "Edit" | ||
| 95 | - When I fill the fields with the new following data | ||
| 96 | - | article_name | Another Configuration | | ||
| 97 | - | article_description | Another Description | | ||
| 98 | - And I press "Save" | ||
| 99 | - Then I should see "Another Configuration" | ||
| 100 | - And I should see "Another Description" | ||
| 101 | - And I should see "Add Metric" | ||
| 102 | - | ||
| 103 | - @selenium @kalibro_restart | ||
| 104 | - Scenario: I try to edit a Mezuro configuration leaving empty its title | ||
| 105 | - Given I have a Mezuro configuration with the following data | ||
| 106 | - | name | Sample Configuration | | ||
| 107 | - | description | Sample Description | | ||
| 108 | - | user | joaosilva | | ||
| 109 | - And I am on article "Sample Configuration" | ||
| 110 | - And I follow "Edit" | ||
| 111 | - When I erase the "article_name" field | ||
| 112 | - And I press "Save" | ||
| 113 | - Then I should see "Title can't be blank" | ||
| 114 | - | ||
| 115 | - @selenium @kalibro_restart | ||
| 116 | - Scenario: I try to edit a Mezuro configuration with title of an existing Mezuro Configuration | ||
| 117 | - Given I have a Mezuro configuration with the following data | ||
| 118 | - | name | Sample Configuration | | ||
| 119 | - | description | Sample Description | | ||
| 120 | - | user | joaosilva | | ||
| 121 | - And I have a Mezuro configuration with the following data | ||
| 122 | - | name | Another Configuration | | ||
| 123 | - | description | Another Description | | ||
| 124 | - | user | joaosilva | | ||
| 125 | - And I am on article "Sample Configuration" | ||
| 126 | - And I follow "Edit" | ||
| 127 | - When I fill the fields with the new following data | ||
| 128 | - | article_name | Another Configuration | | ||
| 129 | - | article_description | Another Description | | ||
| 130 | - And I press "Save" | ||
| 131 | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 132 | - | ||
| 133 | - @selenium @kalibro_restart | ||
| 134 | - Scenario: I delete a Mezuro configuration that belongs to me | ||
| 135 | - Given I have a Mezuro configuration with the following data | ||
| 136 | - | name | Sample Configuration | | ||
| 137 | - | description | Sample Description | | ||
| 138 | - | user | joaosilva | | ||
| 139 | - And I am on article "Sample Configuration" | ||
| 140 | - When I follow "Delete" | ||
| 141 | - And I confirm the "Are you sure that you want to remove the item "Sample Configuration"?" dialog | ||
| 142 | - Then I go to /joaosilva/sample-configuration | ||
| 143 | - And I should see "There is no such page: /joaosilva/sample-configuration" | ||
| 144 | - | ||
| 145 | - @selenium @kalibro_restart | ||
| 146 | - Scenario: I cannot edit or delete a Mezuro configuration that doesn't belong to me | ||
| 147 | - Given I have a Mezuro configuration with the following data | ||
| 148 | - | name | Sample Configuration | | ||
| 149 | - | description | Sample Description | | ||
| 150 | - | user | joaosilva | | ||
| 151 | - And the following users | ||
| 152 | - | login | name | | ||
| 153 | - | adminuser | Admin | | ||
| 154 | - And I am logged in as "adminuser" | ||
| 155 | - When I am on article "Sample Configuration" | ||
| 156 | - Then I should not see "Delete" | ||
| 157 | - And I should not see "Edit" | ||
| 158 | - |
plugins/mezuro/features/project.feature
| @@ -1,134 +0,0 @@ | @@ -1,134 +0,0 @@ | ||
| 1 | -Feature: Project | ||
| 2 | - As a mezuro user | ||
| 3 | - I want to create, edit and remove a Mezuro project | ||
| 4 | - | ||
| 5 | - Background: | ||
| 6 | - Given the following users | ||
| 7 | - | login | name | | ||
| 8 | - | joaosilva | Joao Silva | | ||
| 9 | - And I am logged in as "joaosilva" | ||
| 10 | - And "Mezuro" plugin is enabled | ||
| 11 | - And the following community | ||
| 12 | - | identifier | name | | ||
| 13 | - | mycommunity | My Community | | ||
| 14 | - And "Joao Silva" is admin of "My Community" | ||
| 15 | - | ||
| 16 | - Scenario: I see the Mezuro project input form | ||
| 17 | - Given I am on mycommunity's control panel | ||
| 18 | - When I follow "Mezuro project" | ||
| 19 | - Then I should see "Title" | ||
| 20 | - And I should see "Description" | ||
| 21 | - | ||
| 22 | - @kalibro_restart | ||
| 23 | - Scenario: I create a Mezuro project with valid attributes | ||
| 24 | - Given I am on mycommunity's control panel | ||
| 25 | - When I create a Mezuro project with the following data | ||
| 26 | - | Title | Sample Project | | ||
| 27 | - | Description | Sample Description | | ||
| 28 | - Then I should see "Sample Project" | ||
| 29 | - And I should see "Sample Description" | ||
| 30 | - And I should see "Add Repository" | ||
| 31 | - | ||
| 32 | - Scenario: I try to create a Mezuro project without title | ||
| 33 | - Given I am on mycommunity's control panel | ||
| 34 | - And I follow "Mezuro project" | ||
| 35 | - And the field "article_name" is empty | ||
| 36 | - When I press "Save" | ||
| 37 | - Then I should see "Title can't be blank" | ||
| 38 | - | ||
| 39 | - @kalibro_restart | ||
| 40 | - Scenario: I try to create a Mezuro project with title already in use | ||
| 41 | - Given I have a Mezuro project with the following data | ||
| 42 | - | name | Sample Project | | ||
| 43 | - | description | Sample Description | | ||
| 44 | - | community | mycommunity | | ||
| 45 | - And I am on mycommunity's control panel | ||
| 46 | - When I create a Mezuro project with the following data | ||
| 47 | - | Title | Sample Project | | ||
| 48 | - | Description | Sample Description | | ||
| 49 | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 50 | - | ||
| 51 | - @selenium @kalibro_restart | ||
| 52 | - Scenario: I see a Mezuro project edit form | ||
| 53 | - Given I have a Mezuro project with the following data | ||
| 54 | - | name | Sample Project | | ||
| 55 | - | description | Sample Description | | ||
| 56 | - | community | mycommunity | | ||
| 57 | - And I am on article "Sample Project" | ||
| 58 | - When I follow "Edit" | ||
| 59 | - Then I should see "Sample Project" in the "article_name" | ||
| 60 | - And I should see "Sample Description" in the "article_description" | ||
| 61 | - And I should see "Save" button | ||
| 62 | - | ||
| 63 | - @selenium @kalibro_restart | ||
| 64 | - Scenario: I edit a Mezuro project with valid attributes | ||
| 65 | - Given I have a Mezuro project with the following data | ||
| 66 | - | name | Sample Project | | ||
| 67 | - | description | Sample Description | | ||
| 68 | - | community | mycommunity | | ||
| 69 | - And I am on article "Sample Project" | ||
| 70 | - And I follow "Edit" | ||
| 71 | - When I fill the fields with the new following data | ||
| 72 | - | article_name | Another Project | | ||
| 73 | - | article_description | Another Description| | ||
| 74 | - And I press "Save" | ||
| 75 | - Then I should see "Another Project" | ||
| 76 | - And I should see "Another Description" | ||
| 77 | - And I should see "Add Repository" | ||
| 78 | - | ||
| 79 | - @selenium @kalibro_restart | ||
| 80 | - Scenario: I try to edit a Mezuro project leaving empty its title | ||
| 81 | - Given I have a Mezuro project with the following data | ||
| 82 | - | name | Sample Project | | ||
| 83 | - | description | Sample Description | | ||
| 84 | - | community | mycommunity | | ||
| 85 | - And I am on article "Sample Project" | ||
| 86 | - And I follow "Edit" | ||
| 87 | - When I erase the "article_name" field | ||
| 88 | - And I press "Save" | ||
| 89 | - Then I should see "Title can't be blank" | ||
| 90 | - | ||
| 91 | - @selenium @kalibro_restart | ||
| 92 | - Scenario: I try to edit a Mezuro project with title of an existing Mezuro Project | ||
| 93 | - Given I have a Mezuro project with the following data | ||
| 94 | - | name | Sample Project | | ||
| 95 | - | description | Sample Description | | ||
| 96 | - | community | mycommunity | | ||
| 97 | - And I have a Mezuro project with the following data | ||
| 98 | - | name | Another Project | | ||
| 99 | - | description | Another Description | | ||
| 100 | - | community | mycommunity | | ||
| 101 | - And I am on article "Sample Project" | ||
| 102 | - And I follow "Edit" | ||
| 103 | - When I fill the fields with the new following data | ||
| 104 | - | article_name | Another Project | | ||
| 105 | - | article_description | Another Description| | ||
| 106 | - And I press "Save" | ||
| 107 | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 108 | - | ||
| 109 | - @selenium @kalibro_restart | ||
| 110 | - Scenario: I delete a Mezuro project that belongs to me | ||
| 111 | - Given I have a Mezuro project with the following data | ||
| 112 | - | name | Sample Project | | ||
| 113 | - | description | Sample Description | | ||
| 114 | - | community | mycommunity | | ||
| 115 | - And I am on article "Sample Project" | ||
| 116 | - When I follow "Delete" | ||
| 117 | - And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog | ||
| 118 | - Then I go to /mycommunity/sample-project | ||
| 119 | - And I should see "There is no such page: /mycommunity/sample-project" | ||
| 120 | - | ||
| 121 | - @selenium @kalibro_restart | ||
| 122 | - Scenario: I cannot edit or delete a Mezuro project that doesn't belong to me | ||
| 123 | - Given I have a Mezuro project with the following data | ||
| 124 | - | name | Sample Project | | ||
| 125 | - | description | Sample Description | | ||
| 126 | - | community | mycommunity | | ||
| 127 | - And the following users | ||
| 128 | - | login | name | | ||
| 129 | - | user | User | | ||
| 130 | - And I am logged in as "user" | ||
| 131 | - When I am on article "Sample Project" | ||
| 132 | - Then I should not see "Delete" | ||
| 133 | - And I should not see "Edit" | ||
| 134 | - |
plugins/mezuro/features/reading.feature
| @@ -1,243 +0,0 @@ | @@ -1,243 +0,0 @@ | ||
| 1 | -@kalibro_restart | ||
| 2 | -Feature: Reading | ||
| 3 | - As a Mezuro user | ||
| 4 | - I want to create, edit and remove a reading | ||
| 5 | - | ||
| 6 | - Background: | ||
| 7 | - Given the following users | ||
| 8 | - | login | name | | ||
| 9 | - | joaosilva | Joao Silva | | ||
| 10 | - And I am logged in as "joaosilva" | ||
| 11 | - And "Mezuro" plugin is enabled | ||
| 12 | - And I have a Mezuro reading group with the following data | ||
| 13 | - | name | Sample Reading Group | | ||
| 14 | - | description | Sample Description | | ||
| 15 | - | user | joaosilva | | ||
| 16 | - | ||
| 17 | - @selenium | ||
| 18 | - Scenario: I want to see the Mezuro reading input form | ||
| 19 | - Given I am on article "Sample Reading Group" | ||
| 20 | - When I follow "Add Reading" | ||
| 21 | - Then I should see "Sample Reading Group Reading Group" in a link | ||
| 22 | - And I should see "Label" | ||
| 23 | - And I should see "Grade" | ||
| 24 | - And I should see "Color" | ||
| 25 | - And I should see "Save" button | ||
| 26 | - | ||
| 27 | - @selenium | ||
| 28 | - Scenario: I try to add a reading with no name | ||
| 29 | - Given I am on article "Sample Reading Group" | ||
| 30 | - When I follow "Add Reading" | ||
| 31 | - And I fill the fields with the new following data | ||
| 32 | - | reading_label | | | ||
| 33 | - | reading_grade | 10.2 | | ||
| 34 | - | reading_color | ABCDEF | | ||
| 35 | - And I press "Save" | ||
| 36 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 37 | - | ||
| 38 | - @selenium | ||
| 39 | - Scenario: I try to add a reading with no grade | ||
| 40 | - Given I am on article "Sample Reading Group" | ||
| 41 | - When I follow "Add Reading" | ||
| 42 | - And I fill the fields with the new following data | ||
| 43 | - | reading_label | Useless | | ||
| 44 | - | reading_grade | | | ||
| 45 | - | reading_color | f51313 | | ||
| 46 | - And I press "Save" | ||
| 47 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 48 | - | ||
| 49 | - @selenium | ||
| 50 | - Scenario: I try to add a reading with no color | ||
| 51 | - Given I am on article "Sample Reading Group" | ||
| 52 | - When I follow "Add Reading" | ||
| 53 | - And I fill the fields with the new following data | ||
| 54 | - | reading_label | Fantastic | | ||
| 55 | - | reading_grade | 4.0 | | ||
| 56 | - | reading_color | | | ||
| 57 | - And I press "Save" | ||
| 58 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 59 | - | ||
| 60 | - @selenium | ||
| 61 | - Scenario: I try to add a reading with an invalid color | ||
| 62 | - Given I am on article "Sample Reading Group" | ||
| 63 | - When I follow "Add Reading" | ||
| 64 | - And I fill the fields with the new following data | ||
| 65 | - | reading_label | Fantastic | | ||
| 66 | - | reading_grade | 4.0 | | ||
| 67 | - | reading_color | 1D10T4 | | ||
| 68 | - And I press "Save" | ||
| 69 | - Then I should see "This is not a valid color." inside an alert | ||
| 70 | - | ||
| 71 | - @selenium | ||
| 72 | - Scenario: I try to add a reading with a label which already exists | ||
| 73 | - Given I have a Mezuro reading with the following data | ||
| 74 | - | label | Simple | | ||
| 75 | - | grade | 2.0 | | ||
| 76 | - | color | 34afe2 | | ||
| 77 | - And I am on article "Sample Reading Group" | ||
| 78 | - When I follow "Add Reading" | ||
| 79 | - And I fill the fields with the new following data | ||
| 80 | - | reading_label | Simple | | ||
| 81 | - | reading_grade | 4.0 | | ||
| 82 | - | reading_color | 1f0fa0 | | ||
| 83 | - And I press "Save" | ||
| 84 | - Then I should see "This label already exists! Please, choose another one." inside an alert | ||
| 85 | - | ||
| 86 | - @selenium | ||
| 87 | - Scenario: I try to add a reading with a grade which already exists | ||
| 88 | - Given I have a Mezuro reading with the following data | ||
| 89 | - | label | Extraordinary | | ||
| 90 | - | grade | 10.0 | | ||
| 91 | - | color | b4bad0 | | ||
| 92 | - And I am on article "Sample Reading Group" | ||
| 93 | - When I follow "Add Reading" | ||
| 94 | - And I fill the fields with the new following data | ||
| 95 | - | reading_label | Super | | ||
| 96 | - | reading_grade | 10.0 | | ||
| 97 | - | reading_color | f0f000 | | ||
| 98 | - And I press "Save" | ||
| 99 | - Then I should see "This grade already exists! Please, choose another one." inside an alert | ||
| 100 | - | ||
| 101 | - @selenium | ||
| 102 | - Scenario: I want to add a reading with valid attributes | ||
| 103 | - Given I am on article "Sample Reading Group" | ||
| 104 | - When I follow "Add Reading" | ||
| 105 | - And I fill the fields with the new following data | ||
| 106 | - | reading_label | Normal | | ||
| 107 | - | reading_grade | 1.0 | | ||
| 108 | - | reading_color | 19cbd1 | | ||
| 109 | - And I press "Save" | ||
| 110 | - Then I should see "Normal" | ||
| 111 | - And I should see "1.0" | ||
| 112 | - And I should see the "#19cbd1" color | ||
| 113 | - And I should see "Remove" | ||
| 114 | - | ||
| 115 | - @selenium | ||
| 116 | - Scenario: I want to see a reading edit form | ||
| 117 | - Given I have a Mezuro reading with the following data | ||
| 118 | - | label | Simple | | ||
| 119 | - | grade | 2.0 | | ||
| 120 | - | color | 34afe2 | | ||
| 121 | - And I am on article "Sample Reading Group" | ||
| 122 | - When I follow the edit link for "Simple" reading | ||
| 123 | - Then I should see "Simple" in the "reading_label" | ||
| 124 | - And I should see "2.0" in the "reading_grade" | ||
| 125 | - And I should see "34afe2" in the "reading_color" | ||
| 126 | - And I should see "Save" button | ||
| 127 | - | ||
| 128 | - @selenium | ||
| 129 | - Scenario: I try to edit a reading leaving empty its title | ||
| 130 | - Given I have a Mezuro reading with the following data | ||
| 131 | - | label | Simple | | ||
| 132 | - | grade | 2.0 | | ||
| 133 | - | color | 34afe2 | | ||
| 134 | - And I am on article "Sample Reading Group" | ||
| 135 | - When I follow the edit link for "Simple" reading | ||
| 136 | - And I erase the "reading_label" field | ||
| 137 | - And I press "Save" | ||
| 138 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 139 | - | ||
| 140 | - @selenium | ||
| 141 | - Scenario: I try to edit a reading leaving empty its grade | ||
| 142 | - Given I have a Mezuro reading with the following data | ||
| 143 | - | label | Simple | | ||
| 144 | - | grade | 2.0 | | ||
| 145 | - | color | 34afe2 | | ||
| 146 | - And I am on article "Sample Reading Group" | ||
| 147 | - When I follow the edit link for "Simple" reading | ||
| 148 | - And I erase the "reading_grade" field | ||
| 149 | - And I press "Save" | ||
| 150 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 151 | - | ||
| 152 | - @selenium | ||
| 153 | - Scenario: I try to edit a reading leaving empty its color | ||
| 154 | - Given I have a Mezuro reading with the following data | ||
| 155 | - | label | Simple | | ||
| 156 | - | grade | 2.0 | | ||
| 157 | - | color | 34afe2 | | ||
| 158 | - And I am on article "Sample Reading Group" | ||
| 159 | - When I follow the edit link for "Simple" reading | ||
| 160 | - And I erase the "reading_color" field | ||
| 161 | - And I press "Save" | ||
| 162 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 163 | - | ||
| 164 | - @selenium | ||
| 165 | - Scenario: I try to edit a reading with an invalid color | ||
| 166 | - Given I have a Mezuro reading with the following data | ||
| 167 | - | label | Worthless | | ||
| 168 | - | grade | 1.0 | | ||
| 169 | - | color | e5cad4 | | ||
| 170 | - And I am on article "Sample Reading Group" | ||
| 171 | - When I follow the edit link for "Worthless" reading | ||
| 172 | - And I fill the fields with the new following data | ||
| 173 | - | reading_label | Worthless | | ||
| 174 | - | reading_grade | 1.0 | | ||
| 175 | - | reading_color | bu5aoooooo | | ||
| 176 | - And I press "Save" | ||
| 177 | - Then I should see "This is not a valid color." inside an alert | ||
| 178 | - | ||
| 179 | - @selenium | ||
| 180 | - Scenario: I try to edit a reading with a label which already exists | ||
| 181 | - Given I have a Mezuro reading with the following data | ||
| 182 | - | label | Simple | | ||
| 183 | - | grade | 2.0 | | ||
| 184 | - | color | 34afe2 | | ||
| 185 | - And I have a Mezuro reading with the following data | ||
| 186 | - | label | Complex | | ||
| 187 | - | grade | 5.0 | | ||
| 188 | - | color | 13deb2 | | ||
| 189 | - And I am on article "Sample Reading Group" | ||
| 190 | - When I follow the edit link for "Simple" reading | ||
| 191 | - And I fill the fields with the new following data | ||
| 192 | - | reading_label | Complex | | ||
| 193 | - | reading_grade | 2.0 | | ||
| 194 | - | reading_color | 34afe2 | | ||
| 195 | - And I press "Save" | ||
| 196 | - Then I should see "This label already exists! Please, choose another one." inside an alert | ||
| 197 | - | ||
| 198 | - @selenium | ||
| 199 | - Scenario: I try to edit a reading with a grade which already exists | ||
| 200 | - Given I have a Mezuro reading with the following data | ||
| 201 | - | label | Terrible | | ||
| 202 | - | grade | 0.0 | | ||
| 203 | - | color | 4feda4 | | ||
| 204 | - And I have a Mezuro reading with the following data | ||
| 205 | - | label | Perfect | | ||
| 206 | - | grade | 10.0 | | ||
| 207 | - | color | de41b2 | | ||
| 208 | - And I am on article "Sample Reading Group" | ||
| 209 | - When I follow the edit link for "Terrible" reading | ||
| 210 | - And I fill the fields with the new following data | ||
| 211 | - | reading_label | Terrible | | ||
| 212 | - | reading_grade | 10.0 | | ||
| 213 | - | reading_color | 4feda4 | | ||
| 214 | - And I press "Save" | ||
| 215 | - Then I should see "This grade already exists! Please, choose another one." inside an alert | ||
| 216 | - | ||
| 217 | - @selenium | ||
| 218 | - Scenario: I want to edit a reading with valid attributes | ||
| 219 | - Given I have a Mezuro reading with the following data | ||
| 220 | - | label | Awful | | ||
| 221 | - | grade | 2.5 | | ||
| 222 | - | color | babaca | | ||
| 223 | - And I am on article "Sample Reading Group" | ||
| 224 | - When I follow the edit link for "Awful" reading | ||
| 225 | - And I fill the fields with the new following data | ||
| 226 | - | reading_label | Awesome | | ||
| 227 | - | reading_grade | 10.0 | | ||
| 228 | - | reading_color | fa40fa | | ||
| 229 | - And I press "Save" | ||
| 230 | - Then I should see "Awesome" | ||
| 231 | - And I should see "10.0" | ||
| 232 | - And I should see the "#fa40fa" color | ||
| 233 | - | ||
| 234 | - @selenium | ||
| 235 | - Scenario: I want to remove a reading | ||
| 236 | - Given I have a Mezuro reading with the following data | ||
| 237 | - | label | Unbelievable | | ||
| 238 | - | grade | 9001.0 | | ||
| 239 | - | color | f0f0ca | | ||
| 240 | - And I am on article "Sample Reading Group" | ||
| 241 | - When I follow the remove link for "Unbelievable" reading | ||
| 242 | - Then I should not see "Unbelievable" | ||
| 243 | - And I should not see "9001.0" |
plugins/mezuro/features/reading_group.feature
| @@ -1,131 +0,0 @@ | @@ -1,131 +0,0 @@ | ||
| 1 | -Feature: Reading Group | ||
| 2 | - As a mezuro user | ||
| 3 | - I want to create, edit and remove a Mezuro reading group | ||
| 4 | - | ||
| 5 | - Background: | ||
| 6 | - Given the following users | ||
| 7 | - | login | name | | ||
| 8 | - | joaosilva | Joao Silva | | ||
| 9 | - Given I am logged in as "joaosilva" | ||
| 10 | - And "Mezuro" plugin is enabled | ||
| 11 | - | ||
| 12 | - Scenario: I see Mezuro reading group's input form | ||
| 13 | - Given I am on joaosilva's control panel | ||
| 14 | - When I follow "Mezuro reading group" | ||
| 15 | - Then I should see "Title" | ||
| 16 | - And I should see "Description" | ||
| 17 | - | ||
| 18 | - @kalibro_restart | ||
| 19 | - Scenario: I create a Mezuro reading group with valid attributes | ||
| 20 | - Given I am on joaosilva's control panel | ||
| 21 | - When I create a Mezuro reading group with the following data | ||
| 22 | - | Title | Sample Reading Group | | ||
| 23 | - | Description | Sample Description | | ||
| 24 | - Then I should see "Sample Reading Group" | ||
| 25 | - And I should see "Sample Description" | ||
| 26 | - And I should see "Readings" | ||
| 27 | - And I should see "Add Reading" | ||
| 28 | - | ||
| 29 | - Scenario: I try to create a Mezuro reading group without title | ||
| 30 | - Given I am on joaosilva's control panel | ||
| 31 | - And I follow "Mezuro reading group" | ||
| 32 | - And the field "article_name" is empty | ||
| 33 | - When I press "Save" | ||
| 34 | - Then I should see "Title can't be blank" | ||
| 35 | - | ||
| 36 | - @kalibro_restart | ||
| 37 | - Scenario: I try to create a Mezuro reading group with title already in use | ||
| 38 | - Given I have a Mezuro reading group with the following data | ||
| 39 | - | name | Sample Reading group | | ||
| 40 | - | description | Sample Description | | ||
| 41 | - | user | joaosilva | | ||
| 42 | - And I am on joaosilva's control panel | ||
| 43 | - When I create a Mezuro reading group with the following data | ||
| 44 | - | Title | Sample Reading Group | | ||
| 45 | - | Description | Sample Description | | ||
| 46 | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 47 | - | ||
| 48 | - @selenium @kalibro_restart | ||
| 49 | - Scenario: I see a Mezuro reading group edit form | ||
| 50 | - Given I have a Mezuro reading group with the following data | ||
| 51 | - | name | Sample Reading group | | ||
| 52 | - | description | Sample Description | | ||
| 53 | - | user | joaosilva | | ||
| 54 | - And I am on article "Sample Reading group" | ||
| 55 | - When I follow "Edit" | ||
| 56 | - Then I should see "Sample Reading group" in the "article_name" | ||
| 57 | - And I should see "Sample Description" in the "article_description" | ||
| 58 | - And I should see "Save" button | ||
| 59 | - | ||
| 60 | - @selenium @kalibro_restart | ||
| 61 | - Scenario: I edit a Mezuro reading group with valid attributes | ||
| 62 | - Given I have a Mezuro reading group with the following data | ||
| 63 | - | name | Sample Reading group | | ||
| 64 | - | description | Sample Description | | ||
| 65 | - | user | joaosilva | | ||
| 66 | - And I am on article "Sample Reading group" | ||
| 67 | - And I follow "Edit" | ||
| 68 | - When I fill the fields with the new following data | ||
| 69 | - | article_name | Another Reading group | | ||
| 70 | - | article_description | Another Description | | ||
| 71 | - And I press "Save" | ||
| 72 | - Then I should see "Another Reading group" | ||
| 73 | - And I should see "Another Description" | ||
| 74 | - And I should see "Add Reading" | ||
| 75 | - | ||
| 76 | - @selenium @kalibro_restart | ||
| 77 | - Scenario: I try to edit a Mezuro reading group leaving empty its title | ||
| 78 | - Given I have a Mezuro reading group with the following data | ||
| 79 | - | name | Sample Reading group | | ||
| 80 | - | description | Sample Description | | ||
| 81 | - | user | joaosilva | | ||
| 82 | - And I am on article "Sample Reading group" | ||
| 83 | - And I follow "Edit" | ||
| 84 | - When I erase the "article_name" field | ||
| 85 | - And I press "Save" | ||
| 86 | - Then I should see "Title can't be blank" | ||
| 87 | - | ||
| 88 | - @selenium @kalibro_restart | ||
| 89 | - Scenario: I try to edit a Mezuro reading group with title of an existing Mezuro Reading group | ||
| 90 | - Given I have a Mezuro reading group with the following data | ||
| 91 | - | name | Sample Reading group | | ||
| 92 | - | description | Sample Description | | ||
| 93 | - | user | joaosilva | | ||
| 94 | - And I have a Mezuro reading group with the following data | ||
| 95 | - | name | Another Reading group | | ||
| 96 | - | description | Another Description | | ||
| 97 | - | user | joaosilva | | ||
| 98 | - And I am on article "Sample Reading group" | ||
| 99 | - And I follow "Edit" | ||
| 100 | - When I fill the fields with the new following data | ||
| 101 | - | article_name | Another Reading group | | ||
| 102 | - | article_description | Another Description | | ||
| 103 | - And I press "Save" | ||
| 104 | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 105 | - | ||
| 106 | - @selenium @kalibro_restart | ||
| 107 | - Scenario: I delete a Mezuro reading group that belongs to me | ||
| 108 | - Given I have a Mezuro reading group with the following data | ||
| 109 | - | name | Sample Reading group | | ||
| 110 | - | description | Sample Description | | ||
| 111 | - | user | joaosilva | | ||
| 112 | - And I am on article "Sample Reading group" | ||
| 113 | - When I follow "Delete" | ||
| 114 | - And I confirm the "Are you sure that you want to remove the item "Sample Reading group"?" dialog | ||
| 115 | - Then I go to /joaosilva/sample-reading-group | ||
| 116 | - And I should see "There is no such page: /joaosilva/sample-reading-group" | ||
| 117 | - | ||
| 118 | - @selenium @kalibro_restart | ||
| 119 | - Scenario: I cannot edit or delete a Mezuro reading group that doesn't belong to me | ||
| 120 | - Given I have a Mezuro reading group with the following data | ||
| 121 | - | name | Sample Reading group | | ||
| 122 | - | description | Sample Description | | ||
| 123 | - | user | joaosilva | | ||
| 124 | - And the following users | ||
| 125 | - | login | name | | ||
| 126 | - | adminuser | Admin | | ||
| 127 | - And I am logged in as "adminuser" | ||
| 128 | - When I am on article "Sample Reading group" | ||
| 129 | - Then I should not see "Delete" | ||
| 130 | - And I should not see "Edit" | ||
| 131 | - |
plugins/mezuro/features/repository.feature
| @@ -1,276 +0,0 @@ | @@ -1,276 +0,0 @@ | ||
| 1 | -@kalibro_restart | ||
| 2 | -Feature: Repository | ||
| 3 | - As a Mezuro user | ||
| 4 | - I want to create, edit, remove and process a repository | ||
| 5 | - | ||
| 6 | - Background: | ||
| 7 | - Given the following users | ||
| 8 | - | login | name | | ||
| 9 | - | joaosilva | Joao Silva | | ||
| 10 | - And I am logged in as "joaosilva" | ||
| 11 | - And "Mezuro" plugin is enabled | ||
| 12 | - And the following community | ||
| 13 | - | identifier | name | | ||
| 14 | - | mycommunity | My Community | | ||
| 15 | - And "Joao Silva" is admin of "My Community" | ||
| 16 | - And I have a Mezuro project with the following data | ||
| 17 | - | name | Sample Project | | ||
| 18 | - | description | Sample Description | | ||
| 19 | - | community | mycommunity | | ||
| 20 | - And I have a Mezuro configuration with the following data | ||
| 21 | - | name | Sample Configuration| | ||
| 22 | - | description | Sample Description | | ||
| 23 | - | user | joaosilva | | ||
| 24 | - And I have a Mezuro reading group with the following data | ||
| 25 | - | name | Sample Reading group | | ||
| 26 | - | description | Sample Description | | ||
| 27 | - | user | joaosilva | | ||
| 28 | - And I have a Mezuro metric configuration with previous created configuration and reading group | ||
| 29 | - | ||
| 30 | - Scenario: I want to see the Mezuro repository input form | ||
| 31 | - Given I am on article "Sample Project" | ||
| 32 | - When I follow "Add Repository" | ||
| 33 | - Then I should see "Name" | ||
| 34 | - And I should see "Description" | ||
| 35 | - And I should see "License" | ||
| 36 | - And I should see "Process Period" | ||
| 37 | - And I should see "Type" | ||
| 38 | - And I should see "Address" | ||
| 39 | - And I should see "Configuration" | ||
| 40 | - And I should see "Add" button | ||
| 41 | - | ||
| 42 | - @selenium | ||
| 43 | - Scenario: I try to add a repository with no name | ||
| 44 | - Given I am on article "Sample Project" | ||
| 45 | - And I follow "Add Repository" | ||
| 46 | - When I fill the fields with the new following data | ||
| 47 | - | repository_name | | | ||
| 48 | - | repository_description | My Description | | ||
| 49 | - | repository_license | ISC License (ISC) | | ||
| 50 | - | repository_process_period | Not Periodically | | ||
| 51 | - | repository_type | SUBVERSION | | ||
| 52 | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | | ||
| 53 | - | repository_configuration_id | Sample Configuration | | ||
| 54 | - And I press "Add" | ||
| 55 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 56 | - | ||
| 57 | - @selenium | ||
| 58 | - Scenario: I try to add a repository with no address | ||
| 59 | - Given I am on article "Sample Project" | ||
| 60 | - And I follow "Add Repository" | ||
| 61 | - When I fill the fields with the new following data | ||
| 62 | - | repository_name | My Name | | ||
| 63 | - | repository_description | My Description | | ||
| 64 | - | repository_license | ISC License (ISC) | | ||
| 65 | - | repository_process_period | Not Periodically | | ||
| 66 | - | repository_type | SUBVERSION | | ||
| 67 | - | repository_address | | | ||
| 68 | - | repository_configuration_id | Sample Configuration | | ||
| 69 | - And I press "Add" | ||
| 70 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 71 | - | ||
| 72 | - @selenium | ||
| 73 | - Scenario: I try to add a repository with an invalid address | ||
| 74 | - Given I am on article "Sample Project" | ||
| 75 | - And I follow "Add Repository" | ||
| 76 | - When I fill the fields with the new following data | ||
| 77 | - | repository_name | My Name | | ||
| 78 | - | repository_description | My Description | | ||
| 79 | - | repository_license | ISC License (ISC) | | ||
| 80 | - | repository_process_period | Not Periodically | | ||
| 81 | - | repository_type | GIT | | ||
| 82 | - | repository_address | https://invalid-address.any-extension | | ||
| 83 | - | repository_configuration_id | Sample Configuration | | ||
| 84 | - And I press "Add" | ||
| 85 | - Then I should see "Address does not match type GIT chosen." inside an alert | ||
| 86 | - | ||
| 87 | - @selenium | ||
| 88 | - Scenario: I want to add a repository with valid attributes | ||
| 89 | - Given I am on article "Sample Project" | ||
| 90 | - And I follow "Add Repository" | ||
| 91 | - When I fill the fields with the new following data | ||
| 92 | - | repository_name | My Name | | ||
| 93 | - | repository_description | My Description | | ||
| 94 | - | repository_license | ISC License (ISC) | | ||
| 95 | - | repository_process_period | Not Periodically | | ||
| 96 | - | repository_type | GIT | | ||
| 97 | - | repository_address | https://github.com/user/project.git | | ||
| 98 | - | repository_configuration_id | Sample Configuration | | ||
| 99 | - And I press "Add" | ||
| 100 | - Then I should see "My Name" | ||
| 101 | - And I should see "My Description" | ||
| 102 | - And I should see "ISC License (ISC)" | ||
| 103 | - And I should see "Not Periodically" | ||
| 104 | - And I should see "GIT" | ||
| 105 | - And I should see "https://github.com/user/project.git" | ||
| 106 | - And I should see "Sample Configuration" | ||
| 107 | - And I should see "Status" | ||
| 108 | - | ||
| 109 | - @selenium | ||
| 110 | - Scenario: I want to see the repository edit form | ||
| 111 | - Given I have a Mezuro repository with the following data | ||
| 112 | - | name | My Name | | ||
| 113 | - | description | My Description | | ||
| 114 | - | license | ISC License (ISC) | | ||
| 115 | - | process_period | Not Periodically | | ||
| 116 | - | type | GIT | | ||
| 117 | - | address | https://github.com/user/project.git | | ||
| 118 | - | configuration_id | Sample Configuration | | ||
| 119 | - And I am on article "Sample Project" | ||
| 120 | - When I follow the edit link for "My Name" repository | ||
| 121 | - Then I should see "My Name" in the "repository_name" | ||
| 122 | - And I should see "My Description" in the "repository_description" | ||
| 123 | - And I should see "ISC License (ISC)" in the "repository_license" | ||
| 124 | - And I should see "Not Periodically" in the process period select field | ||
| 125 | - And I should see "GIT" in the "repository_type" | ||
| 126 | - And I should see "https://github.com/user/project.git" in the "repository_address" | ||
| 127 | - And I should see "Sample Configuration" in the repository configuration select field | ||
| 128 | - | ||
| 129 | - @selenium | ||
| 130 | - Scenario: I edit a Mezuro repository with valid attributes | ||
| 131 | - Given I have a Mezuro repository with the following data | ||
| 132 | - | name | My Name | | ||
| 133 | - | description | My Description | | ||
| 134 | - | license | ISC License (ISC) | | ||
| 135 | - | process_period | Not Periodically | | ||
| 136 | - | type | GIT | | ||
| 137 | - | address | https://github.com/user/project.git | | ||
| 138 | - | configuration_id | Sample Configuration | | ||
| 139 | - And I am on article "Sample Project" | ||
| 140 | - When I follow the edit link for "My Name" repository | ||
| 141 | - And I fill the fields with the new following data | ||
| 142 | - | repository_name | Another Name | | ||
| 143 | - | repository_description | Another Description | | ||
| 144 | - | repository_license | Apple Public Source License (APSL-2.0) | | ||
| 145 | - | repository_process_period | Weekly | | ||
| 146 | - | repository_type | SUBVERSION | | ||
| 147 | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | | ||
| 148 | - | repository_configuration_id | Sample Configuration | | ||
| 149 | - And I press "Add" | ||
| 150 | - Then I should see "Another Name" | ||
| 151 | - And I should see "Another Description" | ||
| 152 | - And I should see "Apple Public Source License (APSL-2.0)" | ||
| 153 | - And I should see "Weekly" | ||
| 154 | - And I should see "SUBVERSION" | ||
| 155 | - And I should see "https://project.svn.sourceforge.net/svnroot/project" | ||
| 156 | - And I should see "Sample Configuration" | ||
| 157 | - | ||
| 158 | - @selenium | ||
| 159 | - Scenario: I try to edit a Mezuro repository leaving empty its title | ||
| 160 | - Given I have a Mezuro repository with the following data | ||
| 161 | - | name | My Name | | ||
| 162 | - | description | My Description | | ||
| 163 | - | license | ISC License (ISC) | | ||
| 164 | - | process_period | Not Periodically | | ||
| 165 | - | type | GIT | | ||
| 166 | - | address | https://github.com/user/project.git | | ||
| 167 | - | configuration_id | Sample Configuration | | ||
| 168 | - And I am on article "Sample Project" | ||
| 169 | - And I follow the edit link for "My Name" repository | ||
| 170 | - When I erase the "repository_name" field | ||
| 171 | - And I press "Add" | ||
| 172 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 173 | - | ||
| 174 | - @selenium | ||
| 175 | - Scenario: I try to edit a Mezuro repository leaving empty its address | ||
| 176 | - Given I have a Mezuro repository with the following data | ||
| 177 | - | name | My Name | | ||
| 178 | - | description | My Description | | ||
| 179 | - | license | ISC License (ISC) | | ||
| 180 | - | process_period | Not Periodically | | ||
| 181 | - | type | GIT | | ||
| 182 | - | address | https://github.com/user/project.git | | ||
| 183 | - | configuration_id | Sample Configuration | | ||
| 184 | - And I am on article "Sample Project" | ||
| 185 | - And I follow the edit link for "My Name" repository | ||
| 186 | - When I erase the "repository_address" field | ||
| 187 | - And I press "Add" | ||
| 188 | - Then I should see "Please fill all fields marked with (*)." inside an alert | ||
| 189 | - | ||
| 190 | - @selenium | ||
| 191 | - Scenario: I try to edit a Mezuro repository with an invalid address | ||
| 192 | - Given I have a Mezuro repository with the following data | ||
| 193 | - | name | My Name | | ||
| 194 | - | description | My Description | | ||
| 195 | - | license | ISC License (ISC) | | ||
| 196 | - | process_period | Not Periodically | | ||
| 197 | - | type | GIT | | ||
| 198 | - | address | https://github.com/user/project.git | | ||
| 199 | - | configuration_id | Sample Configuration | | ||
| 200 | - And I am on article "Sample Project" | ||
| 201 | - When I follow the edit link for "My Name" repository | ||
| 202 | - And I fill the fields with the new following data | ||
| 203 | - | repository_name | Another Name | | ||
| 204 | - | repository_description | Another Description | | ||
| 205 | - | repository_license | Apple Public Source License (APSL-2.0) | | ||
| 206 | - | repository_process_period | Weekly | | ||
| 207 | - | repository_type | SUBVERSION | | ||
| 208 | - | repository_address | https://invalid-address.any-extension | | ||
| 209 | - | repository_configuration_id | Sample Configuration | | ||
| 210 | - And I press "Add" | ||
| 211 | - Then I should see "Address does not match type SUBVERSION chosen." inside an alert | ||
| 212 | - | ||
| 213 | - @selenium | ||
| 214 | - Scenario: I try to edit a repository with an existing repository name | ||
| 215 | - Given I have a Mezuro repository with the following data | ||
| 216 | - | name | My Name | | ||
| 217 | - | description | My Description | | ||
| 218 | - | license | ISC License (ISC) | | ||
| 219 | - | process_period | Not Periodically | | ||
| 220 | - | type | GIT | | ||
| 221 | - | address | https://github.com/user/project.git | | ||
| 222 | - | configuration_id | Sample Configuration | | ||
| 223 | - And I have a Mezuro repository with the following data | ||
| 224 | - | name | Another Name | | ||
| 225 | - | description | Another Description | | ||
| 226 | - | license | Apple Public Source License (APSL-2.0) | | ||
| 227 | - | process_period | Weekly | | ||
| 228 | - | type | SUBVERSION | | ||
| 229 | - | address | https://project.svn.sourceforge.net/svnroot/project | | ||
| 230 | - | configuration_id | Sample Configuration | | ||
| 231 | - And I am on article "Sample Project" | ||
| 232 | - When I follow the edit link for "My Name" repository | ||
| 233 | - And I fill the fields with the new following data | ||
| 234 | - | repository_name | Another Name | | ||
| 235 | - | repository_description | Another Description | | ||
| 236 | - | repository_license | Apple Public Source License (APSL-2.0) | | ||
| 237 | - | repository_process_period | Weekly | | ||
| 238 | - | repository_type | SUBVERSION | | ||
| 239 | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | | ||
| 240 | - | repository_configuration_id | Sample Configuration | | ||
| 241 | - And I press "Add" | ||
| 242 | - #Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
| 243 | - #FIXME fix this validation | ||
| 244 | - | ||
| 245 | - @selenium | ||
| 246 | - Scenario: I delete a Mezuro repository of mine | ||
| 247 | - Given I have a Mezuro repository with the following data | ||
| 248 | - | name | My Name | | ||
| 249 | - | description | My Description | | ||
| 250 | - | license | ISC License (ISC) | | ||
| 251 | - | process_period | Not Periodically | | ||
| 252 | - | type | GIT | | ||
| 253 | - | address | https://github.com/user/project.git | | ||
| 254 | - | configuration_id | Sample Configuration | | ||
| 255 | - And I am on article "Sample Project" | ||
| 256 | - When I follow the remove link for "My Name" repository | ||
| 257 | - Then I should not see "My Name" | ||
| 258 | - | ||
| 259 | - @selenium | ||
| 260 | - Scenario: I try to edit or delete a Mezuro repository which doesn't belong to me | ||
| 261 | - Given I have a Mezuro repository with the following data | ||
| 262 | - | name | My Name | | ||
| 263 | - | description | My Description | | ||
| 264 | - | license | ISC License (ISC) | | ||
| 265 | - | process_period | Not Periodically | | ||
| 266 | - | type | GIT | | ||
| 267 | - | address | https://github.com/user/project.git | | ||
| 268 | - | configuration_id | Sample Configuration | | ||
| 269 | - And the following users | ||
| 270 | - | login | name | | ||
| 271 | - | zacarias | Zacarias | | ||
| 272 | - And I am logged in as "zacarias" | ||
| 273 | - When I am on article "Sample Project" | ||
| 274 | - Then I should not see the edit link for "My Name" repository | ||
| 275 | - And I should not see the remove link for "My Name" repository | ||
| 276 | - |
plugins/mezuro/features/step_definitions/mezuro_steps.rb
| @@ -1,164 +0,0 @@ | @@ -1,164 +0,0 @@ | ||
| 1 | -When /^I create a Mezuro (project|reading group) with the following data$/ do |type, fields| | ||
| 2 | - click_link ("Mezuro " + type) | ||
| 3 | - | ||
| 4 | - fields.rows_hash.each do |name, value| | ||
| 5 | - When %{I fill in "#{name}" with "#{value}"} | ||
| 6 | - end | ||
| 7 | - | ||
| 8 | - click_button "Save" | ||
| 9 | - Article.find_by_name(fields.rows_hash[:Title]) | ||
| 10 | -end | ||
| 11 | - | ||
| 12 | -When /^I create a Mezuro configuration with the following data$/ do |fields| | ||
| 13 | - click_link ("Mezuro configuration") | ||
| 14 | - | ||
| 15 | - fields.rows_hash.each do |name, value| | ||
| 16 | - if name != "Clone" | ||
| 17 | - When %{I fill in "#{name}" with "#{value}"} | ||
| 18 | - end | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - click_button "Save" | ||
| 22 | - Article.find_by_name(fields.rows_hash[:Title]) | ||
| 23 | -end | ||
| 24 | - | ||
| 25 | -Then /^I directly delete content with name "([^\"]*)" for testing purposes$/ do |content_name| | ||
| 26 | - Article.find_by_name(content_name).destroy | ||
| 27 | -end | ||
| 28 | - | ||
| 29 | -Then /^I should be at the url "([^\"]*)"$/ do |url| | ||
| 30 | - if response.class.to_s == 'Webrat::SeleniumResponse' | ||
| 31 | - URI.parse(response.selenium.get_location).path.should == url | ||
| 32 | - else | ||
| 33 | - URI.parse(current_url).path.should == url | ||
| 34 | - end | ||
| 35 | -end | ||
| 36 | - | ||
| 37 | -Then /^the field "([^"]*)" is empty$/ do |field_name| | ||
| 38 | - find_field(field_name).value.should be_nil | ||
| 39 | -end | ||
| 40 | - | ||
| 41 | -Then /^I should see "([^\"]*)" inside an alert$/ do |message| | ||
| 42 | - alert = page.driver.browser.switch_to.alert | ||
| 43 | - assert_equal message, alert.text | ||
| 44 | - alert.accept | ||
| 45 | -end | ||
| 46 | - | ||
| 47 | -Then /^I should see "([^"]*)" in the "([^"]*)"$/ do |content, labeltext| | ||
| 48 | - find_field(labeltext).value.should == content | ||
| 49 | -end | ||
| 50 | - | ||
| 51 | -Then /^I should see "([^"]*)" button$/ do |button_name| | ||
| 52 | - find_button(button_name).should_not be_nil | ||
| 53 | -end | ||
| 54 | - | ||
| 55 | -Then /^I should see "([^"]*)" in a link$/ do |link_name| | ||
| 56 | - find_link(link_name).should_not be_nil | ||
| 57 | -end | ||
| 58 | - | ||
| 59 | -Then /^I should see "([^"]*)" in the process period select field$/ do |content| | ||
| 60 | - selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first | ||
| 61 | - assert_equal selected.last, find_field("repository_process_period").value.to_i | ||
| 62 | -end | ||
| 63 | - | ||
| 64 | -Then /^I should see "([^"]*)" in the repository configuration select field$/ do |content| | ||
| 65 | - selected = Kalibro::Configuration.all.select { |option| option.name == content }.first | ||
| 66 | - assert_equal selected.id, find_field("repository_configuration_id").value.to_i | ||
| 67 | -end | ||
| 68 | - | ||
| 69 | -Then /^I should not see "([^"]*)" button$/ do |button_name| | ||
| 70 | - find_button(button_name).should be_nil | ||
| 71 | -end | ||
| 72 | - | ||
| 73 | -When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type, fields| | ||
| 74 | - item = {} | ||
| 75 | - fields.rows_hash.each do |name, value| | ||
| 76 | - if(name=="user" or name=="community") | ||
| 77 | - item.merge!(:profile=>Profile[value]) | ||
| 78 | - else | ||
| 79 | - item.merge!(name => value) | ||
| 80 | - end | ||
| 81 | - end | ||
| 82 | - if (type == "project") | ||
| 83 | - result = MezuroPlugin::ProjectContent.new(item) | ||
| 84 | - elsif (type == "reading group") | ||
| 85 | - result = MezuroPlugin::ReadingGroupContent.new(item) | ||
| 86 | - elsif (type == "configuration") | ||
| 87 | - result = MezuroPlugin::ConfigurationContent.new(item) | ||
| 88 | - end | ||
| 89 | - | ||
| 90 | - result.save! | ||
| 91 | -end | ||
| 92 | - | ||
| 93 | -When /^I have a Mezuro (reading|repository) with the following data$/ do |type, fields| | ||
| 94 | - item = {} | ||
| 95 | - fields.rows_hash.each do |name, value| | ||
| 96 | - if(name=="user" or name=="community") | ||
| 97 | - item.merge!(:profile=>Profile[value]) | ||
| 98 | - else | ||
| 99 | - item.merge!(name => value) | ||
| 100 | - end | ||
| 101 | - end | ||
| 102 | - if (type == "repository") | ||
| 103 | - item["configuration_id"] = Kalibro::Configuration.all.select {|configuration| configuration.name == item["configuration_id"] }.first.id | ||
| 104 | - item.merge!(:project_id => Kalibro::Project.all.last.id) | ||
| 105 | - Kalibro::Repository.create(item) | ||
| 106 | - elsif (type == "reading") | ||
| 107 | - item.merge!(:group_id => Kalibro::ReadingGroup.all.last.id) | ||
| 108 | - Kalibro::Reading.create(item) | ||
| 109 | - end | ||
| 110 | -end | ||
| 111 | - | ||
| 112 | -When /^I erase the "([^"]*)" field$/ do |field_name| | ||
| 113 | - find_field(field_name).set "" | ||
| 114 | -end | ||
| 115 | - | ||
| 116 | -When /^I fill the fields with the new following data$/ do |fields| | ||
| 117 | - fields.rows_hash.each do |key, value| | ||
| 118 | - name = key.to_s | ||
| 119 | - element = find_field(name) | ||
| 120 | - if (element.tag_name.to_s == "select") | ||
| 121 | - select(value, :from => name) | ||
| 122 | - else | ||
| 123 | - element.set value | ||
| 124 | - end | ||
| 125 | - end | ||
| 126 | -end | ||
| 127 | - | ||
| 128 | -When /^I have a Mezuro metric configuration with previous created configuration and reading group$/ do | ||
| 129 | - Kalibro::MetricConfiguration.create({ | ||
| 130 | - :code => 'amloc1', | ||
| 131 | - :metric => {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']}, | ||
| 132 | - :base_tool_name => "Analizo", | ||
| 133 | - :weight => "1.0", | ||
| 134 | - :aggregation_form => 'AVERAGE', | ||
| 135 | - :reading_group_id => Kalibro::ReadingGroup.all.last.id, | ||
| 136 | - :configuration_id => Kalibro::Configuration.all.last.id | ||
| 137 | - }) | ||
| 138 | -end | ||
| 139 | - | ||
| 140 | -When /^I follow the (edit|remove) link for "([^"]*)" (repository|reading)$/ do |action, name, type| | ||
| 141 | - if (type == "repository") | ||
| 142 | - project_id = Kalibro::Project.all.last.id | ||
| 143 | - repositories = Kalibro::Repository.repositories_of project_id | ||
| 144 | - id = repositories.select {|option| option.name == name}.first.id | ||
| 145 | - elsif (type == "reading") | ||
| 146 | - reading_group_id = Kalibro::ReadingGroup.all.last.id | ||
| 147 | - readings = Kalibro::Reading.readings_of reading_group_id | ||
| 148 | - id = readings.select {|option| option.label == name}.first.id | ||
| 149 | - if (action == "edit") | ||
| 150 | - action = name | ||
| 151 | - end | ||
| 152 | - end | ||
| 153 | - | ||
| 154 | - elements = all('a', :text => action.capitalize) | ||
| 155 | - link = type + "_id" | ||
| 156 | - action_link = elements.select {|element| (/#{link}=#{id}/ =~ element[:href]) }.first | ||
| 157 | - action_link.click | ||
| 158 | -end | ||
| 159 | - | ||
| 160 | -Then /^I should see the "([^"]*)" color$/ do |color_name| | ||
| 161 | - elements = all('td', :text => "") | ||
| 162 | - found = elements.select { |element| color_name == element[:bgcolor]}.first | ||
| 163 | - assert_not_nil found | ||
| 164 | -end |
plugins/mezuro/features/support/hooks.rb
| @@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
| 1 | -Before do | ||
| 2 | - if !$dunit | ||
| 3 | - command = "#{RAILS_ROOT}/plugins/mezuro/script/tests/prepare_kalibro_query_file.sh" | ||
| 4 | - system command | ||
| 5 | - $dunit = true | ||
| 6 | - end | ||
| 7 | -end | ||
| 8 | - | ||
| 9 | -After ('@kalibro_restart') do | ||
| 10 | - command = "#{RAILS_ROOT}/plugins/mezuro/script/tests/delete_all_kalibro_entries.sh" | ||
| 11 | - system command | ||
| 12 | -end |
plugins/mezuro/install.rb
| @@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
| 1 | -raise "Not ready yet" |
plugins/mezuro/lib/kalibro/base_tool.rb
| @@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
| 1 | -class Kalibro::BaseTool < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :name, :description, :collector_class_name, :supported_metric | ||
| 4 | - | ||
| 5 | - def self.find_by_name(base_tool_name) | ||
| 6 | - new request(:get_base_tool, {:base_tool_name => base_tool_name})[:base_tool] | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.all | ||
| 10 | - basetools = all_names | ||
| 11 | - basetools.map{ |name| find_by_name(name) } | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - def self.all_names | ||
| 15 | - request(:all_base_tool_names)[:base_tool_name].to_a | ||
| 16 | - end | ||
| 17 | - | ||
| 18 | - def supported_metric=(value) | ||
| 19 | - @supported_metric = Kalibro::Metric.to_objects_array value | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - def supported_metrics | ||
| 23 | - @supported_metric | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def supported_metrics=(supported_metrics) | ||
| 27 | - @supported_metric = supported_metrics | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | - def metric(name) | ||
| 31 | - supported_metrics.find {|metric| metric.name == name} | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | -end |
plugins/mezuro/lib/kalibro/configuration.rb
| @@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
| 1 | -class Kalibro::Configuration < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :name, :description | ||
| 4 | - | ||
| 5 | - def id=(value) | ||
| 6 | - @id = value.to_i | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.all | ||
| 10 | - response = request(:all_configurations)[:configuration] | ||
| 11 | - response = [] if response.nil? | ||
| 12 | - response = [response] if response.is_a?(Hash) | ||
| 13 | - response.map {|configuration| new configuration} | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | -end |
plugins/mezuro/lib/kalibro/date_metric_result.rb
| @@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
| 1 | -class Kalibro::DateMetricResult < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :date, :metric_result | ||
| 4 | - | ||
| 5 | - def date=(value) | ||
| 6 | - @date = value.is_a?(String) ? DateTime.parse(value) : value | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def metric_result=(value) | ||
| 10 | - @metric_result = Kalibro::MetricResult.to_object value | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def result | ||
| 14 | - @metric_result.value | ||
| 15 | - end | ||
| 16 | -end |
plugins/mezuro/lib/kalibro/date_module_result.rb
| @@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
| 1 | -class Kalibro::DateModuleResult < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :date, :module_result | ||
| 4 | - | ||
| 5 | - def date=(value) | ||
| 6 | - @date = value.is_a?(String) ? DateTime.parse(value) : value | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def module_result=(value) | ||
| 10 | - @module_result = Kalibro::ModuleResult.to_object value | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def result | ||
| 14 | - @module_result.grade | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | -end |
plugins/mezuro/lib/kalibro/errors/record_not_found.rb
plugins/mezuro/lib/kalibro/errors/standard.rb
plugins/mezuro/lib/kalibro/metric.rb
| @@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
| 1 | -class Kalibro::Metric < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :name, :compound, :scope, :description, :script, :language | ||
| 4 | - | ||
| 5 | - def languages | ||
| 6 | - @language | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def languages=(languages) | ||
| 10 | - @language = languages | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def language=(value) | ||
| 14 | - @language = Kalibro::Model.to_objects_array value | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | -end |
plugins/mezuro/lib/kalibro/metric_configuration.rb
| @@ -1,43 +0,0 @@ | @@ -1,43 +0,0 @@ | ||
| 1 | -class Kalibro::MetricConfiguration < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :code, :metric, :base_tool_name, :weight, :aggregation_form, :reading_group_id, :configuration_id | ||
| 4 | - | ||
| 5 | - def id=(value) | ||
| 6 | - @id = value.to_i | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def reading_group_id=(value) | ||
| 10 | - @reading_group_id = value.to_i | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def metric=(value) | ||
| 14 | - @metric = Kalibro::Metric.to_object(value) | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def weight=(value) | ||
| 18 | - @weight = value.to_f | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - def update_attributes(attributes={}) | ||
| 22 | - attributes.each { |field, value| send("#{field}=", value) if self.class.is_valid?(field) } | ||
| 23 | - save | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def to_hash | ||
| 27 | - super :except => [:configuration_id] | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | - def self.metric_configurations_of(configuration_id) | ||
| 31 | - response = request(:metric_configurations_of, {:configuration_id => configuration_id})[:metric_configuration] | ||
| 32 | - response = [] if response.nil? | ||
| 33 | - response = [response] if response.is_a?(Hash) | ||
| 34 | - response.map { |metric_configuration| new metric_configuration } | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - private | ||
| 38 | - | ||
| 39 | - def save_params | ||
| 40 | - {:metric_configuration => self.to_hash, :configuration_id => self.configuration_id} | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | -end |
plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb
| @@ -1,38 +0,0 @@ | @@ -1,38 +0,0 @@ | ||
| 1 | -class Kalibro::MetricConfigurationSnapshot < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :code, :weight, :aggregation_form, :metric, :base_tool_name, :range | ||
| 4 | - | ||
| 5 | - def weight=(value) | ||
| 6 | - @weight = value.to_f | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def metric=(value) | ||
| 10 | - if value.kind_of?(Hash) | ||
| 11 | - @metric = Kalibro::Metric.to_object(value) | ||
| 12 | - else | ||
| 13 | - @metric = value | ||
| 14 | - end | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def range=(value) | ||
| 18 | - value.to_a | ||
| 19 | - @range = [] | ||
| 20 | - | ||
| 21 | - value.each do |range_snapshot| | ||
| 22 | - @range << Kalibro::RangeSnapshot.to_object(range_snapshot) | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | - def range_snapshot | ||
| 28 | - range | ||
| 29 | - end | ||
| 30 | - | ||
| 31 | - def to_hash | ||
| 32 | - hash = super | ||
| 33 | - hash[:attributes!][:range] = {'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 34 | - 'xsi:type' => 'kalibro:rangeSnapshotXml' } | ||
| 35 | - hash | ||
| 36 | - end | ||
| 37 | - | ||
| 38 | -end |
plugins/mezuro/lib/kalibro/metric_result.rb
| @@ -1,50 +0,0 @@ | @@ -1,50 +0,0 @@ | ||
| 1 | -class Kalibro::MetricResult < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :configuration, :value, :error | ||
| 4 | - | ||
| 5 | - def initialize(attributes={}) | ||
| 6 | - value = attributes[:value] | ||
| 7 | - @value = (value == "NaN") ? attributes[:aggregated_value].to_f : value.to_f | ||
| 8 | - attributes.each do |field, value| | ||
| 9 | - if field!= :value and field!= :aggregated_value and self.class.is_valid?(field) | ||
| 10 | - send("#{field}=", value) | ||
| 11 | - end | ||
| 12 | - end | ||
| 13 | - @errors = [] | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def id=(value) | ||
| 17 | - @id = value.to_i | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - def configuration=(value) | ||
| 21 | - @configuration = Kalibro::MetricConfigurationSnapshot.to_object value | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def metric_configuration_snapshot | ||
| 25 | - configuration | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - def error=(value) | ||
| 29 | - @error = Kalibro::Throwable.to_object value | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def descendant_results | ||
| 33 | - self.class.request(:descendant_results_of, {:metric_result_id => self.id})[:descendant_result].to_a | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - def self.metric_results_of(module_result_id) | ||
| 37 | - response = request(:metric_results_of, {:module_result_id => module_result_id})[:metric_result] | ||
| 38 | - response = [] if response.nil? | ||
| 39 | - response = [response] if response.is_a?(Hash) | ||
| 40 | - response.map {|metric_result| new metric_result} | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - def self.history_of(metric_name, module_result_id) | ||
| 44 | - response = self.request(:history_of_metric, {:metric_name => metric_name, :module_result_id => module_result_id})[:date_metric_result] | ||
| 45 | - response = [] if response.nil? | ||
| 46 | - response = [response] if response.is_a?(Hash) | ||
| 47 | - response.map {|date_metric_result| Kalibro::DateMetricResult.new date_metric_result} | ||
| 48 | - end | ||
| 49 | - | ||
| 50 | -end |
plugins/mezuro/lib/kalibro/model.rb
| @@ -1,164 +0,0 @@ | @@ -1,164 +0,0 @@ | ||
| 1 | -class Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :errors | ||
| 4 | - | ||
| 5 | - def initialize(attributes={}) | ||
| 6 | - attributes.each { |field, value| send("#{field}=", value) if self.class.is_valid?(field) } | ||
| 7 | - @errors = [] | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - def to_hash(options={}) | ||
| 12 | - hash = Hash.new | ||
| 13 | - excepts = options[:except].nil? ? [] : options[:except] | ||
| 14 | - excepts << :errors | ||
| 15 | - fields.each do |field| | ||
| 16 | - if(!excepts.include?(field)) | ||
| 17 | - field_value = send(field) | ||
| 18 | - if !field_value.nil? | ||
| 19 | - hash[field] = convert_to_hash(field_value) | ||
| 20 | - if field_value.is_a?(Kalibro::Model) | ||
| 21 | - hash = {:attributes! => {}}.merge(hash) | ||
| 22 | - hash[:attributes!][field.to_sym] = { | ||
| 23 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 24 | - 'xsi:type' => 'kalibro:' + xml_instance_class_name(field_value) } | ||
| 25 | - end | ||
| 26 | - end | ||
| 27 | - end | ||
| 28 | - end | ||
| 29 | - hash | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def self.request(action, request_body = nil) | ||
| 33 | - response = client(endpoint).request(:kalibro, action) { soap.body = request_body } | ||
| 34 | - response.to_hash["#{action}_response".to_sym] # response is a Savon::SOAP::Response, and to_hash is a Savon::SOAP::Response method | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - def self.to_objects_array value | ||
| 38 | - array = value.kind_of?(Array) ? value : [value] | ||
| 39 | - array.each.collect { |element| to_object(element) } | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - def self.to_object value | ||
| 43 | - value.kind_of?(Hash) ? new(value) : value | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - def self.create(attributes={}) | ||
| 47 | - new_model = new attributes | ||
| 48 | - new_model.save | ||
| 49 | - new_model | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - def self.find(id) | ||
| 53 | - if(exists?(id)) | ||
| 54 | - new request(find_action, id_params(id))["#{class_name.underscore}".to_sym] | ||
| 55 | - else | ||
| 56 | - raise Kalibro::Errors::RecordNotFound | ||
| 57 | - end | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - def save | ||
| 61 | - begin | ||
| 62 | - self.id = self.class.request(save_action, save_params)["#{instance_class_name.underscore}_id".to_sym] | ||
| 63 | - true | ||
| 64 | - rescue Exception => exception | ||
| 65 | - add_error exception | ||
| 66 | - false | ||
| 67 | - end | ||
| 68 | - end | ||
| 69 | - | ||
| 70 | - def destroy | ||
| 71 | - begin | ||
| 72 | - self.class.request(destroy_action, destroy_params) | ||
| 73 | - rescue Exception => exception | ||
| 74 | - add_error exception | ||
| 75 | - end | ||
| 76 | - end | ||
| 77 | - | ||
| 78 | - def self.exists?(id) | ||
| 79 | - request(exists_action, id_params(id))[:exists] | ||
| 80 | - end | ||
| 81 | - | ||
| 82 | - protected | ||
| 83 | - | ||
| 84 | - def fields | ||
| 85 | - instance_variable_names.each.collect { |variable| variable.to_s.sub(/@/, '').to_sym } | ||
| 86 | - end | ||
| 87 | - | ||
| 88 | - def convert_to_hash(value) | ||
| 89 | - return value if value.nil? | ||
| 90 | - return value.collect { |element| convert_to_hash(element) } if value.is_a?(Array) | ||
| 91 | - return value.to_hash if value.is_a?(Kalibro::Model) | ||
| 92 | - return self.class.date_with_milliseconds(value) if value.is_a?(DateTime) | ||
| 93 | - return 'INF' if value.is_a?(Float) and value.infinite? == 1 | ||
| 94 | - return '-INF' if value.is_a?(Float) and value.infinite? == -1 | ||
| 95 | - value.to_s | ||
| 96 | - end | ||
| 97 | - | ||
| 98 | - def xml_instance_class_name(object) | ||
| 99 | - xml_name = object.class.name | ||
| 100 | - xml_name["Kalibro::"] = "" | ||
| 101 | - xml_name[0..0] = xml_name[0..0].downcase | ||
| 102 | - xml_name + "Xml" | ||
| 103 | - end | ||
| 104 | - | ||
| 105 | - def self.client(endpoint) | ||
| 106 | - service_address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yml") | ||
| 107 | - Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl") | ||
| 108 | - end | ||
| 109 | - | ||
| 110 | - def self.is_valid?(field) | ||
| 111 | - field.to_s[0] != '@' and field != :attributes! and (field.to_s =~ /xsi/).nil? | ||
| 112 | - end | ||
| 113 | - | ||
| 114 | - def self.date_with_milliseconds(date) | ||
| 115 | - milliseconds = "." + (date.sec_fraction * 60 * 60 * 24 * 1000).to_s | ||
| 116 | - date.to_s[0..18] + milliseconds + date.to_s[19..-1] | ||
| 117 | - end | ||
| 118 | - | ||
| 119 | - def instance_class_name | ||
| 120 | - self.class.name.gsub(/Kalibro::/,"") | ||
| 121 | - end | ||
| 122 | - | ||
| 123 | - def self.endpoint | ||
| 124 | - class_name | ||
| 125 | - end | ||
| 126 | - | ||
| 127 | - def save_action | ||
| 128 | - "save_#{instance_class_name.underscore}".to_sym | ||
| 129 | - end | ||
| 130 | - | ||
| 131 | - def save_params | ||
| 132 | - {instance_class_name.underscore.to_sym => self.to_hash} | ||
| 133 | - end | ||
| 134 | - | ||
| 135 | - def destroy_action | ||
| 136 | - "delete_#{instance_class_name.underscore}".to_sym | ||
| 137 | - end | ||
| 138 | - | ||
| 139 | - def destroy_params | ||
| 140 | - {"#{instance_class_name.underscore}_id".to_sym => self.id} | ||
| 141 | - end | ||
| 142 | - | ||
| 143 | - def self.class_name | ||
| 144 | - self.name.gsub(/Kalibro::/,"") | ||
| 145 | - end | ||
| 146 | - | ||
| 147 | - def self.exists_action | ||
| 148 | - "#{class_name.underscore}_exists".to_sym | ||
| 149 | - end | ||
| 150 | - | ||
| 151 | - def self.id_params(id) | ||
| 152 | - {"#{class_name.underscore}_id".to_sym => id} | ||
| 153 | - end | ||
| 154 | - | ||
| 155 | - def self.find_action | ||
| 156 | - "get_#{class_name.underscore}".to_sym | ||
| 157 | - end | ||
| 158 | - | ||
| 159 | - def add_error(exception) | ||
| 160 | - @errors << exception | ||
| 161 | - end | ||
| 162 | - | ||
| 163 | -end | ||
| 164 | - |
plugins/mezuro/lib/kalibro/module.rb
plugins/mezuro/lib/kalibro/module_result.rb
| @@ -1,48 +0,0 @@ | @@ -1,48 +0,0 @@ | ||
| 1 | -class Kalibro::ModuleResult < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :module, :grade, :parent_id, :height | ||
| 4 | - | ||
| 5 | - def self.find(id) | ||
| 6 | - new request(:get_module_result, { :module_result_id => id })[:module_result] | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def children | ||
| 10 | - response = self.class.request(:children_of, {:module_result_id => id})[:module_result] | ||
| 11 | - response = [] if response.nil? | ||
| 12 | - response = [response] if response.is_a?(Hash) | ||
| 13 | - response.map {|module_result| Kalibro::ModuleResult.new module_result} | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def parents | ||
| 17 | - if parent_id.nil? | ||
| 18 | - [] | ||
| 19 | - else | ||
| 20 | - parent = self.class.find(parent_id) | ||
| 21 | - parent.parents << parent | ||
| 22 | - end | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | - def id=(value) | ||
| 26 | - @id = value.to_i | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - def module=(value) | ||
| 30 | - @module = Kalibro::Module.to_object value | ||
| 31 | - end | ||
| 32 | - | ||
| 33 | - def grade=(value) | ||
| 34 | - @grade = value.to_f | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - def parent_id=(value) | ||
| 38 | - @parent_id = value.to_i | ||
| 39 | - end | ||
| 40 | - | ||
| 41 | - def self.history_of(module_result_id) | ||
| 42 | - response = self.request(:history_of_module, {:module_result_id => module_result_id})[:date_module_result] | ||
| 43 | - response = [] if response.nil? | ||
| 44 | - response = [response] if response.is_a?(Hash) | ||
| 45 | - response.map {|date_module_result| Kalibro::DateModuleResult.new date_module_result} | ||
| 46 | - end | ||
| 47 | - | ||
| 48 | -end |
plugins/mezuro/lib/kalibro/process_time.rb
plugins/mezuro/lib/kalibro/processing.rb
| @@ -1,94 +0,0 @@ | @@ -1,94 +0,0 @@ | ||
| 1 | -class Kalibro::Processing < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :date, :state, :error, :process_time, :results_root_id | ||
| 4 | - | ||
| 5 | - def self.processing_of(repository_id) | ||
| 6 | - if has_ready_processing(repository_id) | ||
| 7 | - last_ready_processing_of(repository_id) | ||
| 8 | - else #always exists a processing, we send a requisition to kalibro to process repository | ||
| 9 | - last_processing_of(repository_id) | ||
| 10 | - end | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.processing_with_date_of(repository_id, date) | ||
| 14 | - date = date.is_a?(String) ? DateTime.parse(date) : date | ||
| 15 | - if has_processing_after(repository_id, date) | ||
| 16 | - first_processing_after(repository_id, date) | ||
| 17 | - elsif has_processing_before(repository_id, date) | ||
| 18 | - last_processing_before(repository_id, date) | ||
| 19 | - else | ||
| 20 | - last_processing_of(repository_id) | ||
| 21 | - end | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def id=(value) | ||
| 25 | - @id = value.to_i | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - def date=(value) | ||
| 29 | - @date = value.is_a?(String) ? DateTime.parse(value) : value | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def process_times=(value) | ||
| 33 | - process_time=value | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - def process_time=(value) | ||
| 37 | - @process_time = Kalibro::ProcessTime.to_objects_array value | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - def process_times | ||
| 41 | - process_time | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - def error=(value) | ||
| 45 | - @error = Kalibro::Throwable.to_object value | ||
| 46 | - end | ||
| 47 | - | ||
| 48 | - def results_root_id=(value) | ||
| 49 | - @results_root_id = value.to_i | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - private | ||
| 53 | - | ||
| 54 | - def self.has_processing(repository_id) | ||
| 55 | - request(:has_processing, {:repository_id => repository_id})[:exists] | ||
| 56 | - end | ||
| 57 | - | ||
| 58 | - def self.has_ready_processing(repository_id) | ||
| 59 | - request(:has_ready_processing, {:repository_id => repository_id})[:exists] | ||
| 60 | - end | ||
| 61 | - | ||
| 62 | - def self.has_processing_after(repository_id, date) | ||
| 63 | - request(:has_processing_after, {:repository_id => repository_id, :date => date})[:exists] | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | - def self.has_processing_before(repository_id, date) | ||
| 67 | - request(:has_processing_before, {:repository_id => repository_id, :date => date})[:exists] | ||
| 68 | - end | ||
| 69 | - | ||
| 70 | - def self.last_processing_state_of(repository_id) | ||
| 71 | - request(:last_processing_state, {:repository_id => repository_id})[:process_state] | ||
| 72 | - end | ||
| 73 | - | ||
| 74 | - def self.last_ready_processing_of(repository_id) | ||
| 75 | - new request(:last_ready_processing, {:repository_id => repository_id})[:processing] | ||
| 76 | - end | ||
| 77 | - | ||
| 78 | - def self.first_processing_of(repository_id) | ||
| 79 | - new request(:first_processing, {:repository_id => repository_id})[:processing] | ||
| 80 | - end | ||
| 81 | - | ||
| 82 | - def self.last_processing_of(repository_id) | ||
| 83 | - new request(:last_processing, {:repository_id => repository_id})[:processing] | ||
| 84 | - end | ||
| 85 | - | ||
| 86 | - def self.first_processing_after(repository_id, date) | ||
| 87 | - new request(:first_processing_after, {:repository_id => repository_id, :date => date})[:processing] | ||
| 88 | - end | ||
| 89 | - | ||
| 90 | - def self.last_processing_before(repository_id, date) | ||
| 91 | - new request(:last_processing_before, {:repository_id => repository_id, :date => date})[:processing] | ||
| 92 | - end | ||
| 93 | - | ||
| 94 | -end |
plugins/mezuro/lib/kalibro/project.rb
| @@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
| 1 | -class Kalibro::Project < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :name, :description | ||
| 4 | - | ||
| 5 | - def id=(value) | ||
| 6 | - @id = value.to_i | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.all | ||
| 10 | - response = request(:all_projects)[:project] | ||
| 11 | - response = [] if response.nil? | ||
| 12 | - response = [response] if response.is_a?(Hash) | ||
| 13 | - response.map {|project| new project} | ||
| 14 | - end | ||
| 15 | -end |
plugins/mezuro/lib/kalibro/range.rb
| @@ -1,78 +0,0 @@ | @@ -1,78 +0,0 @@ | ||
| 1 | -class Kalibro::Range < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :beginning, :end, :reading_id, :comments | ||
| 4 | - | ||
| 5 | - def id=(value) | ||
| 6 | - @id = value.to_i | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def beginning=(value) | ||
| 10 | - @beginning = value.to_f | ||
| 11 | - @beginning = -1.0/0.0 if value == "-INF" | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - def beginning | ||
| 15 | - if !@beginning.nil? | ||
| 16 | - case @beginning.to_s | ||
| 17 | - when "-Infinity": "-INF" | ||
| 18 | - else @beginning | ||
| 19 | - end | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - def end=(value) | ||
| 24 | - @end = value.to_f | ||
| 25 | - @end = 1.0/0.0 if value =~ /INF/ | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - def end | ||
| 29 | - if !@end.nil? | ||
| 30 | - case @end.to_s | ||
| 31 | - when "Infinity": "INF" | ||
| 32 | - else @end | ||
| 33 | - end | ||
| 34 | - end | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - def reading_id=(value) | ||
| 38 | - @reading_id = value.to_i | ||
| 39 | - end | ||
| 40 | - | ||
| 41 | - def label | ||
| 42 | - reading.label | ||
| 43 | - end | ||
| 44 | - | ||
| 45 | - def grade | ||
| 46 | - reading.grade | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - def color | ||
| 50 | - reading.color | ||
| 51 | - end | ||
| 52 | - | ||
| 53 | - def self.ranges_of( metric_configuration_id ) | ||
| 54 | - response = request(:ranges_of, {:metric_configuration_id => metric_configuration_id} )[:range] | ||
| 55 | - response = [] if response.nil? | ||
| 56 | - response = [response] if response.is_a?(Hash) | ||
| 57 | - response.map { |range| new range } | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - def save( metric_configuration_id ) | ||
| 61 | - begin | ||
| 62 | - self.id = self.class.request(:save_range, {:range => self.to_hash, :metric_configuration_id => metric_configuration_id})[:range_id] | ||
| 63 | - true | ||
| 64 | - rescue Exception => exception | ||
| 65 | - add_error exception | ||
| 66 | - false | ||
| 67 | - end | ||
| 68 | - end | ||
| 69 | - | ||
| 70 | - private | ||
| 71 | - | ||
| 72 | - def reading | ||
| 73 | - @reading ||= Kalibro::Reading.find(reading_id) | ||
| 74 | - @reading | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | -end | ||
| 78 | - |
plugins/mezuro/lib/kalibro/range_snapshot.rb
| @@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
| 1 | -class Kalibro::RangeSnapshot < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :beginning, :end, :label, :grade, :color, :comments | ||
| 4 | - | ||
| 5 | - def beginning=(value) | ||
| 6 | - @beginning = ((value == "-INF") ? -1.0/0 : value.to_f) | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def end=(value) | ||
| 10 | - @end = ((value == "INF") ? 1.0/0 : value.to_f) | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def grade=(value) | ||
| 14 | - @grade = value.to_f | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | -end |
plugins/mezuro/lib/kalibro/reading.rb
| @@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
| 1 | -class Kalibro::Reading < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :label, :grade, :color, :group_id | ||
| 4 | - | ||
| 5 | - def self.find(id) | ||
| 6 | - new request(:get_reading, {:reading_id => id})[:reading] | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.readings_of( group_id ) | ||
| 10 | - response = request(:readings_of, {:group_id => group_id})[:reading] | ||
| 11 | - response = [] if response.nil? | ||
| 12 | - response = [response] if response.is_a?(Hash) | ||
| 13 | - response.map { |reading| new reading } | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def self.reading_of( range_id ) | ||
| 17 | - new request(:reading_of, {:range_id => range_id} )[:reading] | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - def id=(value) | ||
| 21 | - @id = value.to_i | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def grade=(value) | ||
| 25 | - @grade = value.to_f | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - private | ||
| 29 | - | ||
| 30 | - def save_params | ||
| 31 | - {:reading => self.to_hash, :group_id => group_id} | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | -end |
plugins/mezuro/lib/kalibro/reading_group.rb
| @@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
| 1 | -class Kalibro::ReadingGroup < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :name, :description | ||
| 4 | - | ||
| 5 | - def id=(value) | ||
| 6 | - @id = value.to_i | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.all | ||
| 10 | - response = request(:all_reading_groups)[:reading_group] | ||
| 11 | - response = [] if response.nil? | ||
| 12 | - response = [response] if response.is_a?(Hash) | ||
| 13 | - response.map { |reading_group| new reading_group } | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def self.reading_group_of( metric_configuration_id ) | ||
| 17 | - new request(:reading_group_of, {:metric_configuration_id => metric_configuration_id} )[:reading_group] | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - private | ||
| 21 | - | ||
| 22 | - def self.id_params(id) | ||
| 23 | - {:group_id => id} | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def destroy_params | ||
| 27 | - {:group_id => self.id} | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | -end |
plugins/mezuro/lib/kalibro/repository.rb
| @@ -1,42 +0,0 @@ | @@ -1,42 +0,0 @@ | ||
| 1 | -class Kalibro::Repository < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :id, :name, :description, :license, :process_period, :type, :address, :configuration_id, :project_id | ||
| 4 | - | ||
| 5 | - def self.repository_types | ||
| 6 | - request(:supported_repository_types)[:supported_type].to_a | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.repositories_of(project_id) | ||
| 10 | - response = request(:repositories_of, {:project_id => project_id})[:repository] | ||
| 11 | - response = [] if response.nil? | ||
| 12 | - response = [response] if response.is_a?(Hash) | ||
| 13 | - response.map {|repository| new repository} | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def id=(value) | ||
| 17 | - @id = value.to_i | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - def process_period=(value) | ||
| 21 | - @process_period = value.to_i | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def configuration_id=(value) | ||
| 25 | - @configuration_id = value.to_i | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - def process | ||
| 29 | - self.class.request(:process_repository, {:repository_id => self.id}) | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def cancel_processing_of_repository | ||
| 33 | - self.class.request(:cancel_processing_of_repository, {:repository_id => self.id}) | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - private | ||
| 37 | - | ||
| 38 | - def save_params | ||
| 39 | - {:repository => self.to_hash, :project_id => project_id} | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | -end |
plugins/mezuro/lib/kalibro/stack_trace_element.rb
plugins/mezuro/lib/kalibro/throwable.rb
| @@ -1,21 +0,0 @@ | @@ -1,21 +0,0 @@ | ||
| 1 | -class Kalibro::Throwable < Kalibro::Model | ||
| 2 | - | ||
| 3 | - attr_accessor :target_string, :message, :cause, :stack_trace_element | ||
| 4 | - | ||
| 5 | - def stack_trace_element=(value) | ||
| 6 | - @stack_trace_element = Kalibro::StackTraceElement.to_objects_array value | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def stack_trace | ||
| 10 | - @stack_trace_element | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def stack_trace=(stack_trace) | ||
| 14 | - @stack_trace_element = stack_trace | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def cause=(cause_value) | ||
| 18 | - @cause = Kalibro::Throwable.to_object cause_value | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | -end |
plugins/mezuro/lib/mezuro_plugin.rb
| @@ -1,39 +0,0 @@ | @@ -1,39 +0,0 @@ | ||
| 1 | -require 'yaml' | ||
| 2 | - | ||
| 3 | -Savon.configure do |config| | ||
| 4 | - config.log = HTTPI.log = (RAILS_ENV == 'development') | ||
| 5 | -end | ||
| 6 | - | ||
| 7 | -class MezuroPlugin < Noosfero::Plugin | ||
| 8 | - | ||
| 9 | - def self.plugin_name | ||
| 10 | - "Mezuro" | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.plugin_description | ||
| 14 | - _("A metric analizer plugin.") | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def content_types | ||
| 18 | - if context.profile.is_a?(Community) | ||
| 19 | - MezuroPlugin::ProjectContent | ||
| 20 | - else | ||
| 21 | - [MezuroPlugin::ConfigurationContent, | ||
| 22 | - MezuroPlugin::ReadingGroupContent] | ||
| 23 | - end | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def control_panel_buttons | ||
| 27 | - if context.profile.is_a?(Community) | ||
| 28 | - {:title => _('Mezuro project'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ProjectContent'}, :icon => 'mezuro' } | ||
| 29 | - else | ||
| 30 | - [{:title => _('Mezuro configuration'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ConfigurationContent'}, :icon => 'mezuro' }, | ||
| 31 | - {:title => _('Mezuro reading group'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ReadingGroupContent'}, :icon => 'mezuro' }] | ||
| 32 | - end | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - def stylesheet? | ||
| 36 | - true | ||
| 37 | - end | ||
| 38 | - | ||
| 39 | -end |
plugins/mezuro/lib/mezuro_plugin/configuration_content.rb
| @@ -1,138 +0,0 @@ | @@ -1,138 +0,0 @@ | ||
| 1 | -class MezuroPlugin::ConfigurationContent < Article | ||
| 2 | - validate_on_create :validate_configuration_name | ||
| 3 | - | ||
| 4 | - settings_items :configuration_id | ||
| 5 | - | ||
| 6 | - before_save :send_configuration_to_service | ||
| 7 | - after_destroy :remove_configuration_from_service | ||
| 8 | - | ||
| 9 | - def self.short_description | ||
| 10 | - 'Mezuro configuration' | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.description | ||
| 14 | - 'Set of metric configurations to interpret a Kalibro project' | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - include ActionView::Helpers::TagHelper | ||
| 18 | - def to_html(options = {}) | ||
| 19 | - lambda do | ||
| 20 | - render :file => 'content_viewer/show_configuration.rhtml' | ||
| 21 | - end | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def kalibro_configuration #Can't be just "configuration", method name exists somewhere in noosfero | ||
| 25 | - begin | ||
| 26 | - @configuration ||= Kalibro::Configuration.find(self.configuration_id) | ||
| 27 | - rescue Exception => exception | ||
| 28 | - errors.add_to_base(exception.message) | ||
| 29 | - @configuration = nil | ||
| 30 | - end | ||
| 31 | - @configuration | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - def configuration_names_and_ids | ||
| 35 | - begin | ||
| 36 | - all_configurations = Kalibro::Configuration.all | ||
| 37 | - all_names_and_ids = all_configurations.map { |configuration| [configuration.name, configuration.id] } | ||
| 38 | - [["None", -1]] + (all_names_and_ids.sort { |x,y| x.first.downcase <=> y.first.downcase }) | ||
| 39 | - rescue Exception => exception | ||
| 40 | - errors.add_to_base(exception.message) | ||
| 41 | - [["None", -1]] | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - def description=(value) | ||
| 47 | - @description=value | ||
| 48 | - end | ||
| 49 | - | ||
| 50 | - def description | ||
| 51 | - begin | ||
| 52 | - @description ||= kalibro_configuration.description | ||
| 53 | - rescue | ||
| 54 | - @description = "" | ||
| 55 | - end | ||
| 56 | - @description | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | - def configuration_to_clone_id | ||
| 60 | - begin | ||
| 61 | - @configuration_to_clone_id | ||
| 62 | - rescue Exception => exception | ||
| 63 | - nil | ||
| 64 | - end | ||
| 65 | - end | ||
| 66 | - | ||
| 67 | - def configuration_to_clone_id=(value) | ||
| 68 | - @configuration_to_clone_id = (value == -1) ? nil : value | ||
| 69 | - end | ||
| 70 | - | ||
| 71 | - def metric_configurations | ||
| 72 | - begin | ||
| 73 | - @metric_configurations ||= Kalibro::MetricConfiguration.metric_configurations_of(configuration_id) | ||
| 74 | - rescue Exception => error | ||
| 75 | - errors.add_to_base(error.message) | ||
| 76 | - @metric_configurations = [] | ||
| 77 | - end | ||
| 78 | - @metric_configurations | ||
| 79 | - end | ||
| 80 | - | ||
| 81 | - def metric_configurations=(value) | ||
| 82 | - @metric_configurations = value.kind_of?(Array) ? value : [value] | ||
| 83 | - @metric_configurations = @metric_configurations.map { |element| to_metric_configuration(element) } | ||
| 84 | - end | ||
| 85 | - | ||
| 86 | - private | ||
| 87 | - | ||
| 88 | - def self.to_metric_configuration value | ||
| 89 | - value.kind_of?(Hash) ? Kalibro::MetricConfiguration.new(value) : value | ||
| 90 | - end | ||
| 91 | - | ||
| 92 | - def validate_configuration_name | ||
| 93 | - existing = configuration_names_and_ids.map { |a| a.first.downcase} | ||
| 94 | - | ||
| 95 | - if existing.include?(name.downcase) | ||
| 96 | - errors.add_to_base("Configuration name already exists in Kalibro") | ||
| 97 | - end | ||
| 98 | - end | ||
| 99 | - | ||
| 100 | - def remove_configuration_from_service | ||
| 101 | - kalibro_configuration.destroy unless kalibro_configuration.nil? | ||
| 102 | - end | ||
| 103 | - | ||
| 104 | - def send_configuration_to_service | ||
| 105 | - attributes = {:id => configuration_id, :name => name, :description => description} | ||
| 106 | - created_configuration = Kalibro::Configuration.create attributes | ||
| 107 | - self.configuration_id = created_configuration.id | ||
| 108 | - clone_configuration if cloning_configuration? | ||
| 109 | - end | ||
| 110 | - | ||
| 111 | - def cloning_configuration? | ||
| 112 | - !configuration_to_clone_id.nil? | ||
| 113 | - end | ||
| 114 | - | ||
| 115 | - def clone_configuration | ||
| 116 | - metric_configurations_to_clone ||= Kalibro::MetricConfiguration.metric_configurations_of(configuration_to_clone_id) | ||
| 117 | - clone_metric_configurations metric_configurations_to_clone | ||
| 118 | - end | ||
| 119 | - | ||
| 120 | - def clone_metric_configurations metric_configurations_to_clone | ||
| 121 | - metric_configurations_to_clone.each do |metric_configuration| | ||
| 122 | - clonned_metric_configuration_id = metric_configuration.id | ||
| 123 | - metric_configuration.id = nil | ||
| 124 | - metric_configuration.configuration_id = self.configuration_id | ||
| 125 | - metric_configuration.save | ||
| 126 | - clone_ranges clonned_metric_configuration_id, metric_configuration.id | ||
| 127 | - end | ||
| 128 | - end | ||
| 129 | - | ||
| 130 | - def clone_ranges clonned_metric_configuration_id, new_metric_configuration_id | ||
| 131 | - Kalibro::Range.ranges_of(clonned_metric_configuration_id).each do |range| | ||
| 132 | - range.id = nil | ||
| 133 | - range.save new_metric_configuration_id | ||
| 134 | - end | ||
| 135 | - end | ||
| 136 | - | ||
| 137 | -end | ||
| 138 | - |
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
| @@ -1,80 +0,0 @@ | @@ -1,80 +0,0 @@ | ||
| 1 | -class MezuroPlugin::Helpers::ContentViewerHelper | ||
| 2 | - | ||
| 3 | - MAX_NUMBER_OF_LABELS = 5 | ||
| 4 | - | ||
| 5 | - def self.format_grade(grade) | ||
| 6 | - sprintf("%.2f", grade.to_f) | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.periodicity_options | ||
| 10 | - [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.periodicity_option(periodicity) | ||
| 14 | - periodicity_options.select {|x| x.last == periodicity}.first.first | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def self.license_options | ||
| 18 | - options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yml") | ||
| 19 | - options = options.split("; ") | ||
| 20 | - options | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - def self.generate_chart(score_history) | ||
| 24 | - values = [] | ||
| 25 | - labels = [] | ||
| 26 | - score_history.each do |score_data| | ||
| 27 | - values << score_data.result | ||
| 28 | - labels << score_data.date | ||
| 29 | - end | ||
| 30 | - labels = discretize_array labels | ||
| 31 | - Gchart.line( | ||
| 32 | - :title_color => 'FF0000', | ||
| 33 | - :size => '600x180', | ||
| 34 | - :bg => {:color => 'efefef', :type => 'stripes'}, | ||
| 35 | - :line_colors => 'c4a000', | ||
| 36 | - :data => values, | ||
| 37 | - :labels => labels, | ||
| 38 | - :axis_with_labels => ['y','x'], | ||
| 39 | - :max_value => values.max, | ||
| 40 | - :min_value => values.min | ||
| 41 | - ) | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - def self.format_name(metric_configuration_snapshot) | ||
| 45 | - metric_configuration_snapshot.metric.name.delete("() ") | ||
| 46 | - end | ||
| 47 | - | ||
| 48 | - def self.format_time(miliseconds) | ||
| 49 | - seconds = miliseconds/1000 | ||
| 50 | - MezuroPluginModuleResultController.helpers.distance_of_time_in_words(0, seconds, include_seconds = true) | ||
| 51 | - end | ||
| 52 | - | ||
| 53 | - def self.aggregation_options | ||
| 54 | - [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
| 55 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] | ||
| 56 | - end | ||
| 57 | - | ||
| 58 | - def self.scope_options | ||
| 59 | - [["Software", "SOFTWARE"], ["Package", "PACKAGE"], ["Class", "CLASS"], ["Method", "METHOD"]] | ||
| 60 | - end | ||
| 61 | - | ||
| 62 | - private | ||
| 63 | - | ||
| 64 | - def self.discretize_array(array) | ||
| 65 | - if array.size > MAX_NUMBER_OF_LABELS | ||
| 66 | - range_array.map { |i| discrete_element(array, i)} | ||
| 67 | - else | ||
| 68 | - array | ||
| 69 | - end | ||
| 70 | - end | ||
| 71 | - | ||
| 72 | - def self.range_array | ||
| 73 | - (0..(MAX_NUMBER_OF_LABELS - 1)).to_a | ||
| 74 | - end | ||
| 75 | - | ||
| 76 | - def self.discrete_element(array, i) | ||
| 77 | - array[(i*(array.size - 1))/(MAX_NUMBER_OF_LABELS - 1)] | ||
| 78 | - end | ||
| 79 | - | ||
| 80 | -end |
plugins/mezuro/lib/mezuro_plugin/helpers/module_result_helper.rb
plugins/mezuro/lib/mezuro_plugin/project_content.rb
| @@ -1,96 +0,0 @@ | @@ -1,96 +0,0 @@ | ||
| 1 | -class MezuroPlugin::ProjectContent < Article | ||
| 2 | - include ActionView::Helpers::TagHelper | ||
| 3 | - | ||
| 4 | - settings_items :project_id | ||
| 5 | - | ||
| 6 | - before_save :send_project_to_service | ||
| 7 | - after_destroy :destroy_project_from_service | ||
| 8 | - | ||
| 9 | - def self.short_description | ||
| 10 | - 'Mezuro project' | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.description | ||
| 14 | - 'Software project tracked by Kalibro' | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def to_html(options = {}) | ||
| 18 | - lambda do | ||
| 19 | - render :file => 'content_viewer/show_project.rhtml' | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - def project | ||
| 24 | - begin | ||
| 25 | - @project ||= Kalibro::Project.find(project_id) | ||
| 26 | - rescue Exception => error | ||
| 27 | - errors.add_to_base(error.message) | ||
| 28 | - end | ||
| 29 | - @project | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def repositories | ||
| 33 | - begin | ||
| 34 | - @repositories ||= Kalibro::Repository.repositories_of(project_id) | ||
| 35 | - rescue Exception => error | ||
| 36 | - errors.add_to_base(error.message) | ||
| 37 | - @repositories = [] | ||
| 38 | - end | ||
| 39 | - @repositories | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - def description=(value) | ||
| 43 | - @description=value | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - def description | ||
| 47 | - begin | ||
| 48 | - @description ||= project.description | ||
| 49 | - rescue | ||
| 50 | - @description = "" | ||
| 51 | - end | ||
| 52 | - @description | ||
| 53 | - end | ||
| 54 | - | ||
| 55 | - def repositories=(value) | ||
| 56 | - @repositories = value.kind_of?(Array) ? value : [value] | ||
| 57 | - @repositories = @repositories.map { |element| to_repository(element) } | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - private | ||
| 61 | - | ||
| 62 | - def self.to_repository value | ||
| 63 | - value.kind_of?(Hash) ? Kalibro::Repository.new(value) : value | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | - def validate_repository_address | ||
| 67 | - repositories.each do |repository| | ||
| 68 | - if (!repository.nil?) | ||
| 69 | - address = repository.address | ||
| 70 | - if(address.nil? || address == "") | ||
| 71 | - errors.add_to_base("Repository Address is mandatory") | ||
| 72 | - end | ||
| 73 | - else | ||
| 74 | - errors.add_to_base("Repository is mandatory") | ||
| 75 | - end | ||
| 76 | - end | ||
| 77 | - end | ||
| 78 | - | ||
| 79 | - def send_project_to_service | ||
| 80 | - created_project = create_kalibro_project | ||
| 81 | - self.project_id = created_project.id | ||
| 82 | - end | ||
| 83 | - | ||
| 84 | - def create_kalibro_project | ||
| 85 | - Kalibro::Project.create( | ||
| 86 | - :name => name, | ||
| 87 | - :description => description, | ||
| 88 | - :id => self.project_id | ||
| 89 | - ) | ||
| 90 | - end | ||
| 91 | - | ||
| 92 | - def destroy_project_from_service | ||
| 93 | - project.destroy unless project.nil? | ||
| 94 | - end | ||
| 95 | - | ||
| 96 | -end |
plugins/mezuro/lib/mezuro_plugin/reading_group_content.rb
| @@ -1,83 +0,0 @@ | @@ -1,83 +0,0 @@ | ||
| 1 | -class MezuroPlugin::ReadingGroupContent < Article | ||
| 2 | - include ActionView::Helpers::TagHelper | ||
| 3 | - | ||
| 4 | - settings_items :reading_group_id | ||
| 5 | - | ||
| 6 | - before_save :send_reading_group_to_service | ||
| 7 | - after_destroy :destroy_reading_group_from_service | ||
| 8 | - | ||
| 9 | - def self.short_description | ||
| 10 | - 'Mezuro reading group' | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.description | ||
| 14 | - 'Set of thresholds to interpret metric results' | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def to_html(options = {}) | ||
| 18 | - lambda do | ||
| 19 | - render :file => 'content_viewer/show_reading_group.rhtml' | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - def reading_group | ||
| 24 | - begin | ||
| 25 | - @reading_group ||= Kalibro::ReadingGroup.find(reading_group_id) | ||
| 26 | - rescue Exception => error | ||
| 27 | - errors.add_to_base(error.message) | ||
| 28 | - end | ||
| 29 | - @reading_group | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - def readings | ||
| 33 | - begin | ||
| 34 | - @readings ||= Kalibro::Reading.readings_of(reading_group_id) | ||
| 35 | - rescue Exception => error | ||
| 36 | - errors.add_to_base(error.message) | ||
| 37 | - @readings = [] | ||
| 38 | - end | ||
| 39 | - @readings | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - def description=(value) | ||
| 43 | - @description=value | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - def description | ||
| 47 | - begin | ||
| 48 | - @description ||= reading_group.description | ||
| 49 | - rescue | ||
| 50 | - @description = "" | ||
| 51 | - end | ||
| 52 | - @description | ||
| 53 | - end | ||
| 54 | - | ||
| 55 | - def readings=(value) | ||
| 56 | - @readings = value.kind_of?(Array) ? value : [value] | ||
| 57 | - @readings = @readings.map { |element| to_reading(element) } | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - private | ||
| 61 | - | ||
| 62 | - def self.to_reading value | ||
| 63 | - value.kind_of?(Hash) ? Kalibro::Reading.new(value) : value | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | - def send_reading_group_to_service | ||
| 67 | - created_reading_group = create_kalibro_reading_group | ||
| 68 | - self.reading_group_id = created_reading_group.id | ||
| 69 | - end | ||
| 70 | - | ||
| 71 | - def create_kalibro_reading_group | ||
| 72 | - Kalibro::ReadingGroup.create( | ||
| 73 | - :name => name, | ||
| 74 | - :description => description, | ||
| 75 | - :id => self.reading_group_id | ||
| 76 | - ) | ||
| 77 | - end | ||
| 78 | - | ||
| 79 | - def destroy_reading_group_from_service | ||
| 80 | - reading_group.destroy unless reading_group.nil? | ||
| 81 | - end | ||
| 82 | - | ||
| 83 | -end |
plugins/mezuro/licenses.yml.example
| @@ -1,69 +0,0 @@ | @@ -1,69 +0,0 @@ | ||
| 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) |
plugins/mezuro/public/colorPicker.css
| @@ -1,31 +0,0 @@ | @@ -1,31 +0,0 @@ | ||
| 1 | -div.colorPicker-picker { | ||
| 2 | - height: 16px; | ||
| 3 | - width: 16px; | ||
| 4 | - padding: 0 !important; | ||
| 5 | - border: 1px solid #ccc; | ||
| 6 | - background: url(arrow.gif) no-repeat top right; | ||
| 7 | - cursor: pointer; | ||
| 8 | - line-height: 16px; | ||
| 9 | -} | ||
| 10 | - | ||
| 11 | -div.colorPicker-palette { | ||
| 12 | - width: 110px; | ||
| 13 | - position: absolute; | ||
| 14 | - border: 1px solid #598FEF; | ||
| 15 | - background-color: #EFEFEF; | ||
| 16 | - padding: 2px; | ||
| 17 | - z-index: 9999; | ||
| 18 | -} | ||
| 19 | - div.colorPicker_hexWrap {width: 100%; float:left } | ||
| 20 | - div.colorPicker_hexWrap label {font-size: 95%; color: #2F2F2F; margin: 5px 2px; width: 25%} | ||
| 21 | - div.colorPicker_hexWrap input {margin: 5px 2px; padding: 0; font-size: 95%; border: 1px solid #000; width: 65%; } | ||
| 22 | - | ||
| 23 | -div.colorPicker-swatch { | ||
| 24 | - height: 12px; | ||
| 25 | - width: 12px; | ||
| 26 | - border: 1px solid #000; | ||
| 27 | - margin: 2px; | ||
| 28 | - float: left; | ||
| 29 | - cursor: pointer; | ||
| 30 | - line-height: 12px; | ||
| 31 | -} |
plugins/mezuro/public/icons/mezuro.png
3.82 KB
plugins/mezuro/public/images/file.png
534 Bytes
plugins/mezuro/public/images/folder.png
3.31 KB
plugins/mezuro/public/images/minus.png
215 Bytes
plugins/mezuro/public/images/plus.png
400 Bytes
plugins/mezuro/public/javascripts/processing.js
| @@ -1,133 +0,0 @@ | @@ -1,133 +0,0 @@ | ||
| 1 | -var processingTree = false; | ||
| 2 | -var metricName; | ||
| 3 | -jQuery(function (){ | ||
| 4 | - jQuery('.source-tree-link').live("click", reloadModule); | ||
| 5 | - jQuery('[show-metric-history]').live("click", display_metric_history); | ||
| 6 | - jQuery('[show-grade-history]').live("click", display_grade_history); | ||
| 7 | - jQuery('#project_date_submit').live("click", reloadProcessingWithDate); | ||
| 8 | - showLoadingProcess(true); | ||
| 9 | - showProcessing(); | ||
| 10 | -}); | ||
| 11 | - | ||
| 12 | -function showProcessing() { | ||
| 13 | - repository_id = processingData('repository-id'); | ||
| 14 | - callAction('processing', 'state', {repository_id: repository_id}, showProcessingFor); | ||
| 15 | -} | ||
| 16 | - | ||
| 17 | -function display_metric_history() { | ||
| 18 | - var module_result_id = jQuery(this).attr('data-module-id'); | ||
| 19 | - var formatted_name = jQuery(this).attr('show-metric-history'); | ||
| 20 | - var metric_name = jQuery(this).attr('data-metric-name'); | ||
| 21 | - toggle_mezuro("." + formatted_name); | ||
| 22 | - metricName = formatted_name; | ||
| 23 | - callAction('module_result', 'metric_result_history', {metric_name: metric_name, module_result_id: module_result_id}, show_metrics); | ||
| 24 | - return false; | ||
| 25 | -} | ||
| 26 | - | ||
| 27 | -function display_grade_history() { | ||
| 28 | - var module_result_id = jQuery(this).attr('data-module-id'); | ||
| 29 | - toggle_mezuro("#historical-grade"); | ||
| 30 | - callAction('module_result', 'module_result_history', {module_result_id: module_result_id}, show_grades); | ||
| 31 | - return false; | ||
| 32 | -} | ||
| 33 | - | ||
| 34 | -function show_metrics(content) { | ||
| 35 | - jQuery('#historical-' + metricName).html(content); | ||
| 36 | -} | ||
| 37 | - | ||
| 38 | -function show_grades(content) { | ||
| 39 | - jQuery('#historical-grade').html(content); | ||
| 40 | -} | ||
| 41 | - | ||
| 42 | -function toggle_mezuro(element){ | ||
| 43 | - jQuery(element).toggle(); | ||
| 44 | - return false; | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -function reloadModule(){ | ||
| 48 | - var module_result_id = jQuery(this).attr('data-module-id'); | ||
| 49 | - showLoadingProcess(false); | ||
| 50 | - processingTree = true; | ||
| 51 | - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); | ||
| 52 | - return false; | ||
| 53 | -} | ||
| 54 | - | ||
| 55 | -function reloadProcessingWithDate(date){ | ||
| 56 | - reloadProcessing(date + "T00:00:00+00:00"); | ||
| 57 | - return false; | ||
| 58 | -} | ||
| 59 | - | ||
| 60 | -function reloadProcessing(date){ | ||
| 61 | - repository_id = processingData('repository-id'); | ||
| 62 | - showLoadingProcess(true); | ||
| 63 | - | ||
| 64 | - callAction('processing', 'processing', {date: date, repository_id: repository_id}, function(content){ | ||
| 65 | - showReadyProcessing(content); | ||
| 66 | - var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id'); | ||
| 67 | - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); | ||
| 68 | - } | ||
| 69 | - ); | ||
| 70 | -} | ||
| 71 | - | ||
| 72 | -function showProcessingFor(state){ | ||
| 73 | - repository_id = processingData('repository-id'); | ||
| 74 | - if (state == 'ERROR') { | ||
| 75 | - jQuery('#processing-state').html('<div style="color:Red">ERROR</div>'); | ||
| 76 | - callAction('processing', 'processing', {repository_id: repository_id}, showReadyProcessing); | ||
| 77 | - showModuleResult(''); | ||
| 78 | - } | ||
| 79 | - else if (state == 'READY') { | ||
| 80 | - jQuery('#msg-time').html(''); | ||
| 81 | - jQuery('#processing-state').html('<div style="color:Green">READY</div>'); | ||
| 82 | - callAction('processing', 'processing', {repository_id: repository_id}, function(content){ | ||
| 83 | - showReadyProcessing(content); | ||
| 84 | - var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id'); | ||
| 85 | - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); | ||
| 86 | - } | ||
| 87 | - ); | ||
| 88 | - } | ||
| 89 | - else if (state.endsWith("ING")) { | ||
| 90 | - jQuery('#processing-state').html('<div style="color:DarkGoldenRod">'+ state +'</div>'); | ||
| 91 | - jQuery('#msg-time').html("The project analysis may take long. <br/> You'll receive an e-mail when it's ready!"); | ||
| 92 | - showProcessingAfter(20); | ||
| 93 | - } | ||
| 94 | -} | ||
| 95 | - | ||
| 96 | -function showProcessingAfter(seconds){ | ||
| 97 | - if (seconds > 0){ | ||
| 98 | - setTimeout(function() { showProcessingAfter(seconds - 10);}, 10000); | ||
| 99 | - } else { | ||
| 100 | - showProcessing(); | ||
| 101 | - } | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | -function showReadyProcessing(content) { | ||
| 105 | - jQuery('#processing').html(content); | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -function showModuleResult(content){ | ||
| 109 | - jQuery('#module-result').html(content); | ||
| 110 | -} | ||
| 111 | - | ||
| 112 | -function callAction(controller, action, params, callback){ | ||
| 113 | - var profile = processingData('profile'); | ||
| 114 | - var content = processingData('content'); | ||
| 115 | - var endpoint = '/profile/' + profile + '/plugin/mezuro/' + controller + '/' + action + '/' + content; | ||
| 116 | - jQuery.get(endpoint, params, callback); | ||
| 117 | -} | ||
| 118 | - | ||
| 119 | -function processingData(data){ | ||
| 120 | - return jQuery('#processing').attr('data-' + data); | ||
| 121 | -} | ||
| 122 | - | ||
| 123 | -function showLoadingProcess(firstLoad){ | ||
| 124 | - if(firstLoad) | ||
| 125 | - showReadyProcessing("<img src='/images/loading-small.gif'/>"); | ||
| 126 | - showModuleResult("<img src='/images/loading-small.gif'/>"); | ||
| 127 | -} | ||
| 128 | - | ||
| 129 | -function sourceNodeToggle(id){ | ||
| 130 | - var suffixes = ['_hidden', '_plus', '_minus']; | ||
| 131 | - for (var i in suffixes) | ||
| 132 | - jQuery('#' + id + suffixes[i]).toggle(); | ||
| 133 | -} |
plugins/mezuro/public/javascripts/validations.js
| @@ -1,181 +0,0 @@ | @@ -1,181 +0,0 @@ | ||
| 1 | -jQuery(function (){ | ||
| 2 | - jQuery('#range_submit').live("click", validate_new_range_configuration); | ||
| 3 | - jQuery('#metric_configuration_submit').live("click", validate_metric_configuration); | ||
| 4 | - jQuery('#repository_submit').live("click", validate_new_repository); | ||
| 5 | - jQuery('#reading_submit').live("click", validate_new_reading); | ||
| 6 | -}); | ||
| 7 | - | ||
| 8 | -function validate_code(code){ | ||
| 9 | - return true; | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -function allRequiredFieldsAreFilled() { | ||
| 13 | - var name = jQuery('#repository_name').val(); | ||
| 14 | - var address = jQuery('#repository_address').val(); | ||
| 15 | - | ||
| 16 | - if (is_null(name) || is_null(address)) { | ||
| 17 | - alert("Please fill all fields marked with (*)."); | ||
| 18 | - return false; | ||
| 19 | - } | ||
| 20 | - return true; | ||
| 21 | -} | ||
| 22 | - | ||
| 23 | -function validate_new_reading() { | ||
| 24 | - var name = jQuery('#reading_label').val(); | ||
| 25 | - var grade = jQuery('#reading_grade').val(); | ||
| 26 | - var color = jQuery('#reading_color').val(); | ||
| 27 | - | ||
| 28 | - if (is_null(name) || is_null(grade) || is_null(color)){ | ||
| 29 | - alert("Please fill all fields marked with (*)."); | ||
| 30 | - return false; | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - var parser = jQuery('#labels_and_grades').attr('data-parser'); | ||
| 34 | - var labels_and_grades = jQuery('#labels_and_grades').attr('data-list').split(parser); | ||
| 35 | - for (var id = 0; id < labels_and_grades.length; id = id + 2) { | ||
| 36 | - if (labels_and_grades[id] == name) { | ||
| 37 | - alert("This label already exists! Please, choose another one."); | ||
| 38 | - return false; | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - if (labels_and_grades[id+1] == grade || labels_and_grades[id+1] == grade + ".0") { | ||
| 42 | - alert("This grade already exists! Please, choose another one."); | ||
| 43 | - return false; | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - if (!color.match(/^[a-fA-F0-9]{6}$/)) { | ||
| 48 | - alert("This is not a valid color."); | ||
| 49 | - return false; | ||
| 50 | - } | ||
| 51 | - return true; | ||
| 52 | -} | ||
| 53 | - | ||
| 54 | -function validate_new_repository() { | ||
| 55 | - if (allRequiredFieldsAreFilled()) { | ||
| 56 | - return addressAndTypeMatch(); | ||
| 57 | - } | ||
| 58 | - return false; | ||
| 59 | -} | ||
| 60 | - | ||
| 61 | -function addressAndTypeMatch() { | ||
| 62 | - var type = jQuery('#repository_type').val(); | ||
| 63 | - var address = jQuery('#repository_address').val(); | ||
| 64 | - | ||
| 65 | - switch (type) { | ||
| 66 | - case "BAZAAR": return matchBazaar(address); | ||
| 67 | - case "CVS": return matchCVS(address); | ||
| 68 | - case "GIT": return matchGIT(address); | ||
| 69 | - case "MERCURIAL": return matchMercurial(address); | ||
| 70 | - case "REMOTE_TARBALL": return matchRemoteTarball(address); | ||
| 71 | - case "REMOTE_ZIP": return matchRemoteZIP(address); | ||
| 72 | - case "SUBVERSION": return matchSubversion(address); | ||
| 73 | - } | ||
| 74 | -} | ||
| 75 | - | ||
| 76 | -function matchBazaar(address) { | ||
| 77 | - if (address.match(/bzr/)) { | ||
| 78 | - return true; | ||
| 79 | - } | ||
| 80 | - alert("Address does not match type BAZAAR chosen."); | ||
| 81 | - return false; | ||
| 82 | -} | ||
| 83 | - | ||
| 84 | -function matchCVS(address) { | ||
| 85 | - if (address.match(/cvs/)) { | ||
| 86 | - return true; | ||
| 87 | - } | ||
| 88 | - alert("Address does not match type CVS chosen."); | ||
| 89 | - return false; | ||
| 90 | -} | ||
| 91 | - | ||
| 92 | -function matchGIT(address) { | ||
| 93 | - if (address.match(/^(http(s)?:\/\/git(hub)?\.|git:\/\/git(hub\.com|orious\.org)\/|git@git(hub\.com|orious\.org):).+.git$/)) { | ||
| 94 | - return true; | ||
| 95 | - } | ||
| 96 | - alert("Address does not match type GIT chosen."); | ||
| 97 | - return false; | ||
| 98 | -} | ||
| 99 | - | ||
| 100 | -function matchMercurial(address) { | ||
| 101 | - if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) { | ||
| 102 | - return true; | ||
| 103 | - } | ||
| 104 | - alert("Address does not match type MERCURIAL chosen."); | ||
| 105 | - return false; | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -function matchRemoteTarball(address) { | ||
| 109 | - if (address.match(/\.tar(\..+)*$/)) { | ||
| 110 | - return true; | ||
| 111 | - } | ||
| 112 | - alert("Address does not match type REMOTE_TARBALL chosen."); | ||
| 113 | - return false; | ||
| 114 | -} | ||
| 115 | - | ||
| 116 | -function matchRemoteZIP(address) { | ||
| 117 | - if (address.match(/\.zip$/)) { | ||
| 118 | - return true; | ||
| 119 | - } | ||
| 120 | - alert("Address does not match type REMOTE_ZIP chosen."); | ||
| 121 | - return false; | ||
| 122 | -} | ||
| 123 | - | ||
| 124 | -function matchSubversion(address) { | ||
| 125 | - if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) { | ||
| 126 | - return true; | ||
| 127 | - } | ||
| 128 | - alert("Address does not match type SUBVERSION chosen."); | ||
| 129 | - return false; | ||
| 130 | -} | ||
| 131 | - | ||
| 132 | -function validate_metric_configuration() { | ||
| 133 | - var code = jQuery('#metric_configuration_code').val(); | ||
| 134 | - if (is_null(code)) { | ||
| 135 | - alert("Code must be filled out"); | ||
| 136 | - return false; | ||
| 137 | - } | ||
| 138 | - return true; | ||
| 139 | -} | ||
| 140 | - | ||
| 141 | -function is_null(value) { | ||
| 142 | - if (value == "" || value == null) { | ||
| 143 | - return true; | ||
| 144 | - } | ||
| 145 | - return false; | ||
| 146 | -} | ||
| 147 | - | ||
| 148 | -function IsNotNumeric(value) { | ||
| 149 | - if (value.match(/[0-9]*\.?[0-9]+/)) { | ||
| 150 | - return false; | ||
| 151 | - } | ||
| 152 | - return true; | ||
| 153 | -} | ||
| 154 | - | ||
| 155 | -function IsNotInfinite(value) { | ||
| 156 | - if (value.match(/INF/)) { | ||
| 157 | - return false; | ||
| 158 | - } | ||
| 159 | - return true; | ||
| 160 | -} | ||
| 161 | - | ||
| 162 | -function validate_new_range_configuration(event) { | ||
| 163 | - var beginning = jQuery("#range_beginning").val(); | ||
| 164 | - var end = jQuery("#range_end").val(); | ||
| 165 | - | ||
| 166 | - if (is_null(beginning) || is_null(end)) { | ||
| 167 | - alert("Please fill all fields marked with (*)."); | ||
| 168 | - return false; | ||
| 169 | - } | ||
| 170 | - if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end))) { | ||
| 171 | - alert("Beginning, End and Grade must be numeric values."); | ||
| 172 | - return false; | ||
| 173 | - } | ||
| 174 | - if (parseInt(beginning) > parseInt(end)) { | ||
| 175 | - if (IsNotInfinite(beginning) && IsNotInfinite(end)) { | ||
| 176 | - alert("End must be greater than Beginning."); | ||
| 177 | - return false; | ||
| 178 | - } | ||
| 179 | - } | ||
| 180 | - return true; | ||
| 181 | -} |
plugins/mezuro/public/style.css
| @@ -1,37 +0,0 @@ | @@ -1,37 +0,0 @@ | ||
| 1 | -@import url('colorPicker.css'); | ||
| 2 | - | ||
| 3 | -.link { | ||
| 4 | - cursor: pointer; | ||
| 5 | -} | ||
| 6 | - | ||
| 7 | -.source-tree{ | ||
| 8 | - background: #e7e7e7; | ||
| 9 | - border: groove 1px #666; | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -.icon { | ||
| 13 | - width: 20px; | ||
| 14 | -} | ||
| 15 | - | ||
| 16 | -.source-tree-text{ | ||
| 17 | - font-family: Arial, Impact; | ||
| 18 | - font-size: 12px; | ||
| 19 | - border-left: solid 1px #666; | ||
| 20 | -} | ||
| 21 | - | ||
| 22 | -a:link,active,visited .ancestor{ | ||
| 23 | - font-family: Arial, Impact; | ||
| 24 | - color: #5E5400; | ||
| 25 | -} | ||
| 26 | - | ||
| 27 | -.path{ | ||
| 28 | - font-family: Arial, Impact; | ||
| 29 | - font-size: 14px; | ||
| 30 | - font-style: underline; | ||
| 31 | - display: inline; | ||
| 32 | -} | ||
| 33 | - | ||
| 34 | -.controller-profile_editor a.control-panel-mezuro, | ||
| 35 | - .controller-profile_editor .msie6 a.control-panel-mezuro { | ||
| 36 | - background-image: url(/plugins/mezuro/icons/mezuro.png) | ||
| 37 | -} |
plugins/mezuro/script/install/install-rvm.sh
| @@ -1,118 +0,0 @@ | @@ -1,118 +0,0 @@ | ||
| 1 | -#!/bin/bash --login | ||
| 2 | - | ||
| 3 | -#Ubuntu Package Dependencies | ||
| 4 | -sudo apt-get update | ||
| 5 | -sudo apt-get install build-essential curl libxslt1-dev git git-core tango-icon-theme sqlite3 libsqlite3-dev patch bzip2 openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev openjdk-6-jre | ||
| 6 | - | ||
| 7 | -#RVM Installation for Ubuntu 12.10 | ||
| 8 | -curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --version 1.19.0 | ||
| 9 | - | ||
| 10 | -# Load RVM into a shell session *as a function* | ||
| 11 | -if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then | ||
| 12 | - # First try to load from a user install | ||
| 13 | - source "$HOME/.rvm/scripts/rvm" | ||
| 14 | -elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then | ||
| 15 | - # Then try to load from a root install | ||
| 16 | - source "/usr/local/rvm/scripts/rvm" | ||
| 17 | -else | ||
| 18 | - printf "ERROR: An RVM installation was not found.\n" | ||
| 19 | -fi | ||
| 20 | -rvm reload | ||
| 21 | - | ||
| 22 | -#Complements the RVM installation | ||
| 23 | -rvm requirements run | ||
| 24 | -#rvm pkg install zlib --verify-downloads 1 | ||
| 25 | - | ||
| 26 | -#Ruby installation and setup | ||
| 27 | -CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rvm install 1.8.7-p302 | ||
| 28 | -rvm use ruby-1.8.7-p302@global | ||
| 29 | -gem install rubygems-update -v 1.3.7 | ||
| 30 | -update_rubygems | ||
| 31 | -gem install rake -v 0.8.7 | ||
| 32 | -yes | gem uninstall rake -v 10.0.4 | ||
| 33 | -rvm gemset create mezuro | ||
| 34 | -rvm use ruby-1.8.7-p302@mezuro | ||
| 35 | - | ||
| 36 | -#Gems installation | ||
| 37 | -#The order really matters here, so if you see an output like "2 gems instaled" something should be wrong | ||
| 38 | -gem install --no-ri --no-rdoc rack -v 1.0.1 | ||
| 39 | -gem install --no-ri --no-rdoc rack-test -v 0.6.2 | ||
| 40 | -gem install --no-ri --no-rdoc httpi -v 1.0 | ||
| 41 | -gem install --no-ri --no-rdoc nokogiri -v 1.5.5 | ||
| 42 | -gem install --no-ri --no-rdoc wasabi -v 2.0.0 | ||
| 43 | -gem install --no-ri --no-rdoc json -v 1.7.5 | ||
| 44 | -gem install --no-ri --no-rdoc gherkin -v 2.5.4 | ||
| 45 | -gem install --no-ri --no-rdoc multi_json -v 1.3.7 | ||
| 46 | -gem install --no-ri --no-rdoc rubyzip -v 0.9.9 | ||
| 47 | -gem install --no-ri --no-rdoc ffi -v 1.2.0 | ||
| 48 | -gem install --no-ri --no-rdoc childprocess -v 0.3.6 | ||
| 49 | -gem install --no-ri --no-rdoc websocket -v 1.0.4 | ||
| 50 | -gem install --no-ri --no-rdoc libwebsocket -v 0.1.6.1 | ||
| 51 | -gem install --no-ri --no-rdoc selenium-webdriver -v 2.30.0 | ||
| 52 | -gem install --no-ri --no-rdoc activesupport -v 2.3.5 | ||
| 53 | -gem install --no-ri --no-rdoc actionpack -v 2.3.5 | ||
| 54 | -gem install --no-ri --no-rdoc actionmailer -v 2.3.5 | ||
| 55 | -gem install --no-ri --no-rdoc activerecord -v 2.3.5 | ||
| 56 | -gem install --no-ri --no-rdoc activeresource -v 2.3.5 | ||
| 57 | -gem install --no-ri --no-rdoc addressable -v 2.2.2 | ||
| 58 | -gem install --no-ri --no-rdoc builder -v 3.1.4 | ||
| 59 | -gem install --no-ri --no-rdoc gyoku -v 0.4.6 | ||
| 60 | -gem install --no-ri --no-rdoc akami -v 1.2.0 | ||
| 61 | -gem install --no-ri --no-rdoc xpath -v 0.1.4 | ||
| 62 | -gem install --no-ri --no-rdoc mime-types -v 1.19 | ||
| 63 | -gem install --no-ri --no-rdoc capybara -v 1.1.1 | ||
| 64 | -gem install --no-ri --no-rdoc term-ansicolor -v 1.0.7 | ||
| 65 | -gem install --no-ri --no-rdoc diff-lcs -v 1.1.3 | ||
| 66 | -gem install --no-ri --no-rdoc cucumber -v 1.1.0 | ||
| 67 | -gem install --no-ri --no-rdoc cucumber-rails -v 0.3.2 | ||
| 68 | -gem install --no-ri --no-rdoc culerity -v 0.2.15 | ||
| 69 | -gem install --no-ri --no-rdoc database_cleaner -v 0.9.1 | ||
| 70 | -gem install --no-ri --no-rdoc exception_notification -v 1.0.20090728 | ||
| 71 | -gem install --no-ri --no-rdoc googlecharts -v 1.6.8 | ||
| 72 | -gem install --no-ri --no-rdoc hpricot -v 0.8.2 | ||
| 73 | -gem install --no-ri --no-rdoc httpi -v 0.9.7 | ||
| 74 | -gem install --no-ri --no-rdoc i18n -v 0.4.1 | ||
| 75 | -gem install --no-ri --no-rdoc metaclass -v 0.0.1 | ||
| 76 | -gem install --no-ri --no-rdoc mocha -v 0.9.8 | ||
| 77 | -gem install --no-ri --no-rdoc nori -v 1.1.3 | ||
| 78 | -gem install --no-ri --no-rdoc ntlm-http -v 0.1.1 | ||
| 79 | -gem install --no-ri --no-rdoc polyglot -v 0.3.3 | ||
| 80 | -gem install --no-ri --no-rdoc rails -v 2.3.5 | ||
| 81 | -gem install --no-ri --no-rdoc rcov -v 0.9.7.1 | ||
| 82 | -gem install --no-ri --no-rdoc RedCloth -v 4.2.2 | ||
| 83 | -gem install --no-ri --no-rdoc rspec -v 1.2.9 | ||
| 84 | -gem install --no-ri --no-rdoc rspec-rails -v 1.2.9 | ||
| 85 | -gem install --no-ri --no-rdoc savon -v 0.9.7 | ||
| 86 | -gem install --no-ri --no-rdoc Selenium -v 1.1.14 | ||
| 87 | -gem install --no-ri --no-rdoc selenium-client -v 1.2.18 | ||
| 88 | -gem install --no-ri --no-rdoc sqlite3 -v 1.3.6 | ||
| 89 | -gem install --no-ri --no-rdoc system_timer -v 1.2.4 | ||
| 90 | -gem install --no-ri --no-rdoc tango -v 0.1.15 | ||
| 91 | -gem install --no-ri --no-rdoc tidy -v 1.1.2 | ||
| 92 | -gem install --no-ri --no-rdoc treetop -v 1.4.10 | ||
| 93 | -gem install --no-ri --no-rdoc webrat -v 0.5.1 | ||
| 94 | -gem install --no-ri --no-rdoc will_paginate -v 2.3.12 | ||
| 95 | -gem install --no-ri --no-rdoc gettext -v 1.8.0 | ||
| 96 | - | ||
| 97 | -#Mezuro installation | ||
| 98 | -git clone git@gitorious.org:+mezuro/noosfero/mezuro.git | ||
| 99 | -cd mezuro | ||
| 100 | -git checkout mezuro-dev | ||
| 101 | -rvm use ruby-1.8.7-p302@mezuro | ||
| 102 | -cp config/database.yml.sqlite3 config/database.yml | ||
| 103 | -cp plugins/mezuro/service.yml.example plugins/mezuro/service.yml | ||
| 104 | -cp plugins/mezuro/licenses.yml.example plugins/mezuro/licenses.yml | ||
| 105 | -mkdir tmp | ||
| 106 | -rake db:schema:load | ||
| 107 | -rake db:migrate | ||
| 108 | -rake makemo | ||
| 109 | -./script/sample-data | ||
| 110 | -./script/noosfero-plugins enable mezuro | ||
| 111 | -cd public/designs/themes | ||
| 112 | -rm -f default | ||
| 113 | -git clone https://git.gitorious.org/mezuro/mezuro-theme.git | ||
| 114 | -ln -s mezuro-theme/ default | ||
| 115 | -cd ../../../ | ||
| 116 | - | ||
| 117 | -#Prepare Mezuro for running functional and unit tests | ||
| 118 | -rake db:test:prepare |
plugins/mezuro/script/tests/delete_all_kalibro_entries.sh
plugins/mezuro/script/tests/kalibro_scripts.conf
plugins/mezuro/script/tests/prepare_kalibro_query_file.sh
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -#!/bin/bash | ||
| 2 | - | ||
| 3 | -source plugins/mezuro/script/tests/kalibro_scripts.conf | ||
| 4 | -if ! [ -f $PSQLFILE ] | ||
| 5 | - then wget http://gitorious.org/kalibro/kalibro/blobs/raw/master/KalibroCore/src/META-INF/PostgreSQL.sql -O $PSQLFILE | ||
| 6 | -fi | ||
| 7 | - | ||
| 8 | -DROPLIMIT="END OF DROP TABLES" | ||
| 9 | -RANGE=$(grep -n "$DROPLIMIT" $PSQLFILE | cut -d":" -f1) | ||
| 10 | -START=1 | ||
| 11 | -END=$(($RANGE - 1)) | ||
| 12 | -CUT=$START,$END\!d | ||
| 13 | -REPLACE="s/DROP TABLE IF EXISTS sequences,/TRUNCATE/" | ||
| 14 | - | ||
| 15 | -if [ -f $QUERYFILE ] | ||
| 16 | - then sudo rm $QUERYFILE | ||
| 17 | -fi | ||
| 18 | - | ||
| 19 | -sed -e "$CUT" -e "$REPLACE" $PSQLFILE > $QUERYFILE | ||
| 20 | -sudo chown postgres.postgres $QUERYFILE | ||
| 21 | \ No newline at end of file | 0 | \ No newline at end of file |
plugins/mezuro/script/tests/run_acceptance_tests.sh
| @@ -1,42 +0,0 @@ | @@ -1,42 +0,0 @@ | ||
| 1 | -#!/bin/bash | ||
| 2 | - | ||
| 3 | -TEST_FILE=$1 | ||
| 4 | -PROFILE=$2 | ||
| 5 | - | ||
| 6 | -if [ -z "$PROFILE" ]; then | ||
| 7 | - PROFILE='default' | ||
| 8 | -fi | ||
| 9 | - | ||
| 10 | -# where are your .kalibro dir? | ||
| 11 | -KALIBRO_HOME='/usr/share/tomcat6/.kalibro' | ||
| 12 | - | ||
| 13 | -# create a kalibro test dir | ||
| 14 | -echo "--> Creating tests directory" | ||
| 15 | -sudo mkdir $KALIBRO_HOME/tests | ||
| 16 | -echo "--> Copying test settings" | ||
| 17 | -sudo cp $KALIBRO_HOME/kalibro_test.settings $KALIBRO_HOME/tests/kalibro.settings | ||
| 18 | -echo "--> Changing owner of tests directory to tomcat6" | ||
| 19 | -sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests | ||
| 20 | - | ||
| 21 | -# you must restart tomcat6 | ||
| 22 | -#if you are using a tomcat installed from apt-get, for example: | ||
| 23 | -sudo service tomcat6 restart | ||
| 24 | - | ||
| 25 | -#if you are using a tomcat installed a specific dir, for exemple: | ||
| 26 | -#~/tomcat6/bin/shoutdown.sh | ||
| 27 | -#~/tomcat6/bin/startup.sh | ||
| 28 | - | ||
| 29 | -# run test | ||
| 30 | -cucumber $TEST_FILE -p $PROFILE | ||
| 31 | - | ||
| 32 | -#back to normal mode | ||
| 33 | -echo "--> Removing tests directory" | ||
| 34 | -sudo rm -rf $KALIBRO_HOME/tests | ||
| 35 | - | ||
| 36 | -# you must restart tomcat6 again | ||
| 37 | -sudo service tomcat6 restart | ||
| 38 | - | ||
| 39 | -#or some thing like that... | ||
| 40 | -#~/tomcat6/bin/shoutdown.sh | ||
| 41 | -#~/tomcat6/bin/startup.sh | ||
| 42 | - |
plugins/mezuro/service.yml.example
| @@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
| 1 | -http://localhost:8080/KalibroService/ |
plugins/mezuro/test/features/echo_port_test.rb
| @@ -1,90 +0,0 @@ | @@ -1,90 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
| 4 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 5 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
| 6 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" | ||
| 7 | - | ||
| 8 | -class EchoPortTest < ActiveSupport::TestCase | ||
| 9 | - | ||
| 10 | - def setup | ||
| 11 | - @port = Kalibro::Client::Port.new('Echo') | ||
| 12 | - address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml") | ||
| 13 | - address['KalibroService'] = 'KalibroFake' | ||
| 14 | - @port.service_address=(address); | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'echo base tool' do | ||
| 18 | - test BaseToolFixtures.analizo, 'BaseTool' do |base_tool| | ||
| 19 | - base_tool.name = "echo " + base_tool.name | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - should 'echo configuration' do | ||
| 24 | - test ConfigurationFixtures.kalibro_configuration, 'Configuration' do |configuration| | ||
| 25 | - configuration.name = "echo " + configuration.name | ||
| 26 | - end | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'echo metric configuration' do | ||
| 30 | - test_metric_configuration(MetricConfigurationFixtures.amloc_configuration) | ||
| 31 | - test_metric_configuration(MetricConfigurationFixtures.sc_configuration) | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - should 'echo module result' do | ||
| 35 | - test ModuleResultFixtures.create, 'ModuleResult' do |module_result| | ||
| 36 | - module_result.module.name = "echo." + module_result.module.name | ||
| 37 | - end | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'echo project' do | ||
| 41 | - test(ProjectFixtures.qt_calculator, 'Project') do |project| | ||
| 42 | - project.name = "echo " + project.name | ||
| 43 | - end | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - should 'echo project result' do | ||
| 47 | - test(ProjectResultFixtures.qt_calculator, 'ProjectResult') do |project_result| | ||
| 48 | - project_result.project.name = "echo " + project_result.project.name | ||
| 49 | - end | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'echo raw project' do | ||
| 53 | - project = ProjectFixtures.qt_calculator | ||
| 54 | - echoed = @port.request(:echo_raw_project, {:project => project.to_hash})[:project] | ||
| 55 | - project.name = "echo " + project.name | ||
| 56 | - project.state = nil | ||
| 57 | - project.error = nil | ||
| 58 | - assert_equal project, Kalibro::Entities::Project.from_hash(echoed) | ||
| 59 | - end | ||
| 60 | - | ||
| 61 | - should 'work with enums' do | ||
| 62 | - test_granularity("METHOD", "CLASS") | ||
| 63 | - test_granularity("CLASS", "PACKAGE") | ||
| 64 | - test_granularity("PACKAGE", "PACKAGE") | ||
| 65 | - test_granularity("APPLICATION", "APPLICATION") | ||
| 66 | - end | ||
| 67 | - | ||
| 68 | - private | ||
| 69 | - | ||
| 70 | - def test_metric_configuration(fixture) | ||
| 71 | - test fixture, 'MetricConfiguration' do |metric_configuration| | ||
| 72 | - metric_configuration.code = "echo_" + metric_configuration.code | ||
| 73 | - end | ||
| 74 | - end | ||
| 75 | - | ||
| 76 | - def test(fixture, entity_name) | ||
| 77 | - entity_symbol = entity_name.underscore.to_sym | ||
| 78 | - request_body = {entity_symbol => fixture.to_hash} | ||
| 79 | - echoed = @port.request("echo_#{entity_symbol}".to_sym, request_body)[entity_symbol] | ||
| 80 | - yield fixture | ||
| 81 | - entity_class = "Kalibro::Entities::#{entity_name}".constantize | ||
| 82 | - assert_equal fixture, entity_class.from_hash(echoed) | ||
| 83 | - end | ||
| 84 | - | ||
| 85 | - def test_granularity(granularity, parent) | ||
| 86 | - body = {:granularity => granularity} | ||
| 87 | - assert_equal parent, @port.request(:infer_parent_granularity, body)[:parent_granularity] | ||
| 88 | - end | ||
| 89 | - | ||
| 90 | -end |
plugins/mezuro/test/fixtures/base_tool_fixtures.rb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/metric_fixtures' | ||
| 2 | - | ||
| 3 | -class BaseToolFixtures | ||
| 4 | - | ||
| 5 | - def self.base_tool | ||
| 6 | - Kalibro::BaseTool.new base_tool_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.base_tool_hash | ||
| 10 | - { | ||
| 11 | - :name => 'Analizo', | ||
| 12 | - :supported_metric => [ | ||
| 13 | - MetricFixtures.total_cof_hash, | ||
| 14 | - MetricFixtures.amloc_hash], | ||
| 15 | - :collector_class_name => "org.analizo.AnalizoMetricCollector" | ||
| 16 | - } | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | -end |
plugins/mezuro/test/fixtures/configuration_content_fixtures.rb
| @@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
| 1 | -class ConfigurationContentFixtures | ||
| 2 | - | ||
| 3 | - def self.configuration_content | ||
| 4 | - MezuroPlugin::ConfigurationContent.new configuration_content_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.created_configuration_content | ||
| 8 | - MezuroPlugin::ConfigurationContent.new( { | ||
| 9 | - :name => 'Sample Configuration', | ||
| 10 | - :description => 'Kalibro configuration for Java projects.', | ||
| 11 | - :configuration_id => nil | ||
| 12 | - } ) | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - def self.configuration_content_hash | ||
| 16 | - { | ||
| 17 | - :name => 'Sample Configuration', | ||
| 18 | - :description => 'Kalibro configuration for Java projects.', | ||
| 19 | - :configuration_id => "42" | ||
| 20 | - } | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | -end |
plugins/mezuro/test/fixtures/configuration_fixtures.rb
| @@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/metric_configuration_fixtures' | ||
| 2 | - | ||
| 3 | -class ConfigurationFixtures | ||
| 4 | - | ||
| 5 | - def self.configuration | ||
| 6 | - Kalibro::Configuration.new configuration_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.created_configuration | ||
| 10 | - Kalibro::Configuration.new({ | ||
| 11 | - :name => 'Created Sample Configuration', | ||
| 12 | - :description => 'Kalibro configuration for Java projects.' | ||
| 13 | - }) | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def self.configuration_hash | ||
| 17 | - { | ||
| 18 | - :id => "42", | ||
| 19 | - :name => 'Sample Configuration', | ||
| 20 | - :description => 'Kalibro configuration for Java projects.' | ||
| 21 | - } | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def self.all | ||
| 25 | - [configuration] | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | -end |
plugins/mezuro/test/fixtures/date_metric_result_fixtures.rb
| @@ -1,33 +0,0 @@ | @@ -1,33 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/metric_result_fixtures' | ||
| 2 | - | ||
| 3 | -class DateMetricResultFixtures | ||
| 4 | - | ||
| 5 | - def self.date_metric_result | ||
| 6 | - Kalibro::DateMetricResult.new date_metric_result_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.date_metric_result_hash | ||
| 10 | - { | ||
| 11 | - :date => '2011-10-20T18:26:43.151+00:00', | ||
| 12 | - :metric_result => MetricResultFixtures.native_metric_result_hash, | ||
| 13 | - :attributes! => | ||
| 14 | - { | ||
| 15 | - :metric_result => | ||
| 16 | - { | ||
| 17 | - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", | ||
| 18 | - "xsi:type"=>"kalibro:metricResultXml" | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - } | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def self.score_history | ||
| 25 | - result = [] | ||
| 26 | - result << date_metric_result | ||
| 27 | - newer_date_metric_result = date_metric_result | ||
| 28 | - newer_date_metric_result.date = '2011-10-25T18:26:43.151+00:00' | ||
| 29 | - newer_date_metric_result.metric_result.value = 5.0 | ||
| 30 | - result << newer_date_metric_result | ||
| 31 | - end | ||
| 32 | - | ||
| 33 | -end |
plugins/mezuro/test/fixtures/date_module_result_fixtures.rb
| @@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/module_result_fixtures' | ||
| 2 | - | ||
| 3 | -class DateModuleResultFixtures | ||
| 4 | - | ||
| 5 | - def self.date_module_result | ||
| 6 | - Kalibro::DateModuleResult.new date_module_result_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.date_module_result_hash | ||
| 10 | - { | ||
| 11 | - :date => '2011-10-20T18:26:43.151+00:00', | ||
| 12 | - :module_result => ModuleResultFixtures.module_result_hash, | ||
| 13 | - :attributes! => | ||
| 14 | - { | ||
| 15 | - :module_result => | ||
| 16 | - { | ||
| 17 | - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", | ||
| 18 | - "xsi:type"=>"kalibro:moduleResultXml" | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - } | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | -end |
plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb
| @@ -1,58 +0,0 @@ | @@ -1,58 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/metric_fixtures' | ||
| 2 | - | ||
| 3 | -class MetricConfigurationFixtures | ||
| 4 | - | ||
| 5 | - def self.amloc_metric_configuration | ||
| 6 | - amloc = Kalibro::MetricConfiguration.new amloc_metric_configuration_hash | ||
| 7 | - amloc.configuration_id = "13" | ||
| 8 | - amloc | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def self.sc_metric_configuration | ||
| 12 | - sc = Kalibro::MetricConfiguration.new sc_metric_configuration_hash | ||
| 13 | - sc.configuration_id = "13" | ||
| 14 | - sc | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - def self.created_metric_configuration | ||
| 18 | - Kalibro::MetricConfiguration.new({ | ||
| 19 | - :code => 'amloc', | ||
| 20 | - :metric => MetricFixtures.amloc_hash, | ||
| 21 | - :base_tool_name => "Analizo", | ||
| 22 | - :weight => "1.0", | ||
| 23 | - :aggregation_form => 'AVERAGE', | ||
| 24 | - :reading_group_id => "31", | ||
| 25 | - :configuration_id => "13" | ||
| 26 | - }) | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - def self.amloc_metric_configuration_hash | ||
| 30 | - { | ||
| 31 | - :id => "42", | ||
| 32 | - :code => 'amloc', | ||
| 33 | - :metric => MetricFixtures.amloc_hash, | ||
| 34 | - :base_tool_name => "Analizo", | ||
| 35 | - :weight => "1.0", | ||
| 36 | - :aggregation_form => 'AVERAGE', | ||
| 37 | - :reading_group_id => "31", | ||
| 38 | - :attributes! => {:metric => { | ||
| 39 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 40 | - 'xsi:type' => 'kalibro:metricXml' }} | ||
| 41 | - } | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - def self.sc_metric_configuration_hash | ||
| 45 | - { | ||
| 46 | - :id => "42", | ||
| 47 | - :code => 'sc', | ||
| 48 | - :metric => MetricFixtures.compound_metric_hash, | ||
| 49 | - :weight => "1.0", | ||
| 50 | - :aggregation_form => 'AVERAGE', | ||
| 51 | - :reading_group_id => "31", | ||
| 52 | - :attributes! => {:metric => { | ||
| 53 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 54 | - 'xsi:type' => 'kalibro:metricXml' }} | ||
| 55 | - } | ||
| 56 | - end | ||
| 57 | - | ||
| 58 | -end |
plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb
| @@ -1,62 +0,0 @@ | @@ -1,62 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/metric_fixtures' | ||
| 2 | -require File.dirname(__FILE__) + '/range_snapshot_fixtures' | ||
| 3 | - | ||
| 4 | -class MetricConfigurationSnapshotFixtures | ||
| 5 | - | ||
| 6 | - def self.metric_configuration_snapshot | ||
| 7 | - Kalibro::MetricConfigurationSnapshot.new metric_configuration_snapshot_hash | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - def self.metric_configuration_snapshot_hash | ||
| 11 | - { | ||
| 12 | - :code => "code", | ||
| 13 | - :weight => "1.0", | ||
| 14 | - :aggregation_form => 'AVERAGE', | ||
| 15 | - :metric => MetricFixtures.amloc_hash, | ||
| 16 | - :base_tool_name => "Analizo", | ||
| 17 | - :range => [RangeSnapshotFixtures.range_snapshot_hash], | ||
| 18 | - :attributes! => { | ||
| 19 | - :metric => { | ||
| 20 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 21 | - 'xsi:type' => 'kalibro:metricXml' }, | ||
| 22 | - :range => { | ||
| 23 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 24 | - 'xsi:type' => 'kalibro:rangeSnapshotXml' } | ||
| 25 | - } | ||
| 26 | - } | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - def self.metric_configuration_snapshot_with_2_elements | ||
| 30 | - Kalibro::MetricConfigurationSnapshot.new metric_configuration_snapshot_hash_with_2_elements | ||
| 31 | - end | ||
| 32 | - | ||
| 33 | - def self.metric_configuration_snapshot_hash_with_2_elements | ||
| 34 | - hash = self.metric_configuration_snapshot_hash | ||
| 35 | - hash[:range] << RangeSnapshotFixtures.range_snapshot_hash | ||
| 36 | - hash | ||
| 37 | - end | ||
| 38 | - | ||
| 39 | - def self.compound_metric_configuration_snapshot | ||
| 40 | - Kalibro::MetricConfigurationSnapshot.new compound_metric_configuration_snapshot_hash | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - def self.compound_metric_configuration_snapshot_hash | ||
| 44 | - { | ||
| 45 | - :code => "code", | ||
| 46 | - :weight => "1.0", | ||
| 47 | - :aggregation_form => 'AVERAGE', | ||
| 48 | - :metric => MetricFixtures.compound_metric, | ||
| 49 | - :base_tool_name => "Analizo", | ||
| 50 | - :range => [RangeSnapshotFixtures.range_snapshot_hash], | ||
| 51 | - :attributes! => { | ||
| 52 | - :metric => { | ||
| 53 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 54 | - 'xsi:type' => 'kalibro:metricXml' }, | ||
| 55 | - :range => { | ||
| 56 | - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ||
| 57 | - 'xsi:type' => 'kalibro:rangeSnapshotXml' } | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - end | ||
| 61 | - | ||
| 62 | -end |
plugins/mezuro/test/fixtures/metric_fixtures.rb
| @@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
| 1 | -class MetricFixtures | ||
| 2 | - | ||
| 3 | - def self.compound_metric | ||
| 4 | - Kalibro::Metric.new compound_metric_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.compound_metric_hash | ||
| 8 | - {:name => 'Structural Complexity', :compound => "true", :scope => 'CLASS', :script => 'return 42;', :description => 'Calculate the Structural Complexity of the Code'} | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def self.total_cof | ||
| 12 | - Kalibro::Metric.new total_cof_hash | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - def self.total_cof_hash | ||
| 16 | - {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']} | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - def self.amloc | ||
| 20 | - Kalibro::Metric.new amloc_hash | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - def self.amloc_hash | ||
| 24 | - {:name => 'Average Method LOC', :compound => "false", :scope => 'CLASS', :language => ['JAVA']} | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | -end |
plugins/mezuro/test/fixtures/metric_result_fixtures.rb
| @@ -1,54 +0,0 @@ | @@ -1,54 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/metric_configuration_snapshot_fixtures' | ||
| 2 | -require File.dirname(__FILE__) + '/throwable_fixtures' | ||
| 3 | - | ||
| 4 | -class MetricResultFixtures | ||
| 5 | - | ||
| 6 | - def self.native_metric_result | ||
| 7 | - Kalibro::MetricResult.new native_metric_result_hash | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - def self.compound_metric_result | ||
| 11 | - Kalibro::MetricResult.new compound_metric_result_hash | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - def self.metric_result_with_error_hash | ||
| 15 | - { | ||
| 16 | - :id => "41", | ||
| 17 | - :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash, | ||
| 18 | - :error => ThrowableFixtures.throwable_hash | ||
| 19 | - } | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - def self.native_metric_result_hash | ||
| 23 | - { | ||
| 24 | - :id => "42", | ||
| 25 | - :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash, | ||
| 26 | - :value => "0.0", | ||
| 27 | - :attributes! => | ||
| 28 | - { | ||
| 29 | - :configuration => | ||
| 30 | - { | ||
| 31 | - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", | ||
| 32 | - "xsi:type"=>"kalibro:metricConfigurationSnapshotXml" | ||
| 33 | - } | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | - end | ||
| 37 | - | ||
| 38 | - def self.compound_metric_result_hash | ||
| 39 | - { | ||
| 40 | - :id => "43", | ||
| 41 | - :configuration => MetricConfigurationSnapshotFixtures.compound_metric_configuration_snapshot_hash, | ||
| 42 | - :value => "1.0", | ||
| 43 | - :attributes! => | ||
| 44 | - { | ||
| 45 | - :configuration => | ||
| 46 | - { | ||
| 47 | - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", | ||
| 48 | - "xsi:type"=>"kalibro:metricConfigurationSnapshotXml" | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - end | ||
| 53 | - | ||
| 54 | -end |
plugins/mezuro/test/fixtures/module_fixtures.rb
plugins/mezuro/test/fixtures/module_result_fixtures.rb
| @@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/module_fixtures' | ||
| 2 | - | ||
| 3 | -class ModuleResultFixtures | ||
| 4 | - | ||
| 5 | - def self.module_result | ||
| 6 | - Kalibro::ModuleResult.new module_result_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.module_result_hash | ||
| 10 | - { | ||
| 11 | - :id => "42", | ||
| 12 | - :module => ModuleFixtures.module_hash, | ||
| 13 | - :grade => "10.0", | ||
| 14 | - :parent_id => "31", | ||
| 15 | - :attributes! => | ||
| 16 | - { | ||
| 17 | - :module => | ||
| 18 | - { | ||
| 19 | - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", | ||
| 20 | - "xsi:type"=>"kalibro:moduleXml" | ||
| 21 | - } | ||
| 22 | - } | ||
| 23 | - } | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - def self.parent_module_result_hash | ||
| 27 | - { | ||
| 28 | - :id => "31", | ||
| 29 | - :module => { | ||
| 30 | - :name => 'Qt-Calculator Parent', | ||
| 31 | - :granularity => 'APPLICATION' | ||
| 32 | - }, | ||
| 33 | - :grade => "10.0", | ||
| 34 | - :attributes! => | ||
| 35 | - { | ||
| 36 | - :module => | ||
| 37 | - { | ||
| 38 | - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", | ||
| 39 | - "xsi:type"=>"kalibro:moduleXml" | ||
| 40 | - } | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - end | ||
| 44 | -end |
plugins/mezuro/test/fixtures/process_time_fixtures.rb
plugins/mezuro/test/fixtures/processing_fixtures.rb
| @@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/process_time_fixtures' | ||
| 2 | -require File.dirname(__FILE__) + '/throwable_fixtures' | ||
| 3 | - | ||
| 4 | -class ProcessingFixtures | ||
| 5 | - | ||
| 6 | - def self.processing | ||
| 7 | - Kalibro::Processing.new processing_hash | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - def self.processing_hash | ||
| 11 | - { | ||
| 12 | - :id => "31", | ||
| 13 | - :date => '2011-10-20T18:26:43.151+00:00', | ||
| 14 | - :state => 'READY', | ||
| 15 | - :process_time => [ProcessTimeFixtures.process_time_hash], | ||
| 16 | - :results_root_id => "13" | ||
| 17 | - } | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - def self.processing_with_error_hash | ||
| 21 | - { | ||
| 22 | - :id => "31", | ||
| 23 | - :date => '2011-10-20T18:26:43.151+00:00', | ||
| 24 | - :state => 'ERROR', | ||
| 25 | - :process_time => [ProcessTimeFixtures.process_time_hash], | ||
| 26 | - :error => ThrowableFixtures.throwable_hash | ||
| 27 | - } | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | -end |
plugins/mezuro/test/fixtures/project_content_fixtures.rb
plugins/mezuro/test/fixtures/project_fixtures.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/repository_fixtures' | ||
| 2 | - | ||
| 3 | -class ProjectFixtures | ||
| 4 | - | ||
| 5 | - def self.project | ||
| 6 | - Kalibro::Project.new project_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.created_project | ||
| 10 | - Kalibro::Project.new :name => 'Qt-Calculator', :description => 'Calculator for Qt' | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def self.project_hash | ||
| 14 | - { | ||
| 15 | - :id => "42", | ||
| 16 | - :name => 'Qt-Calculator', | ||
| 17 | - :description => 'Calculator for Qt' | ||
| 18 | - } | ||
| 19 | - end | ||
| 20 | -end |
plugins/mezuro/test/fixtures/range_fixtures.rb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -class RangeFixtures | ||
| 2 | - | ||
| 3 | - def self.range | ||
| 4 | - Kalibro::Range.new range_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.created_range | ||
| 8 | - Kalibro::Range.new created_range_hash | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def self.created_range_hash | ||
| 12 | - {:beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"} | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - def self.range_hash | ||
| 16 | - {:id => "1", :beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"} | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | -end |
plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -class RangeSnapshotFixtures | ||
| 2 | - | ||
| 3 | - def self.range_snapshot | ||
| 4 | - Kalibro::RangeSnapshot.new range_snapshot_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.range_snapshot_with_infinite_range | ||
| 8 | - Kalibro::RangeSnapshot.new range_snapshot_with_infinite_range_hash | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def self.range_snapshot_hash | ||
| 12 | - { :beginning => "1.1", :end => "5.1", :label => "snapshot", :grade => "10.1", :color => "FF2284", :comments => "comment" } | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - def self.range_snapshot_with_infinite_range_hash | ||
| 16 | - { :beginning => "-INF", :end => "INF", :label => "snapshot", :grade => "10.1", :color => "FF2284", :comments => "comment" } | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | -end |
plugins/mezuro/test/fixtures/reading_fixtures.rb
| @@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
| 1 | -class ReadingFixtures | ||
| 2 | - | ||
| 3 | - def self.reading | ||
| 4 | - Kalibro::Reading.new reading_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.created_reading # A created object has no id before being sent to kalibro | ||
| 8 | - Kalibro::Reading.new :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC", :group_id => "31" | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def self.reading_hash | ||
| 12 | - {:id => "42", :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC", :group_id => "31"} | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | -end | ||
| 16 | - |
plugins/mezuro/test/fixtures/reading_group_content_fixtures.rb
plugins/mezuro/test/fixtures/reading_group_fixtures.rb
| @@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
| 1 | -class ReadingGroupFixtures | ||
| 2 | - | ||
| 3 | - def self.reading_group | ||
| 4 | - Kalibro::ReadingGroup.new reading_group_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.created_reading_group # A created object has no id before being sent to kalibro | ||
| 8 | - Kalibro::ReadingGroup.new :name => "Reading Group Test", :description => "Reading group in the fixtures" | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - def self.reading_group_hash | ||
| 12 | - {:id => "42", :name => "Reading Group Test", :description => "Reading group in the fixtures"} | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | -end |
plugins/mezuro/test/fixtures/repository_fixtures.rb
| @@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
| 1 | -class RepositoryFixtures | ||
| 2 | - | ||
| 3 | - def self.repository | ||
| 4 | - Kalibro::Repository.new repository_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.created_repository | ||
| 8 | - Kalibro::Repository.new({ | ||
| 9 | - :name => "test created repository", | ||
| 10 | - :description => "test description", | ||
| 11 | - :license => "GPL", | ||
| 12 | - :process_period => "1", | ||
| 13 | - :type => 'SUBVERSION', | ||
| 14 | - :address => 'https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator', | ||
| 15 | - :configuration_id => "31", | ||
| 16 | - :project_id => "32" | ||
| 17 | - }) | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - def self.repository_hash | ||
| 21 | - {:id => "42", :name => "test repository", :description => "test description", :license => "GPL", :process_period => "1", :type => 'SUBVERSION', :address => "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator", :configuration_id => "31", :project_id => "32"} | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - def self.types | ||
| 25 | - ["SUBVERSION", "GIT"] | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | -end |
plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb
| @@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
| 1 | -class StackTraceElementFixtures | ||
| 2 | - | ||
| 3 | - def self.stack_trace_element | ||
| 4 | - Kalibro::StackTraceElement.new stack_trace_element_hash | ||
| 5 | - end | ||
| 6 | - | ||
| 7 | - def self.stack_trace_element_hash | ||
| 8 | - { | ||
| 9 | - :declaring_class => 'my.declaring.Class', | ||
| 10 | - :method_name => 'my method name', | ||
| 11 | - :file_name => 'MyFile.java', | ||
| 12 | - :line_number => '42' | ||
| 13 | - } | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | -end |
plugins/mezuro/test/fixtures/throwable_fixtures.rb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -require File.dirname(__FILE__) + '/stack_trace_element_fixtures' | ||
| 2 | - | ||
| 3 | -class ThrowableFixtures | ||
| 4 | - | ||
| 5 | - def self.throwable | ||
| 6 | - Kalibro::Throwable.new throwable_hash | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def self.throwable_hash | ||
| 10 | - { | ||
| 11 | - :target_string => 'Target String', | ||
| 12 | - :message => 'Throwable message from ThrowableTest', | ||
| 13 | - :stack_trace_element => [ | ||
| 14 | - StackTraceElementFixtures.stack_trace_element_hash, StackTraceElementFixtures.stack_trace_element_hash | ||
| 15 | - ] | ||
| 16 | - } | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | -end |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
| @@ -1,228 +0,0 @@ | @@ -1,228 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" | ||
| 4 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
| 5 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" | ||
| 6 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 7 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 8 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" | ||
| 9 | - | ||
| 10 | -class MezuroPluginMyprofileControllerTest < ActionController::TestCase | ||
| 11 | - | ||
| 12 | - def setup | ||
| 13 | - @controller = MezuroPluginMyprofileController.new | ||
| 14 | - @request = ActionController::TestRequest.new | ||
| 15 | - @response = ActionController::TestResponse.new | ||
| 16 | - @profile = fast_create(Community) | ||
| 17 | - | ||
| 18 | - @base_tool = BaseToolFixtures.base_tool | ||
| 19 | - @base_tool_hash = BaseToolFixtures.base_tool_hash | ||
| 20 | - @metric = NativeMetricFixtures.amloc | ||
| 21 | - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | ||
| 22 | - @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash | ||
| 23 | - @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration | ||
| 24 | - @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash | ||
| 25 | - @configuration = ConfigurationFixtures.configuration | ||
| 26 | - @configuration_hash = ConfigurationFixtures.configuration_hash | ||
| 27 | - | ||
| 28 | - Kalibro::Configuration.expects(:all_names).returns([]) | ||
| 29 | - @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name) | ||
| 30 | - @content.expects(:send_kalibro_configuration_to_service).returns(nil) | ||
| 31 | - @content.stubs(:solr_save) | ||
| 32 | - @content.save | ||
| 33 | - | ||
| 34 | - @native_hash = @metric_configuration.to_hash.merge({:configuration_name => @metric_configuration.configuration_name}) | ||
| 35 | - @native_hash.delete :attributes! | ||
| 36 | - @compound_hash = @compound_metric_configuration.to_hash.merge({:configuration_name => @compound_metric_configuration.configuration_name}) | ||
| 37 | - @compound_hash.delete :attributes! | ||
| 38 | - | ||
| 39 | - @range = RangeFixtures.range_excellent | ||
| 40 | - @range_hash = RangeFixtures.range_excellent_hash | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - should 'test choose base tool' do | ||
| 44 | - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool_names).returns({:base_tool_name => @base_tool.name}) | ||
| 45 | - get :choose_base_tool, :profile => @profile.identifier, :id => @content.id | ||
| 46 | - assert_equal [@base_tool.name], assigns(:base_tools) | ||
| 47 | - assert_equal @content, assigns(:configuration_content) | ||
| 48 | - assert_response 200 | ||
| 49 | - end | ||
| 50 | - | ||
| 51 | - should 'test choose metric' do | ||
| 52 | - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | ||
| 53 | - get :choose_metric, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name | ||
| 54 | - assert_equal @content, assigns(:configuration_content) | ||
| 55 | - assert_equal @base_tool.name, assigns(:base_tool) | ||
| 56 | - assert_equal @base_tool.supported_metric[0].name, assigns(:supported_metrics)[0].name | ||
| 57 | - assert_response 200 | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - should 'test new metric configuration' do | ||
| 61 | - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | ||
| 62 | - get :new_metric_configuration, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name, :metric_name => @metric.name | ||
| 63 | - assert_equal @content, assigns(:configuration_content) | ||
| 64 | - assert_equal @metric.name, assigns(:metric).name | ||
| 65 | - assert_response 200 | ||
| 66 | - end | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - should 'test new compound metric configuration' do | ||
| 70 | - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | ||
| 71 | - get :new_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id | ||
| 72 | - assert_equal @content, assigns(:configuration_content) | ||
| 73 | - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | ||
| 74 | - assert_response 200 | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | - should 'test edit metric configuration' do | ||
| 78 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 79 | - :configuration_name => @content.name, | ||
| 80 | - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 81 | - get :edit_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | ||
| 82 | - assert_equal @content, assigns(:configuration_content) | ||
| 83 | - assert_equal @metric_configuration.code, assigns(:metric_configuration).code | ||
| 84 | - assert_equal @metric_configuration.metric.name, assigns(:metric).name | ||
| 85 | - assert_response 200 | ||
| 86 | - end | ||
| 87 | - | ||
| 88 | - should 'test edit compound metric configuration' do | ||
| 89 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 90 | - :configuration_name => @content.name, | ||
| 91 | - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | ||
| 92 | - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | ||
| 93 | - get :edit_compound_metric_configuration, | ||
| 94 | - :profile => @profile.identifier, | ||
| 95 | - :id => @content.id, | ||
| 96 | - :metric_name => @compound_metric_configuration.metric.name | ||
| 97 | - assert_equal @content, assigns(:configuration_content) | ||
| 98 | - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code | ||
| 99 | - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name | ||
| 100 | - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | ||
| 101 | - assert_response 200 | ||
| 102 | - end | ||
| 103 | - | ||
| 104 | - should 'test create native metric configuration' do | ||
| 105 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 106 | - :metric_configuration => @metric_configuration.to_hash, | ||
| 107 | - :configuration_name => @metric_configuration.configuration_name}) | ||
| 108 | - get :create_metric_configuration, | ||
| 109 | - :profile => @profile.identifier, | ||
| 110 | - :id => @content.id, | ||
| 111 | - :metric_configuration => @native_hash | ||
| 112 | - assert_response 302 | ||
| 113 | - end | ||
| 114 | - | ||
| 115 | - should 'test compound metric creation' do | ||
| 116 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 117 | - :metric_configuration => @compound_metric_configuration.to_hash, | ||
| 118 | - :configuration_name => @compound_metric_configuration.configuration_name}) | ||
| 119 | - get :create_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | ||
| 120 | - :metric_configuration => @compound_hash | ||
| 121 | - assert_response 302 | ||
| 122 | - end | ||
| 123 | - | ||
| 124 | - should 'test update native metric configuration' do | ||
| 125 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 126 | - :configuration_name => @content.name, | ||
| 127 | - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 128 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 129 | - :metric_configuration => @metric_configuration.to_hash, | ||
| 130 | - :configuration_name => @metric_configuration.configuration_name}) | ||
| 131 | - get :update_metric_configuration, :profile => @profile.identifier, :id => @content.id, | ||
| 132 | - :metric_configuration => @native_hash | ||
| 133 | - assert_equal @content, assigns(:configuration_content) | ||
| 134 | - assert_response 302 | ||
| 135 | - end | ||
| 136 | - | ||
| 137 | - should 'test update compound metric configuration' do | ||
| 138 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 139 | - :configuration_name => @content.name, | ||
| 140 | - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | ||
| 141 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 142 | - :metric_configuration => @compound_metric_configuration.to_hash, | ||
| 143 | - :configuration_name => @compound_metric_configuration.configuration_name}) | ||
| 144 | - get :update_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | ||
| 145 | - :metric_configuration => @compound_hash | ||
| 146 | - assert_equal @content, assigns(:configuration_content) | ||
| 147 | - assert_response 302 | ||
| 148 | - end | ||
| 149 | - | ||
| 150 | - should 'test remove metric configuration' do | ||
| 151 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 152 | - :configuration_name => @content.name, | ||
| 153 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 154 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :remove_metric_configuration, { | ||
| 155 | - :metric_name => @metric.name, | ||
| 156 | - :configuration_name => @metric_configuration.configuration_name}) | ||
| 157 | - get :remove_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | ||
| 158 | - assert_response 302 | ||
| 159 | - end | ||
| 160 | - | ||
| 161 | - should 'test new range' do | ||
| 162 | - get :new_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | ||
| 163 | - assert_equal @content, assigns(:configuration_content) | ||
| 164 | - assert_equal @metric.name, assigns(:metric_name) | ||
| 165 | - assert_response 200 | ||
| 166 | - end | ||
| 167 | - | ||
| 168 | - should 'test edit range' do | ||
| 169 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 170 | - :configuration_name => @content.name, | ||
| 171 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 172 | - get :edit_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name, :beginning_id => @range.beginning | ||
| 173 | - assert_equal @content, assigns(:configuration_content) | ||
| 174 | - assert_equal @metric.name, assigns(:metric_name) | ||
| 175 | - assert_equal @range.beginning, assigns(:beginning_id) | ||
| 176 | - assert_equal @range.end, assigns(:range).end | ||
| 177 | - assert_response 200 | ||
| 178 | - end | ||
| 179 | - | ||
| 180 | - should 'test create instance range' do | ||
| 181 | - metric_configuration = @metric_configuration | ||
| 182 | - metric_configuration.add_range(@range) | ||
| 183 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 184 | - :configuration_name => @content.name, | ||
| 185 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 186 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 187 | - :metric_configuration => metric_configuration.to_hash, | ||
| 188 | - :configuration_name => metric_configuration.configuration_name}) | ||
| 189 | - get :create_range, :profile => @profile.identifier, :range => @range_hash, :id => @content.id, :metric_name => @metric.name | ||
| 190 | - assert_equal @content, assigns(:configuration_content) | ||
| 191 | - assert_equal @range.end, assigns(:range).end | ||
| 192 | - assert_response 200 | ||
| 193 | - end | ||
| 194 | - | ||
| 195 | - should 'test update range' do | ||
| 196 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 197 | - :configuration_name => @content.name, | ||
| 198 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 199 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 200 | - :metric_configuration => @metric_configuration.to_hash, | ||
| 201 | - :configuration_name => @metric_configuration.configuration_name}) | ||
| 202 | - get :update_range, | ||
| 203 | - :profile => @profile.identifier, | ||
| 204 | - :range => @range_hash, | ||
| 205 | - :id => @content.id, | ||
| 206 | - :metric_name => @metric.name, | ||
| 207 | - :beginning_id => @range.beginning | ||
| 208 | - assert_response 200 | ||
| 209 | - end | ||
| 210 | - | ||
| 211 | - should 'test remove range' do | ||
| 212 | - metric_configuration = @metric_configuration | ||
| 213 | - metric_configuration.ranges.delete_if { |range| range.beginning == @range.beginning.to_f } | ||
| 214 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | ||
| 215 | - :configuration_name => @content.name, | ||
| 216 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | ||
| 217 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | ||
| 218 | - :metric_configuration => metric_configuration.to_hash, | ||
| 219 | - :configuration_name => metric_configuration.configuration_name}) | ||
| 220 | - get :remove_range, | ||
| 221 | - :profile => @profile.identifier, | ||
| 222 | - :id => @content.id, | ||
| 223 | - :metric_name => @metric.name, | ||
| 224 | - :beginning_id => @range.beginning | ||
| 225 | - assert_response 302 | ||
| 226 | - end | ||
| 227 | - | ||
| 228 | -end |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| @@ -1,141 +0,0 @@ | @@ -1,141 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
| 4 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" | ||
| 5 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" | ||
| 6 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" | ||
| 7 | - | ||
| 8 | -class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
| 9 | - | ||
| 10 | - def setup | ||
| 11 | - @controller = MezuroPluginProfileController.new | ||
| 12 | - @request = ActionController::TestRequest.new | ||
| 13 | - @response = ActionController::TestResponse.new | ||
| 14 | - @profile = fast_create(Community) | ||
| 15 | - | ||
| 16 | - @project_result = ProjectResultFixtures.project_result | ||
| 17 | - @module_result = ModuleResultFixtures.module_result | ||
| 18 | - @repository_url = RepositoryFixtures.repository.address | ||
| 19 | - @project = @project_result.project | ||
| 20 | - @date = "2012-04-13T20:39:41+04:00" | ||
| 21 | - | ||
| 22 | - Kalibro::Project.expects(:all_names).returns([]) | ||
| 23 | - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url) | ||
| 24 | - @content.expects(:send_project_to_service).returns(nil) | ||
| 25 | - @content.save | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - should 'test project state without kalibro_error' do | ||
| 29 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | ||
| 30 | - get :project_state, :profile => @profile.identifier, :id => @content.id | ||
| 31 | - assert_response 200 | ||
| 32 | - assert_equal @content, assigns(:content) | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'test project state with kalibro_error' do | ||
| 36 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) | ||
| 37 | - get :project_state, :profile => @profile.identifier, :id => @content.id | ||
| 38 | - assert_response 200 | ||
| 39 | - assert_equal "ERROR", @response.body | ||
| 40 | - assert_equal @content, assigns(:content) | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - should 'test project error' do | ||
| 44 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) | ||
| 45 | - get :project_error, :profile => @profile.identifier, :id => @content.id | ||
| 46 | - assert_response 200 | ||
| 47 | - assert_select('h3', 'ERROR') | ||
| 48 | - assert_equal @content, assigns(:content) | ||
| 49 | - assert_equal @project.name, assigns(:project).name | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'test project result without date' do | ||
| 53 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | ||
| 54 | - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => nil | ||
| 55 | - assert_equal @content, assigns(:content) | ||
| 56 | - assert_equal @project_result.project.name, assigns(:project_result).project.name | ||
| 57 | - assert_response 200 | ||
| 58 | - assert_select('h4', 'Last Result') | ||
| 59 | - end | ||
| 60 | - | ||
| 61 | - should 'test project results from a specific date' do | ||
| 62 | - request_body = {:project_name => @project.name, :date => @date} | ||
| 63 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | ||
| 64 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | ||
| 65 | - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @date | ||
| 66 | - assert_equal @content, assigns(:content) | ||
| 67 | - assert_equal @project_result.project.name, assigns(:project_result).project.name | ||
| 68 | - assert_response 200 | ||
| 69 | - assert_select('h4', 'Last Result') | ||
| 70 | - end | ||
| 71 | - | ||
| 72 | - | ||
| 73 | - should 'get module result without date' do | ||
| 74 | - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | ||
| 75 | - Kalibro::ProjectResult.expects(:request). | ||
| 76 | - with("ProjectResult", :get_last_result_of, {:project_name => @project.name}). | ||
| 77 | - returns({:project_result => @project_result.to_hash}) | ||
| 78 | - Kalibro::ModuleResult.expects(:request). | ||
| 79 | - with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}). | ||
| 80 | - returns({:module_result => @module_result.to_hash}) | ||
| 81 | - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | ||
| 82 | - assert_equal @content, assigns(:content) | ||
| 83 | - assert_equal @module_result.grade, assigns(:module_result).grade | ||
| 84 | - assert_response 200 | ||
| 85 | - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | ||
| 86 | - end | ||
| 87 | - | ||
| 88 | - should 'get module result with a specific date' do | ||
| 89 | - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | ||
| 90 | - request_body = {:project_name => @project.name, :date => @project_result.date} | ||
| 91 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | ||
| 92 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | ||
| 93 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).returns({:module_result => @module_result.to_hash}) | ||
| 94 | - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | ||
| 95 | - assert_equal @content, assigns(:content) | ||
| 96 | - assert_equal @module_result.grade, assigns(:module_result).grade | ||
| 97 | - assert_response 200 | ||
| 98 | - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | ||
| 99 | - end | ||
| 100 | - | ||
| 101 | - should 'test project tree without date' do | ||
| 102 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | ||
| 103 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | ||
| 104 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | ||
| 105 | - assert_equal @content, assigns(:content) | ||
| 106 | - assert_equal @project.name, assigns(:project_name) | ||
| 107 | - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | ||
| 108 | - assert_response 200 | ||
| 109 | - assert_select('h2', /Qt-Calculator/) | ||
| 110 | - end | ||
| 111 | - | ||
| 112 | - should 'test project tree with a specific date' do | ||
| 113 | - request_body = {:project_name => @project.name, :date => @project_result.date} | ||
| 114 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | ||
| 115 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | ||
| 116 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | ||
| 117 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | ||
| 118 | - assert_equal @content, assigns(:content) | ||
| 119 | - assert_equal @project.name, assigns(:project_name) | ||
| 120 | - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | ||
| 121 | - assert_response 200 | ||
| 122 | - end | ||
| 123 | - | ||
| 124 | - should 'test module metrics history' do | ||
| 125 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | ||
| 126 | - get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, | ||
| 127 | - :metric_name => @module_result.metric_result.first.metric.name.delete("() ") | ||
| 128 | - assert_equal @content, assigns(:content) | ||
| 129 | - assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) | ||
| 130 | - assert_response 200 | ||
| 131 | - end | ||
| 132 | - | ||
| 133 | - should 'test grade history' do | ||
| 134 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | ||
| 135 | - get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name | ||
| 136 | - assert_equal @content, assigns(:content) | ||
| 137 | - assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) | ||
| 138 | - assert_response 200 | ||
| 139 | - end | ||
| 140 | - | ||
| 141 | -end |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb
| @@ -1,123 +0,0 @@ | @@ -1,123 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 7 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures" | ||
| 8 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | ||
| 9 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" | ||
| 10 | - | ||
| 11 | -class MezuroPluginMetricConfigurationControllerTest < ActionController::TestCase | ||
| 12 | - | ||
| 13 | - def setup | ||
| 14 | - @controller = MezuroPluginMetricConfigurationController.new | ||
| 15 | - @request = ActionController::TestRequest.new | ||
| 16 | - @response = ActionController::TestResponse.new | ||
| 17 | - @profile = fast_create(Profile) | ||
| 18 | - | ||
| 19 | - @configuration = ConfigurationFixtures.configuration | ||
| 20 | - @created_configuration = ConfigurationFixtures.created_configuration | ||
| 21 | - @configuration_hash = ConfigurationFixtures.configuration_hash | ||
| 22 | - | ||
| 23 | - @configuration_content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name, :configuration_id => 42) | ||
| 24 | - @configuration_content.expects(:send_configuration_to_service).returns(nil) | ||
| 25 | - @configuration_content.expects(:validate_configuration_name).returns(true) | ||
| 26 | - @configuration_content.save | ||
| 27 | - | ||
| 28 | - @base_tool = BaseToolFixtures.base_tool | ||
| 29 | - @base_tool_hash = BaseToolFixtures.base_tool_hash | ||
| 30 | - | ||
| 31 | - @metric = MetricFixtures.amloc | ||
| 32 | - | ||
| 33 | - @reading_group = ReadingGroupFixtures.reading_group | ||
| 34 | - @range = RangeFixtures.range | ||
| 35 | - @reading = ReadingFixtures.reading | ||
| 36 | - | ||
| 37 | - @native_metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | ||
| 38 | - @native_metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash | ||
| 39 | - @created_metric_configuration = MetricConfigurationFixtures.created_metric_configuration | ||
| 40 | - @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration | ||
| 41 | - @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'choose metric' do | ||
| 45 | - Kalibro::BaseTool.expects(:all).returns([@base_tool]) | ||
| 46 | - get :choose_metric, :profile => @profile.identifier, :id => @configuration_content.id | ||
| 47 | - assert_equal @configuration_content, assigns(:configuration_content) | ||
| 48 | - assert_equal [@base_tool], assigns(:base_tools) | ||
| 49 | - assert_response :success | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'initialize native' do | ||
| 53 | - Kalibro::BaseTool.expects(:find_by_name).with(@base_tool.name).returns(@base_tool) | ||
| 54 | - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) | ||
| 55 | - get :new_native, :profile => @profile.identifier, :id => @configuration_content.id, :base_tool_name => @base_tool.name, :metric_name => @metric.name | ||
| 56 | - assert_equal @configuration_content, assigns(:configuration_content) | ||
| 57 | - assert_equal @metric.name, assigns(:metric).name | ||
| 58 | - assert_equal @base_tool.name, assigns(:metric_configuration).base_tool_name | ||
| 59 | - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) | ||
| 60 | - assert_response :success | ||
| 61 | - end | ||
| 62 | - | ||
| 63 | - should 'edit native' do | ||
| 64 | - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@native_metric_configuration]) | ||
| 65 | - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) | ||
| 66 | - Kalibro::Range.expects(:ranges_of).with(@native_metric_configuration.id).returns([@range]) | ||
| 67 | - Kalibro::Reading.expects(:find).with(@range.reading_id).returns(@reading) | ||
| 68 | - get :edit_native, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id | ||
| 69 | - assert_equal @configuration_content, assigns(:configuration_content) | ||
| 70 | - assert_equal @native_metric_configuration.code, assigns(:metric_configuration).code | ||
| 71 | - assert_equal @native_metric_configuration.metric.name, assigns(:metric).name | ||
| 72 | - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) | ||
| 73 | - assert_equal [@range], assigns(:ranges) | ||
| 74 | - assert_response :success | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | - should 'initialize compound' do | ||
| 78 | - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) | ||
| 79 | - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration_content.configuration_id).returns([@compound_metric_configuration]) | ||
| 80 | - get :new_compound, :profile => @profile.identifier, :id => @configuration_content.id | ||
| 81 | - assert_equal @configuration_content, assigns(:configuration_content) | ||
| 82 | - assert_equal @compound_metric_configuration.code, assigns(:metric_configurations).first.code | ||
| 83 | - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) | ||
| 84 | - assert_response :success | ||
| 85 | - end | ||
| 86 | - | ||
| 87 | - should 'edit compound' do | ||
| 88 | - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@compound_metric_configuration]) | ||
| 89 | - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) | ||
| 90 | - Kalibro::Range.expects(:ranges_of).with(@compound_metric_configuration.id).returns([@range]) | ||
| 91 | - Kalibro::Reading.expects(:find).with(@range.reading_id).returns(@reading) | ||
| 92 | - get :edit_compound, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @compound_metric_configuration.id | ||
| 93 | - assert_equal @configuration_content, assigns(:configuration_content) | ||
| 94 | - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code | ||
| 95 | - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name | ||
| 96 | - assert_equal [@compound_metric_configuration], assigns(:metric_configurations) | ||
| 97 | - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) | ||
| 98 | - assert_equal [@range], assigns(:ranges) | ||
| 99 | - assert_response :success | ||
| 100 | - end | ||
| 101 | - | ||
| 102 | - should 'create' do | ||
| 103 | - Kalibro::MetricConfiguration.expects(:create).returns(@compound_metric_configuration) #FIXME need .with(some_hash), should it mock the request?. | ||
| 104 | - get :create, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @compound_metric_configuration_hash | ||
| 105 | - assert_response :redirect | ||
| 106 | - end | ||
| 107 | - | ||
| 108 | - should 'update' do | ||
| 109 | - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration_content.configuration_id).returns([@native_metric_configuration]) | ||
| 110 | - @native_metric_configuration.expects(:update_attributes).returns(true) #FIXME need .with(some_hash), should it mock the request?. | ||
| 111 | - get :update, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @native_metric_configuration_hash | ||
| 112 | - assert_equal @configuration_content, assigns(:configuration_content) | ||
| 113 | - assert_response :redirect | ||
| 114 | - end | ||
| 115 | - | ||
| 116 | - should 'remove' do | ||
| 117 | - Kalibro::MetricConfiguration.expects(:new).with({:id => @native_metric_configuration.id}).returns(@native_metric_configuration) | ||
| 118 | - @native_metric_configuration.expects(:destroy).returns() | ||
| 119 | - get :remove, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id | ||
| 120 | - assert_response :redirect | ||
| 121 | - end | ||
| 122 | - | ||
| 123 | -end |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_range_controller_test.rb
| @@ -1,83 +0,0 @@ | @@ -1,83 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | ||
| 7 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" | ||
| 8 | - | ||
| 9 | -class MezuroPluginRangeControllerTest < ActionController::TestCase | ||
| 10 | - | ||
| 11 | - def setup | ||
| 12 | - @controller = MezuroPluginRangeController.new | ||
| 13 | - @request = ActionController::TestRequest.new | ||
| 14 | - @response = ActionController::TestResponse.new | ||
| 15 | - @profile = fast_create(Profile) | ||
| 16 | - | ||
| 17 | - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | ||
| 18 | - @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash | ||
| 19 | - @configuration = ConfigurationFixtures.configuration | ||
| 20 | - | ||
| 21 | - @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name, :configuration_id => 42) | ||
| 22 | - @content.expects(:send_configuration_to_service).returns(nil) | ||
| 23 | - @content.expects(:validate_configuration_name).returns(true) | ||
| 24 | - @content.save | ||
| 25 | - | ||
| 26 | - @created_range = RangeFixtures.created_range | ||
| 27 | - @range = RangeFixtures.range | ||
| 28 | - @created_range_hash = RangeFixtures.created_range_hash | ||
| 29 | - @range_hash = RangeFixtures.range_hash | ||
| 30 | - | ||
| 31 | - @reading = ReadingFixtures.reading | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - should 'set correct attributes to create a new range' do | ||
| 35 | - Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading]) | ||
| 36 | - get :new, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound | ||
| 37 | - assert_equal @content.id, assigns(:content_id) | ||
| 38 | - assert_equal @metric_configuration.id, assigns(:metric_configuration_id) | ||
| 39 | - assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids) | ||
| 40 | - assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id) | ||
| 41 | - assert_equal @metric_configuration.metric.compound, assigns(:compound) | ||
| 42 | - assert_response :success | ||
| 43 | - end | ||
| 44 | - | ||
| 45 | - should 'set correct attributes to edit a range' do | ||
| 46 | - Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading]) | ||
| 47 | - Kalibro::Range.expects(:ranges_of).with(@metric_configuration.id).returns([@range]) | ||
| 48 | - get :edit, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :range_id => @range.id, :reading_group_id => @metric_configuration.reading_group_id | ||
| 49 | - assert_equal @content.id, assigns(:content_id) | ||
| 50 | - assert_equal @metric_configuration.id, assigns(:metric_configuration_id) | ||
| 51 | - assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids) | ||
| 52 | - assert_equal @range, assigns(:range) | ||
| 53 | - assert_response :success | ||
| 54 | - end | ||
| 55 | - | ||
| 56 | - should 'test create instance range' do | ||
| 57 | - Kalibro::Range.expects(:request).with(:save_range, { | ||
| 58 | - :metric_configuration_id => @metric_configuration.id, | ||
| 59 | - :range => @created_range.to_hash}).returns(:range_id => @range.id) | ||
| 60 | - Kalibro::Reading.expects(:find).with(@created_range.reading_id).returns(@reading) | ||
| 61 | - get :create, :profile => @profile.identifier, :range => @created_range_hash, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound | ||
| 62 | - assert_equal @range.id, assigns(:range).id | ||
| 63 | - assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id) | ||
| 64 | - assert_equal @metric_configuration.metric.compound, assigns(:compound) | ||
| 65 | - assert_response :success | ||
| 66 | - end | ||
| 67 | - | ||
| 68 | - should 'test update range' do | ||
| 69 | - Kalibro::Range.expects(:request).with(:save_range, { | ||
| 70 | - :metric_configuration_id => @metric_configuration.id, | ||
| 71 | - :range => @range.to_hash}).returns(:range_id => @range.id) | ||
| 72 | - get :update, :profile => @profile.identifier, :range => @range_hash, :metric_configuration_id => @metric_configuration.id | ||
| 73 | - assert_equal @range.id, assigns(:range).id | ||
| 74 | - assert_response :success | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | - should 'test remove range in native metric configuration' do | ||
| 78 | - Kalibro::Range.expects(:new).with({:id => @range.id}).returns(@range) | ||
| 79 | - @range.expects(:destroy).with().returns() | ||
| 80 | - get :remove, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :range_id => @range.id, :compound => false | ||
| 81 | - assert_response :redirect | ||
| 82 | - end | ||
| 83 | -end |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb
| @@ -1,83 +0,0 @@ | @@ -1,83 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_content_fixtures" | ||
| 5 | - | ||
| 6 | -class MezuroPluginReadingControllerTest < ActionController::TestCase | ||
| 7 | - | ||
| 8 | - def setup | ||
| 9 | - @controller = MezuroPluginReadingController.new | ||
| 10 | - @request = ActionController::TestRequest.new | ||
| 11 | - @response = ActionController::TestResponse.new | ||
| 12 | - @profile = fast_create(Profile) | ||
| 13 | - | ||
| 14 | - @reading = ReadingFixtures.reading | ||
| 15 | - @created_reading = ReadingFixtures.created_reading | ||
| 16 | - @reading_hash = ReadingFixtures.hash | ||
| 17 | - @content = MezuroPlugin::ReadingGroupContent.new(:profile => @profile, :name => name) | ||
| 18 | - @content.expects(:send_reading_group_to_service).returns(nil) | ||
| 19 | - @content.save | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - should 'set variables to create a new reading' do | ||
| 23 | - parser = "|*|" | ||
| 24 | - Kalibro::Reading.expects(:readings_of).with(@content.reading_group_id).returns([@reading]) | ||
| 25 | - get :new, :profile => @profile.identifier, :id => @content.id | ||
| 26 | - assert_equal parser, assigns(:parser) | ||
| 27 | - assert_equal ["#{@reading.label}#{parser}#{@reading.grade}#{parser}"], assigns(:labels_and_grades) | ||
| 28 | - assert_equal @content.id, assigns(:reading_group_content).id | ||
| 29 | - assert_response :success | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - should 'create a reading' do | ||
| 33 | - Kalibro::Reading.expects(:new).with(@reading_hash.to_s).returns(@created_reading) | ||
| 34 | - @created_reading.expects(:save).with(@content.reading_group_id).returns(true) | ||
| 35 | - get :save, :profile => @profile.identifier, :id => @content.id, :reading => @reading_hash | ||
| 36 | - assert @created_reading.errors.empty? | ||
| 37 | - assert_response :redirect | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'put an Exception in reading when an error occurs in create action' do | ||
| 41 | - @created_reading.errors = [Exception.new] | ||
| 42 | - Kalibro::Reading.expects(:new).with(@reading_hash.to_s).returns(@created_reading) | ||
| 43 | - @created_reading.expects(:save).with(@content.reading_group_id).returns(false) | ||
| 44 | - get :save, :profile => @profile.identifier, :id => @content.id, :reading => @reading_hash | ||
| 45 | - assert !@created_reading.errors.empty? | ||
| 46 | - assert_response :redirect | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - should 'set variables to edit a reading' do | ||
| 50 | - parser = "|*|" | ||
| 51 | - another_reading = ReadingFixtures.reading | ||
| 52 | - another_reading.id = 10 | ||
| 53 | - Kalibro::Reading.expects(:readings_of).with(@content.reading_group_id).returns([@reading, another_reading]) | ||
| 54 | - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) | ||
| 55 | - get :edit, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id | ||
| 56 | - assert_equal @content.id, assigns(:reading_group_content).id | ||
| 57 | - assert_equal @reading, assigns(:reading) | ||
| 58 | - assert_equal parser, assigns(:parser) | ||
| 59 | - assert_equal ["#{another_reading.label}#{parser}#{another_reading.grade}#{parser}"], assigns(:labels_and_grades) | ||
| 60 | - assert_response :success | ||
| 61 | - end | ||
| 62 | - | ||
| 63 | - should 'destroy a reading' do | ||
| 64 | - @reading.expects(:destroy) | ||
| 65 | - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) | ||
| 66 | - | ||
| 67 | - get :destroy, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id | ||
| 68 | - | ||
| 69 | - assert @reading.errors.empty? | ||
| 70 | - assert_response :redirect | ||
| 71 | - end | ||
| 72 | - | ||
| 73 | - should 'put an Exception in reading when an error occurs in destroy action' do | ||
| 74 | - @reading.errors = [Exception.new] | ||
| 75 | - @reading.expects(:destroy) | ||
| 76 | - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) | ||
| 77 | - | ||
| 78 | - get :destroy, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id | ||
| 79 | - | ||
| 80 | - assert !@reading.errors.empty? | ||
| 81 | - assert_response :redirect | ||
| 82 | - end | ||
| 83 | -end |
plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
| @@ -1,58 +0,0 @@ | @@ -1,58 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_result_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" | ||
| 6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_module_result_fixtures" | ||
| 7 | - | ||
| 8 | -class MezuroPluginModuleResultControllerTest < ActionController::TestCase | ||
| 9 | - | ||
| 10 | - def setup | ||
| 11 | - @controller = MezuroPluginModuleResultController.new | ||
| 12 | - @request = ActionController::TestRequest.new | ||
| 13 | - @response = ActionController::TestResponse.new | ||
| 14 | - @profile = fast_create(Community) | ||
| 15 | - | ||
| 16 | - @module_result_hash = ModuleResultFixtures.module_result_hash | ||
| 17 | - @metric_result_hash = MetricResultFixtures.native_metric_result_hash | ||
| 18 | - @date_metric_result_hash = DateMetricResultFixtures.date_metric_result_hash | ||
| 19 | - @date_module_result_hash = DateModuleResultFixtures.date_module_result_hash | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - should 'find module result on kalibro' do | ||
| 23 | - parent_module_result = ModuleResultFixtures.parent_module_result_hash | ||
| 24 | - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id].to_i }). | ||
| 25 | - returns({:module_result => @module_result_hash}) | ||
| 26 | - Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id].to_i }). | ||
| 27 | - returns({:metric_result => @metric_result_hash}) | ||
| 28 | - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:parent_id].to_i }). | ||
| 29 | - returns({:module_result => parent_module_result}) | ||
| 30 | - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result_hash[:id].to_i}). | ||
| 31 | - returns({:module_result => nil}) | ||
| 32 | - get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] | ||
| 33 | - assert_equal @module_result_hash[:grade].to_f, assigns(:module_result).grade | ||
| 34 | - assert_equal @metric_result_hash[:value].to_f, assigns(:metric_results).first.value | ||
| 35 | - assert_response :success | ||
| 36 | - #TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | ||
| 37 | - end | ||
| 38 | - | ||
| 39 | - should 'get metric result history' do | ||
| 40 | - metric_name = @metric_result_hash[:configuration][:metric][:name] | ||
| 41 | - Kalibro::MetricResult.expects(:request).with(:history_of_metric, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id].to_i }). | ||
| 42 | - returns({:date_metric_result => @date_metric_result_hash}) | ||
| 43 | - get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name | ||
| 44 | - assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date | ||
| 45 | - assert_response :success | ||
| 46 | - #TODO assert_select | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - should 'get module result history' do | ||
| 50 | - Kalibro::ModuleResult.expects(:request).with(:history_of_module, { :module_result_id => @module_result_hash[:id].to_i }). | ||
| 51 | - returns({:date_module_result => @date_module_result_hash}) | ||
| 52 | - get :module_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] | ||
| 53 | - assert_equal DateTime.parse(@date_module_result_hash[:date]), assigns(:history).first.date | ||
| 54 | - assert_response :success | ||
| 55 | - #TODO assert_select | ||
| 56 | - end | ||
| 57 | - | ||
| 58 | -end |
plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb
| @@ -1,60 +0,0 @@ | @@ -1,60 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | ||
| 6 | - | ||
| 7 | - | ||
| 8 | -class MezuroPluginProcessingControllerTest < ActionController::TestCase | ||
| 9 | - def setup | ||
| 10 | - @controller = MezuroPluginProcessingController.new | ||
| 11 | - @request = ActionController::TestRequest.new | ||
| 12 | - @response = ActionController::TestResponse.new | ||
| 13 | - @profile = fast_create(Community) | ||
| 14 | - | ||
| 15 | - @repository_id = RepositoryFixtures.repository.id | ||
| 16 | - @processing = ProcessingFixtures.processing | ||
| 17 | - @processing_hash = ProcessingFixtures.processing_hash | ||
| 18 | - @processing_with_error_hash = ProcessingFixtures.processing_with_error_hash | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'render last processing state' do | ||
| 22 | - Kalibro::Processing.expects(:processing_of).with(@repository_id).returns(@processing) | ||
| 23 | - get :state, :profile => @profile.identifier, :repository_id => @repository_id | ||
| 24 | - assert_response :success | ||
| 25 | - assert_equal @processing.state, @response.body | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - should 'render a processing state in a specific date' do | ||
| 29 | - Kalibro::Processing.expects(:processing_with_date_of).with(@repository_id, @processing.date).returns(@processing) | ||
| 30 | - get :state, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date | ||
| 31 | - assert_response :success | ||
| 32 | - assert_equal @processing.state, @response.body | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'render processing with error' do | ||
| 36 | - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => false}) | ||
| 37 | - Kalibro::Processing.expects(:request).with(:last_processing, :repository_id => @repository_id).returns({:processing => @processing_with_error_hash}) | ||
| 38 | - get :processing, :profile => @profile.identifier, :repository_id => @repository_id | ||
| 39 | - assert_response :success | ||
| 40 | - assert_equal @processing_with_error_hash[:state], assigns(:processing).state | ||
| 41 | - #TODO How to assert from view? assert_select('h3', 'ERROR') | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'test project result without date' do | ||
| 45 | - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => true}) | ||
| 46 | - Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @processing_hash}) | ||
| 47 | - get :processing, :profile => @profile.identifier, :repository_id => @repository_id | ||
| 48 | - assert_response :success | ||
| 49 | - assert_select('h4', 'Last Result') | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'test project results from a specific date' do | ||
| 53 | - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:exists => true}) | ||
| 54 | - Kalibro::Processing.expects(:request).with(:first_processing_after, :repository_id => @repository_id, :date => @processing.date).returns({:processing => @processing_hash}) | ||
| 55 | - get :processing, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date | ||
| 56 | - assert_response :success | ||
| 57 | - assert_select('h4', 'Last Result') | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | -end |
plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb
| @@ -1,103 +0,0 @@ | @@ -1,103 +0,0 @@ | ||
| 1 | -require 'test_helper' | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | ||
| 6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_content_fixtures" | ||
| 7 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 8 | - | ||
| 9 | -class MezuroPluginRepositoryControllerTest < ActionController::TestCase | ||
| 10 | - | ||
| 11 | - def setup | ||
| 12 | - @controller = MezuroPluginRepositoryController.new | ||
| 13 | - @request = ActionController::TestRequest.new | ||
| 14 | - @response = ActionController::TestResponse.new | ||
| 15 | - @profile = fast_create(Community) | ||
| 16 | - | ||
| 17 | - @configuration = ConfigurationFixtures.configuration | ||
| 18 | - @repository_types = RepositoryFixtures.types | ||
| 19 | - @all_configurations = ConfigurationFixtures.all | ||
| 20 | - @repository = RepositoryFixtures.repository | ||
| 21 | - @repository_hash = RepositoryFixtures.hash | ||
| 22 | - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => name) | ||
| 23 | - @content.expects(:send_project_to_service).returns(nil) | ||
| 24 | - @content.save | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | - should 'set variables to create a new repository' do | ||
| 28 | - Kalibro::Repository.expects(:repository_types).returns(@repository_types) | ||
| 29 | - Kalibro::Configuration.expects(:all).returns(@all_configurations) | ||
| 30 | - | ||
| 31 | - get :new, :profile => @profile.identifier, :id => @content.id | ||
| 32 | - | ||
| 33 | - assert_equal @content.id, assigns(:project_content).id | ||
| 34 | - assert_equal @repository_types, assigns(:repository_types) | ||
| 35 | - assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first | ||
| 36 | - assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last | ||
| 37 | - assert_response :success | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'save a repository' do | ||
| 41 | - Kalibro::Repository.expects(:new).returns(@repository) | ||
| 42 | - @repository.expects(:save).with(@content.project_id).returns(true) | ||
| 43 | - @repository.expects(:process) | ||
| 44 | - get :save, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash | ||
| 45 | - assert @repository.errors.empty? | ||
| 46 | - assert_response :redirect | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - should 'not save a repository' do | ||
| 50 | - @repository.errors = [Exception.new] | ||
| 51 | - Kalibro::Repository.expects(:new).returns(@repository) | ||
| 52 | - @repository.expects(:save).with(@content.project_id).returns(false) | ||
| 53 | - get :save, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash | ||
| 54 | - assert !@repository.errors.empty? | ||
| 55 | - assert_response :redirect | ||
| 56 | - end | ||
| 57 | - | ||
| 58 | - should 'set variables to edit a repository' do | ||
| 59 | - Kalibro::Repository.expects(:repository_types).returns(@repository_types) | ||
| 60 | - Kalibro::Configuration.expects(:all).returns(@all_configurations) | ||
| 61 | - Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository]) | ||
| 62 | - | ||
| 63 | - get :edit, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id | ||
| 64 | - | ||
| 65 | - assert_equal @content.id, assigns(:project_content).id | ||
| 66 | - assert_equal @repository_types, assigns(:repository_types) | ||
| 67 | - assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first | ||
| 68 | - assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last | ||
| 69 | - assert_equal @repository, assigns(:repository) | ||
| 70 | - assert_response :success | ||
| 71 | - end | ||
| 72 | - | ||
| 73 | - should 'set variables to show a repository' do | ||
| 74 | - Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository]) | ||
| 75 | - Kalibro::Configuration.expects(:find).with(@repository.configuration_id).returns(@configuration) | ||
| 76 | - | ||
| 77 | - get :show, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id | ||
| 78 | - | ||
| 79 | - assert_equal @content.id, assigns(:project_content).id | ||
| 80 | - assert_equal @repository, assigns(:repository) | ||
| 81 | - assert_equal @configuration.name, assigns(:configuration_name) | ||
| 82 | - assert_response :success | ||
| 83 | - end | ||
| 84 | - | ||
| 85 | - should 'destroy a repository' do | ||
| 86 | - Kalibro::Repository.expects(:new).with(:id => @repository.id.to_s).returns(@repository) | ||
| 87 | - @repository.expects(:destroy) | ||
| 88 | - get :destroy, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id | ||
| 89 | - | ||
| 90 | - assert @repository.errors.empty? | ||
| 91 | - assert_response :redirect | ||
| 92 | - end | ||
| 93 | - | ||
| 94 | - should 'not destroy a repository' do | ||
| 95 | - @repository.errors = [Exception.new] | ||
| 96 | - Kalibro::Repository.expects(:new).with(:id => @repository.id.to_s).returns(@repository) | ||
| 97 | - @repository.expects(:destroy) | ||
| 98 | - get :destroy, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id | ||
| 99 | - | ||
| 100 | - #TODO verify if it is redirected to the right page | ||
| 101 | - assert_response :redirect | ||
| 102 | - end | ||
| 103 | -end |
plugins/mezuro/test/unit/kalibro/base_tool_test.rb
| @@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
| 3 | - | ||
| 4 | -class BaseToolTest < ActiveSupport::TestCase | ||
| 5 | - | ||
| 6 | - def setup | ||
| 7 | - @hash = BaseToolFixtures.base_tool_hash | ||
| 8 | - @base_tool = BaseToolFixtures.base_tool | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - should 'create base tool from hash' do | ||
| 12 | - assert_equal @hash[:name], Kalibro::BaseTool.new(@hash).name | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - should 'get base tool names' do | ||
| 16 | - names = ['Analizo', 'Checkstyle'] | ||
| 17 | - Kalibro::BaseTool.expects(:request).with(:all_base_tool_names).returns({:base_tool_name => names}) | ||
| 18 | - assert_equal names, Kalibro::BaseTool.all_names | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'get base tool by name' do | ||
| 22 | - request_body = {:base_tool_name => @base_tool.name} | ||
| 23 | - Kalibro::BaseTool.expects(:request).with(:get_base_tool, request_body).returns({:base_tool => @hash}) | ||
| 24 | - assert_equal @base_tool.name, Kalibro::BaseTool.find_by_name(@base_tool.name).name | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | -end |
plugins/mezuro/test/unit/kalibro/compound_metric_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_fixtures" | ||
| 4 | - | ||
| 5 | -class CompoundMetricTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = CompoundMetricFixtures.compound_metric_hash | ||
| 9 | - @metric = CompoundMetricFixtures.compound_metric | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create compound metric from hash' do | ||
| 13 | - assert_equal @hash[:script], Kalibro::CompoundMetric.new(@hash).script | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert compound metric to hash' do | ||
| 17 | - assert_equal @hash, @metric.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_with_error_fixtures" | ||
| 4 | - | ||
| 5 | -class CompoundMetricWithErrorTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = CompoundMetricWithErrorFixtures.compound_metric_with_error_hash | ||
| 9 | - @compound_metric_with_error = CompoundMetricWithErrorFixtures.compound_metric_with_error | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create error from hash' do | ||
| 13 | - assert_equal @hash[:error][:message], Kalibro::CompoundMetricWithError.new(@hash).error.message | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert error to hash' do | ||
| 17 | - assert_equal @hash, @compound_metric_with_error.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/configuration_test.rb
| @@ -1,60 +0,0 @@ | @@ -1,60 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 4 | - | ||
| 5 | -class ConfigurationTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ConfigurationFixtures.configuration_hash | ||
| 9 | - @configuration = ConfigurationFixtures.configuration | ||
| 10 | - @created_configuration = ConfigurationFixtures.created_configuration | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'initialize configuration' do | ||
| 14 | - assert_equal @hash[:name], Kalibro::Configuration.new(@hash).name | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'convert configuration to hash' do | ||
| 18 | - assert_equal @hash, @configuration.to_hash | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'answer if configuration exists in kalibro' do | ||
| 22 | - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => true}) | ||
| 23 | - assert Kalibro::Configuration.exists?(@configuration.id) | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - should 'find a configuration' do | ||
| 27 | - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => true}) | ||
| 28 | - Kalibro::Configuration.expects(:request).with(:get_configuration, {:configuration_id => @configuration.id}).returns(:configuration => @hash) | ||
| 29 | - assert_equal @hash[:name], Kalibro::Configuration.find(@configuration.id).name | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - should 'return exception when configuration doesnt exist' do | ||
| 33 | - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => false}) | ||
| 34 | - assert_raise(Kalibro::Errors::RecordNotFound){Kalibro::Configuration.find(@configuration.id)} | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - should 'get all configurations' do | ||
| 38 | - Kalibro::Configuration.expects(:request).with(:all_configurations).returns({:configuration => [@hash]}) | ||
| 39 | - assert_equal @hash[:name], Kalibro::Configuration.all.first.name | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - should 'return true when configuration is saved successfully' do | ||
| 43 | - id_from_kalibro = 1 | ||
| 44 | - Kalibro::Configuration.expects(:request).with(:save_configuration, {:configuration => @created_configuration.to_hash}).returns(:configuration_id => id_from_kalibro) | ||
| 45 | - assert @created_configuration.save | ||
| 46 | - assert_equal id_from_kalibro, @created_configuration.id | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - should 'return false when configuration is not saved successfully' do | ||
| 50 | - Kalibro::Configuration.expects(:request).with(:save_configuration, {:configuration => @created_configuration.to_hash}).raises(Exception.new) | ||
| 51 | - assert !(@created_configuration.save) | ||
| 52 | - assert_nil @created_configuration.id | ||
| 53 | - end | ||
| 54 | - | ||
| 55 | - should 'remove existent configuration from service' do | ||
| 56 | - Kalibro::Configuration.expects(:request).with(:delete_configuration, {:configuration_id => @configuration.id}) | ||
| 57 | - @configuration.destroy | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | -end |
plugins/mezuro/test/unit/kalibro/date_metric_result_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" | ||
| 4 | - | ||
| 5 | -class DateMetricResultTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = DateMetricResultFixtures.date_metric_result_hash | ||
| 9 | - @date_metric_result = DateMetricResultFixtures.date_metric_result | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create date_metric_result from hash' do | ||
| 13 | - assert_equal @hash[:metric_result][:id].to_i, Kalibro::DateMetricResult.new(@hash).metric_result.id | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert date_metric_result to hash' do | ||
| 17 | - assert_equal @hash, @date_metric_result.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/date_module_result_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_module_result_fixtures" | ||
| 4 | - | ||
| 5 | -class DateModuleResultTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = DateModuleResultFixtures.date_module_result_hash | ||
| 9 | - @date_module_result = DateModuleResultFixtures.date_module_result | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create date_module_result from hash' do | ||
| 13 | - assert_equal @hash[:module_result][:id].to_i, Kalibro::DateModuleResult.new(@hash).module_result.id | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert date_module_result to hash' do | ||
| 17 | - assert_equal @hash, @date_module_result.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/error_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" | ||
| 4 | - | ||
| 5 | -class ErrorTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ErrorFixtures.error_hash | ||
| 9 | - @error = ErrorFixtures.error | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create error from hash' do | ||
| 13 | - assert_equal @hash[:message], Kalibro::Error.new(@hash).message | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert error to hash' do | ||
| 17 | - assert_equal @hash, @error.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/metric_configuration_snapshot_test.rb
| @@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures" | ||
| 4 | - | ||
| 5 | -class MetricConfigurationSnapshotTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash | ||
| 9 | - @hash2 = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash_with_2_elements | ||
| 10 | - @metric_configuration_snapshot = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot | ||
| 11 | - @metric_configuration_snapshot2 = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_with_2_elements | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - should 'create and convert metric configuration snapshot from hash' do | ||
| 15 | - assert_equal @hash[:code], Kalibro::MetricConfigurationSnapshot.new(@hash).code | ||
| 16 | - assert_equal @hash[:weight].to_f, @metric_configuration_snapshot.weight | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - should 'create and convert metric configuration snapshot from hash with 2 elements' do | ||
| 20 | - assert_equal @hash2[:code], Kalibro::MetricConfigurationSnapshot.new(@hash2).code | ||
| 21 | - assert_equal @hash2, @metric_configuration_snapshot2.to_hash | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | -end |
plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb
| @@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 4 | - | ||
| 5 | -class MetricConfigurationTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @native_metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | ||
| 9 | - @native_metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash | ||
| 10 | - @created_metric_configuration = MetricConfigurationFixtures.created_metric_configuration | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'create metric configuration from hash' do | ||
| 14 | - metric_configuration = Kalibro::MetricConfiguration.new(@native_metric_configuration_hash) | ||
| 15 | - assert_equal @native_metric_configuration_hash[:code], metric_configuration.code | ||
| 16 | - assert_equal @native_metric_configuration_hash[:id].to_i, metric_configuration.id | ||
| 17 | - assert_equal @native_metric_configuration_hash[:reading_group_id].to_i, metric_configuration.reading_group_id | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - should 'convert metric configuration to hash' do | ||
| 21 | - assert_equal @native_metric_configuration_hash, @native_metric_configuration.to_hash | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - should 'get all metric configurations of a configuration' do | ||
| 25 | - configuration_id = 13 | ||
| 26 | - request_body = { :configuration_id => configuration_id } | ||
| 27 | - response_hash = {:metric_configuration => [@native_metric_configuration_hash]} | ||
| 28 | - Kalibro::MetricConfiguration.expects(:request).with(:metric_configurations_of, request_body).returns(response_hash) | ||
| 29 | - assert_equal @native_metric_configuration.code, Kalibro::MetricConfiguration.metric_configurations_of(configuration_id).first.code | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - should 'return true when metric configuration is saved successfully' do | ||
| 33 | - id_from_kalibro = 1 | ||
| 34 | - configuration_id = @created_metric_configuration.configuration_id | ||
| 35 | - Kalibro::MetricConfiguration.expects(:request).with(:save_metric_configuration, {:metric_configuration => @created_metric_configuration.to_hash, :configuration_id => configuration_id}).returns(:metric_configuration_id => id_from_kalibro) | ||
| 36 | - assert @created_metric_configuration.save | ||
| 37 | - assert_equal id_from_kalibro, @created_metric_configuration.id | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'return false when metric configuration is not saved successfully' do | ||
| 41 | - configuration_id = @created_metric_configuration.configuration_id | ||
| 42 | - Kalibro::MetricConfiguration.expects(:request).with(:save_metric_configuration, {:metric_configuration => @created_metric_configuration.to_hash, :configuration_id => configuration_id}).raises(Exception.new) | ||
| 43 | - assert !(@created_metric_configuration.save) | ||
| 44 | - assert_nil @created_metric_configuration.id | ||
| 45 | - end | ||
| 46 | - | ||
| 47 | - should 'destroy metric configuration' do | ||
| 48 | - Kalibro::MetricConfiguration.expects(:request).with(:delete_metric_configuration, :metric_configuration_id => @native_metric_configuration.id) | ||
| 49 | - @native_metric_configuration.destroy | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | -end |
plugins/mezuro/test/unit/kalibro/metric_result_test.rb
| @@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_result_fixtures" | ||
| 4 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" | ||
| 5 | - | ||
| 6 | -class MetricResultTest < ActiveSupport::TestCase | ||
| 7 | - | ||
| 8 | - def setup | ||
| 9 | - @native_hash = MetricResultFixtures.native_metric_result_hash | ||
| 10 | - @compound_hash = MetricResultFixtures.compound_metric_result_hash | ||
| 11 | - @result = MetricResultFixtures.native_metric_result | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - should 'create metric result from hash' do | ||
| 15 | - metric_result = Kalibro::MetricResult.new(@native_hash) | ||
| 16 | - assert_equal @native_hash[:configuration][:code], metric_result.configuration.code | ||
| 17 | - assert_equal @native_hash[:id].to_i, metric_result.id | ||
| 18 | - assert_equal @native_hash[:value].to_f, metric_result.value | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'create metric result with aggregated value from hash' do | ||
| 22 | - hash = @native_hash | ||
| 23 | - hash[:aggregated_value] = "2.0" | ||
| 24 | - hash[:value] = "NaN" | ||
| 25 | - metric_result = Kalibro::MetricResult.new(hash) | ||
| 26 | - assert_equal @native_hash[:aggregated_value].to_f, metric_result.value | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'convert metric result to hash' do | ||
| 30 | - assert_equal @native_hash, @result.to_hash | ||
| 31 | - end | ||
| 32 | - | ||
| 33 | - should 'return descendant results of a metric result' do | ||
| 34 | - descendant = [31, 13] | ||
| 35 | - Kalibro::MetricResult.expects(:request).with(:descendant_results_of, {:metric_result_id => @result.id}).returns({:descendant_result => descendant}) | ||
| 36 | - assert_equal descendant, @result.descendant_results | ||
| 37 | - end | ||
| 38 | - | ||
| 39 | - should 'return metric results of a module result' do | ||
| 40 | - id = 31 | ||
| 41 | - Kalibro::MetricResult.expects(:request).with(:metric_results_of, {:module_result_id => id}).returns(:metric_result => [@native_hash, @compound_hash]) | ||
| 42 | - assert_equal @native_hash[:id].to_i, Kalibro::MetricResult.metric_results_of(id).first.id | ||
| 43 | - end | ||
| 44 | - | ||
| 45 | - should 'return history of a metric with a module result id' do | ||
| 46 | - module_result_id = 31 | ||
| 47 | - Kalibro::MetricResult.expects(:request).with(:history_of_metric, {:metric_name => @result.configuration.metric.name, :module_result_id => module_result_id}).returns({:date_metric_result => DateMetricResultFixtures.date_metric_result_hash}) | ||
| 48 | - assert_equal DateMetricResultFixtures.date_metric_result_hash[:metric_result][:id].to_i, Kalibro::MetricResult.history_of(@result.configuration.metric.name, module_result_id).first.metric_result.id | ||
| 49 | - end | ||
| 50 | - | ||
| 51 | -end |
plugins/mezuro/test/unit/kalibro/metric_test.rb
| @@ -1,29 +0,0 @@ | @@ -1,29 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures" | ||
| 3 | - | ||
| 4 | -class MetricTest < ActiveSupport::TestCase | ||
| 5 | - | ||
| 6 | - def setup | ||
| 7 | - @native_hash = MetricFixtures.amloc_hash | ||
| 8 | - @native = MetricFixtures.amloc | ||
| 9 | - @compound_hash = MetricFixtures.compound_metric_hash | ||
| 10 | - @compound = MetricFixtures.compound_metric | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'create native metric from hash' do | ||
| 14 | - assert_equal @native_hash[:name], Kalibro::Metric.new(@native_hash).name | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'convert native metric to hash' do | ||
| 18 | - assert_equal @native_hash, @native.to_hash | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'create compound metric from hash' do | ||
| 22 | - assert_equal @compound_hash[:script], Kalibro::Metric.new(@compound_hash).script | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | - should 'convert compound metric to hash' do | ||
| 26 | - assert_equal @compound_hash, @compound.to_hash | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | -end |
plugins/mezuro/test/unit/kalibro/module_node_test.rb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_node_fixtures" | ||
| 3 | - | ||
| 4 | -class ModuleNodeTest < ActiveSupport::TestCase | ||
| 5 | - | ||
| 6 | - def setup | ||
| 7 | - @hash = ModuleNodeFixtures.module_node_hash | ||
| 8 | - @node = ModuleNodeFixtures.module_node | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - should 'create module node from hash' do | ||
| 12 | - assert_equal( @node.child[0].module.name, Kalibro::ModuleNode.new(@hash).child[0].module.name) | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - should 'convert children hash to array of ModuleNode' do | ||
| 16 | - assert_equal @hash, @node.to_hash | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | -end |
plugins/mezuro/test/unit/kalibro/module_result_test.rb
| @@ -1,49 +0,0 @@ | @@ -1,49 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_module_result_fixtures" | ||
| 4 | - | ||
| 5 | -class ModuleResultTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ModuleResultFixtures.module_result_hash | ||
| 9 | - @module_result = ModuleResultFixtures.module_result | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create module result' do | ||
| 13 | - module_result = Kalibro::ModuleResult.new(@hash) | ||
| 14 | - assert_equal @hash[:id].to_i , module_result.id | ||
| 15 | - assert_equal @hash[:grade].to_f , module_result.grade | ||
| 16 | - assert_equal @hash[:parent_id].to_i , module_result.parent_id | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - should 'convert module result to hash' do | ||
| 20 | - assert_equal @hash, @module_result.to_hash | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - should 'find module result' do | ||
| 24 | - response = {:module_result => @hash} | ||
| 25 | - Kalibro::ModuleResult.expects(:request).with(:get_module_result, {:module_result_id => @module_result.id}).returns(response) | ||
| 26 | - assert_equal @module_result.grade, Kalibro::ModuleResult.find(@module_result.id).grade | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'return children of a module result' do | ||
| 30 | - response = {:module_result => [@hash]} | ||
| 31 | - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result.id}).returns(response) | ||
| 32 | - assert @hash[:id], @module_result.children.first.id | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'return parents of a module result' do | ||
| 36 | - parent_module_result = ModuleResultFixtures.parent_module_result_hash | ||
| 37 | - response = {:module_result => parent_module_result} | ||
| 38 | - Kalibro::ModuleResult.expects(:request).with(:get_module_result, {:module_result_id => @module_result.parent_id}).returns(response) | ||
| 39 | - parents = @module_result.parents | ||
| 40 | - assert parent_module_result[:module][:name], parents.first.module.name | ||
| 41 | - assert parent_module_result[:module][:name], parents.last.module.name | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'return history of a module result' do | ||
| 45 | - Kalibro::ModuleResult.expects(:request).with(:history_of_module, {:module_result_id => @module_result.id}).returns({:date_module_result => [DateModuleResultFixtures.date_module_result_hash]}) | ||
| 46 | - assert_equal DateModuleResultFixtures.date_module_result_hash[:module_result][:id].to_i, Kalibro::ModuleResult.history_of(@module_result.id).first.module_result.id | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | -end |
plugins/mezuro/test/unit/kalibro/module_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" | ||
| 4 | - | ||
| 5 | -class ModuleTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ModuleFixtures.module_hash | ||
| 9 | - @module = ModuleFixtures.module | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create module from hash' do | ||
| 13 | - assert_equal @hash[:name], Kalibro::Module.new(@hash).name | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert module to hash' do | ||
| 17 | - assert_equal @hash, @module.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/native_metric_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" | ||
| 4 | - | ||
| 5 | -class NativeMetricTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = NativeMetricFixtures.amloc_hash | ||
| 9 | - @metric = NativeMetricFixtures.amloc | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create native metric from hash' do | ||
| 13 | - assert_equal @hash[:name], Kalibro::NativeMetric.new(@hash).name | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert native metric to hash' do | ||
| 17 | - assert_equal @hash, @metric.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/process_time_test.rb
| @@ -1,25 +0,0 @@ | @@ -1,25 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/process_time_fixtures" | ||
| 4 | - | ||
| 5 | -class ProcessTimeTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ProcessTimeFixtures.process_time_hash | ||
| 9 | - @process_time = ProcessTimeFixtures.process_time | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create process time from hash' do | ||
| 13 | - assert_equal @hash[:state], Kalibro::ProcessTime.new(@hash).state | ||
| 14 | - assert_equal @hash[:time].to_i, Kalibro::ProcessTime.new(@hash).time | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'convert process time to hash' do | ||
| 18 | - assert_equal @hash, @process_time.to_hash | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'get time as an integer' do | ||
| 22 | - assert_equal 1.class, @process_time.time.class | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | -end |
plugins/mezuro/test/unit/kalibro/processing_test.rb
| @@ -1,98 +0,0 @@ | @@ -1,98 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" | ||
| 4 | -class ProcessingTest < ActiveSupport::TestCase | ||
| 5 | - | ||
| 6 | - def setup | ||
| 7 | - @hash = ProcessingFixtures.processing_hash | ||
| 8 | - @processing = ProcessingFixtures.processing | ||
| 9 | - | ||
| 10 | - @repository_id = 31 | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'create processing from hash' do | ||
| 14 | - processing = Kalibro::Processing.new(@hash) | ||
| 15 | - assert_equal @hash[:results_root_id].to_i, processing.results_root_id | ||
| 16 | - assert_equal @hash[:process_time].first[:state], processing.process_times.first.state | ||
| 17 | - assert_equal @hash[:id].to_i, processing.id | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - should 'convert processing to hash' do | ||
| 21 | - assert_equal @hash, @processing.to_hash | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - should 'verify if a repository has a processing' do | ||
| 25 | - true_repository_id = 31 | ||
| 26 | - false_repository_id = 32 | ||
| 27 | - | ||
| 28 | - Kalibro::Processing.expects(:request).with(:has_processing, {:repository_id => true_repository_id}).returns({:exists => true}) | ||
| 29 | - Kalibro::Processing.expects(:request).with(:has_processing, {:repository_id => false_repository_id}).returns({:exists => false}) | ||
| 30 | - | ||
| 31 | - assert Kalibro::Processing.has_processing(true_repository_id) | ||
| 32 | - assert !Kalibro::Processing.has_processing(false_repository_id) | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'verify if a repository has a ready processing' do | ||
| 36 | - true_repository_id = 31 | ||
| 37 | - false_repository_id = 32 | ||
| 38 | - | ||
| 39 | - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => true_repository_id}).returns({:exists => true}) | ||
| 40 | - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => false_repository_id}).returns({:exists => false}) | ||
| 41 | - | ||
| 42 | - assert Kalibro::Processing.has_ready_processing(true_repository_id) | ||
| 43 | - assert !Kalibro::Processing.has_ready_processing(false_repository_id) | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - should 'verify if a repository has a processing after a date' do | ||
| 47 | - true_repository_id = 31 | ||
| 48 | - false_repository_id = 32 | ||
| 49 | - | ||
| 50 | - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => true_repository_id, :date => @processing.date}).returns({:exists => true}) | ||
| 51 | - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => false_repository_id, :date => @processing.date}).returns({:exists => false}) | ||
| 52 | - | ||
| 53 | - assert Kalibro::Processing.has_processing_after(true_repository_id, @processing.date) | ||
| 54 | - assert !Kalibro::Processing.has_processing_after(false_repository_id, @processing.date) | ||
| 55 | - end | ||
| 56 | - | ||
| 57 | - should 'verify if a repository has a processing before a date' do | ||
| 58 | - true_repository_id = 31 | ||
| 59 | - false_repository_id = 32 | ||
| 60 | - | ||
| 61 | - Kalibro::Processing.expects(:request).with(:has_processing_before, {:repository_id => true_repository_id, :date => @processing.date}).returns({:exists => true}) | ||
| 62 | - Kalibro::Processing.expects(:request).with(:has_processing_before, {:repository_id => false_repository_id, :date => @processing.date}).returns({:exists => false}) | ||
| 63 | - | ||
| 64 | - assert Kalibro::Processing.has_processing_before(true_repository_id, @processing.date) | ||
| 65 | - assert !Kalibro::Processing.has_processing_before(false_repository_id, @processing.date) | ||
| 66 | - end | ||
| 67 | - | ||
| 68 | - should 'get last processing state of a repository' do | ||
| 69 | - Kalibro::Processing.expects(:request).with(:last_processing_state, {:repository_id => @repository_id}).returns({:process_state => @processing.state}) | ||
| 70 | - assert_equal @processing.state, Kalibro::Processing.last_processing_state_of(@repository_id) | ||
| 71 | - end | ||
| 72 | - | ||
| 73 | - should 'get last ready processing of a repository' do | ||
| 74 | - Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @hash}) | ||
| 75 | - assert_equal @processing.id, Kalibro::Processing.last_ready_processing_of(@repository_id).id | ||
| 76 | - end | ||
| 77 | - | ||
| 78 | - should 'get first processing of a repository' do | ||
| 79 | - Kalibro::Processing.expects(:request).with(:first_processing, {:repository_id => @repository_id}).returns({:processing => @hash}) | ||
| 80 | - assert_equal @processing.id, Kalibro::Processing.first_processing_of(@repository_id).id | ||
| 81 | - end | ||
| 82 | - | ||
| 83 | - should 'get last processing of a repository' do | ||
| 84 | - Kalibro::Processing.expects(:request).with(:last_processing, {:repository_id => @repository_id}).returns({:processing => @hash}) | ||
| 85 | - assert_equal @processing.id, Kalibro::Processing.last_processing_of(@repository_id).id | ||
| 86 | - end | ||
| 87 | - | ||
| 88 | - should 'get first processing after a date of a repository' do | ||
| 89 | - Kalibro::Processing.expects(:request).with(:first_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:processing => @hash}) | ||
| 90 | - assert_equal @processing.id, Kalibro::Processing.first_processing_after(@repository_id, @processing.date).id | ||
| 91 | - end | ||
| 92 | - | ||
| 93 | - should 'get last processing before a date of a repository' do | ||
| 94 | - Kalibro::Processing.expects(:request).with(:last_processing_before, {:repository_id => @repository_id, :date => @processing.date}).returns({:processing => @hash}) | ||
| 95 | - assert_equal @processing.id, Kalibro::Processing.last_processing_before(@repository_id, @processing.date).id | ||
| 96 | - end | ||
| 97 | - | ||
| 98 | -end |
plugins/mezuro/test/unit/kalibro/project_result_test.rb
| @@ -1,88 +0,0 @@ | @@ -1,88 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" | ||
| 4 | - | ||
| 5 | -class ProjectResultTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ProjectResultFixtures.project_result_hash | ||
| 9 | - @project_result = ProjectResultFixtures.project_result | ||
| 10 | - | ||
| 11 | - @project_name = @project_result.project.name | ||
| 12 | - @date = @project_result.date | ||
| 13 | - @flag = DateTime.now.sec % 2 == 0 #random choose between true or false | ||
| 14 | - | ||
| 15 | - @request = {:project_name => @project_name} | ||
| 16 | - @request_with_date = {:project_name => @project_name, :date => @date} | ||
| 17 | - @flag_response = {:has_results => @flag} | ||
| 18 | - @result_response = {:project_result => @project_result.to_hash} | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'create project result from hash' do | ||
| 22 | - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.new(@hash).analysis_time | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | - should 'convert project result to hash' do | ||
| 26 | - assert_equal @hash, @project_result.to_hash | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'get last result' do | ||
| 30 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_last_result_of, @request).returns(@result_response) | ||
| 31 | - assert_equal @project_result.analysis_time , Kalibro::ProjectResult.last_result(@project_name).analysis_time | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - should 'get first result' do | ||
| 35 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_first_result_of, @request).returns(@result_response) | ||
| 36 | - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.first_result(@project_name).analysis_time | ||
| 37 | - end | ||
| 38 | - | ||
| 39 | - should 'get first result after date' do | ||
| 40 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_first_result_after, @request_with_date).returns(@result_response) | ||
| 41 | - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.first_result_after(@project_name, @date).analysis_time | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'get last result before date' do | ||
| 45 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_last_result_before, @request_with_date).returns(@result_response) | ||
| 46 | - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.last_result_before(@project_name, @date).analysis_time | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - should 'verify if project has results' do | ||
| 50 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_for, @request).returns(@flag_response) | ||
| 51 | - assert_equal @flag, Kalibro::ProjectResult.has_results?(@project_name) | ||
| 52 | - end | ||
| 53 | - | ||
| 54 | - should 'verify if project has results before date' do | ||
| 55 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_before, @request_with_date).returns(@flag_response) | ||
| 56 | - assert_equal @flag, Kalibro::ProjectResult.has_results_before?(@project_name, @date) | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | - should 'verify if project has results after date' do | ||
| 60 | - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_after, @request_with_date).returns(@flag_response) | ||
| 61 | - assert_equal @flag, Kalibro::ProjectResult.has_results_after?(@project_name, @date) | ||
| 62 | - end | ||
| 63 | - | ||
| 64 | - should 'retrieve formatted load time' do | ||
| 65 | - assert_equal '00:00:14', @project_result.formatted_load_time | ||
| 66 | - end | ||
| 67 | - | ||
| 68 | - should 'retrieve formatted analysis time' do | ||
| 69 | - assert_equal '00:00:01', @project_result.formatted_analysis_time | ||
| 70 | - end | ||
| 71 | - | ||
| 72 | - should 'retrive complex module' do | ||
| 73 | - assert_equal @hash[:source_tree][:child][0][:child].first, @project_result.node("org.Window").to_hash | ||
| 74 | - end | ||
| 75 | - | ||
| 76 | - should 'return source tree node when nil is given' do | ||
| 77 | - assert_equal @hash[:source_tree], @project_result.node(nil).to_hash | ||
| 78 | - end | ||
| 79 | - | ||
| 80 | - should 'return source tree node when project name is given' do | ||
| 81 | - assert_equal @hash[:source_tree], @project_result.node(@project_result.project.name).to_hash | ||
| 82 | - end | ||
| 83 | - | ||
| 84 | - should 'return correct node when module name is given' do | ||
| 85 | - assert_equal @hash[:source_tree][:child][2], @project_result.node("main").to_hash | ||
| 86 | - end | ||
| 87 | - | ||
| 88 | -end |
plugins/mezuro/test/unit/kalibro/project_test.rb
| @@ -1,75 +0,0 @@ | @@ -1,75 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" | ||
| 4 | - | ||
| 5 | -class ProjectTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ProjectFixtures.project_hash | ||
| 9 | - @project = ProjectFixtures.project | ||
| 10 | - @created_project = ProjectFixtures.created_project | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'initialize new project from hash' do | ||
| 14 | - project = Kalibro::Project.new @hash | ||
| 15 | - assert_equal @hash[:name], project.name | ||
| 16 | - assert_equal @hash[:id].to_i, project.id | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - should 'convert project to hash' do | ||
| 20 | - hash = @project.to_hash | ||
| 21 | - assert_equal @project.name, hash[:name] | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - should 'answer if project exists in kalibro' do | ||
| 25 | - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => true}) | ||
| 26 | - assert Kalibro::Project.exists?(@project.id) | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'find project' do | ||
| 30 | - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => true}) | ||
| 31 | - Kalibro::Project.expects(:request).with(:get_project, {:project_id => @project.id}).returns(:project => @hash) | ||
| 32 | - assert_equal @hash[:name], Kalibro::Project.find(@project.id).name | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'raise RecordNotFound exception when project doesnt exist' do | ||
| 36 | - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => false}) | ||
| 37 | - assert_raise(Kalibro::Errors::RecordNotFound){Kalibro::Project.find(@project.id)} | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'get all projects when there is only one project' do | ||
| 41 | - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => @hash}) | ||
| 42 | - assert_equal @hash[:name], Kalibro::Project.all.first.name | ||
| 43 | - end | ||
| 44 | - | ||
| 45 | - should 'get all projects when there are many projects' do | ||
| 46 | - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => [@hash, @hash]}) | ||
| 47 | - projects = Kalibro::Project.all | ||
| 48 | - assert_equal @hash[:name], projects.first.name | ||
| 49 | - assert_equal @hash[:name], projects.last.name | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'return empty when there are no projects' do | ||
| 53 | - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => nil}) | ||
| 54 | - assert_equal [], Kalibro::Project.all | ||
| 55 | - end | ||
| 56 | - | ||
| 57 | - should 'return true when project is saved successfully' do | ||
| 58 | - id_from_kalibro = 1 | ||
| 59 | - Kalibro::Project.expects(:request).with(:save_project, {:project => @created_project.to_hash}).returns(:project_id => id_from_kalibro) | ||
| 60 | - assert @created_project.save | ||
| 61 | - assert_equal id_from_kalibro, @created_project.id | ||
| 62 | - end | ||
| 63 | - | ||
| 64 | - should 'return false when project is not saved successfully' do | ||
| 65 | - Kalibro::Project.expects(:request).with(:save_project, {:project => @created_project.to_hash}).raises(Exception.new) | ||
| 66 | - assert !(@created_project.save) | ||
| 67 | - assert_nil @created_project.id | ||
| 68 | - end | ||
| 69 | - | ||
| 70 | - should 'remove existent project from service' do | ||
| 71 | - Kalibro::Project.expects(:request).with(:delete_project, {:project_id => @project.id}) | ||
| 72 | - @project.destroy | ||
| 73 | - end | ||
| 74 | - | ||
| 75 | -end |
plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb
| @@ -1,32 +0,0 @@ | @@ -1,32 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_snapshot_fixtures" | ||
| 4 | - | ||
| 5 | -class RangeSnapshotTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = RangeSnapshotFixtures.range_snapshot_hash | ||
| 9 | - @range_snapshot_with_infinite_range_hash = RangeSnapshotFixtures.range_snapshot_with_infinite_range_hash | ||
| 10 | - @range_snapshot = RangeSnapshotFixtures.range_snapshot | ||
| 11 | - @range_snapshot_with_infinite_range = RangeSnapshotFixtures.range_snapshot_with_infinite_range | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - should 'create range_snapshot from hash' do | ||
| 15 | - range_snapshot = Kalibro::RangeSnapshot.new(@hash) | ||
| 16 | - assert_equal @hash[:comments], range_snapshot.comments | ||
| 17 | - assert_equal @hash[:beginning].to_f, range_snapshot.beginning | ||
| 18 | - assert_equal @hash[:end].to_f, range_snapshot.end | ||
| 19 | - assert_equal @hash[:grade].to_f, range_snapshot.grade | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - should 'create range_snapshot from hash with infinity values' do | ||
| 23 | - range_snapshot = Kalibro::RangeSnapshot.new(@range_snapshot_with_infinite_range_hash) | ||
| 24 | - assert_equal -1.0/0, range_snapshot.beginning | ||
| 25 | - assert_equal 1.0/0, range_snapshot.end | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - should 'convert range_snapshot to hash' do | ||
| 29 | - assert_equal @hash, @range_snapshot.to_hash | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | -end |
plugins/mezuro/test/unit/kalibro/range_test.rb
| @@ -1,47 +0,0 @@ | @@ -1,47 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" | ||
| 4 | - | ||
| 5 | -class RangeTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = RangeFixtures.range_hash | ||
| 9 | - @range = RangeFixtures.range | ||
| 10 | - @created_range = RangeFixtures.created_range | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'create range from hash' do | ||
| 14 | - assert_equal @hash[:comments], Kalibro::Range.new(@hash).comments | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'convert range to hash' do | ||
| 18 | - assert_equal @hash, @range.to_hash | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'get ranges of a metric configuration' do | ||
| 22 | - metric_configuration_id = 31 | ||
| 23 | - Kalibro::Range.expects(:request).with(:ranges_of, {:metric_configuration_id => metric_configuration_id}).returns({:range => [@hash]}) | ||
| 24 | - assert_equal @hash[:comments], Kalibro::Range.ranges_of(metric_configuration_id).first.comments | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | - should 'return true when range is saved successfully' do | ||
| 28 | - id_from_kalibro = 1 | ||
| 29 | - metric_configuration_id = 2 | ||
| 30 | - Kalibro::Range.expects(:request).with(:save_range, {:range => @created_range.to_hash, :metric_configuration_id => metric_configuration_id}).returns(:range_id => id_from_kalibro) | ||
| 31 | - assert @created_range.save(metric_configuration_id) | ||
| 32 | - assert_equal id_from_kalibro, @created_range.id | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'return false when range is not saved successfully' do | ||
| 36 | - metric_configuration_id = 2 | ||
| 37 | - Kalibro::Range.expects(:request).with(:save_range, {:range => @created_range.to_hash, :metric_configuration_id => metric_configuration_id}).raises(Exception.new) | ||
| 38 | - assert !(@created_range.save(metric_configuration_id)) | ||
| 39 | - assert_nil @created_range.id | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - should 'destroy range by id' do | ||
| 43 | - Kalibro::Range.expects(:request).with(:delete_range, {:range_id => @range.id}) | ||
| 44 | - @range.destroy | ||
| 45 | - end | ||
| 46 | - | ||
| 47 | -end |
plugins/mezuro/test/unit/kalibro/reading_group_test.rb
| @@ -1,78 +0,0 @@ | @@ -1,78 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures" | ||
| 3 | - | ||
| 4 | -class ReadingGroupTest < ActiveSupport::TestCase | ||
| 5 | - | ||
| 6 | - def setup | ||
| 7 | - @hash = ReadingGroupFixtures.reading_group_hash | ||
| 8 | - @reading_group = ReadingGroupFixtures.reading_group | ||
| 9 | - @created_reading_group = ReadingGroupFixtures.created_reading_group | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create reading group from hash' do | ||
| 13 | - assert_equal @hash[:name], Kalibro::ReadingGroup.new(@hash).name | ||
| 14 | - assert_equal @hash[:id].to_i, Kalibro::ReadingGroup.new(@hash).id | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'convert reading group to hash' do | ||
| 18 | - assert_equal @hash, @reading_group.to_hash | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'verify existence of reading group' do | ||
| 22 | - fake_id = 0 | ||
| 23 | - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => fake_id}).returns({:exists => false}) | ||
| 24 | - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => @hash[:id].to_i}).returns({:exists => true}) | ||
| 25 | - assert !Kalibro::ReadingGroup.exists?(fake_id) | ||
| 26 | - assert Kalibro::ReadingGroup.exists?(@hash[:id].to_i) | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'get reading group' do | ||
| 30 | - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => @hash[:id]}).returns({:exists => true}) | ||
| 31 | - Kalibro::ReadingGroup.expects(:request).with(:get_reading_group, {:group_id => @hash[:id]}). | ||
| 32 | - returns({:reading_group => @hash}) | ||
| 33 | - assert_equal @hash[:name], Kalibro::ReadingGroup.find(@hash[:id]).name | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - should 'get all reading groups when there is only one reading group' do | ||
| 37 | - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => @hash}) | ||
| 38 | - assert_equal @hash[:name], Kalibro::ReadingGroup.all.first.name | ||
| 39 | - end | ||
| 40 | - | ||
| 41 | - should 'get all reading groups when there are many reading groups' do | ||
| 42 | - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => [@hash, @hash]}) | ||
| 43 | - reading_groups = Kalibro::ReadingGroup.all | ||
| 44 | - assert_equal @hash[:name], reading_groups.first.name | ||
| 45 | - assert_equal @hash[:name], reading_groups.last.name | ||
| 46 | - end | ||
| 47 | - | ||
| 48 | - should 'return empty when there are no reading groups' do | ||
| 49 | - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => nil}) | ||
| 50 | - assert_equal [], Kalibro::ReadingGroup.all | ||
| 51 | - end | ||
| 52 | - | ||
| 53 | - should 'get reading group of a metric configuration' do | ||
| 54 | - id = 31 | ||
| 55 | - Kalibro::ReadingGroup.expects(:request).with(:reading_group_of, {:metric_configuration_id => id}).returns({:reading_group => @hash}) | ||
| 56 | - assert_equal @hash[:name], Kalibro::ReadingGroup.reading_group_of(id).name | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | - should 'return true when reading group is saved successfully' do | ||
| 60 | - id_from_kalibro = 1 | ||
| 61 | - Kalibro::ReadingGroup.expects(:request).with(:save_reading_group, {:reading_group => @created_reading_group.to_hash}).returns(:reading_group_id => id_from_kalibro) | ||
| 62 | - assert @created_reading_group.save | ||
| 63 | - assert_equal id_from_kalibro, @created_reading_group.id | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | - should 'return false when reading group is not saved successfully' do | ||
| 67 | - Kalibro::ReadingGroup.expects(:request).with(:save_reading_group, {:reading_group => @created_reading_group.to_hash}).raises(Exception.new) | ||
| 68 | - assert !(@created_reading_group.save) | ||
| 69 | - assert_nil @created_reading_group.id | ||
| 70 | - end | ||
| 71 | - | ||
| 72 | - should 'destroy reading group by id' do | ||
| 73 | - Kalibro::ReadingGroup.expects(:request).with(:delete_reading_group, {:group_id => @reading_group.id}) | ||
| 74 | - @reading_group.destroy | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | -end | ||
| 78 | - |
plugins/mezuro/test/unit/kalibro/reading_test.rb
| @@ -1,59 +0,0 @@ | @@ -1,59 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" | ||
| 3 | - | ||
| 4 | -class ReadingTest < ActiveSupport::TestCase | ||
| 5 | - | ||
| 6 | - def setup | ||
| 7 | - @hash = ReadingFixtures.reading_hash | ||
| 8 | - @reading = ReadingFixtures.reading | ||
| 9 | - @created_reading = ReadingFixtures.created_reading | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create reading from hash' do | ||
| 13 | - assert_equal @hash[:label], Kalibro::Reading.new(@hash).label | ||
| 14 | - assert_equal @hash[:id].to_i, Kalibro::Reading.new(@hash).id | ||
| 15 | - assert_equal @hash[:grade].to_f, Kalibro::Reading.new(@hash).grade | ||
| 16 | - end | ||
| 17 | - | ||
| 18 | - should 'convert reading to hash' do | ||
| 19 | - assert_equal @hash, @reading.to_hash | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - should 'get reading' do | ||
| 23 | - Kalibro::Reading.expects(:request).with(:get_reading, {:reading_id => @hash[:id]}). | ||
| 24 | - returns({:reading => @hash}) | ||
| 25 | - assert_equal @hash[:label], Kalibro::Reading.find(@hash[:id]).label | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - should 'get reading of a range' do | ||
| 29 | - range_id = 31 | ||
| 30 | - Kalibro::Reading.expects(:request).with(:reading_of, {:range_id => range_id}).returns({:reading => @hash}) | ||
| 31 | - assert_equal @hash[:label], Kalibro::Reading.reading_of(range_id).label | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - should 'get readings of a reading group' do | ||
| 35 | - reading_group_id = 31 | ||
| 36 | - Kalibro::Reading.expects(:request).with(:readings_of, {:group_id => reading_group_id}).returns({:reading => [@hash]}) | ||
| 37 | - assert_equal @hash[:label], Kalibro::Reading.readings_of(reading_group_id).first.label | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'return true when reading is saved successfully' do | ||
| 41 | - id_from_kalibro = 1 | ||
| 42 | - Kalibro::Reading.expects(:request).with(:save_reading, {:group_id => @created_reading.group_id, :reading => @created_reading.to_hash}).returns(:reading_id => id_from_kalibro) | ||
| 43 | - assert @created_reading.save | ||
| 44 | - assert_equal id_from_kalibro, @created_reading.id | ||
| 45 | - end | ||
| 46 | - | ||
| 47 | - should 'return false when reading is not saved successfully' do | ||
| 48 | - Kalibro::Reading.expects(:request).with(:save_reading, {:group_id => @created_reading.group_id, :reading => @created_reading.to_hash}).raises(Exception.new) | ||
| 49 | - assert !(@created_reading.save) | ||
| 50 | - assert_nil @created_reading.id | ||
| 51 | - end | ||
| 52 | - | ||
| 53 | - should 'destroy reading by id' do | ||
| 54 | - Kalibro::Reading.expects(:request).with(:delete_reading, {:reading_id => @reading.id}) | ||
| 55 | - @reading.destroy | ||
| 56 | - end | ||
| 57 | - | ||
| 58 | -end | ||
| 59 | - |
plugins/mezuro/test/unit/kalibro/repository_test.rb
| @@ -1,65 +0,0 @@ | @@ -1,65 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" | ||
| 4 | - | ||
| 5 | -class RepositoryTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = RepositoryFixtures.repository_hash | ||
| 9 | - @repository = RepositoryFixtures.repository | ||
| 10 | - @created_repository = RepositoryFixtures.created_repository | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'new repository from hash' do | ||
| 14 | - repository = Kalibro::Repository.new(@hash) | ||
| 15 | - assert_equal @hash[:type], repository.type | ||
| 16 | - assert_equal @hash[:id].to_i, repository.id | ||
| 17 | - assert_equal @hash[:process_period].to_i, repository.process_period | ||
| 18 | - assert_equal @hash[:configuration_id].to_i, repository.configuration_id | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'convert repository to hash' do | ||
| 22 | - assert_equal @hash, @repository.to_hash | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | - should 'get supported repository types' do | ||
| 26 | - types = ['BAZAAR', 'GIT', 'SUBVERSION'] | ||
| 27 | - Kalibro::Repository.expects(:request).with(:supported_repository_types).returns({:supported_type => types}) | ||
| 28 | - assert_equal types, Kalibro::Repository.repository_types | ||
| 29 | - end | ||
| 30 | - | ||
| 31 | - should 'get repositories of a project' do | ||
| 32 | - project_id = 31 | ||
| 33 | - Kalibro::Repository.expects(:request).with(:repositories_of, {:project_id => project_id}).returns({:repository => [@hash]}) | ||
| 34 | - assert_equal @hash[:name], Kalibro::Repository.repositories_of(project_id).first.name | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - should 'return true when repository is saved successfully' do | ||
| 38 | - id_from_kalibro = 1 | ||
| 39 | - Kalibro::Repository.expects(:request).with(:save_repository, {:repository => @created_repository.to_hash, :project_id => @created_repository.project_id}).returns(:repository_id => id_from_kalibro) | ||
| 40 | - assert @created_repository.save | ||
| 41 | - assert_equal id_from_kalibro, @created_repository.id | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'return false when repository is not saved successfully' do | ||
| 45 | - Kalibro::Repository.expects(:request).with(:save_repository, {:repository => @created_repository.to_hash, :project_id => @created_repository.project_id}).raises(Exception.new) | ||
| 46 | - assert !(@created_repository.save) | ||
| 47 | - assert_nil @created_repository.id | ||
| 48 | - end | ||
| 49 | - | ||
| 50 | - should 'destroy repository by id' do | ||
| 51 | - Kalibro::Repository.expects(:request).with(:delete_repository, {:repository_id => @repository.id}) | ||
| 52 | - @repository.destroy | ||
| 53 | - end | ||
| 54 | - | ||
| 55 | - should 'process repository' do | ||
| 56 | - Kalibro::Repository.expects(:request).with(:process_repository, {:repository_id => @repository.id}); | ||
| 57 | - @repository.process | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - should 'cancel processing of a repository' do | ||
| 61 | - Kalibro::Repository.expects(:request).with(:cancel_processing_of_repository, {:repository_id => @repository.id}); | ||
| 62 | - @repository.cancel_processing_of_repository | ||
| 63 | - end | ||
| 64 | - | ||
| 65 | -end |
plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures" | ||
| 4 | - | ||
| 5 | -class StackTraceElementTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = StackTraceElementFixtures.stack_trace_element_hash | ||
| 9 | - @stack_trace_element = StackTraceElementFixtures.stack_trace_element | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create stack trace element from hash' do | ||
| 13 | - assert_equal @hash[:method_name], Kalibro::StackTraceElement.new(@hash).method_name | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert stack trace element to hash' do | ||
| 17 | - assert_equal @hash, @stack_trace_element.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/kalibro/throwable_test.rb
| @@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures" | ||
| 4 | - | ||
| 5 | -class ThrowableTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @hash = ThrowableFixtures.throwable_hash | ||
| 9 | - @throwable = ThrowableFixtures.throwable | ||
| 10 | - end | ||
| 11 | - | ||
| 12 | - should 'create throwable from hash' do | ||
| 13 | - assert_equal @hash[:message], Kalibro::Throwable.new(@hash).message | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'convert throwable to hash' do | ||
| 17 | - assert_equal @hash, @throwable.to_hash | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | -end |
plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb
| @@ -1,90 +0,0 @@ | @@ -1,90 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 4 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_content_fixtures" | ||
| 5 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 6 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" | ||
| 7 | - | ||
| 8 | -class ConfigurationContentTest < ActiveSupport::TestCase | ||
| 9 | - | ||
| 10 | - def setup | ||
| 11 | - @configuration = ConfigurationFixtures.configuration | ||
| 12 | - @content = ConfigurationContentFixtures.configuration_content | ||
| 13 | - @created_configuration = ConfigurationFixtures.created_configuration | ||
| 14 | - @content_hash = ConfigurationContentFixtures.configuration_content_hash | ||
| 15 | - @configuration_hash = {:name => @content_hash[:name], :description => @content_hash[:description], :id => @content_hash[:configuration_id]} | ||
| 16 | - @created_content = ConfigurationContentFixtures.created_configuration_content | ||
| 17 | - | ||
| 18 | - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | ||
| 19 | - @range = RangeFixtures.range | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - should 'be an article' do | ||
| 23 | - assert_kind_of Article, @content | ||
| 24 | - end | ||
| 25 | - | ||
| 26 | - should 'provide proper short description' do | ||
| 27 | - assert_equal 'Mezuro configuration', MezuroPlugin::ConfigurationContent.short_description | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | - should 'provide proper description' do | ||
| 31 | - assert_equal 'Set of metric configurations to interpret a Kalibro project', MezuroPlugin::ConfigurationContent.description | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - should 'have an html view' do | ||
| 35 | - assert_not_nil @content.to_html | ||
| 36 | - end | ||
| 37 | - | ||
| 38 | - should 'not save a configuration with an existing cofiguration name in kalibro' do | ||
| 39 | - Kalibro::Configuration.expects(:all).returns([@configuration]) | ||
| 40 | - @content.send :validate_configuration_name | ||
| 41 | - assert_equal "Configuration name already exists in Kalibro", @content.errors.on_base | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'get configuration from service' do | ||
| 45 | - Kalibro::Configuration.expects(:find).with(@content.configuration_id).returns(@configuration) | ||
| 46 | - assert_equal @configuration, @content.kalibro_configuration | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | - should 'send configuration to service after saving' do | ||
| 50 | - @content.expects :send_configuration_to_service | ||
| 51 | - @content.run_callbacks :before_save | ||
| 52 | - end | ||
| 53 | - | ||
| 54 | - should 'create new configuration' do | ||
| 55 | - Kalibro::Configuration.expects(:create).with(:name => @created_content.name, :description => @created_content.description, :id => nil).returns(@configuration) | ||
| 56 | - @created_content.send :send_configuration_to_service | ||
| 57 | - assert_equal @configuration.id, @created_content.configuration_id | ||
| 58 | - end | ||
| 59 | - | ||
| 60 | - should 'clone configuration' do | ||
| 61 | - clone_id = @configuration.id | ||
| 62 | - @content.configuration_to_clone_id = clone_id | ||
| 63 | - Kalibro::Configuration.expects(:create).with(:id => @content.configuration_id, :name => @content.name, :description => @content.description).returns(@configuration) | ||
| 64 | - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@metric_configuration]) | ||
| 65 | - Kalibro::MetricConfiguration.expects(:request).returns(:metric_configuration_id => @metric_configuration.id) | ||
| 66 | - Kalibro::Range.expects(:ranges_of).with(@metric_configuration.id).returns([@range]) | ||
| 67 | - @range.expects(:save).with(@metric_configuration.id).returns(true) | ||
| 68 | - @content.send :send_configuration_to_service | ||
| 69 | - end | ||
| 70 | - | ||
| 71 | - should 'edit configuration' do | ||
| 72 | - Kalibro::Configuration.expects(:new).with(@configuration_hash).returns(@configuration) | ||
| 73 | - @configuration.expects(:save).returns(true) | ||
| 74 | - @content.send :send_configuration_to_service | ||
| 75 | - assert_equal @configuration.id, @content.configuration_id | ||
| 76 | - end | ||
| 77 | - | ||
| 78 | - should 'send correct configuration to service but comunication fails' do | ||
| 79 | - Kalibro::Configuration.expects(:new).with(@configuration_hash).returns(@created_configuration) | ||
| 80 | - @created_configuration.expects(:save).returns(false) | ||
| 81 | - @content.send :send_configuration_to_service | ||
| 82 | - end | ||
| 83 | - | ||
| 84 | - should 'remove configuration from service' do | ||
| 85 | - Kalibro::Configuration.expects(:find).with(@content.configuration_id).returns(@configuration) | ||
| 86 | - @configuration.expects(:destroy) | ||
| 87 | - @content.send :remove_configuration_from_service | ||
| 88 | - end | ||
| 89 | - | ||
| 90 | -end |
plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb
| @@ -1,65 +0,0 @@ | @@ -1,65 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures" | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" | ||
| 4 | - | ||
| 5 | -class ContentViewerHelperTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @helper = MezuroPlugin::Helpers::ContentViewerHelper | ||
| 9 | - end | ||
| 10 | - | ||
| 11 | - should 'get the number rounded by two decimal points' do | ||
| 12 | - assert_equal '4.22', @helper.format_grade('4.22344') | ||
| 13 | - assert_equal '4.10', @helper.format_grade('4.1') | ||
| 14 | - assert_equal '4.00', @helper.format_grade('4') | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'create the periodicity options array' do | ||
| 18 | - assert_equal [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]], @helper.periodicity_options | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'return the correct string for a given periodicity' do | ||
| 22 | - assert_equal "Not Periodically", @helper.periodicity_option(0) | ||
| 23 | - assert_equal "1 day", @helper.periodicity_option(1) | ||
| 24 | - assert_equal "2 days", @helper.periodicity_option(2) | ||
| 25 | - assert_equal "Weekly", @helper.periodicity_option(7) | ||
| 26 | - assert_equal "Biweekly", @helper.periodicity_option(15) | ||
| 27 | - assert_equal "Monthly", @helper.periodicity_option(30) | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | - should 'create the license options array' do | ||
| 31 | - options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yml") | ||
| 32 | - options = options.split("; ") | ||
| 33 | - assert_equal options, @helper.license_options | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - should 'generate chart from metric result history' do | ||
| 37 | - chart = "http://chart.apis.google.com/chart?chxt=y,x&chco=c4a000&chf=bg,ls,90,efefef,0.2,ffffff,0.2&chd=s:A9&chl=2011-10-20T18%3A26%3A43%2B00%3A00|2011-10-25T18%3A26%3A43%2B00%3A00&cht=lc&chs=600x180&chxr=0,0.0,5.0" | ||
| 38 | - metric_history = DateMetricResultFixtures.score_history | ||
| 39 | - | ||
| 40 | - assert_equal chart, @helper.generate_chart(metric_history) | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - should 'format time to show a sentence' do | ||
| 44 | - assert_equal 'less than 5 seconds', @helper.format_time(0) | ||
| 45 | - assert_equal 'less than 5 seconds', @helper.format_time(4999) | ||
| 46 | - assert_equal 'less than 10 seconds', @helper.format_time(5000) | ||
| 47 | - assert_equal '1 minute', @helper.format_time(70000) | ||
| 48 | - assert_equal 'about 2 hours', @helper.format_time(7000000) | ||
| 49 | - end | ||
| 50 | - | ||
| 51 | - should 'format metric name for metric configuration snapshot' do | ||
| 52 | - metric_configuration_snapshot = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot | ||
| 53 | - assert_equal 'AverageMethodLOC', @helper.format_name(metric_configuration_snapshot) | ||
| 54 | - end | ||
| 55 | - | ||
| 56 | - should 'create aggregation options array' do | ||
| 57 | - assert_equal [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
| 58 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]], @helper.aggregation_options | ||
| 59 | - end | ||
| 60 | - | ||
| 61 | - should 'create scope options' do | ||
| 62 | - assert_equal [["Software", "SOFTWARE"], ["Package", "PACKAGE"], ["Class", "CLASS"], ["Method", "METHOD"]], @helper.scope_options | ||
| 63 | - end | ||
| 64 | - | ||
| 65 | -end |
plugins/mezuro/test/unit/mezuro_plugin/helpers/module_result_helper_test.rb
| @@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -class ModuleResultHelperTest < ActiveSupport::TestCase | ||
| 4 | - | ||
| 5 | - should 'return last module name when receive a string' do | ||
| 6 | - name = 'Class' | ||
| 7 | - assert_equal name, MezuroPlugin::Helpers::ModuleResultHelper.module_name(name) | ||
| 8 | - end | ||
| 9 | - | ||
| 10 | - should 'return last module name when receive an array of strings' do | ||
| 11 | - name = ['Class', 'Module'] | ||
| 12 | - assert_equal name.last, MezuroPlugin::Helpers::ModuleResultHelper.module_name(name) | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | -end |
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
| @@ -1,59 +0,0 @@ | @@ -1,59 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" | ||
| 4 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_content_fixtures" | ||
| 5 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/processing_fixtures" | ||
| 6 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" | ||
| 7 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
| 8 | -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" | ||
| 9 | - | ||
| 10 | -class ProjectContentTest < ActiveSupport::TestCase | ||
| 11 | - | ||
| 12 | - def setup | ||
| 13 | - @project_content = ProjectContentFixtures.project_content | ||
| 14 | - @project = ProjectFixtures.project | ||
| 15 | - @repository = RepositoryFixtures.repository | ||
| 16 | - @processing = ProcessingFixtures.processing | ||
| 17 | - @date = @processing.date | ||
| 18 | - @module = ModuleFixtures.module | ||
| 19 | - @module_result = ModuleResultFixtures.module_result | ||
| 20 | - @date_metric_result = DateMetricResultFixtures.date_metric_result | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - should 'provide proper short description' do | ||
| 24 | - assert_equal 'Mezuro project', MezuroPlugin::ProjectContent.short_description | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | - should 'provide proper description' do | ||
| 28 | - assert_equal 'Software project tracked by Kalibro', MezuroPlugin::ProjectContent.description | ||
| 29 | - end | ||
| 30 | - | ||
| 31 | - should 'have an html view' do | ||
| 32 | - assert_not_nil @project_content.to_html | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - should 'get project from service' do | ||
| 36 | - Kalibro::Project.expects(:find).with(@project.id).returns(@project) | ||
| 37 | - assert_equal @project, @project_content.project | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'add error to base when the project does not exist' do | ||
| 41 | - Kalibro::Project.expects(:find).with(@project.id).raises(Kalibro::Errors::RecordNotFound) | ||
| 42 | - assert_nil @project_content.errors[:base] | ||
| 43 | - @project_content.project | ||
| 44 | - assert_not_nil @project_content.errors[:base] | ||
| 45 | - end | ||
| 46 | - | ||
| 47 | - should 'get repositories of the project from service' do | ||
| 48 | - Kalibro::Repository.expects(:repositories_of).with(@project.id).returns([@repository]) | ||
| 49 | - assert_equal [@repository], @project_content.repositories | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'add error to base when getting the repositories of a project that does not exist' do | ||
| 53 | - Kalibro::Repository.expects(:repositories_of).with(@project.id).raises(Kalibro::Errors::RecordNotFound) | ||
| 54 | - assert_nil @project_content.errors[:base] | ||
| 55 | - @project_content.repositories | ||
| 56 | - assert_not_nil @project_content.errors[:base] | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | -end |
plugins/mezuro/test/unit/mezuro_plugin/reading_group_content_test.rb
| @@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_content_fixtures" | ||
| 6 | - | ||
| 7 | -class ReadingGroupContentTest < ActiveSupport::TestCase | ||
| 8 | - | ||
| 9 | - def setup | ||
| 10 | - @reading_group_content = ReadingGroupContentFixtures.reading_group_content | ||
| 11 | - @reading_group = ReadingGroupFixtures.reading_group | ||
| 12 | - @reading = ReadingFixtures.reading | ||
| 13 | - end | ||
| 14 | - | ||
| 15 | - should 'provide proper short description' do | ||
| 16 | - assert_equal 'Mezuro reading group', MezuroPlugin::ReadingGroupContent.short_description | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - should 'provide proper description' do | ||
| 20 | - assert_equal 'Set of thresholds to interpret metric results', MezuroPlugin::ReadingGroupContent.description | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - should 'have an html view' do | ||
| 24 | - assert_not_nil @reading_group_content.to_html | ||
| 25 | - end | ||
| 26 | - | ||
| 27 | - should 'get reading_group from service' do | ||
| 28 | - Kalibro::ReadingGroup.expects(:find).with(@reading_group.id).returns(@reading_group) | ||
| 29 | - assert_equal @reading_group, @reading_group_content.reading_group | ||
| 30 | - end | ||
| 31 | - | ||
| 32 | - should 'add error to base when the reading_group does not exist' do | ||
| 33 | - Kalibro::ReadingGroup.expects(:find).with(@reading_group.id).raises(Kalibro::Errors::RecordNotFound) | ||
| 34 | - assert_nil @reading_group_content.errors[:base] | ||
| 35 | - @reading_group_content.reading_group | ||
| 36 | - assert_not_nil @reading_group_content.errors[:base] | ||
| 37 | - end | ||
| 38 | - | ||
| 39 | - should 'get readings of the reading_group from service' do | ||
| 40 | - Kalibro::Reading.expects(:readings_of).with(@reading_group.id).returns([@reading]) | ||
| 41 | - assert_equal [@reading], @reading_group_content.readings | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - should 'add error to base when getting the readings of a reading_group that does not exist' do | ||
| 45 | - Kalibro::Reading.expects(:readings_of).with(@reading_group.id).raises(Kalibro::Errors::RecordNotFound) | ||
| 46 | - assert_nil @reading_group_content.errors[:base] | ||
| 47 | - @reading_group_content.readings | ||
| 48 | - assert_not_nil @reading_group_content.errors[:base] | ||
| 49 | - end | ||
| 50 | - | ||
| 51 | -end |
plugins/mezuro/test/unit/mezuro_plugin_test.rb
| @@ -1,25 +0,0 @@ | @@ -1,25 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -class MezuroPluginTest < ActiveSupport::TestCase | ||
| 4 | - | ||
| 5 | - def setup | ||
| 6 | - @plugin = MezuroPlugin.new | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - should 'be a noosfero plugin' do | ||
| 10 | - assert_kind_of Noosfero::Plugin, @plugin | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'have name' do | ||
| 14 | - assert_equal 'Mezuro', MezuroPlugin.plugin_name | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'have description' do | ||
| 18 | - assert_equal _('A metric analizer plugin.'), MezuroPlugin.plugin_description | ||
| 19 | - end | ||
| 20 | - | ||
| 21 | - should 'have stylesheet' do | ||
| 22 | - assert @plugin.stylesheet? | ||
| 23 | - end | ||
| 24 | - | ||
| 25 | -end |
plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -<h1> <%= _(MezuroPlugin::ConfigurationContent.short_description) %> </h1> | ||
| 2 | - | ||
| 3 | -<% | ||
| 4 | - kalibro_configuration = @article.title.nil? ? nil : @article.kalibro_configuration | ||
| 5 | - configuration_names_and_ids = @article.configuration_names_and_ids | ||
| 6 | -%> | ||
| 7 | - | ||
| 8 | -<%= error_messages_for 'kalibro_configuration' %> | ||
| 9 | - | ||
| 10 | - | ||
| 11 | -<%= hidden_field_tag 'configuration_content[profile_id]', profile.id %> | ||
| 12 | -<%= hidden_field_tag 'configuration_id', @article.configuration_id %> | ||
| 13 | -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %> | ||
| 14 | - | ||
| 15 | -<br/> | ||
| 16 | -<%= if kalibro_configuration.nil? | ||
| 17 | - required labelled_form_field _('Clone Configuration'), | ||
| 18 | - f.select(:configuration_to_clone_id, configuration_names_and_ids) | ||
| 19 | -end %> |
plugins/mezuro/views/cms/mezuro_plugin/_mezuro_content_form.html.erb
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
| @@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
| 1 | -<h1> <%= _(MezuroPlugin::ProjectContent.short_description) %> </h1> | ||
| 2 | - | ||
| 3 | -<% | ||
| 4 | - @project = @article.title.nil? ? nil : @article.project | ||
| 5 | -%> | ||
| 6 | - | ||
| 7 | -<%= error_messages_for 'project_content' %> | ||
| 8 | - | ||
| 9 | -<%= hidden_field_tag 'project_content[profile_id]', profile.id %> | ||
| 10 | -<%= hidden_field_tag 'project_id', @article.project_id %> | ||
| 11 | -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %> |
plugins/mezuro/views/cms/mezuro_plugin/_reading_group_content.html.erb
| @@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
| 1 | -<h1> <%= _(MezuroPlugin::ReadingGroupContent.short_description) %> </h1> | ||
| 2 | - | ||
| 3 | -<% | ||
| 4 | - reading_group = @article.title.nil? ? nil : @article.reading_group | ||
| 5 | -%> | ||
| 6 | - | ||
| 7 | -<%= error_messages_for 'reading_group_content' %> | ||
| 8 | - | ||
| 9 | -<%= hidden_field_tag 'reading_group_content[profile_id]', profile.id %> | ||
| 10 | -<%= hidden_field_tag 'reading_group_id', (reading_group.id unless reading_group.nil?) %> | ||
| 11 | -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %> |
plugins/mezuro/views/content_viewer/show_configuration.rhtml
| @@ -1,77 +0,0 @@ | @@ -1,77 +0,0 @@ | ||
| 1 | -<% @configuration_content = @page | ||
| 2 | -@kalibro_configuration = @page.kalibro_configuration %> | ||
| 3 | -<!-- #TODO check owner verification to remove or edit metric configuration --> | ||
| 4 | -<% owner = (not user.nil?) && user.id == @profile.id %> | ||
| 5 | -<% unless @page.errors[:base].nil? %> | ||
| 6 | - <% if @page.errors[:base] =~ /Kalibro::Errors::RecordNotFound/ %> | ||
| 7 | - <h3>Warning:</h3> | ||
| 8 | - <p>This Configuration doesn't exist on the Web Service.</p> | ||
| 9 | - <% if owner %> | ||
| 10 | - <p> Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | ||
| 11 | - <% end %> | ||
| 12 | - <% else %> | ||
| 13 | - <%= @page.errors[:base] %> | ||
| 14 | - <% end %> | ||
| 15 | -<% else %> | ||
| 16 | - | ||
| 17 | - <table id="project_info"> | ||
| 18 | - <tr> | ||
| 19 | - <td><%= _('Name') %></td> | ||
| 20 | - <td><%= @kalibro_configuration.name %></td> | ||
| 21 | - </tr> | ||
| 22 | - <tr> | ||
| 23 | - <td><%= _('Description') %></td> | ||
| 24 | - <td><%= @kalibro_configuration.description %></td> | ||
| 25 | - </tr> | ||
| 26 | - </table> | ||
| 27 | - | ||
| 28 | - <br/> | ||
| 29 | - | ||
| 30 | - <% if owner %> | ||
| 31 | - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_metric_configuration", | ||
| 32 | - :profile => @page.profile.identifier, | ||
| 33 | - :action => "choose_metric", | ||
| 34 | - :id => @configuration_content.id %><br/> | ||
| 35 | - <% end %> | ||
| 36 | - | ||
| 37 | - <table> | ||
| 38 | - <tr class="titles"> | ||
| 39 | - <td><h5>Metric Name</h5></td> | ||
| 40 | - <td><h5>Collector Name</h5></td> | ||
| 41 | - <td><h5>Metric Code</h5></td> | ||
| 42 | - <td><h5>Weight</h5></td> | ||
| 43 | - <td><h5>Aggregation Form</h5></td> | ||
| 44 | - <td/> | ||
| 45 | - </tr> | ||
| 46 | - <% @configuration_content.metric_configurations.each do |metric_configuration| %> | ||
| 47 | - <tr class="metric"> | ||
| 48 | - <% if metric_configuration.metric.compound | ||
| 49 | - edit_action = "edit_compound" | ||
| 50 | - else | ||
| 51 | - edit_action = "edit_native" | ||
| 52 | - end | ||
| 53 | - %> | ||
| 54 | - <td><%= link_to metric_configuration.metric.name, :controller => "mezuro_plugin_metric_configuration", :action => edit_action, | ||
| 55 | - :metric_configuration_id => metric_configuration.id, :id => @configuration_content.id, | ||
| 56 | - :profile => @page.profile.identifier %></td> | ||
| 57 | - <% if metric_configuration.metric.compound %> | ||
| 58 | - <td> | ||
| 59 | - Compound Metric | ||
| 60 | - </td> | ||
| 61 | - <% else %> | ||
| 62 | - <td> | ||
| 63 | - <%= metric_configuration.base_tool_name %> | ||
| 64 | - </td> | ||
| 65 | - <% end %> | ||
| 66 | - <td><%= metric_configuration.code %></td> | ||
| 67 | - <td><%= metric_configuration.weight %></td> | ||
| 68 | - <td><%= metric_configuration.aggregation_form %></td> | ||
| 69 | - <% if owner %> | ||
| 70 | - <td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove", | ||
| 71 | - :metric_configuration_id => metric_configuration.id, :id => @configuration_content.id, | ||
| 72 | - :profile => @page.profile.identifier %></td> | ||
| 73 | - <% end %> | ||
| 74 | - </tr> | ||
| 75 | - <% end %> | ||
| 76 | - </table> | ||
| 77 | -<% end %> |
plugins/mezuro/views/content_viewer/show_project.rhtml
| @@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
| 1 | -<% @project = @page.project %> | ||
| 2 | -<% unless @page.errors[:base].nil? %> | ||
| 3 | -<!-- #TODO add owner verification to remove or edit repository --> | ||
| 4 | - <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %> | ||
| 5 | - <h3>Warning:</h3> | ||
| 6 | - <p>This project doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | ||
| 7 | - <% else %> | ||
| 8 | - <%= @page.errors[:base] %> | ||
| 9 | - <% end %> | ||
| 10 | -<% else %> | ||
| 11 | - | ||
| 12 | - <table> | ||
| 13 | - <tr> | ||
| 14 | - <td><%= _('Name') %></td> | ||
| 15 | - <td><%= @project.name %></td> | ||
| 16 | - </tr> | ||
| 17 | - <tr> | ||
| 18 | - <td><%= _('Description') %></td> | ||
| 19 | - <td><%= @project.description %></td> | ||
| 20 | - </tr> | ||
| 21 | - </table> | ||
| 22 | - <br/> | ||
| 23 | - <h5><%= _('Repositories') %></h5> | ||
| 24 | - <table> | ||
| 25 | - <% @page.repositories.each do |repository| %> | ||
| 26 | - <tr> | ||
| 27 | - <td><%= link_to repository.name, :controller => "mezuro_plugin_repository", | ||
| 28 | - :profile => @page.profile.identifier, | ||
| 29 | - :action => "show", | ||
| 30 | - :id => @page.id, | ||
| 31 | - :repository_id => repository.id %></td> | ||
| 32 | - <td ><%= link_to _('Edit'), {:controller => "mezuro_plugin_repository", | ||
| 33 | - :profile => @page.profile.identifier, | ||
| 34 | - :action => "edit", | ||
| 35 | - :id => @page.id, | ||
| 36 | - :repository_id => repository.id}, :class=>"button with-text icon-edit" %></td> | ||
| 37 | - <td ><%= link_to _('Remove'), {:controller => "mezuro_plugin_repository", | ||
| 38 | - :profile => @page.profile.identifier, | ||
| 39 | - :action => "destroy", | ||
| 40 | - :id => @page.id, | ||
| 41 | - :repository_id => repository.id}, :class=>"button with-text icon-delete" %></td> | ||
| 42 | - </tr> | ||
| 43 | - <% end %> | ||
| 44 | - </table> | ||
| 45 | - | ||
| 46 | - <br> | ||
| 47 | - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Repository", :controller => "mezuro_plugin_repository", | ||
| 48 | - :profile => @page.profile.identifier, | ||
| 49 | - :action => "new", | ||
| 50 | - :id => @page.id %><br/> | ||
| 51 | - | ||
| 52 | -<% end %> |
plugins/mezuro/views/content_viewer/show_reading_group.rhtml
| @@ -1,49 +0,0 @@ | @@ -1,49 +0,0 @@ | ||
| 1 | -<% @reading_group = @page.reading_group %> | ||
| 2 | -<!-- #TODO add owner verification to remove or edit reading group --> | ||
| 3 | -<% unless @page.errors[:base].nil? %> | ||
| 4 | - <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %> | ||
| 5 | - <h3>Warning:</h3> | ||
| 6 | - <p>This reading group doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | ||
| 7 | - <% else %> | ||
| 8 | - <%= @page.errors[:base] %> | ||
| 9 | - <% end %> | ||
| 10 | -<% else %> | ||
| 11 | - | ||
| 12 | - <table> | ||
| 13 | - <tr> | ||
| 14 | - <td><%= _('Name') %></td> | ||
| 15 | - <td><%= @reading_group.name %></td> | ||
| 16 | - </tr> | ||
| 17 | - <tr> | ||
| 18 | - <td><%= _('Description') %></td> | ||
| 19 | - <td><%= @reading_group.description %></td> | ||
| 20 | - </tr> | ||
| 21 | - </table> | ||
| 22 | - <br/> | ||
| 23 | - <h5><%= _('Readings') %></h5> | ||
| 24 | - <table> | ||
| 25 | - <% @page.readings.each do |reading| %> | ||
| 26 | - <tr> | ||
| 27 | - <td><%= link_to reading.label, :controller => "mezuro_plugin_reading", | ||
| 28 | - :profile => @page.profile.identifier, | ||
| 29 | - :action => "edit", | ||
| 30 | - :id => @page.id, | ||
| 31 | - :reading_id => reading.id %></td> | ||
| 32 | - <td><%= reading.grade %></td> | ||
| 33 | - <td bgcolor="#<%= reading.color %>"></td> | ||
| 34 | - <td ><%= link_to _('Remove'), {:controller => "mezuro_plugin_reading", | ||
| 35 | - :profile => @page.profile.identifier, | ||
| 36 | - :action => "destroy", | ||
| 37 | - :id => @page.id, | ||
| 38 | - :reading_id => reading.id}, :class=>"button with-text icon-delete" %></td> | ||
| 39 | - </tr> | ||
| 40 | - <% end %> | ||
| 41 | - </table> | ||
| 42 | - | ||
| 43 | - <br/> | ||
| 44 | - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Reading", :controller => "mezuro_plugin_reading", | ||
| 45 | - :profile => @page.profile.identifier, | ||
| 46 | - :action => "new", | ||
| 47 | - :id => @page.id %><br/> | ||
| 48 | - | ||
| 49 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/_compound_metric_configuration_form.html.erb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -<%= hidden_field_tag :id, @configuration_content.id %> | ||
| 2 | -<%= f.hidden_field :configuration_id, :value => @configuration_content.configuration_id %> | ||
| 3 | - | ||
| 4 | -<% f.fields_for :metric do |m| %> | ||
| 5 | - <%= m.hidden_field :compound, :value => "true" %> | ||
| 6 | - <%= required labelled_form_field _('Metric Name:'), m.text_field(:name, :value => @metric_configuration.metric.name) %> | ||
| 7 | - <%= labelled_form_field _('Description:'), m.text_field(:description, :value => @metric_configuration.metric.description) %> | ||
| 8 | - <%= required labelled_form_field _('Script:'), m.text_area(:script, :rows => 5, :value => @metric_configuration.metric.script) %> | ||
| 9 | - <%= required labelled_form_field _('Scope:'), | ||
| 10 | - m.select(:scope, MezuroPlugin::Helpers::ContentViewerHelper.scope_options, :selected => @metric_configuration.metric.scope) %> | ||
| 11 | -<% end %> | ||
| 12 | - | ||
| 13 | -<%= required labelled_form_field _('Code:'), f.text_field(:code) %> | ||
| 14 | -<%= required labelled_form_field _('Aggregation Form:'), | ||
| 15 | - f.select(:aggregation_form, MezuroPlugin::Helpers::ContentViewerHelper.aggregation_options) %> | ||
| 16 | -<%= required labelled_form_field _('Weight:'), f.text_field(:weight) %> | ||
| 17 | -<%= required labelled_form_field _('Reading Group:'), f.select(:reading_group_id, @reading_group_names_and_ids) %> | ||
| 18 | - | ||
| 19 | -<p><%= f.submit "Save" %></p> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_metric_configuration/_metric_codes.html.erb
| @@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
| 1 | -<table> | ||
| 2 | - <tr class="titles"> | ||
| 3 | - <td><h5>Metric Name</h5></td> | ||
| 4 | - <td><h5>Metric Code</h5></td> | ||
| 5 | - </tr> | ||
| 6 | - <% metric_configurations.each do |metric_configuration| %> | ||
| 7 | - <tr class="metric"> | ||
| 8 | - <td><%= metric_configuration.metric.name %></td> | ||
| 9 | - <td><%= metric_configuration.code %></td> | ||
| 10 | - </tr> | ||
| 11 | - <% end %> | ||
| 12 | -</table> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_form.rhtml
| @@ -1,26 +0,0 @@ | @@ -1,26 +0,0 @@ | ||
| 1 | -<%= hidden_field_tag :id, @configuration_content.id %> | ||
| 2 | -<%= f.hidden_field :configuration_id, :value => @configuration_content.configuration_id %> | ||
| 3 | - | ||
| 4 | -<%= labelled_form_field _('Collector Name:'), f.text_field(:base_tool_name, :readonly => true) %> | ||
| 5 | - | ||
| 6 | -<% f.fields_for :metric do |m| %> | ||
| 7 | - <%= m.hidden_field :compound, :value => "false" %> | ||
| 8 | - <% @metric_configuration.metric.language.each do |language| %> | ||
| 9 | - <%= m.hidden_field :language, :multiple => true, :value => language %> | ||
| 10 | - <% end %> | ||
| 11 | - <%= m.hidden_field "scope", :value => @metric.scope %> | ||
| 12 | - <%= required labelled_form_field _('Metric Name:'), m.text_field(:name, :readonly => true, :value => @metric.name) %> | ||
| 13 | - <%= labelled_form_field _('Description:'), m.text_field(:description, :readonly => true, :value => @metric.description) %> | ||
| 14 | -<% end %> | ||
| 15 | - | ||
| 16 | -<%= required labelled_form_field _('Code:'), f.text_field(:code) %> | ||
| 17 | - | ||
| 18 | -<%= required labelled_form_field _('Aggregation Form:'), | ||
| 19 | -f.select(:aggregation_form, MezuroPlugin::Helpers::ContentViewerHelper.aggregation_options) %> | ||
| 20 | - | ||
| 21 | -<%= required labelled_form_field _('Weight:'), f.text_field(:weight) %> | ||
| 22 | - | ||
| 23 | -<%= required labelled_form_field _('Reading Group:'), | ||
| 24 | -f.select(:reading_group_id, @reading_group_names_and_ids) %> | ||
| 25 | - | ||
| 26 | -<p><%= f.submit "Save" %></p> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_view.rhtml
| @@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
| 1 | -<p> | ||
| 2 | - <b>Collector Name:</b> <%= @metric_configuration.base_tool_name %> | ||
| 3 | -</p> | ||
| 4 | -<p> | ||
| 5 | - <b>Metric Name:</b> <%= @metric.name %> | ||
| 6 | -</p> | ||
| 7 | -<p> | ||
| 8 | - <b>Code:</b> <%= @metric_configuration.code %> | ||
| 9 | -</p> | ||
| 10 | -<p> | ||
| 11 | - <b>Aggregation Form:</b> <%= @metric_configuration.aggregation_form %> | ||
| 12 | -</p> | ||
| 13 | -<p> | ||
| 14 | - <b>Weight:</b> <%= @metric_configuration.weight %> | ||
| 15 | -</p> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb
| @@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
| 1 | -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2> | ||
| 2 | - | ||
| 3 | -<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound", | ||
| 4 | - :id => @configuration_content.id %> | ||
| 5 | - | ||
| 6 | -<h5>Base Tools:</h5> | ||
| 7 | -<% @base_tools.each do |base_tool| %> | ||
| 8 | - <h4><%= link_to base_tool.name, "#", :onclick => "jQuery(\"\##{base_tool.name}\").toggle();"%></h4> | ||
| 9 | - <hr/> | ||
| 10 | - | ||
| 11 | - <div id="<%=base_tool.name%>" style="display:none"> | ||
| 12 | - <% base_tool.supported_metrics.each do |metric| %> | ||
| 13 | -       <%= link_to metric.name, :controller => "mezuro_plugin_metric_configuration", :action => "new_native", | ||
| 14 | - :metric_name => metric.name, :base_tool_name => base_tool.name, :id => @configuration_content.id %> | ||
| 15 | - <hr size="1" width="93%"/> | ||
| 16 | - <% end %> | ||
| 17 | - </div> | ||
| 18 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb
| @@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> --> | ||
| 3 | -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> --> | ||
| 4 | - | ||
| 5 | -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2> | ||
| 6 | - | ||
| 7 | -<% owner = (not user.nil?) && user.id == @profile.id %> | ||
| 8 | - | ||
| 9 | -<% form_for :metric_configuration, :url => {:action =>"update", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | ||
| 10 | - <%= f.hidden_field :id %> | ||
| 11 | - <%= render :partial => "compound_metric_configuration_form", :locals => {:f => f} %> | ||
| 12 | -<% end %> | ||
| 13 | - | ||
| 14 | -<%= render :partial => "mezuro_plugin_range/ranges", :locals => {:owner => owner} %> | ||
| 15 | -<hr> | ||
| 16 | -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb
| @@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> --> | ||
| 3 | -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> --> | ||
| 4 | - | ||
| 5 | -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2> | ||
| 6 | - | ||
| 7 | -<% owner = (not user.nil?) && user.id == @profile.id %> | ||
| 8 | - | ||
| 9 | -<% if owner %> | ||
| 10 | - <% form_for :metric_configuration, :url => {:action =>"update", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | ||
| 11 | - <%= f.hidden_field :id %> | ||
| 12 | - <%= render :partial => "native_metric_configuration_form", :locals => {:f => f} %> | ||
| 13 | - <% end %> | ||
| 14 | -<% else %> | ||
| 15 | - <%= render :partial => "native_metric_configuration_view" %> | ||
| 16 | -<% end %> | ||
| 17 | - | ||
| 18 | -<%= render :partial => "mezuro_plugin_range/ranges", :locals => {:owner => owner} %> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb
| @@ -1,7 +0,0 @@ | @@ -1,7 +0,0 @@ | ||
| 1 | -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2> | ||
| 2 | - | ||
| 3 | -<% form_for :metric_configuration, :url => {:action =>"create", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | ||
| 4 | - <%= render :partial => "compound_metric_configuration_form", :locals => {:f => f} %> | ||
| 5 | -<% end %> | ||
| 6 | - | ||
| 7 | -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb
| @@ -1,7 +0,0 @@ | @@ -1,7 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | - | ||
| 3 | -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2> | ||
| 4 | - | ||
| 5 | -<% form_for :metric_configuration, :url => {:action =>"create", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | ||
| 6 | - <%= render :partial => "native_metric_configuration_form", :locals => {:f => f} %> | ||
| 7 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_module_result/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml
| @@ -1,41 +0,0 @@ | @@ -1,41 +0,0 @@ | ||
| 1 | -<thead> | ||
| 2 | - <tr> | ||
| 3 | - <th style="width: 74%">Metric</th> | ||
| 4 | - <th>Value</th> | ||
| 5 | - <th>Weight</th> | ||
| 6 | - <th>Threshold</th> | ||
| 7 | - </tr> | ||
| 8 | -</thead> | ||
| 9 | -<tbody> | ||
| 10 | - <% @metric_results.each do |metric_result| %> | ||
| 11 | - <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%> | ||
| 12 | - <% range_snapshots = metric_configuration_snapshot.range_snapshot %> | ||
| 13 | - <% metric_name = metric_configuration_snapshot.metric.name %> | ||
| 14 | - <% formatted_name = metric_name.delete("() ") %> | ||
| 15 | - <% if !range_snapshots.nil? %> | ||
| 16 | - <tr> | ||
| 17 | - <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-metric-name="<%= metric_name %>" data-module-id="<%= @module_result.id %>"><%= metric_name %></a></td> | ||
| 18 | - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td> | ||
| 19 | - <td><%= metric_configuration_snapshot.weight %></td> | ||
| 20 | - <% range_snapshots.each do |range_snapshot| %> | ||
| 21 | - <% if range_snapshot.beginning <= metric_result.value and range_snapshot.end > metric_result.value %> | ||
| 22 | - <td style="background-color: #<%= range_snapshot.color %>"> | ||
| 23 | - <span title="<%= range_snapshot.comments %>" > | ||
| 24 | - <%= range_snapshot.label %> | ||
| 25 | - </span> | ||
| 26 | - </td> | ||
| 27 | - </tr> | ||
| 28 | - <tr class="<%= formatted_name %>" style="display: none;"> | ||
| 29 | - <td colspan="3"> | ||
| 30 | - <div id='historical-<%= formatted_name %>'> | ||
| 31 | - </div> | ||
| 32 | - </td> | ||
| 33 | - <td align="right"> | ||
| 34 | - <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %> | ||
| 35 | - </td> | ||
| 36 | - </tr> | ||
| 37 | - <% end %> | ||
| 38 | - <% end %> | ||
| 39 | - <% end %> | ||
| 40 | - <% end %> | ||
| 41 | -</tbody> |
plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml
| @@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
| 1 | -<%= render :partial => "source_tree", :locals => {:module_result => @module_result} %> | ||
| 2 | -<h5><%= _"Metric results for: #{MezuroPlugin::Helpers::ModuleResultHelper.module_name(@module_result.module.name)} (#{@module_result.module.granularity})" %> </h5> | ||
| 3 | - | ||
| 4 | -<hr/> | ||
| 5 | -<div class="zoomable-image"> | ||
| 6 | -<table style="width: 100%"> | ||
| 7 | - <%= render :partial => "metric_results", :locals => {:metric_results => @metric_results, :module_result_id => @module_result.id} %> | ||
| 8 | - <tfoot> | ||
| 9 | - <tr> | ||
| 10 | - <td colspan = "3"> | ||
| 11 | - <div id='historical-grade' style="display: none;"></div> | ||
| 12 | - </td> | ||
| 13 | - <td align = "right"> | ||
| 14 | - <a href="#" show-grade-history="<%= @module_result.id %>" data-module-id="<%= @module_result.id %>" > | ||
| 15 | - <strong> | ||
| 16 | - <%= _('Grade:') %> | ||
| 17 | - <%= "%.02f" % @module_result.grade %> | ||
| 18 | - </strong> | ||
| 19 | - </a> | ||
| 20 | - </td> | ||
| 21 | - </tr> | ||
| 22 | - </tfoot> | ||
| 23 | -</table> | ||
| 24 | -</div> |
plugins/mezuro/views/mezuro_plugin_module_result/_score_history.rhtml
| @@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
| 1 | -<%= image_tag(MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(@history)) %> |
plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml
| @@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
| 1 | -<h4><%= _('Source tree') %></h4> | ||
| 2 | -<% helper = MezuroPlugin::Helpers::ModuleResultHelper %> | ||
| 3 | -<% module_name = helper.module_name(module_result.module.name) %> | ||
| 4 | -<% module_label = "#{module_name} (#{module_result.module.granularity})" %> | ||
| 5 | - | ||
| 6 | -<p> | ||
| 7 | - <h2 class="path"> | ||
| 8 | - <% module_result.parents.each do |parent| %> | ||
| 9 | - /<a href="#" class="source-tree-link" data-module-id="<%= parent.id %>"> | ||
| 10 | - <%= helper.module_name parent.module.name %> | ||
| 11 | - </a> | ||
| 12 | - <% end %>/ <%= helper.module_name module_name %> | ||
| 13 | - </h2> | ||
| 14 | -</p> | ||
| 15 | - | ||
| 16 | -<table border="0" class="source-tree"> | ||
| 17 | - <% module_result.children.each do |child| %> | ||
| 18 | - <% if child.module.granularity=='PACKAGE' %> | ||
| 19 | - <tr> | ||
| 20 | - <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td> | ||
| 21 | - <td class="source-tree-text"><a href='#' class="source-tree-link" data-module-id="<%= child.id %>"><%= helper.module_name child.module.name %></a></td> | ||
| 22 | - </tr> | ||
| 23 | - <% else %> | ||
| 24 | - <tr> | ||
| 25 | - <td class="icon"><%= image_tag('/plugins/mezuro/images/file.png') %></td> | ||
| 26 | - <td class="source-tree-text"> | ||
| 27 | - <a href='#' class="source-tree-link" data-module-id="<%= child.id %>"> | ||
| 28 | - <%= helper.module_name child.module.name %> | ||
| 29 | - </a> | ||
| 30 | - </td> | ||
| 31 | - </tr> | ||
| 32 | - <% end %> | ||
| 33 | - <% end %> | ||
| 34 | -</table> |
plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb
| @@ -1,4 +0,0 @@ | @@ -1,4 +0,0 @@ | ||
| 1 | -<%= remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
| 2 | - <%= hidden_field_tag :beginning_id, beginning_id %> | ||
| 3 | - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :id => id, :beginning_id => beginning_id, :range => range } %> | ||
| 4 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_myprofile/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb
plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb
| @@ -1,81 +0,0 @@ | @@ -1,81 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script> | ||
| 3 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script> | ||
| 4 | - | ||
| 5 | -<h2><%= @configuration_content.name %> Configuration</h2> | ||
| 6 | - | ||
| 7 | -<%= form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
| 8 | - <%= hidden_field_tag :id, @configuration_content.id %> | ||
| 9 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | ||
| 10 | - | ||
| 11 | - <p> | ||
| 12 | - <%= "Metric Name:" + @metric.name %> | ||
| 13 | - </p> | ||
| 14 | - <% f.fields_for :metric do |m| %> | ||
| 15 | - <%= m.hidden_field :name, :value => @metric.name %> | ||
| 16 | - <p> | ||
| 17 | - <%= m.label :description, "Description:" %> | ||
| 18 | - <%= m.text_field "description", :value => @metric.description %> | ||
| 19 | - </p> | ||
| 20 | - <p> | ||
| 21 | - <%= m.label :scope, "Scope:" %> | ||
| 22 | - <%= m.select :scope, [["Class", "CLASS"]], :selected => @metric.scope %> | ||
| 23 | - </p> | ||
| 24 | - <p> | ||
| 25 | - <%= m.label :script, "Script:" %> | ||
| 26 | - <%= m.text_area "script", :value => @metric.script %> | ||
| 27 | - </p> | ||
| 28 | - <% end %> | ||
| 29 | - <p> | ||
| 30 | - <%= f.label :code, "Code:" %> | ||
| 31 | - <%= f.text_field "code" %> | ||
| 32 | - </p> | ||
| 33 | - <p> | ||
| 34 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
| 35 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
| 36 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
| 37 | - </p> | ||
| 38 | - <p> | ||
| 39 | - <%= f.label :weight, "Weight:" %> | ||
| 40 | - <%= f.text_field :weight %> | ||
| 41 | - </p> | ||
| 42 | - <p> | ||
| 43 | - <%= f.submit "Save" %> | ||
| 44 | - </p> | ||
| 45 | -<% end %> | ||
| 46 | - | ||
| 47 | - | ||
| 48 | -<h5> Ranges </h5><br/> | ||
| 49 | - | ||
| 50 | -<table id="ranges"> | ||
| 51 | - <tr> | ||
| 52 | - <td> | ||
| 53 | - Label | ||
| 54 | - </td> | ||
| 55 | - <td> | ||
| 56 | - Beginning | ||
| 57 | - </td> | ||
| 58 | - <td> | ||
| 59 | - End | ||
| 60 | - </td> | ||
| 61 | - <td> | ||
| 62 | - Grade | ||
| 63 | - </td> | ||
| 64 | - <td> | ||
| 65 | - Color | ||
| 66 | - </td> | ||
| 67 | - </tr> | ||
| 68 | - <% if (@metric_configuration.ranges!=nil) | ||
| 69 | - @metric_configuration.ranges.each do |range| %> | ||
| 70 | - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, | ||
| 71 | - :metric_name => @metric_configuration.metric.name} %> | ||
| 72 | - <% end | ||
| 73 | - end %> | ||
| 74 | -</table> | ||
| 75 | - | ||
| 76 | -<br/> | ||
| 77 | -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %> | ||
| 78 | -<div id="range_form" style="display:none"></div> | ||
| 79 | - | ||
| 80 | -<br/> | ||
| 81 | -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb
| @@ -1,89 +0,0 @@ | @@ -1,89 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script> | ||
| 3 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script> | ||
| 4 | - | ||
| 5 | -<h2><%= @configuration_content.name %> Configuration</h2> | ||
| 6 | - | ||
| 7 | -<%= form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
| 8 | - <%= hidden_field_tag :id, @configuration_content.id %> | ||
| 9 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | ||
| 10 | - | ||
| 11 | - <% f.fields_for :metric do |m| %> | ||
| 12 | - | ||
| 13 | - <% @metric.language.each do |language| %> | ||
| 14 | - <%= m.hidden_field :language, :multiple => true, :value => language %> | ||
| 15 | - <% end %> | ||
| 16 | - | ||
| 17 | - <%= m.hidden_field "scope", :value => @metric.scope %> | ||
| 18 | - <p> | ||
| 19 | - <%= m.label :origin, "Collector Name:" %> | ||
| 20 | - <%= @metric.origin %> | ||
| 21 | - <%= m.hidden_field "origin", :value => @metric.origin %> | ||
| 22 | - </p> | ||
| 23 | - <p> | ||
| 24 | - <%= m.label :metric_name, "Metric Name:" %> | ||
| 25 | - <%= @metric.name %> | ||
| 26 | - <%= m.hidden_field "name", :value => @metric.name %> | ||
| 27 | - </p> | ||
| 28 | - <!--<p>--> | ||
| 29 | - <% m.label :description, "Description:" %> | ||
| 30 | - <% @metric.description %> | ||
| 31 | - <% m.hidden_field "description", :value => @metric.description %> | ||
| 32 | - <!--</p>--> | ||
| 33 | - <% end %> | ||
| 34 | - <p> | ||
| 35 | - <%= f.label :code, "Code:" %> | ||
| 36 | - <%= @metric_configuration.code %> | ||
| 37 | - <%= f.hidden_field "code", :value => @metric_configuration.code %> | ||
| 38 | - </p> | ||
| 39 | - <p> | ||
| 40 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
| 41 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
| 42 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
| 43 | - </p> | ||
| 44 | - <p> | ||
| 45 | - <%= f.label :weight, "Weight:" %> | ||
| 46 | - <%= f.text_field "weight", :value => @metric_configuration.weight %> | ||
| 47 | - </p> | ||
| 48 | - | ||
| 49 | - <p> | ||
| 50 | - <%= f.submit "Save" %> | ||
| 51 | - </p> | ||
| 52 | -<% end %> | ||
| 53 | - | ||
| 54 | - | ||
| 55 | -<h5> Ranges </h5><br/> | ||
| 56 | - | ||
| 57 | -<table id="ranges"> | ||
| 58 | - <tr> | ||
| 59 | - <td> | ||
| 60 | - Label | ||
| 61 | - </td> | ||
| 62 | - <td> | ||
| 63 | - Beginning | ||
| 64 | - </td> | ||
| 65 | - <td> | ||
| 66 | - End | ||
| 67 | - </td> | ||
| 68 | - <td> | ||
| 69 | - Grade | ||
| 70 | - </td> | ||
| 71 | - <td> | ||
| 72 | - Color | ||
| 73 | - </td> | ||
| 74 | - <td></td> | ||
| 75 | - <td></td> | ||
| 76 | - </tr> | ||
| 77 | - <% if (@metric_configuration.ranges!=nil) | ||
| 78 | - @metric_configuration.ranges.each do |range| %> | ||
| 79 | - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, | ||
| 80 | - :metric_name => @metric.name} %> | ||
| 81 | - <% end | ||
| 82 | - end %> | ||
| 83 | -</table> | ||
| 84 | - | ||
| 85 | -<br/> | ||
| 86 | -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %> | ||
| 87 | -<div id="range_form" style="display:none"></div> | ||
| 88 | - | ||
| 89 | - |
plugins/mezuro/views/mezuro_plugin_myprofile/error_page.html.erb
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric_configuration.html.erb
| @@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
| 1 | -<h2><%= @configuration_content.name %> Configuration</h2> | ||
| 2 | - | ||
| 3 | -<%= form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration", | ||
| 4 | -:controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
| 5 | - <%= hidden_field_tag :id, @configuration_content.id %> | ||
| 6 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | ||
| 7 | - | ||
| 8 | - <% f.fields_for :metric do |m| %> | ||
| 9 | - <p> | ||
| 10 | - <%= m.label :name, "Name:" %> | ||
| 11 | - <%= m.text_field "name" %> | ||
| 12 | - </p> | ||
| 13 | - <p> | ||
| 14 | - <%= m.label :description, "Description:" %> | ||
| 15 | - <%= m.text_field "description" %> | ||
| 16 | - </p> | ||
| 17 | - <p> | ||
| 18 | - <%= m.label :scope, "Scope:" %> | ||
| 19 | - <%= m.select :scope, [["Class", "CLASS"]] %> | ||
| 20 | - </p> | ||
| 21 | - <p> | ||
| 22 | - <%= m.label :script, "Script:" %> | ||
| 23 | - <%= m.text_area "script" %> | ||
| 24 | - </p> | ||
| 25 | - <% end %> | ||
| 26 | - <p> | ||
| 27 | - <%= f.label :code, "Code:" %> | ||
| 28 | - <%= f.text_field "code" %> | ||
| 29 | - </p> | ||
| 30 | - <p> | ||
| 31 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
| 32 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
| 33 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
| 34 | - </p> | ||
| 35 | - <p> | ||
| 36 | - <%= f.label :weight, "Weight:" %> | ||
| 37 | - <%= f.text_field :weight %> | ||
| 38 | - </p> | ||
| 39 | - <p> | ||
| 40 | - <%= f.submit "Add" %> | ||
| 41 | - </p> | ||
| 42 | -<% end %> | ||
| 43 | - | ||
| 44 | -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> |
plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb
| @@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | - | ||
| 3 | -<h2><%= @configuration_content.name %> Configuration</h2> | ||
| 4 | - | ||
| 5 | -<%= form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
| 6 | - <%= hidden_field_tag :id, @configuration_content.id %> | ||
| 7 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | ||
| 8 | - | ||
| 9 | - <% f.fields_for :metric do |m| %> | ||
| 10 | - | ||
| 11 | - <% @metric.language.each do |language| %> | ||
| 12 | - <%= m.hidden_field :language, :multiple => true, :value => language %> | ||
| 13 | - <% end %> | ||
| 14 | - | ||
| 15 | - <%= m.hidden_field "scope", :value => @metric.scope %> | ||
| 16 | - <p> | ||
| 17 | - <%= m.label :origin, "Collector Name:" %> | ||
| 18 | - <%= @metric.origin %> | ||
| 19 | - <%= m.hidden_field "origin", :value => @metric.origin %> | ||
| 20 | - </p> | ||
| 21 | - <p> | ||
| 22 | - <%= m.label :name, "Metric Name:" %> | ||
| 23 | - <%= @metric.name %> | ||
| 24 | - <%= m.hidden_field "name", :value => @metric.name %> | ||
| 25 | - </p> | ||
| 26 | - <!--<p>--> | ||
| 27 | - <% m.label :description, "Description:" %> | ||
| 28 | - <% @metric.description %> | ||
| 29 | - <% m.hidden_field "description", :value => @metric.description %> | ||
| 30 | - <!--</p>--> | ||
| 31 | - <% end %> | ||
| 32 | - <p> | ||
| 33 | - <%= f.label :code, "Code:" %> | ||
| 34 | - <%= f.text_field :code %> | ||
| 35 | - </p> | ||
| 36 | - <p> | ||
| 37 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
| 38 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
| 39 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
| 40 | - </p> | ||
| 41 | - <p> | ||
| 42 | - <%= f.label :weight, "Weight:" %> | ||
| 43 | - <%= f.text_field :weight %> | ||
| 44 | - </p> | ||
| 45 | - | ||
| 46 | - <p> | ||
| 47 | - <%= f.submit "Add" %> | ||
| 48 | - </p> | ||
| 49 | - | ||
| 50 | -<% end %> | ||
| 51 | - |
plugins/mezuro/views/mezuro_plugin_processing/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_processing/_processing.rhtml
| @@ -1,36 +0,0 @@ | @@ -1,36 +0,0 @@ | ||
| 1 | -<div id="current_processing_date" data-date="<%= @processing.date %>"/> | ||
| 2 | - | ||
| 3 | -<h4><%= _('Last Result') %></h4> | ||
| 4 | - | ||
| 5 | -<table> | ||
| 6 | - <tr> | ||
| 7 | - <td><%= _('Date') %></td> | ||
| 8 | - <td><%= @processing.date.inspect %></td> | ||
| 9 | - </tr> | ||
| 10 | - <% @processing.process_time.each do |process_time| %> | ||
| 11 | - <tr> | ||
| 12 | - <td><%= _(process_time.state + ' time') %></td> | ||
| 13 | - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_time(process_time.time) %></td> | ||
| 14 | - </tr> | ||
| 15 | - <% end %> | ||
| 16 | - <tr> | ||
| 17 | - <td>Click to choose specific date:</td> | ||
| 18 | - <td><%= link_to(image_tag('/images/calendar_date_select/calendar.png', :width => 20, :height => 20, :onClick => "$( 'datepicker' ).toggle();"), "javascript:void(0)") %></td> | ||
| 19 | - </tr> | ||
| 20 | -</table> | ||
| 21 | - | ||
| 22 | -<div id="datepicker"></div> | ||
| 23 | - | ||
| 24 | -<script> | ||
| 25 | - jQuery(document).ready(function($) { | ||
| 26 | - $("#datepicker").datepicker({ | ||
| 27 | - onSelect: function(dateText, inst) { | ||
| 28 | - reloadProcessingWithDate(dateText) } }); | ||
| 29 | - $("#datepicker").toggle(); | ||
| 30 | - var date = jQuery("#current_processing_date").attr('data-date').substr(0,10); | ||
| 31 | - $("#datepicker").datepicker( "setDate" , date.substr(5,2)+"/"+date.substr(8,2)+"/"+date.substr(0,4)); | ||
| 32 | - | ||
| 33 | - }); | ||
| 34 | -</script> | ||
| 35 | - | ||
| 36 | -<span id="module_result_root_id" module_result_root_id="<%= @processing.results_root_id %>"> |
plugins/mezuro/views/mezuro_plugin_processing/_processing_error.rhtml
| @@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
| 1 | -<h3><%= _('ERROR') %></h3> | ||
| 2 | -<p> | ||
| 3 | - <%= "State when error ocurred: #{@processing.state}" %> | ||
| 4 | - <br/> | ||
| 5 | - <% error = @processing.error %> | ||
| 6 | - <%= error.message %> | ||
| 7 | -<ul> | ||
| 8 | - <% error.stack_trace.each do |trace| %> | ||
| 9 | - <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li> | ||
| 10 | - <% end %> | ||
| 11 | -</ul> | ||
| 12 | -</p> |
plugins/mezuro/views/mezuro_plugin_profile/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_range/_edit.html.erb
plugins/mezuro/views/mezuro_plugin_range/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_range/_form.html.erb
| @@ -1,37 +0,0 @@ | @@ -1,37 +0,0 @@ | ||
| 1 | -<%= hidden_field_tag :id, @content_id %> | ||
| 2 | -<%= hidden_field_tag :metric_configuration_id, @metric_configuration_id %> | ||
| 3 | -<%= hidden_field_tag :reading_group_id, @reading_group_id %> | ||
| 4 | -<%= hidden_field_tag :compound, @compound %> | ||
| 5 | - | ||
| 6 | -<%= f.hidden_field :id %> | ||
| 7 | - | ||
| 8 | - <%= required labelled_form_field _('Label'), | ||
| 9 | - f.select(:reading_id, @reading_labels_and_ids) %><br/> | ||
| 10 | -<table> | ||
| 11 | - <tr> | ||
| 12 | - <td> | ||
| 13 | - <%= f.label :beginning, "(*) Beginning:" %> | ||
| 14 | - </td> | ||
| 15 | - <td> | ||
| 16 | - <%= required f.text_field :beginning, :id => "range_beginning" %> <%= link_to('-∞', 'javascript:void(0)', :onClick => "jQuery( '#range_beginning' ).val('-INF');") %> | ||
| 17 | - </td> | ||
| 18 | - </tr> | ||
| 19 | - <tr> | ||
| 20 | - <td> | ||
| 21 | - <%= f.label :end, "(*) End:" %> | ||
| 22 | - </td> | ||
| 23 | - <td> | ||
| 24 | - <%= required f.text_field(:end, :id => "range_end") %> <%= link_to('+∞', 'javascript:void(0)', :onClick => "jQuery( '#range_end' ).val('+INF');") %> | ||
| 25 | - </td> | ||
| 26 | - </tr> | ||
| 27 | - <tr> | ||
| 28 | - <td> | ||
| 29 | - <%= f.label :comments, "(*) Comments:" %> | ||
| 30 | - </td> | ||
| 31 | - <td> | ||
| 32 | - <%= required f.text_area :comments, :rows => 3 %> | ||
| 33 | - </td> | ||
| 34 | - </tr> | ||
| 35 | -</table> | ||
| 36 | -<br/> | ||
| 37 | -<%= f.submit "Save Range" %> |
plugins/mezuro/views/mezuro_plugin_range/_new.html.erb
plugins/mezuro/views/mezuro_plugin_range/_range.html.erb
| @@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
| 1 | -<tr> | ||
| 2 | - <td> | ||
| 3 | - <%=range.label%> | ||
| 4 | - </td> | ||
| 5 | - <td> | ||
| 6 | - <%=range.beginning%> | ||
| 7 | - </td> | ||
| 8 | - <td> | ||
| 9 | - <%=range.end%> | ||
| 10 | - </td> | ||
| 11 | - <td> | ||
| 12 | - <%=range.grade%> | ||
| 13 | - </td> | ||
| 14 | - <td bgcolor="#<%= range.color %>"></td> | ||
| 15 | - <% if (not user.nil?) && user.id == @profile.id %> | ||
| 16 | - <td><%= link_to_remote "Edit", :url => {:action =>"edit", :controller => "mezuro_plugin_range", :id => params[:id], :metric_configuration_id => params[:metric_configuration_id], :range_id => range.id, :reading_group_id => reading_group_id} %> | ||
| 17 | - </td> | ||
| 18 | - <td><%= link_to "Remove", :action =>"remove", :controller => "mezuro_plugin_range", :id => params[:id], :metric_configuration_id => params[:metric_configuration_id], :range_id => range.id, :compound => compound %> | ||
| 19 | - </td> | ||
| 20 | - <% else %> | ||
| 21 | - <td></td> | ||
| 22 | - <td></td> | ||
| 23 | - <% end %> | ||
| 24 | -</tr> |
plugins/mezuro/views/mezuro_plugin_range/_ranges.html.erb
| @@ -1,31 +0,0 @@ | @@ -1,31 +0,0 @@ | ||
| 1 | -<h5> Ranges </h5><br/> | ||
| 2 | - | ||
| 3 | -<table id="ranges"> | ||
| 4 | - <tr> | ||
| 5 | - <td> | ||
| 6 | - Label | ||
| 7 | - </td> | ||
| 8 | - <td> | ||
| 9 | - Beginning | ||
| 10 | - </td> | ||
| 11 | - <td> | ||
| 12 | - End | ||
| 13 | - </td> | ||
| 14 | - <td> | ||
| 15 | - Grade | ||
| 16 | - </td> | ||
| 17 | - <td> | ||
| 18 | - Color | ||
| 19 | - </td> | ||
| 20 | - </tr> | ||
| 21 | - <% @ranges.each do |range| %> | ||
| 22 | - <%= render :partial => "mezuro_plugin_range/range", :locals => {:range => range, :id => @configuration_content.id, | ||
| 23 | - :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound} %> | ||
| 24 | - <% end %> | ||
| 25 | -</table> | ||
| 26 | - | ||
| 27 | -<br/> | ||
| 28 | -<% if owner %> | ||
| 29 | - <%= link_to_remote "New Range", :url => {:action =>"new", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound} %> | ||
| 30 | -<% end %> | ||
| 31 | -<div id="form" style="display:none"></div> |
plugins/mezuro/views/mezuro_plugin_range/create.rjs
plugins/mezuro/views/mezuro_plugin_range/edit.rjs
plugins/mezuro/views/mezuro_plugin_range/new.rjs
plugins/mezuro/views/mezuro_plugin_range/update.rjs
plugins/mezuro/views/mezuro_plugin_reading/_form.html.erb
| @@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
| 1 | -<%= hidden_field_tag :id, @reading_group_content.id %> | ||
| 2 | -<%= f.hidden_field(:group_id, :value => @reading_group_content.reading_group_id) %> | ||
| 3 | - | ||
| 4 | -<%= required labelled_form_field _('Label:'), f.text_field(:label) %> | ||
| 5 | - | ||
| 6 | -<%= required labelled_form_field _('Grade:'), f.text_field(:grade) %> | ||
| 7 | - | ||
| 8 | -<%= required labelled_form_field _('Color:'), | ||
| 9 | -colorpicker_field(:reading, :color) %>Click in the field to change Color | ||
| 10 | - | ||
| 11 | -<div id="labels_and_grades" data-list="<%= @labels_and_grades %>" data-parser="<%= @parser %>"/> | ||
| 12 | - | ||
| 13 | -<p><%= f.submit "Save" %></p> |
plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb
| @@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
| 1 | -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> --> | ||
| 2 | -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> --> | ||
| 3 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 4 | - | ||
| 5 | -<h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2> | ||
| 6 | - | ||
| 7 | -<% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> | ||
| 8 | - <%= f.hidden_field :id %> | ||
| 9 | - <%= render :partial => "form", :locals => {:f => f} %> | ||
| 10 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_reading/new.html.erb
| @@ -1,9 +0,0 @@ | @@ -1,9 +0,0 @@ | ||
| 1 | -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> --> | ||
| 2 | -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> --> | ||
| 3 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 4 | - | ||
| 5 | -<h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2> | ||
| 6 | - | ||
| 7 | -<% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> | ||
| 8 | - <%= render :partial => "form", :locals => {:f => f} %> | ||
| 9 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_repository/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_repository/_form.html.erb
| @@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
| 1 | -<%= hidden_field_tag :id, @project_content.id %> | ||
| 2 | -<%= f.hidden_field(:project_id, :value => @project_content.project_id) %> | ||
| 3 | - | ||
| 4 | -<%= required labelled_form_field _('Name'), f.text_field(:name) %> | ||
| 5 | - | ||
| 6 | -<%= labelled_form_field _("Description"), f.text_field(:description) %> | ||
| 7 | - | ||
| 8 | -<%= required labelled_form_field _('License'), | ||
| 9 | -f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.license_options) %> | ||
| 10 | - | ||
| 11 | -<%= required labelled_form_field _('Process Period'), | ||
| 12 | -f.select(:process_period, MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options) %> | ||
| 13 | - | ||
| 14 | -<%= required labelled_form_field _('Type'), | ||
| 15 | -f.select(:type, @repository_types) %> | ||
| 16 | - | ||
| 17 | -<%= required labelled_form_field _('Address'), | ||
| 18 | -f.text_field(:address) %> | ||
| 19 | - | ||
| 20 | -<%= required labelled_form_field _('Configuration'), | ||
| 21 | -f.select(:configuration_id, @configuration_select) %> | ||
| 22 | - | ||
| 23 | -<p> <%= f.submit "Add" %> </p> |
plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb
| @@ -1,7 +0,0 @@ | @@ -1,7 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | - | ||
| 3 | -<h2><%= link_to("#{@project_content.name} Project", @project_content.view_url) %></h2> | ||
| 4 | -<% form_for :repository, :url => {:action =>"save", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> | ||
| 5 | - <%= f.hidden_field :id %> | ||
| 6 | - <%= render :partial => "form", :locals => {:f => f} %> | ||
| 7 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_repository/new.html.erb
| @@ -1,6 +0,0 @@ | @@ -1,6 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | ||
| 2 | - | ||
| 3 | -<h2><%= link_to("#{@project_content.name} Project", @project_content.view_url) %></h2> | ||
| 4 | -<% form_for :repository, :url => {:action =>"save", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> | ||
| 5 | - <%= render :partial => "form", :locals => {:f => f} %> | ||
| 6 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_repository/show.html.erb
| @@ -1,45 +0,0 @@ | @@ -1,45 +0,0 @@ | ||
| 1 | -<script src="/plugins/mezuro/javascripts/processing.js" type="text/javascript"></script> | ||
| 2 | -<h2><%= link_to("#{@project_content.name} Project", @project_content.view_url) %></h2> | ||
| 3 | - | ||
| 4 | -<table> | ||
| 5 | - <tr> | ||
| 6 | - <td><%= _('Name') %></td> | ||
| 7 | - <td><%= @repository.name %></td> | ||
| 8 | - </tr> | ||
| 9 | - <tr> | ||
| 10 | - <td><%= _('Description') %></td> | ||
| 11 | - <td><%= @repository.description %></td> | ||
| 12 | - </tr> | ||
| 13 | - <tr> | ||
| 14 | - <td><%= _('License') %></td> | ||
| 15 | - <td><%= @repository.license %></td> | ||
| 16 | - </tr> | ||
| 17 | - <tr> | ||
| 18 | - <td><%= _('Process Period') %></td> | ||
| 19 | - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.periodicity_option(@repository.process_period.to_i) %></td> | ||
| 20 | - </tr> | ||
| 21 | - <tr> | ||
| 22 | - <td><%= _('Type') %></td> | ||
| 23 | - <td><%= @repository.type %></td> | ||
| 24 | - </tr> | ||
| 25 | - <tr> | ||
| 26 | - <td><%= _('Address') %></td> | ||
| 27 | - <td><%= @repository.address %></td> | ||
| 28 | - </tr> | ||
| 29 | - <tr> | ||
| 30 | - <td><%= _('Configuration') %></td> | ||
| 31 | - <td><%= @configuration_name %></td> | ||
| 32 | - </tr> | ||
| 33 | - <tr> | ||
| 34 | - <td><%= _('Status')%></td> | ||
| 35 | - <td> | ||
| 36 | - <div id="processing-state" style="color:DarkGoldenRod">Retrieving</div> | ||
| 37 | - <div id="msg-time"></div> | ||
| 38 | - </td> | ||
| 39 | - </tr> | ||
| 40 | -</table> | ||
| 41 | -<br /> | ||
| 42 | - | ||
| 43 | -<div id="processing" data-profile="<%= @project_content.profile.identifier %>" data-content="<%= @project_content.id %>" | ||
| 44 | - data-repository-id="<%= @repository.id %>"></div> | ||
| 45 | -<div id="module-result"></div> |
plugins/people_block/before_disable.rb
plugins/work_assignment/test/unit/work_assingment_plugin/work_assignment_test.rb
| @@ -35,7 +35,7 @@ class WorkAssignmentTest < ActiveSupport::TestCase | @@ -35,7 +35,7 @@ class WorkAssignmentTest < ActiveSupport::TestCase | ||
| 35 | organization = fast_create(Organization) | 35 | organization = fast_create(Organization) |
| 36 | author = fast_create(Person) | 36 | author = fast_create(Person) |
| 37 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Sample Work Assignment', :profile => organization) | 37 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Sample Work Assignment', :profile => organization) |
| 38 | - submission = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => work_assignment, :last_changed_by => author) | 38 | + submission = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => work_assignment, :created_by => author) |
| 39 | 39 | ||
| 40 | author_folder = work_assignment.find_or_create_author_folder(author) | 40 | author_folder = work_assignment.find_or_create_author_folder(author) |
| 41 | assert_equal author_folder, submission.parent | 41 | assert_equal author_folder, submission.parent |
plugins/work_assignment/test/unit/work_assingment_plugin_test.rb
| @@ -3,7 +3,7 @@ require 'test_helper' | @@ -3,7 +3,7 @@ require 'test_helper' | ||
| 3 | class WorkAssignmentPluginTest < ActiveSupport::TestCase | 3 | class WorkAssignmentPluginTest < ActiveSupport::TestCase |
| 4 | should 'verify if a content is a work_assignment submission' do | 4 | should 'verify if a content is a work_assignment submission' do |
| 5 | organization = fast_create(Organization) | 5 | organization = fast_create(Organization) |
| 6 | - content = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :last_changed_by => fast_create(Person)) | 6 | + content = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :created_by => fast_create(Person)) |
| 7 | assert !WorkAssignmentPlugin.is_submission?(content) | 7 | assert !WorkAssignmentPlugin.is_submission?(content) |
| 8 | 8 | ||
| 9 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) | 9 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) |
| @@ -46,9 +46,11 @@ class WorkAssignmentPluginTest < ActiveSupport::TestCase | @@ -46,9 +46,11 @@ class WorkAssignmentPluginTest < ActiveSupport::TestCase | ||
| 46 | private | 46 | private |
| 47 | 47 | ||
| 48 | def create_submission(author=nil) | 48 | def create_submission(author=nil) |
| 49 | + author ||= fast_create(Person) | ||
| 49 | organization = fast_create(Organization) | 50 | organization = fast_create(Organization) |
| 51 | + | ||
| 50 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) | 52 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) |
| 51 | - author_folder = work_assignment.find_or_create_author_folder(fast_create(Person)) | ||
| 52 | - create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => author_folder, :last_changed_by => author) | 53 | + author_folder = work_assignment.find_or_create_author_folder(author) |
| 54 | + create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => author_folder, :created_by => author) | ||
| 53 | end | 55 | end |
| 54 | end | 56 | end |
6.41 KB
13.7 KB
1003 Bytes
1.33 KB
6.4 KB
public/javascripts/jquery.fancybox-1.3.4.pack.js
| @@ -1,46 +0,0 @@ | @@ -1,46 +0,0 @@ | ||
| 1 | -/* | ||
| 2 | - * FancyBox - jQuery Plugin | ||
| 3 | - * Simple and fancy lightbox alternative | ||
| 4 | - * | ||
| 5 | - * Examples and documentation at: http://fancybox.net | ||
| 6 | - * | ||
| 7 | - * Copyright (c) 2008 - 2010 Janis Skarnelis | ||
| 8 | - * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. | ||
| 9 | - * | ||
| 10 | - * Version: 1.3.4 (11/11/2010) | ||
| 11 | - * Requires: jQuery v1.3+ | ||
| 12 | - * | ||
| 13 | - * Dual licensed under the MIT and GPL licenses: | ||
| 14 | - * http://www.opensource.org/licenses/mit-license.php | ||
| 15 | - * http://www.gnu.org/licenses/gpl.html | ||
| 16 | - */ | ||
| 17 | - | ||
| 18 | -;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>'); | ||
| 19 | -F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)|| | ||
| 20 | -c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick= | ||
| 21 | -false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel", | ||
| 22 | -function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+ | ||
| 23 | -'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win== | ||
| 24 | -"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+ | ||
| 25 | -";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor, | ||
| 26 | -opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length? | ||
| 27 | -d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding}); | ||
| 28 | -y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height== | ||
| 29 | -i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents()); | ||
| 30 | -f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode== | ||
| 31 | -37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto"); | ||
| 32 | -s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j); | ||
| 33 | -f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c); | ||
| 34 | -j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type== | ||
| 35 | -"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"), | ||
| 36 | -10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)}; | ||
| 37 | -b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k= | ||
| 38 | -0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+ | ||
| 39 | -1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h= | ||
| 40 | -true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1; | ||
| 41 | -b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5- | ||
| 42 | -d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f); | ||
| 43 | -D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()}); | ||
| 44 | -b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}}; | ||
| 45 | -b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing", | ||
| 46 | -easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery); |
| @@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
| 1 | +/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ | ||
| 2 | +(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20, | ||
| 3 | +width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"}, | ||
| 4 | +keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+ | ||
| 5 | +(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, | ||
| 6 | +openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, | ||
| 7 | +isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, | ||
| 8 | +c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& | ||
| 9 | +k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| | ||
| 10 | +b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= | ||
| 11 | +setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current; | ||
| 12 | +d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d= | ||
| 13 | +a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")), | ||
| 14 | +b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(), | ||
| 15 | +y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement; | ||
| 16 | +if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&& | ||
| 17 | +(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0, | ||
| 18 | +{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1, | ||
| 19 | +mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio= | ||
| 20 | +!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href"); | ||
| 21 | +"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload= | ||
| 22 | +this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href); | ||
| 23 | +f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload, | ||
| 24 | +e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin, | ||
| 25 | +outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}", | ||
| 26 | +g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll": | ||
| 27 | +"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside? | ||
| 28 | +h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth|| | ||
| 29 | +h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&& | ||
| 30 | +"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width(); | ||
| 31 | +y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&& | ||
| 32 | +!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(), | ||
| 33 | +b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a= | ||
| 34 | +a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())): | ||
| 35 | +(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"=== | ||
| 36 | +f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c, | ||
| 37 | +{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a= | ||
| 38 | +b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay= | ||
| 39 | +f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive? | ||
| 40 | +b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth), | ||
| 41 | +p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"=== | ||
| 42 | +f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d= | ||
| 43 | +b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d, | ||
| 44 | +e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+ | ||
| 45 | +":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20=== | ||
| 46 | +d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery); | ||
| 0 | \ No newline at end of file | 47 | \ No newline at end of file |
public/stylesheets/application.css
| @@ -144,6 +144,7 @@ div#notice { | @@ -144,6 +144,7 @@ div#notice { | ||
| 144 | position: fixed; | 144 | position: fixed; |
| 145 | top: 30px; | 145 | top: 30px; |
| 146 | right: 30px; | 146 | right: 30px; |
| 147 | + pointer-events: none; | ||
| 147 | } | 148 | } |
| 148 | /* * * Generic Content Formating * * */ | 149 | /* * * Generic Content Formating * * */ |
| 149 | 150 |
public/stylesheets/fancybox.css
| @@ -1,359 +0,0 @@ | @@ -1,359 +0,0 @@ | ||
| 1 | -/* | ||
| 2 | - * FancyBox - jQuery Plugin | ||
| 3 | - * Simple and fancy lightbox alternative | ||
| 4 | - * | ||
| 5 | - * Examples and documentation at: http://fancybox.net | ||
| 6 | - * | ||
| 7 | - * Copyright (c) 2008 - 2010 Janis Skarnelis | ||
| 8 | - * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. | ||
| 9 | - * | ||
| 10 | - * Version: 1.3.4 (11/11/2010) | ||
| 11 | - * Requires: jQuery v1.3+ | ||
| 12 | - * | ||
| 13 | - * Dual licensed under the MIT and GPL licenses: | ||
| 14 | - * http://www.opensource.org/licenses/mit-license.php | ||
| 15 | - * http://www.gnu.org/licenses/gpl.html | ||
| 16 | - */ | ||
| 17 | - | ||
| 18 | -#fancybox-loading { | ||
| 19 | - position: fixed; | ||
| 20 | - top: 50%; | ||
| 21 | - left: 50%; | ||
| 22 | - width: 40px; | ||
| 23 | - height: 40px; | ||
| 24 | - margin-top: -20px; | ||
| 25 | - margin-left: -20px; | ||
| 26 | - cursor: pointer; | ||
| 27 | - overflow: hidden; | ||
| 28 | - z-index: 1104; | ||
| 29 | - display: none; | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -#fancybox-loading div { | ||
| 33 | - position: absolute; | ||
| 34 | - top: 0; | ||
| 35 | - left: 0; | ||
| 36 | - width: 40px; | ||
| 37 | - height: 480px; | ||
| 38 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 39 | -} | ||
| 40 | - | ||
| 41 | -#fancybox-overlay { | ||
| 42 | - position: absolute; | ||
| 43 | - top: 0; | ||
| 44 | - left: 0; | ||
| 45 | - width: 100%; | ||
| 46 | - z-index: 1100; | ||
| 47 | - display: none; | ||
| 48 | -} | ||
| 49 | - | ||
| 50 | -#fancybox-tmp { | ||
| 51 | - padding: 0; | ||
| 52 | - margin: 0; | ||
| 53 | - border: 0; | ||
| 54 | - overflow: auto; | ||
| 55 | - display: none; | ||
| 56 | -} | ||
| 57 | - | ||
| 58 | -#fancybox-wrap { | ||
| 59 | - position: absolute; | ||
| 60 | - top: 0; | ||
| 61 | - left: 0; | ||
| 62 | - padding: 20px; | ||
| 63 | - z-index: 1101; | ||
| 64 | - outline: none; | ||
| 65 | - display: none; | ||
| 66 | -} | ||
| 67 | - | ||
| 68 | -#fancybox-outer { | ||
| 69 | - position: relative; | ||
| 70 | - width: 100%; | ||
| 71 | - height: 100%; | ||
| 72 | - background: #fff; | ||
| 73 | -} | ||
| 74 | - | ||
| 75 | -#fancybox-content { | ||
| 76 | - width: 0; | ||
| 77 | - height: 0; | ||
| 78 | - padding: 0; | ||
| 79 | - outline: none; | ||
| 80 | - position: relative; | ||
| 81 | - overflow: hidden; | ||
| 82 | - z-index: 1102; | ||
| 83 | - border: 0px solid #fff; | ||
| 84 | -} | ||
| 85 | - | ||
| 86 | -#fancybox-hide-sel-frame { | ||
| 87 | - position: absolute; | ||
| 88 | - top: 0; | ||
| 89 | - left: 0; | ||
| 90 | - width: 100%; | ||
| 91 | - height: 100%; | ||
| 92 | - background: transparent; | ||
| 93 | - z-index: 1101; | ||
| 94 | -} | ||
| 95 | - | ||
| 96 | -#fancybox-close { | ||
| 97 | - position: absolute; | ||
| 98 | - top: -15px; | ||
| 99 | - right: -15px; | ||
| 100 | - width: 30px; | ||
| 101 | - height: 30px; | ||
| 102 | - background: transparent url('../images/fancybox/fancybox.png') -40px 0px; | ||
| 103 | - cursor: pointer; | ||
| 104 | - z-index: 1103; | ||
| 105 | - display: none; | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -#fancybox-error { | ||
| 109 | - color: #444; | ||
| 110 | - font: normal 12px/20px Arial; | ||
| 111 | - padding: 14px; | ||
| 112 | - margin: 0; | ||
| 113 | -} | ||
| 114 | - | ||
| 115 | -#fancybox-img { | ||
| 116 | - width: 100%; | ||
| 117 | - height: 100%; | ||
| 118 | - padding: 0; | ||
| 119 | - margin: 0; | ||
| 120 | - border: none; | ||
| 121 | - outline: none; | ||
| 122 | - line-height: 0; | ||
| 123 | - vertical-align: top; | ||
| 124 | -} | ||
| 125 | - | ||
| 126 | -#fancybox-frame { | ||
| 127 | - width: 100%; | ||
| 128 | - height: 100%; | ||
| 129 | - border: none; | ||
| 130 | - display: block; | ||
| 131 | -} | ||
| 132 | - | ||
| 133 | -#fancybox-left, #fancybox-right { | ||
| 134 | - position: absolute; | ||
| 135 | - bottom: 0px; | ||
| 136 | - height: 100%; | ||
| 137 | - width: 35%; | ||
| 138 | - cursor: pointer; | ||
| 139 | - outline: none; | ||
| 140 | - background: transparent url('../images/fancybox/blank.gif'); | ||
| 141 | - z-index: 1102; | ||
| 142 | - display: none; | ||
| 143 | -} | ||
| 144 | - | ||
| 145 | -#fancybox-left { | ||
| 146 | - left: 0px; | ||
| 147 | -} | ||
| 148 | - | ||
| 149 | -#fancybox-right { | ||
| 150 | - right: 0px; | ||
| 151 | -} | ||
| 152 | - | ||
| 153 | -#fancybox-left-ico, #fancybox-right-ico { | ||
| 154 | - position: absolute; | ||
| 155 | - top: 50%; | ||
| 156 | - left: -9999px; | ||
| 157 | - width: 30px; | ||
| 158 | - height: 30px; | ||
| 159 | - margin-top: -15px; | ||
| 160 | - cursor: pointer; | ||
| 161 | - z-index: 1102; | ||
| 162 | - display: block; | ||
| 163 | -} | ||
| 164 | - | ||
| 165 | -#fancybox-left-ico { | ||
| 166 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 167 | - background-position: -40px -30px; | ||
| 168 | -} | ||
| 169 | - | ||
| 170 | -#fancybox-right-ico { | ||
| 171 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 172 | - background-position: -40px -60px; | ||
| 173 | -} | ||
| 174 | - | ||
| 175 | -#fancybox-left:hover, #fancybox-right:hover { | ||
| 176 | - visibility: visible; /* IE6 */ | ||
| 177 | -} | ||
| 178 | - | ||
| 179 | -#fancybox-left:hover span { | ||
| 180 | - left: 20px; | ||
| 181 | -} | ||
| 182 | - | ||
| 183 | -#fancybox-right:hover span { | ||
| 184 | - left: auto; | ||
| 185 | - right: 20px; | ||
| 186 | -} | ||
| 187 | - | ||
| 188 | -.fancybox-bg { | ||
| 189 | - position: absolute; | ||
| 190 | - padding: 0; | ||
| 191 | - margin: 0; | ||
| 192 | - border: 0; | ||
| 193 | - width: 20px; | ||
| 194 | - height: 20px; | ||
| 195 | - z-index: 1001; | ||
| 196 | -} | ||
| 197 | - | ||
| 198 | -#fancybox-bg-n { | ||
| 199 | - top: -20px; | ||
| 200 | - left: 0; | ||
| 201 | - width: 100%; | ||
| 202 | - background-image: url('../images/fancybox/fancybox-x.png'); | ||
| 203 | -} | ||
| 204 | - | ||
| 205 | -#fancybox-bg-ne { | ||
| 206 | - top: -20px; | ||
| 207 | - right: -20px; | ||
| 208 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 209 | - background-position: -40px -162px; | ||
| 210 | -} | ||
| 211 | - | ||
| 212 | -#fancybox-bg-e { | ||
| 213 | - top: 0; | ||
| 214 | - right: -20px; | ||
| 215 | - height: 100%; | ||
| 216 | - background-image: url('../images/fancybox/fancybox-y.png'); | ||
| 217 | - background-position: -20px 0px; | ||
| 218 | -} | ||
| 219 | - | ||
| 220 | -#fancybox-bg-se { | ||
| 221 | - bottom: -20px; | ||
| 222 | - right: -20px; | ||
| 223 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 224 | - background-position: -40px -182px; | ||
| 225 | -} | ||
| 226 | - | ||
| 227 | -#fancybox-bg-s { | ||
| 228 | - bottom: -20px; | ||
| 229 | - left: 0; | ||
| 230 | - width: 100%; | ||
| 231 | - background-image: url('../images/fancybox/fancybox-x.png'); | ||
| 232 | - background-position: 0px -20px; | ||
| 233 | -} | ||
| 234 | - | ||
| 235 | -#fancybox-bg-sw { | ||
| 236 | - bottom: -20px; | ||
| 237 | - left: -20px; | ||
| 238 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 239 | - background-position: -40px -142px; | ||
| 240 | -} | ||
| 241 | - | ||
| 242 | -#fancybox-bg-w { | ||
| 243 | - top: 0; | ||
| 244 | - left: -20px; | ||
| 245 | - height: 100%; | ||
| 246 | - background-image: url('../images/fancybox/fancybox-y.png'); | ||
| 247 | -} | ||
| 248 | - | ||
| 249 | -#fancybox-bg-nw { | ||
| 250 | - top: -20px; | ||
| 251 | - left: -20px; | ||
| 252 | - background-image: url('../images/fancybox/fancybox.png'); | ||
| 253 | - background-position: -40px -122px; | ||
| 254 | -} | ||
| 255 | - | ||
| 256 | -#fancybox-title { | ||
| 257 | - font-family: Helvetica; | ||
| 258 | - font-size: 12px; | ||
| 259 | - z-index: 1102; | ||
| 260 | -} | ||
| 261 | - | ||
| 262 | -.fancybox-title-inside { | ||
| 263 | - padding-bottom: 10px; | ||
| 264 | - text-align: center; | ||
| 265 | - color: #333; | ||
| 266 | - background: #fff; | ||
| 267 | - position: relative; | ||
| 268 | -} | ||
| 269 | - | ||
| 270 | -.fancybox-title-outside { | ||
| 271 | - padding-top: 10px; | ||
| 272 | - color: #fff; | ||
| 273 | -} | ||
| 274 | - | ||
| 275 | -.fancybox-title-over { | ||
| 276 | - position: absolute; | ||
| 277 | - bottom: 0; | ||
| 278 | - left: 0; | ||
| 279 | - color: #FFF; | ||
| 280 | - text-align: left; | ||
| 281 | -} | ||
| 282 | - | ||
| 283 | -#fancybox-title-over { | ||
| 284 | - padding: 10px; | ||
| 285 | - background-image: url('../images/fancybox/fancy_title_over.png'); | ||
| 286 | - display: block; | ||
| 287 | -} | ||
| 288 | - | ||
| 289 | -.fancybox-title-float { | ||
| 290 | - position: absolute; | ||
| 291 | - left: 0; | ||
| 292 | - bottom: -20px; | ||
| 293 | - height: 32px; | ||
| 294 | -} | ||
| 295 | - | ||
| 296 | -#fancybox-title-float-wrap { | ||
| 297 | - border: none; | ||
| 298 | - border-collapse: collapse; | ||
| 299 | - width: auto; | ||
| 300 | -} | ||
| 301 | - | ||
| 302 | -#fancybox-title-float-wrap td { | ||
| 303 | - border: none; | ||
| 304 | - white-space: nowrap; | ||
| 305 | -} | ||
| 306 | - | ||
| 307 | -#fancybox-title-float-left { | ||
| 308 | - padding: 0 0 0 15px; | ||
| 309 | - background: url('../images/fancybox/fancybox.png') -40px -90px no-repeat; | ||
| 310 | -} | ||
| 311 | - | ||
| 312 | -#fancybox-title-float-main { | ||
| 313 | - color: #FFF; | ||
| 314 | - line-height: 29px; | ||
| 315 | - font-weight: bold; | ||
| 316 | - padding: 0 0 3px 0; | ||
| 317 | - background: url('../images/fancybox/fancybox-x.png') 0px -40px; | ||
| 318 | -} | ||
| 319 | - | ||
| 320 | -#fancybox-title-float-right { | ||
| 321 | - padding: 0 0 0 15px; | ||
| 322 | - background: url('../images/fancybox/fancybox.png') -55px -90px no-repeat; | ||
| 323 | -} | ||
| 324 | - | ||
| 325 | -/* IE6 */ | ||
| 326 | - | ||
| 327 | -.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_close.png', sizingMethod='scale'); } | ||
| 328 | - | ||
| 329 | -.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_nav_left.png', sizingMethod='scale'); } | ||
| 330 | -.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_nav_right.png', sizingMethod='scale'); } | ||
| 331 | - | ||
| 332 | -.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } | ||
| 333 | -.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_title_left.png', sizingMethod='scale'); } | ||
| 334 | -.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_title_main.png', sizingMethod='scale'); } | ||
| 335 | -.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_title_right.png', sizingMethod='scale'); } | ||
| 336 | - | ||
| 337 | -.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame { | ||
| 338 | - height: expression(this.parentNode.clientHeight + "px"); | ||
| 339 | -} | ||
| 340 | - | ||
| 341 | -#fancybox-loading.fancybox-ie6 { | ||
| 342 | - position: absolute; margin-top: 0; | ||
| 343 | - top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'); | ||
| 344 | -} | ||
| 345 | - | ||
| 346 | -#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_loading.png', sizingMethod='scale'); } | ||
| 347 | - | ||
| 348 | -/* IE6, IE7, IE8 */ | ||
| 349 | - | ||
| 350 | -.fancybox-ie .fancybox-bg { background: transparent !important; } | ||
| 351 | - | ||
| 352 | -.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_n.png', sizingMethod='scale'); } | ||
| 353 | -.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } | ||
| 354 | -.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_e.png', sizingMethod='scale'); } | ||
| 355 | -.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_se.png', sizingMethod='scale'); } | ||
| 356 | -.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_s.png', sizingMethod='scale'); } | ||
| 357 | -.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } | ||
| 358 | -.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_w.png', sizingMethod='scale'); } | ||
| 359 | -.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } |
| @@ -0,0 +1,275 @@ | @@ -0,0 +1,275 @@ | ||
| 1 | +/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ | ||
| 2 | +.fancybox-wrap, | ||
| 3 | +.fancybox-skin, | ||
| 4 | +.fancybox-outer, | ||
| 5 | +.fancybox-inner, | ||
| 6 | +.fancybox-image, | ||
| 7 | +.fancybox-wrap iframe, | ||
| 8 | +.fancybox-wrap object, | ||
| 9 | +.fancybox-nav, | ||
| 10 | +.fancybox-nav span, | ||
| 11 | +.fancybox-tmp | ||
| 12 | +{ | ||
| 13 | + padding: 0; | ||
| 14 | + margin: 0; | ||
| 15 | + border: 0; | ||
| 16 | + outline: none; | ||
| 17 | + vertical-align: top; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +.fancybox-wrap { | ||
| 21 | + position: absolute; | ||
| 22 | + top: 0; | ||
| 23 | + left: 0; | ||
| 24 | + z-index: 8020; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +.fancybox-skin { | ||
| 28 | + position: relative; | ||
| 29 | + background: #f9f9f9; | ||
| 30 | + color: #444; | ||
| 31 | + text-shadow: none; | ||
| 32 | + -webkit-border-radius: 4px; | ||
| 33 | + -moz-border-radius: 4px; | ||
| 34 | + border-radius: 4px; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +.fancybox-opened { | ||
| 38 | + z-index: 8030; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +.fancybox-opened .fancybox-skin { | ||
| 42 | + -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); | ||
| 43 | + -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); | ||
| 44 | + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +.fancybox-outer, .fancybox-inner { | ||
| 48 | + position: relative; | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +.fancybox-inner { | ||
| 52 | + overflow: hidden; | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +.fancybox-type-iframe .fancybox-inner { | ||
| 56 | + -webkit-overflow-scrolling: touch; | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +.fancybox-error { | ||
| 60 | + color: #444; | ||
| 61 | + font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
| 62 | + margin: 0; | ||
| 63 | + padding: 15px; | ||
| 64 | + white-space: nowrap; | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +.fancybox-image, .fancybox-iframe { | ||
| 68 | + display: block; | ||
| 69 | + width: 100%; | ||
| 70 | + height: 100%; | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +.fancybox-image { | ||
| 74 | + max-width: 100%; | ||
| 75 | + max-height: 100%; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { | ||
| 79 | + background-image: url('fancybox_sprite.png'); | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +#fancybox-loading { | ||
| 83 | + position: fixed; | ||
| 84 | + top: 50%; | ||
| 85 | + left: 50%; | ||
| 86 | + margin-top: -22px; | ||
| 87 | + margin-left: -22px; | ||
| 88 | + background-position: 0 -108px; | ||
| 89 | + opacity: 0.8; | ||
| 90 | + cursor: pointer; | ||
| 91 | + z-index: 8060; | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +#fancybox-loading div { | ||
| 95 | + width: 44px; | ||
| 96 | + height: 44px; | ||
| 97 | + background: url('fancybox_loading.gif') center center no-repeat; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +.fancybox-close { | ||
| 101 | + position: absolute; | ||
| 102 | + top: -15px; | ||
| 103 | + right: -15px; | ||
| 104 | + width: 30px; | ||
| 105 | + height: 30px; | ||
| 106 | + background: transparent url('../images/fancybox/fancy_close.png'); | ||
| 107 | + cursor: pointer; | ||
| 108 | + z-index: 8040; | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +.fancybox-nav { | ||
| 112 | + position: absolute; | ||
| 113 | + top: 0; | ||
| 114 | + width: 40%; | ||
| 115 | + height: 100%; | ||
| 116 | + cursor: pointer; | ||
| 117 | + text-decoration: none; | ||
| 118 | + background: transparent url('blank.gif'); /* helps IE */ | ||
| 119 | + -webkit-tap-highlight-color: rgba(0,0,0,0); | ||
| 120 | + z-index: 8040; | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +.fancybox-prev { | ||
| 124 | + left: 0; | ||
| 125 | +} | ||
| 126 | + | ||
| 127 | +.fancybox-next { | ||
| 128 | + right: 0; | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +.fancybox-nav span { | ||
| 132 | + position: absolute; | ||
| 133 | + top: 50%; | ||
| 134 | + width: 36px; | ||
| 135 | + height: 34px; | ||
| 136 | + margin-top: -18px; | ||
| 137 | + cursor: pointer; | ||
| 138 | + z-index: 8040; | ||
| 139 | + visibility: hidden; | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +.fancybox-prev span { | ||
| 143 | + left: 10px; | ||
| 144 | + background-position: 0 -36px; | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +.fancybox-next span { | ||
| 148 | + right: 10px; | ||
| 149 | + background-position: 0 -72px; | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +.fancybox-nav:hover span { | ||
| 153 | + visibility: visible; | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | +.fancybox-tmp { | ||
| 157 | + position: absolute; | ||
| 158 | + top: -99999px; | ||
| 159 | + left: -99999px; | ||
| 160 | + visibility: hidden; | ||
| 161 | + max-width: 99999px; | ||
| 162 | + max-height: 99999px; | ||
| 163 | + overflow: visible !important; | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +/* Overlay helper */ | ||
| 167 | + | ||
| 168 | +.fancybox-lock { | ||
| 169 | + overflow: hidden !important; | ||
| 170 | + width: auto; | ||
| 171 | +} | ||
| 172 | + | ||
| 173 | +.fancybox-lock body { | ||
| 174 | + overflow: hidden !important; | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +.fancybox-lock-test { | ||
| 178 | + overflow-y: hidden !important; | ||
| 179 | +} | ||
| 180 | + | ||
| 181 | +.fancybox-overlay { | ||
| 182 | + position: absolute; | ||
| 183 | + top: 0; | ||
| 184 | + left: 0; | ||
| 185 | + overflow: hidden; | ||
| 186 | + display: none; | ||
| 187 | + z-index: 8010; | ||
| 188 | + background: url('fancybox_overlay.png'); | ||
| 189 | +} | ||
| 190 | + | ||
| 191 | +.fancybox-overlay-fixed { | ||
| 192 | + position: fixed; | ||
| 193 | + bottom: 0; | ||
| 194 | + right: 0; | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +.fancybox-lock .fancybox-overlay { | ||
| 198 | + overflow: auto; | ||
| 199 | + overflow-y: scroll; | ||
| 200 | +} | ||
| 201 | + | ||
| 202 | +/* Title helper */ | ||
| 203 | + | ||
| 204 | +.fancybox-title { | ||
| 205 | + visibility: hidden; | ||
| 206 | + font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
| 207 | + position: relative; | ||
| 208 | + text-shadow: none; | ||
| 209 | + z-index: 8050; | ||
| 210 | +} | ||
| 211 | + | ||
| 212 | +.fancybox-opened .fancybox-title { | ||
| 213 | + visibility: visible; | ||
| 214 | +} | ||
| 215 | + | ||
| 216 | +.fancybox-title-float-wrap { | ||
| 217 | + position: absolute; | ||
| 218 | + bottom: 0; | ||
| 219 | + right: 50%; | ||
| 220 | + margin-bottom: -35px; | ||
| 221 | + z-index: 8050; | ||
| 222 | + text-align: center; | ||
| 223 | +} | ||
| 224 | + | ||
| 225 | +.fancybox-title-float-wrap .child { | ||
| 226 | + display: inline-block; | ||
| 227 | + margin-right: -100%; | ||
| 228 | + padding: 2px 20px; | ||
| 229 | + background: transparent; /* Fallback for web browsers that doesn't support RGBa */ | ||
| 230 | + background: rgba(0, 0, 0, 0.8); | ||
| 231 | + -webkit-border-radius: 15px; | ||
| 232 | + -moz-border-radius: 15px; | ||
| 233 | + border-radius: 15px; | ||
| 234 | + text-shadow: 0 1px 2px #222; | ||
| 235 | + color: #FFF; | ||
| 236 | + font-weight: bold; | ||
| 237 | + line-height: 24px; | ||
| 238 | + white-space: nowrap; | ||
| 239 | +} | ||
| 240 | + | ||
| 241 | +.fancybox-title-outside-wrap { | ||
| 242 | + position: relative; | ||
| 243 | + margin-top: 10px; | ||
| 244 | + color: #fff; | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +.fancybox-title-inside-wrap { | ||
| 248 | + padding-top: 10px; | ||
| 249 | +} | ||
| 250 | + | ||
| 251 | +.fancybox-title-over-wrap { | ||
| 252 | + position: absolute; | ||
| 253 | + bottom: 0; | ||
| 254 | + left: 0; | ||
| 255 | + color: #fff; | ||
| 256 | + padding: 10px; | ||
| 257 | + background: #000; | ||
| 258 | + background: rgba(0, 0, 0, .8); | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +/*Retina graphics!*/ | ||
| 262 | +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), | ||
| 263 | + only screen and (min--moz-device-pixel-ratio: 1.5), | ||
| 264 | + only screen and (min-device-pixel-ratio: 1.5){ | ||
| 265 | + | ||
| 266 | + #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { | ||
| 267 | + background-image: url('fancybox_sprite@2x.png'); | ||
| 268 | + background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/ | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + #fancybox-loading div { | ||
| 272 | + background-image: url('fancybox_loading@2x.gif'); | ||
| 273 | + background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/ | ||
| 274 | + } | ||
| 275 | +} | ||
| 0 | \ No newline at end of file | 276 | \ No newline at end of file |
script/ci-build
| @@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
| 1 | -#!/bin/sh | ||
| 2 | - | ||
| 3 | -set -e | ||
| 4 | - | ||
| 5 | -build() { | ||
| 6 | - cp config/database.yml.sqlite3 config/database.yml && /usr/bin/rake db:schema:load && /usr/bin/rake | ||
| 7 | -} | ||
| 8 | - | ||
| 9 | -# build the code in the VCS | ||
| 10 | -build | ||
| 11 | - | ||
| 12 | -# build the release tarball as well | ||
| 13 | -version=$(ruby -Ilib -rnoosfero -e 'puts Noosfero::VERSION') | ||
| 14 | -rm -rf pkg/ && rake -f Rakefile.pkg && cd pkg/noosfero-${version}/ && build |
script/feed-updater
| @@ -28,6 +28,7 @@ OptionParser.new do |opts| | @@ -28,6 +28,7 @@ OptionParser.new do |opts| | ||
| 28 | end.parse!(ARGV) | 28 | end.parse!(ARGV) |
| 29 | 29 | ||
| 30 | Daemons.run_proc(options[:app_name], options) do | 30 | Daemons.run_proc(options[:app_name], options) do |
| 31 | - require NOOSFERO_ROOT + '/config/environment' | 31 | + Dir.chdir NOOSFERO_ROOT |
| 32 | + require './config/environment' | ||
| 32 | FeedUpdater.new.start | 33 | FeedUpdater.new.start |
| 33 | end | 34 | end |
script/install-dependencies/debian-wheezy.sh
| 1 | -# FIXME upload to a more official repository and sign with an existing key | ||
| 2 | -if [ ! -e /etc/apt/sources.list.d/noosfero.list ]; then | 1 | +sources_entry='deb http://download.noosfero.org/debian/wheezy ./' |
| 2 | + | ||
| 3 | +if ! grep -q "$sources_entry" /etc/apt/sources.list.d/noosfero.list; then | ||
| 3 | sudo tee /etc/apt/sources.list.d/noosfero.list <<EOF | 4 | sudo tee /etc/apt/sources.list.d/noosfero.list <<EOF |
| 4 | -deb http://people.debian.org/~terceiro/noosfero-wheezy-backports/ ./ | 5 | +$sources_entry |
| 5 | EOF | 6 | EOF |
| 7 | + | ||
| 6 | sudo apt-key add - <<EOF | 8 | sudo apt-key add - <<EOF |
| 7 | -----BEGIN PGP PUBLIC KEY BLOCK----- | 9 | -----BEGIN PGP PUBLIC KEY BLOCK----- |
| 8 | -Version: GnuPG v1 | 10 | +Version: GnuPG v1.4.9 (GNU/Linux) |
| 9 | 11 | ||
| 10 | -mQINBEo1mTQBEAD29YIKM0hM2IsB+TzBOpQja6h5hJ1gVeP7IWhC8E11jwaaoP1K | ||
| 11 | -SXESKFMVPt0es0aCSDftm5TVTvLl08MG9fZBFT8pERfkWTEWWhY1MJ28sV8PRBHf | ||
| 12 | -nhN0mv5aduvgVx32+aCD0mWhI/3XHObf6c/X9WMwEaH+6A9UFiXRCyflra9YOfHU | ||
| 13 | -inXj5aYllc2UNiNxPhJ5sQTv97hdVbb/dFa+t9A2LFgPADbwUW+ShJN8zGR3XMne | ||
| 14 | -lXTcOgPhBadiNPPi8PztfOgcUk/NqZ5H4i0cXXbZB6leWcGMMMiWNexapgea/Hvp | ||
| 15 | -aXT2kSIug7OySFXM4nhM4xGo426+r9QHx1dzndHP5AW+WRuJmi3hMEdj22ifIFrV | ||
| 16 | -XtwovTb6/R2nG7WLVSHKg1AuFvIfG1RrTaVUVMcXVGX83CB2qKjfMHFRyMKUxoK7 | ||
| 17 | -cZZkgD+sst47L+P3MlrRPfuB6selEySIrcwXTxFiuhLf74Zc8AZZeOi5ae2GObGr | ||
| 18 | -b40wIT4HpJZO9M2YfZkMcnFsAqB8D4tPz9OjXiZdqNrXBMKJo0nsOFsYqkOCpnXP | ||
| 19 | -ic4HQvmEaEWzNuPlWFH54AQf3zAWMoawLXOfgAOYAc8gf1dxYOTMJEBIplBBj8ch | ||
| 20 | -E7WeiTv/f9vxuyX4CfTuuX/EEPTvkJ69bcBExtSm+bNs7fgwQwju0sHE7QARAQAB | ||
| 21 | -tC1BbnRvbmlvIFRlcmNlaXJvIDx0ZXJjZWlyb0Bzb2Z0d2FyZWxpdnJlLm9yZz6J | ||
| 22 | -AjoEEwEIACQCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AFAko1mzkCGQEACgkQ | ||
| 23 | -/A2xu81GC96yww/9HLaTgFTwnKZUhFEgcR9uOyZrb87NvCuXRkGAcy9sr5axSewh | ||
| 24 | -Fibf0I6eFWvq2goOMaPp4rKAFI8UDm/clFUrO62LRKUXy+1/8KWvTJm4c7p7mg9f | ||
| 25 | -Yhs8DPdQAKhl1AOqsT0m93ck+rQcYfAmSkBkX3usu+xEECrVH7oxD0nv3K+UDupT | ||
| 26 | -TXHYYvSBb2xjB8H7MQqEM04utbZb8osRFBKlz7TEbwuxyacvZPEq9qlchStPVMCm | ||
| 27 | -sr/sxeSSZawjKl3oZBG58JPj4+/nLkK+ADVP8E/lEtK45u47576QxgA8YHiNYtFm | ||
| 28 | -lmsrvCyHNaS2g4Pj9gYamYDeFehdH2roQnp28829b/VEs2sUMltj/hZQ58QQNdqe | ||
| 29 | -CpQVuHELD9tIw7CjGwjUYEMD8sow2ebwnl+ZNj5gz4PtOfetTR+0VBJG69kug1GC | ||
| 30 | -lD5SsRrdUp3dSfFAIoMG0LTDnfobjDX/VbJ24hBbCAkdE/1io/57X6GSlDg2tZ4+ | ||
| 31 | -gwIexMXzoRSl+to3XQBXSi8CdU99ePlf7MRNIJHpCZnFKZIMVlWpDckqvrGn4Ubv | ||
| 32 | -UfDBnS7K7lBOKxWvOX+uvYxSD0Deo5tbCPKH40pYmDT9R87QQhzI8QnrUUaUEcM0 | ||
| 33 | -G28XNcamChJFH/mEU3+Is9fSV4eyoN1sKi0gbvtgha0AZewFbeUkCH5aLae0J0Fu | ||
| 34 | -dG9uaW8gVGVyY2Vpcm8gPHRlcmNlaXJvQGRjYy51ZmJhLmJyPokCNwQTAQgAIQUC | ||
| 35 | -SjWa4AIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRD8DbG7zUYL3u4FD/4x | ||
| 36 | -qv8lFOEc8so7Iktp/1b3wLJ6jCyQ1XtgC2Bem91Rda0VGCoTj83nh1NXW2tV1Phi | ||
| 37 | -yIo82LA8/oRqsQnMVZZLe1kRX7vnpLzOjUG17kVOwpt7KwuK2VpXFoSYlntSR8cH | ||
| 38 | -P/vfyhuySN5Gd9RN/liSJLEMUb+r16ibm56mOSWpHFddiQtCGYkqP7Iz1w6L2axq | ||
| 39 | -+d+LPtD4jKVvQHTh9WPMDjZLNn4+glNOCXWj24GjWzdwsJuUJnOybDbgEpNLdpV0 | ||
| 40 | -I1Tr52ObTB4V1JmMQQ33pPwe70xeV9FcyIhKJKy+6NE/S7yiJDqYd1a10pDQDNvJ | ||
| 41 | -H2t+d6bxuI6+E3AEhvoOw6mTNrbLWIBciNGEWFSZc18gkmOLEijiu5cmFbvp6btu | ||
| 42 | -6glgPphTJGkGqkS96KKJcohCYtok9s6QFNr4+yb3iXb1nB2j484vCdukjEg0xoxE | ||
| 43 | -4sfhf/QRDuKfl5SWwebIhTxv50pJ+WCdXCTneK19SZO86EaGYInNdjZkEF4dO51O | ||
| 44 | -cLYvbcy+zMMpINdZu+yp2eaaAtJbFPBaMtbY2KJGDp4gzfRiYhyGcujZ3vJ1u5Ch | ||
| 45 | -KWqtPDsIXsr6a5hy9xI0WFeZ2CeHVO1UvW6i7qj+bgSDI9riAuub4ksk1LJvEL08 | ||
| 46 | -48yC3EZ5Vdai0PY40lVm7+u7Guq8WJku2LnTx2owUbQrQW50b25pbyBUZXJjZWly | ||
| 47 | -byA8dGVyY2Vpcm9AY29saXZyZS5jb29wLmJyPokCNwQTAQgAIQUCSjWazAIbAwUL | ||
| 48 | -CQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRD8DbG7zUYL3o7ND/9yesmfkHbrezjL | ||
| 49 | -nTthjgFizm96wDqCpX9Vif6/YNjorXxy5Yrd+Q3XHrPwkDvJQtrIbuG9IfQDvFRQ | ||
| 50 | -OdvieMquBDbCfIxFVfi8Vbvji6WyR5NU81TbcIw3MC9HXZP9fKJ7ZtFeqjXdjJEs | ||
| 51 | -stfoi4LmNPzPZqAD8DlV3gpTZ2gIPivA4QxxRR+tX3DHktklbLr8cektLzi1LJIH | ||
| 52 | -eXYMpVR9l0TyCmaszQiQOzVBUETmANuSgKOvs9qK80bvjrkuA5R7gx5py/VUOFht | ||
| 53 | -SJzjutL/eVlW/mqJQ/D7l6Je8XhX+niCw0HhbnHMtUruP8pwjcRkdf1b9ikxC1ib | ||
| 54 | -zpcxw0b6hn5tbcFZxcGWKQYv3H37ve4JJ74ZUnQPwbLKGhxXYi5UpNb1D1gePE/+ | ||
| 55 | -685bwDYI+4r9NB8Wqm7D+Qthaucmwg44lBscXtqUYZJqKGBR8PNH05j83H9q6FLy | ||
| 56 | -6M0/XYe9dDv6+PJ8QdtRe9ovQ5CibJZV/BERehm4g66k0t6WXofcDuw9mipLz+Os | ||
| 57 | -YUcx5MSnlbCGFtJjDlgNGaFh7S3cnWf1MX8lAJvftuzbtNq5FWKG0YihxhzMOiUf | ||
| 58 | -0BTWrh4DYmf3wVs8EGL6JVhTZK6bJRYQjyUrwQ1LuAJ8C40N0bjAnMEMBi5Sratn | ||
| 59 | -3uZRWXmoqepFn1D4nin/vXxI3p3ZN7QmQW50b25pbyBUZXJjZWlybyA8dGVyY2Vp | ||
| 60 | -cm9AZGViaWFuLm9yZz6JAjcEEwEIACEFAk4ocKwCGwMFCwkIBwMFFQoJCAsFFgID | ||
| 61 | -AQACHgECF4AACgkQ/A2xu81GC94nahAA8/gqJeozduayDxTWF/iNnC8PMOD0Stnn | ||
| 62 | -8GxuoamLmxspmu6etbwSm2FBBrBBZOGOVx6rV6OvtmzYnyIallEqY0lMEi7yySA/ | ||
| 63 | -spPvvEihB8KkVj8CW55BE8vaNhynXzneVzHpheV6zoH8o6YzBzg84LB4X3+IG3EZ | ||
| 64 | -52SUVMUoek6ZSUrTXLA0AuJE/LrchzRsVzEQj6Y9h5gpCsj9P/8n+4y403k26tuO | ||
| 65 | -sZWqLv/Sb3byinB0hdrg4U9sm9fk4yDB9fmFWQUaj5nUDxxPgWjdKrvI+y9+d4nP | ||
| 66 | -09Jg0fgG8viiQTer/Kg0n3Pwka7zGEn2o2BvZ/1LQBF0h+0BqNM0uXxoJoGVyOgY | ||
| 67 | -P1CIgfy/LZyl9f9kxDN8IYco0sCAjq8ZYIfjc0TLOI6F3StZZaEXDpXfFGfROh2e | ||
| 68 | -0/1gNEIKicgdLWYQNzcNf3Y7GqJtigRQaGSXpqN2WVL54vTpR55+IPEGgZUNlEU+ | ||
| 69 | -cG366pk9gj8gJo3Myhtm8jibXsPfVbVMz7QPJR/DfBte6s3maFdTDM4X8VbuMGRm | ||
| 70 | -PqH/6P7+KNVXdOBBMZMk223sZ2xdFVrrFE0njVSnXq+0kX6qmmG323YBm76XNdBO | ||
| 71 | -4a2s3weSJAboygKJ7uLUGgt2/6FZt2eMlUizta9eGxzkQ0c5e5MVBxHoC0BD1jTu | ||
| 72 | -FkQeKfqTDH60LkFudG9uaW8gVGVyY2Vpcm8gPGFudG9uaW8udGVyY2Vpcm9AbGlu | ||
| 73 | -YXJvLm9yZz6JAjcEEwEIACEFAlBGLZoCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgEC | ||
| 74 | -F4AACgkQ/A2xu81GC96aExAAgz2svW9mADXyLLUEOFMbpNR6G4gtXRTKZNmOsJBe | ||
| 75 | -7DRewKFWdKlXbtxLs77uZPqzX7S/sNFXetOieg1C2MBM1rL5artKpaXrHxWZEyCa | ||
| 76 | -DbWVeDdnCC0/WYn6hqrIyqjAJx9h+e3fpGTqxOuztMcp2uiMijuYVaPyCN0z6Hnj | ||
| 77 | -Y7p/IUTAUtUDU8dLQqzYimKrmsioIEPWlzt44g1MOLt2znQjedMTrDwQOstJj2G7 | ||
| 78 | -9v0meFVllTpMBSECKnt1I4SQEk0kq/R3cPqqLBJ75K+DH0fsGlqb6tW0oIB2BZDn | ||
| 79 | -nGnttUphS3xgSd1qy3/wTB047w2i5DqrHfleUgyWOMydSck8PK11i1x9UYdV0137 | ||
| 80 | -foVbTnRdY8/uoH32r4SjlRCeQA5VSeBxIq4EDW+G6tGEDawRji4x94TDgXYm54hO | ||
| 81 | -OzFhkL7zi0wtWc1GFQF7vZyLE93hYkhID70MnajqU0umZL+losmBiOvQGkIt9hSC | ||
| 82 | -iL+oTlmRw+SXtu7aPmu7Ue9s1ieaeivTMlFf7OD3tB1m/YiRbQH/XcBMaQp0GELI | ||
| 83 | -QeSzYmmY03E8E/X5IPtF0tRCvfp9GmUn3lfBDWcYhaWy6k3YqvLw8FS+uhmYwfhx | ||
| 84 | -j5bUV6MRIfNv06rXklhjgX22FUL9p0qilYqJmYQqVYku2Ff431dyDuzv7q0AkMoP | ||
| 85 | -N6+0JUFudG9uaW8gVGVyY2Vpcm8gPHRlcmNlaXJvQGNzLnViYy5jYT6JAjcEEwEI | ||
| 86 | -ACEFAk2SGLsCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQ/A2xu81GC95+ | ||
| 87 | -mg/+MGbOb7ntM05SO95GNKP8fTQXEnYa6xYIkASkHY7wPfBhYWdYE8kLajWdD1ec | ||
| 88 | -hDIS3nJ/4fVDUrF1ZJM37lIWJZhhQWwLPONCTlxWYTScosYzKkTeQ0PzBBrrsqOF | ||
| 89 | -xTtANvb8N9fE6rxkzl7cT48Ty+B0o+U2BolgtM/lmzdu44c7Wr9QIkCpE3wqMfj2 | ||
| 90 | -kw3JUMojOSVDTwavZyPHGa1wibH6R59rQ+WhG6OxiZAXCh8QIEbe6Z50R5Araqc4 | ||
| 91 | -x9/yvBN03j7YCSOJ0hDpRS9VWRWiGNEnn20My0mZRPI+VjvnYmR9w6cHWU33LwQ1 | ||
| 92 | -/xmpJfhJg989/rDRZlJZ4nYgGZoope+5+HcrOud+wrXBUXht3mMDuZTBoBMM5ey/ | ||
| 93 | -Z4Rl1FikNYgD58MDt3bNUyrb+MsUjNuCDPmmdH5CLTG0abxaSjRJ4dR6AZDVqt2x | ||
| 94 | -KVlhzkGEEBRyKRDmphMoC6AG+kIYuJqfnr1zh35QDuBZNRytt22HzDQk8RcMslrd | ||
| 95 | -nx94X/53LRvkdXNXoijhMMz4bt6exBz1GbRcW1Oe3JNeW3btekEgSizTfj5rFxQG | ||
| 96 | -Z8syg28WfQscpY4ffl+YlFALj+8ZqpIzezxa2aB0WqMq8BcFUe7+6NZliDwbOC35 | ||
| 97 | -ufMBt8SqCJd/o4Egmz09AZxVfWHlmQfApzKs3ARXnSkLeoK5Ag0ETXvdtwEQAOjS | ||
| 98 | -WZVeJx12YPlaz4ylULBrVpgbcSucTIYkx5sPFc0cJCRseG7AKBOG+Me4SfLma25/ | ||
| 99 | -IhcmoEsxCgo9eNM5XMysg3jo7Pui6g8OEw5wNIlKHsrOXk0ITSZpimxltrEMLm5a | ||
| 100 | -eaF95Ne35VNyr285H/AL1qM+Ubwfmpwd1Eu49z39/aY/0IDymdO11Aai8kz2OHED | ||
| 101 | -Rkx/Fe95Xx4JhdkwSYoaE3Tzz8GGU6Rig+MwJZeb9YiFSXHqRgP1+IjI+Ht1APvH | ||
| 102 | -kUKwXfmM1IuGBLE6pw0a6V4mWASW4Dy2+0PE/jR1R5AVxh03sd5eUC/BPQ/wFKH7 | ||
| 103 | -0+EryemO5181YLoOv3/RRDHmsxSk9C1BDLboSFbO9Mo5e78xYHkFHonm7iGejYto | ||
| 104 | -DLE9xHixOiyc86jbAkdL7Qjc6NJVNtCvTU58/4aArFBVzfEvWdz1umFcPmJKaCEp | ||
| 105 | -8YI8LalWK5meTbVUDuRWE/mtu8/k3jaCzHhj83GFIoFP6YNWGWlAZJGklhvM5Spr | ||
| 106 | -tvaD78hoaNpuPCh+u0Atuv3uWBHIsczIVxJYbSNvpLu+EN7O4DNnxkFI6GBDhHX+ | ||
| 107 | -lGEJdHn5JXmD43c2JVykS9d3XJcWdlyXgwdwRviXz2/kYdP7iAVLhl7T0skk8/A4 | ||
| 108 | -xv6p2FRMgixM/PIp1GZu915egPlilrFxYAg1xMGLABEBAAGJAh8EGAEIAAkFAk17 | ||
| 109 | -3bcCGwwACgkQ/A2xu81GC97B0w//QT1SS/s1fgJ8IDmbcUrfk3Y5+PvDnmHr8gsJ | ||
| 110 | -8A8hMJ2OLdxa2lrcWXebmiSPConAJlzBUKqYm+WZItjJYqEvRfLjKpzTJuxxSae1 | ||
| 111 | -v5v7Y2kUPKgIKmaD9EYl3c3SsyQB8lJ9cBhU6vSdo2L7/nckKSheiEw99MnJBK3B | ||
| 112 | -iyTYikt2NILuInZ0RErZ7xz1jpinCfkvZSYwJ+IiGxCFefYzDFECjj9bWjIE6vz6 | ||
| 113 | -4HyrXjtSdXsCcFrL+fSnhWOpdgmUuzdUWBH84mAWM6aXqNzAHOIrp5VatDWpHBPH | ||
| 114 | -bi3M/TIHyjrKnsaYrYU5fmhnTdLig2LMZhKg3vHAqvZfb1XbRgYTSuayGW9sGFG5 | ||
| 115 | -AWZDUOuv+E9FAvHGlv7EZJsy+yhQh4cNWlJQJnGEA/HxA2sRZlwGawwjbZ0xF6MG | ||
| 116 | -0Dj8x+9Eu3/nRYO0VYgzAYVKMF5cBfblNnWG8p5Npz6lfr1sLY1W9E/2XWkwvnr5 | ||
| 117 | -KDSaDo9iTj+Bhk60vWFDjD69oY1HpAZMGuBd/Z0qy0W/l+ovuMAIU6vH9gHtizdY | ||
| 118 | -uZe/53J8oBHx+zXgPxzCE7mylVCrVgq6MV6NZtEBQSa5PjPrzu12HAnfzHhV/z3Y | ||
| 119 | -o9boBnVcNoOCGxUTqpg1aCDvzH8B8Y6hQKVETA077iYfLMFcqMaMLGwAXxGGJbCy | ||
| 120 | -y/cBuQY= | ||
| 121 | -=oYoG | 12 | +mQGiBE1HCIURBADw6SnRbc1qCHdTV9wD0rxSMIWevzUX+bnDgvV455yudqtVFUhX |
| 13 | +2QYvtlwclllbLWKzRdiM7GsBi+2DyWli4B17xl86A5RBQNdc1v1vWZG3QwURxd4E | ||
| 14 | +46fC6mR/K09mJl7aD0yq1rFFLt8pq8aCn6geslqqwAkQHR1gXEL8ftqcpwCg7EkU | ||
| 15 | +n/yivf3qPX03zWBDmdQZog0D/2z0JGdVqLZJHAKjndKHSCuQlP+8d8NF0d27kStN | ||
| 16 | +hJjX8WcBLFKo9BeZUZnc0Kgq7+6p3wuvI1MzyqSEVEi2YxSB0zXU59HGrXtRQlQ2 | ||
| 17 | +YksppP2Hwe30/qrLgWJnNP4pxmWjv0F3PFSD4Om07hGxJ2ldWdBlfh2mAwOPtSXK | ||
| 18 | +yYTZA/93+OvQSyneVEBNMH58cCB98tbnFz15VBdinNLRUpbWYMq/UGjDr5HCn54B | ||
| 19 | +zh/SZOEVRVxgC8LMHsimNkBmpe2b6/5UdRa24CWb0iZV1mHEhNnaVp0PdMq2ljW0 | ||
| 20 | +T43e2pXeDuhfeFeELJyFdaQBRG7NIN+Udnu0tGZH3RonqVPM6LRETm9vc2Zlcm8g | ||
| 21 | +QXJjaGl2ZSBTaWduaW5nIEtleSA8bm9vc2Zlcm8tZGV2QGxpc3Rhcy5zb2Z0d2Fy | ||
| 22 | +ZWxpdnJlLm9yZz6IYAQTEQIAIAUCTUcIhQIbAwYLCQgHAwIEFQIIAwQWAgMBAh4B | ||
| 23 | +AheAAAoJELpeS0yfHm2nWpQAoNA5o6KDy8WUcXUHTfhmm5LYzPlQAJ91Ar/zaMdY | ||
| 24 | +9g/5zr9/Quy8NIUpwLkEDQRNRwiFEBAAmtDGneyUvMU6HHA3sd9rgfa+EXHzGSwG | ||
| 25 | +NvpREyAhxijnfPx4AUOCCOnh2Cf6jrwbxNNsWzgYVMdsO7yS/h1BHkO4t+RiPrYg | ||
| 26 | +nEggQFU2SNff+TZPYci7aeXPTs9/K4IyKQ/+whYpO8R8LFGECz7b7F1vyPzCHGbs | ||
| 27 | +Ki7mrNyinRFYVlpnmML7hBfrSFItSdefe59RL9Tu2kvr+vUvk60yvbdu93OrY5J7 | ||
| 28 | +ADAMN+NGPyPr/Y3Q9cXREmIRr5EV7U0IFBSDybMyvYODUc1gt25y+Byh3Yz7EyEZ | ||
| 29 | +N+0Oh3A1CydWkjrWUwpuNe/Eni6B8awu4nYq9ow4VMMZLE3ruhMeMj5YX74qg3Fl | ||
| 30 | +mOUODM5ffWbfiGaD2r4I+ZuH1VWvgPWWSLHHt8UI7eQLMxPWOoKVpKPPeme/27Rj | ||
| 31 | +qXljFWZpuhsmVuGN32R79T5jCnZUKAaciwvYN9ucZ3RazdhynpX1izmSCWkZEaCb | ||
| 32 | ++YNF3w/Wc9DqB9Ai78cVJzGqe7O11P4xtSI4T8oCx7oWlxHxlXUWD3Oa1b2yrXuL | ||
| 33 | +hDmF8uyUFRSKSVtP8et2SbCozF/wK90DCy55FqUdraDahyAt8kFgM3CQR9mRh56p | ||
| 34 | +EWorsDpd08puRFoPevEGe99+McZ29pR6f3RbrcFe2ws7lw2w8AJbHgelXRbeEie+ | ||
| 35 | +x/4Nfu/UATsAAwUP+gN2nSgLAS2Md3awg9mBI6VufflMbsuZJxjemJ9Phdyx5PR2 | ||
| 36 | +PvRvyZffaqZltTbBxPiOA1wAIpeWNVJehCpiZgXih93HMTrucBvYyLlbxr7Or7ex | ||
| 37 | +t1/K7TZo5Si+yJ6zNCNXewPimZCV1oUWE8P2uy8iyMUhgpFc7q7xeQCOkvqYphlA | ||
| 38 | +bUT8BcD6Coo4s98gOfgetch0fgCdiCYTNbT0+7jOw8sTx7DmlQHKSmQ6NXOZypI7 | ||
| 39 | +lk3OwZIGB6t+Os2Q8uLYxoWzK6fqc8CSSgQPpL4wd4w9/etwzav3/SiZJN3NE0UL | ||
| 40 | +RoayneyD0bC83w2HAEcYb8qDsF85pPkjXSXZdlXulTZC89/4yq8h6hJODOQ7hKTx | ||
| 41 | +TvEE5i3LmAYj+uTbuoauYBJMiU2oXrqfCGR+tmxz5V7QSwLdy0d95w0F/Rj1sesO | ||
| 42 | +SfBRGyxqSqQsO9KDMJdmi/FyjiPBVKE3i9YFWsePLnHs3JNCRehDt3xpap3YrjBW | ||
| 43 | +MAMb36KpZ9M6Cj2nRjB4pfVNno0hmsQ3+8So2vBW/UAbHUW/izQPRFVp+HXVxDf6 | ||
| 44 | +xjIi9gyocstFCkKrD7NFL/7u6fWginUNXIjYAdqbqRIihzfW7Et2QiPL4tnQrQey | ||
| 45 | +4P8Y7+gThn0CWeJw4leCueYr/yYUJ7lelYCd9q2uphC/2KinUxBSInKjQ7+8iEkE | ||
| 46 | +GBECAAkFAk1HCIUCGwwACgkQul5LTJ8ebae2qgCeOMvYOOVDVtchTRhD56VlYKOi | ||
| 47 | +FPQAoNmiMgP6zGF9rgOEWMEiFEryayrz | ||
| 48 | +=70DR | ||
| 122 | -----END PGP PUBLIC KEY BLOCK----- | 49 | -----END PGP PUBLIC KEY BLOCK----- |
| 123 | EOF | 50 | EOF |
| 124 | run sudo apt-get update | 51 | run sudo apt-get update |
| @@ -131,4 +58,4 @@ packages=$(grep-dctrl -n -s Build-Depends,Depends,Recommends -S -X noosfero debi | @@ -131,4 +58,4 @@ packages=$(grep-dctrl -n -s Build-Depends,Depends,Recommends -S -X noosfero debi | ||
| 131 | run sudo apt-get -y install $packages | 58 | run sudo apt-get -y install $packages |
| 132 | sudo apt-get -y install iceweasel || sudo apt-get -y install firefox | 59 | sudo apt-get -y install iceweasel || sudo apt-get -y install firefox |
| 133 | 60 | ||
| 134 | -run bundle install | 61 | +run bundle --local |
script/noosfero-plugins
| @@ -14,9 +14,10 @@ fi | @@ -14,9 +14,10 @@ fi | ||
| 14 | # data | 14 | # data |
| 15 | available_plugins_dir="$NOOSFERO_DIR/plugins" | 15 | available_plugins_dir="$NOOSFERO_DIR/plugins" |
| 16 | enabled_plugins_dir="$NOOSFERO_DIR/config/plugins" | 16 | enabled_plugins_dir="$NOOSFERO_DIR/config/plugins" |
| 17 | +base_plugins_dir="$NOOSFERO_DIR/baseplugins" | ||
| 17 | available_plugins=$(find "$available_plugins_dir" -maxdepth 1 -mindepth 1 -type d -not -name 'template' -printf '%f\n' | sort) | 18 | available_plugins=$(find "$available_plugins_dir" -maxdepth 1 -mindepth 1 -type d -not -name 'template' -printf '%f\n' | sort) |
| 18 | enabled_plugins=$(find -L "$enabled_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort) | 19 | enabled_plugins=$(find -L "$enabled_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort) |
| 19 | -disabled_plugins=$(printf "%s\n" $available_plugins $enabled_plugins_dir | sort | uniq -u) | 20 | +base_plugins=$(find -L "$base_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort) |
| 20 | 21 | ||
| 21 | # operation defaults | 22 | # operation defaults |
| 22 | quiet=false | 23 | quiet=false |
| @@ -32,7 +33,7 @@ _list() { | @@ -32,7 +33,7 @@ _list() { | ||
| 32 | 33 | ||
| 33 | _status() { | 34 | _status() { |
| 34 | for plugin in $available_plugins; do | 35 | for plugin in $available_plugins; do |
| 35 | - if [ -h "$enabled_plugins_dir/$plugin" ]; then | 36 | + if [ -h "$enabled_plugins_dir/$plugin" -o -h "$base_plugins_dir/$plugin" ]; then |
| 36 | status="*" | 37 | status="*" |
| 37 | else | 38 | else |
| 38 | status=" " | 39 | status=" " |
| @@ -79,8 +80,9 @@ _enable(){ | @@ -79,8 +80,9 @@ _enable(){ | ||
| 79 | cd $enabled_plugins_dir | 80 | cd $enabled_plugins_dir |
| 80 | source="../../plugins/$plugin" | 81 | source="../../plugins/$plugin" |
| 81 | target="$enabled_plugins_dir/$plugin" | 82 | target="$enabled_plugins_dir/$plugin" |
| 83 | + base="$base_plugins_dir/$plugin" | ||
| 82 | run "$source/before_enable.rb" | 84 | run "$source/before_enable.rb" |
| 83 | - if [ -h "$target" ]; then | 85 | + if [ -h "$target" -o -h "$base" ]; then |
| 84 | _say "$plugin already enabled" | 86 | _say "$plugin already enabled" |
| 85 | else | 87 | else |
| 86 | if [ ! -d "$source" ]; then | 88 | if [ ! -d "$source" ]; then |
| @@ -127,19 +129,20 @@ _disable(){ | @@ -127,19 +129,20 @@ _disable(){ | ||
| 127 | target="$enabled_plugins_dir/$plugin" | 129 | target="$enabled_plugins_dir/$plugin" |
| 128 | plugins_public_dir="$NOOSFERO_DIR/public/plugins" | 130 | plugins_public_dir="$NOOSFERO_DIR/public/plugins" |
| 129 | plugins_features_dir="$NOOSFERO_DIR/features/plugins" | 131 | plugins_features_dir="$NOOSFERO_DIR/features/plugins" |
| 130 | - if ! run "$source/before_disable.rb"; then | ||
| 131 | - echo "W: failed to disabling $plugin" | ||
| 132 | - echo | 132 | + |
| 133 | + if [ -h "$base_plugins_dir/$plugin" ]; then | ||
| 134 | + _say "$plugin is a base plugin and cannot be disabled" | ||
| 135 | + return | ||
| 136 | + fi | ||
| 137 | + | ||
| 138 | + if [ -h "$target" ]; then | ||
| 139 | + rm "$target" | ||
| 140 | + test -h "$plugins_public_dir/$plugin" && rm "$plugins_public_dir/$plugin" | ||
| 141 | + test -h "$plugins_features_dir/$plugin" && rm "$plugins_features_dir/$plugin" | ||
| 142 | + _say "$plugin disabled" | ||
| 143 | + run "$source/after_disable.rb" | ||
| 133 | else | 144 | else |
| 134 | - if [ -h "$target" ]; then | ||
| 135 | - rm "$target" | ||
| 136 | - test -h "$plugins_public_dir/$plugin" && rm "$plugins_public_dir/$plugin" | ||
| 137 | - test -h "$plugins_features_dir/$plugin" && rm "$plugins_features_dir/$plugin" | ||
| 138 | - _say "$plugin disabled" | ||
| 139 | - run "$source/after_disable.rb" | ||
| 140 | - else | ||
| 141 | - _say "$plugin already disabled" | ||
| 142 | - fi | 145 | + _say "$plugin already disabled" |
| 143 | fi | 146 | fi |
| 144 | } | 147 | } |
| 145 | 148 |
test/functional/cms_controller_test.rb
| @@ -321,6 +321,14 @@ class CmsControllerTest < ActionController::TestCase | @@ -321,6 +321,14 @@ class CmsControllerTest < ActionController::TestCase | ||
| 321 | assert_equal 'test.txt', f.children[0].name | 321 | assert_equal 'test.txt', f.children[0].name |
| 322 | end | 322 | end |
| 323 | 323 | ||
| 324 | + should 'set author of uploaded files' do | ||
| 325 | + f = Folder.new(:name => 'f'); profile.articles << f; f.save! | ||
| 326 | + post :upload_files, :profile => profile.identifier, :parent_id => f.id, :uploaded_files => [fixture_file_upload('/files/test.txt', 'text/plain')] | ||
| 327 | + | ||
| 328 | + uf = profile.articles.find_by_name('test.txt') | ||
| 329 | + assert_equal profile, uf.author | ||
| 330 | + end | ||
| 331 | + | ||
| 324 | should 'display destination folder of files when uploading file in root folder' do | 332 | should 'display destination folder of files when uploading file in root folder' do |
| 325 | get :upload_files, :profile => profile.identifier | 333 | get :upload_files, :profile => profile.identifier |
| 326 | 334 |
test/unit/approve_article_test.rb
| @@ -431,4 +431,13 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -431,4 +431,13 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
| 431 | end | 431 | end |
| 432 | end | 432 | end |
| 433 | 433 | ||
| 434 | + should 'create link to referenced article' do | ||
| 435 | + article = fast_create(Article) | ||
| 436 | + a = create(ApproveArticle, :name => 'test name', :article => article, :target => community, :requestor => profile) | ||
| 437 | + a.create_link = true | ||
| 438 | + a.finish | ||
| 439 | + | ||
| 440 | + assert_equal article, LinkArticle.last.reference_article | ||
| 441 | + end | ||
| 442 | + | ||
| 434 | end | 443 | end |
| @@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | ||
| 2 | + | ||
| 3 | +class LinkArticleTest < ActiveSupport::TestCase | ||
| 4 | + | ||
| 5 | + def setup | ||
| 6 | + @profile = create_user('testing').person | ||
| 7 | + end | ||
| 8 | + attr_reader :profile | ||
| 9 | + | ||
| 10 | + should 'url of article link redirects to referenced article' do | ||
| 11 | + article = fast_create(Article, :profile_id => profile.id) | ||
| 12 | + link = LinkArticle.new(:reference_article => article) | ||
| 13 | + assert_equal article.url, link.url | ||
| 14 | + end | ||
| 15 | + | ||
| 16 | + should 'name of article link is the same as the name of referenced article' do | ||
| 17 | + article = fast_create(Article, :profile_id => profile.id) | ||
| 18 | + link = LinkArticle.new(:reference_article => article) | ||
| 19 | + assert_equal article.name, link.name | ||
| 20 | + end | ||
| 21 | + | ||
| 22 | + should 'destroy link article when reference article is removed' do | ||
| 23 | + target_profile = fast_create(Community) | ||
| 24 | + article = fast_create(Article, :profile_id => profile.id) | ||
| 25 | + link = LinkArticle.create!(:reference_article => article, :profile => target_profile) | ||
| 26 | + article.destroy | ||
| 27 | + assert_raise ActiveRecord::RecordNotFound do | ||
| 28 | + link.reload | ||
| 29 | + end | ||
| 30 | + end | ||
| 31 | + | ||
| 32 | +end |
test/unit/profile_list_block_test.rb
| @@ -216,4 +216,14 @@ class ProfileListBlockTest < ActiveSupport::TestCase | @@ -216,4 +216,14 @@ class ProfileListBlockTest < ActiveSupport::TestCase | ||
| 216 | assert ProfileListBlock.new.prioritize_profiles_with_image | 216 | assert ProfileListBlock.new.prioritize_profiles_with_image |
| 217 | end | 217 | end |
| 218 | 218 | ||
| 219 | + should 'return the max value in the range between zero and limit' do | ||
| 220 | + block = ProfileListBlock.new | ||
| 221 | + assert_equal 6, block.get_limit | ||
| 222 | + end | ||
| 223 | + | ||
| 224 | + should 'return 0 if limit of the block is negative' do | ||
| 225 | + block = ProfileListBlock.new | ||
| 226 | + block.limit = -5 | ||
| 227 | + assert_equal 0, block.get_limit | ||
| 228 | + end | ||
| 219 | end | 229 | end |
test/unit/recent_documents_block_test.rb
| @@ -89,4 +89,14 @@ class RecentDocumentsBlockTest < ActiveSupport::TestCase | @@ -89,4 +89,14 @@ class RecentDocumentsBlockTest < ActiveSupport::TestCase | ||
| 89 | assert_equal 'always', @block.display | 89 | assert_equal 'always', @block.display |
| 90 | end | 90 | end |
| 91 | 91 | ||
| 92 | + should 'return the max value in the range between zero and limit' do | ||
| 93 | + block = RecentDocumentsBlock.new | ||
| 94 | + assert_equal 5, block.get_limit | ||
| 95 | + end | ||
| 96 | + | ||
| 97 | + should 'return 0 if limit of the block is negative' do | ||
| 98 | + block = RecentDocumentsBlock.new | ||
| 99 | + block.limit = -5 | ||
| 100 | + assert_equal 0, block.get_limit | ||
| 101 | + end | ||
| 92 | end | 102 | end |
test/unit/tags_block_test.rb
| @@ -58,4 +58,14 @@ class TagsBlockTest < ActiveSupport::TestCase | @@ -58,4 +58,14 @@ class TagsBlockTest < ActiveSupport::TestCase | ||
| 58 | assert /\/first-tag".*\/second-tag".*\/third-tag"/m =~ block.content | 58 | assert /\/first-tag".*\/second-tag".*\/third-tag"/m =~ block.content |
| 59 | end | 59 | end |
| 60 | 60 | ||
| 61 | + should 'return the max value in the range between zero and limit' do | ||
| 62 | + block = TagsBlock.new | ||
| 63 | + assert_equal 12, block.get_limit | ||
| 64 | + end | ||
| 65 | + | ||
| 66 | + should '' do | ||
| 67 | + block = TagsBlock.new | ||
| 68 | + block.limit = -5 | ||
| 69 | + assert_equal 0, block.get_limit | ||
| 70 | + end | ||
| 61 | end | 71 | end |
vendor/gdata-1.1.1/lib/gdata.rb
| @@ -17,5 +17,3 @@ $:.unshift(File.dirname(__FILE__)) | @@ -17,5 +17,3 @@ $:.unshift(File.dirname(__FILE__)) | ||
| 17 | require 'gdata/http' | 17 | require 'gdata/http' |
| 18 | require 'gdata/client' | 18 | require 'gdata/client' |
| 19 | require 'gdata/auth' | 19 | require 'gdata/auth' |
| 20 | -# This is for Unicode "support" | ||
| 21 | -$KCODE = 'UTF8' |