Commit 17dffbf902e035758ee378abaae2b01e606bfb9b

Authored by Leandro Santos
1 parent d55a0db2

removing serpro integration plugin

Showing 24 changed files with 0 additions and 945 deletions   Show diff stats
plugins/serpro_integration/Gemfile
... ... @@ -1,3 +0,0 @@
1   -source 'https://rubygems.org'
2   -gem 'gitlab', '~> 3.3.0'
3   -gem 'jenkins_api_client', '~> 0.14.1'
plugins/serpro_integration/controllers/serpro_integration_plugin_admin_controller.rb
... ... @@ -1,15 +0,0 @@
1   -class SerproIntegrationPluginAdminController < PluginAdminController
2   -
3   - def index
4   - settings = params[:settings]
5   - settings ||= {}
6   -
7   - @settings = Noosfero::Plugin::Settings.new(environment, SerproIntegrationPlugin, settings)
8   - if request.post?
9   - @settings.save!
10   - session[:notice] = 'Settings succefully saved.'
11   - redirect_to :action => 'index'
12   - end
13   - end
14   -
15   -end
plugins/serpro_integration/controllers/serpro_integration_plugin_myprofile_controller.rb
... ... @@ -1,13 +0,0 @@
1   -class SerproIntegrationPluginMyprofileController < MyProfileController
2   - append_view_path File.join(File.dirname(__FILE__) + '/../views')
3   -
4   - def create_gitlab
5   - profile.create_gitlab_project
6   - render :update do |page|
7   - page.replace_html 'gitlab', :partial => 'gitlab'
8   -# page.replace_html 'gitlab', 'teste'
9   - end
10   -# raise 'teste my profile'
11   - end
12   -
13   -end
plugins/serpro_integration/features/sonar.feature
... ... @@ -1,15 +0,0 @@
1   -Feature: require authentication to comment
2   -
3   - Background:
4   - Given plugin RequireAuthToCommentPlugin is enabled on environment
5   - And the following users
6   - | login |
7   - | bozo |
8   -
9   - Scenario: enabling unauthenticated comment per profile
10   - Given I am logged in as "bozo"
11   - When I edit my profile
12   - And I check "Accept comments from unauthenticated users"
13   - And I press "Save"
14   - Then I edit my profile
15   - And the "Accept comments from unauthenticated users" checkbox should be checked
plugins/serpro_integration/install.rb
... ... @@ -1,2 +0,0 @@
1   -system "gem install --user-install gitlab"
2   -system "gem install --user-install jenkins_api_client"
plugins/serpro_integration/lib/ext/community.rb
... ... @@ -1,76 +0,0 @@
1   -require_dependency 'community'
2   -
3   -class Community
4   -
5   - settings_items :allow_sonar_integration, :type => :boolean, :default => false
6   - settings_items :allow_gitlab_integration, :type => :boolean, :default => true
7   - settings_items :allow_jenkins_integration, :type => :boolean, :default => true
8   -
9   - settings_items :serpro_integration_plugin_gitlab, :type => Hash, :default => {}
10   - settings_items :serpro_integration_plugin_jenkins, :type => Hash, :default => {}
11   - settings_items :serpro_integration_plugin_sonar, :type => Hash, :default => {}
12   -
13   - attr_accessible :allow_unauthenticated_comments, :allow_gitlab_integration, :allow_sonar_integration, :allow_jenkins_integration, :serpro_integration_plugin_gitlab, :serpro_integration_plugin_jenkins, :serpro_integration_plugin_sonar
14   -
15   - after_create :create_integration_projects, :if => lambda { |c| c.allow_serpro_integration?}
16   -
17   - def create_integration_projects
18   -
19   - if allow_gitlab_integration
20   - gitlab_integration = SerproIntegrationPlugin::GitlabIntegration.new(gitlab_host, gitlab_private_token)
21   - gitlab_project = gitlab_integration.create_gitlab_project(self)
22   - serpro_integration_plugin_gitlab[:project_id] = gitlab_project.id
23   -
24   - if allow_jenkins_integration
25   - jenkins_integration = SerproIntegrationPlugin::JenkinsIntegration.new(jenkins_host, jenkins_private_token, jenkins_user)
26   -
27   - jenkins_integration.create_jenkis_project(self, gitlab_project.path_with_namespace, gitlab_project.web_url, gitlab_project.http_url_to_repo)
28   - gitlab_integration.create_jenkins_hook(jenkins_integration.host)
29   - end
30   -
31   - end
32   - end
33   -
34   - def serpro_integration_plugin_settings
35   - @settings ||= Noosfero::Plugin::Settings.new(environment, SerproIntegrationPlugin)
36   - end
37   -
38   - def gitlab_group
39   - serpro_integration_plugin_gitlab[:group] || self.identifier
40   - end
41   -
42   - def gitlab_project_name
43   - serpro_integration_plugin_gitlab[:project_name] || self.identifier
44   - end
45   -
46   - def gitlab_host
47   - serpro_integration_plugin_settings.gitlab[:host]
48   - end
49   -
50   - def gitlab_private_token
51   - serpro_integration_plugin_settings.gitlab[:private_token]
52   - end
53   -
54   - def jenkins_host
55   - serpro_integration_plugin_settings.jenkins[:host]
56   - end
57   -
58   - def jenkins_private_token
59   - serpro_integration_plugin_settings.jenkins[:private_token]
60   - end
61   -
62   - def jenkins_user
63   - serpro_integration_plugin_settings.jenkins[:user]
64   - end
65   -
66   - def jenkins_project_name
67   - serpro_integration_plugin_jenkins[:project_name] || self.identifier
68   - end
69   -
70   - def allow_serpro_integration?
71   - return false if serpro_integration_plugin_settings.communities.blank? || serpro_integration_plugin_settings.communities[:templates].blank?
72   - allow = serpro_integration_plugin_settings.communities[:templates].include?(self.id.to_s)
73   - allow || serpro_integration_plugin_settings.communities[:templates].include?(self.template_id.to_s)
74   - end
75   -
76   -end
plugins/serpro_integration/lib/serpro_integration_plugin.rb
... ... @@ -1,39 +0,0 @@
1   -class SerproIntegrationPlugin < Noosfero::Plugin
2   -
3   - def self.plugin_name
4   - "Serpro Integration Plugin"
5   - end
6   -
7   - def self.plugin_description
8   - _("Make integration with serpro servers.")
9   - end
10   -
11   - #FIXME make this test
12   - # User could not have this block
13   - def self.extra_blocks
14   - { SerproIntegrationPlugin::SonarWidgetBlock => {:type => [Community] },
15   - SerproIntegrationPlugin::SmileBlock => {:type => [Community] },
16   - }
17   - end
18   -
19   - #FIXME make this test
20   - def profile_editor_extras
21   - proc do
22   - render :file => 'profile-editor-extras', :locals => {:context => self} if profile.kind_of?(Community)
23   - end
24   - end
25   -
26   - def profile_id
27   - context.profile
28   - end
29   -
30   - def stylesheet?
31   - true
32   - end
33   -
34   -# FIXME make this test
35   - def js_files
36   - ['smile_face.js']
37   - end
38   -
39   -end
plugins/serpro_integration/lib/serpro_integration_plugin/gitlab_integration.rb
... ... @@ -1,71 +0,0 @@
1   -require 'gitlab'
2   -
3   -class SerproIntegrationPlugin::GitlabIntegration
4   -
5   - def initialize(host, private_token)
6   - @client = Gitlab.client(:endpoint => host, :private_token => private_token)
7   - @group = nil
8   - @project = nil
9   - end
10   -
11   - def create_group(group_name)
12   - #FIXME find group by name
13   - group = @client.groups(:search => group_name).select {|group| group.name == group_name}.first
14   - group ||= @client.create_group(group_name, group_name)
15   - @group = group
16   - end
17   -
18   - def create_project(project_name, group)
19   - path_with_namespace = "#{group.name}/#{project_name}"
20   - #FIXME find project by namespace
21   - project = @client.get("/projects/search/#{project_name}").select do |project|
22   - project.path_with_namespace == path_with_namespace
23   - end.first
24   -
25   - if project.nil?
26   - project_options = {}
27   - project_options[:namespace_id] = group.id
28   - project_options[:issues_enabled ] = true
29   - project_options[:wall_enabled] = true
30   - project_options[:wiki_enabled] = true
31   - project_options[:public] = true
32   -
33   - project = @client.create_project(project_name, project_options)
34   - #Create Web Hook for Jenkins' integration
35   - #Gitlab.add_project_hook(project.id, "#{self.jenkins[:url]}/gitlab/build_now")
36   - end
37   - @project = project
38   - end
39   -
40   - def create_user(email, group)
41   - user = @client.users(:search => email).first
42   - username = name = email[/[^@]+/]
43   - user ||= @client.create_user(email, '123456', {:username => username, :name => name, :provider => 'ldap'})
44   -
45   - begin
46   - @client.add_group_member(group.id, user.id, 40)
47   - rescue Gitlab::Error::Conflict => e
48   - #already member
49   - Rails.logger.info e.to_s
50   - end
51   - user
52   - end
53   -
54   - #http://rubydoc.info/gems/gitlab/frames
55   - def create_gitlab_project(profile)
56   - group = create_group(profile.gitlab_group)
57   -
58   - #create admins and add to group
59   - profile.admins.each do |person|
60   - create_user(person.user.email, group)
61   - end
62   -
63   - project = create_project(profile.gitlab_project_name, group)
64   - end
65   -
66   -
67   - def create_jenkins_hook(jenkins_host)
68   - @client.add_project_hook(@project.id, "#{jenkins_host}/gitlab/build_now")
69   - end
70   -
71   -end
plugins/serpro_integration/lib/serpro_integration_plugin/gitlab_issues_block.rb
... ... @@ -1,33 +0,0 @@
1   -require 'open-uri'
2   -require 'json'
3   -
4   -class SerproIntegrationPlugin::GitlabIssuesBlock < Block
5   -
6   - def self.description
7   - _('Gitlab Issues')
8   - end
9   -
10   - def help
11   - _('This block list gitlab issues')
12   - end
13   -
14   - #FIXME make this test
15   - def content(args={})
16   - gitlab_integration = SerproIntegrationPlugin::GitlabIntegration.new(owner.gitlab_host, owner.gitlab_private_token)
17   - issues = gitlab_integration.issues(owner)
18   - block = self
19   - proc do
20   - render :file => 'blocks/gitlab_issues', :locals => {:issues => issues, :block => block}
21   - end
22   - #content_tag(:div,
23   - # content_tag(:canvas, '', :id => smile_face_id, :width => '95%', :height => '95%' ) +
24   - # "<script type='text/javascript'>drawFace('#{smile_face_id}', '#{self.smile_factor}')</script>",
25   - # :class => 'smile'
26   - #)
27   - end
28   -
29   - def cacheable?
30   - false
31   - end
32   -
33   -end
plugins/serpro_integration/lib/serpro_integration_plugin/jenkins_integration.rb
... ... @@ -1,117 +0,0 @@
1   -# encoding: UTF-8
2   -require 'jenkins_api_client'
3   -
4   -class SerproIntegrationPlugin::JenkinsIntegration
5   -
6   - attr_accessor :profile
7   -
8   - def initialize(host, private_token, user)
9   - @client = JenkinsApi::Client.new(:server_url => host, :password => private_token, :username => user)
10   - @profile = nil
11   - @private_token = private_token
12   - end
13   -
14   - def project_url
15   - "#{host}/#{project_name}"
16   - end
17   -
18   - def host
19   - @profile.jenkins_host
20   - end
21   -
22   - def project_name
23   - @profile.jenkins_project_name
24   - end
25   - #FIXME make jenkins integration works
26   - def create_jenkis_project(profile, repository_path, web_url, git_url)
27   - @profile = profile
28   - #begin
29   - if @client.job.list(project_name).blank?
30   - @client.job.create(profile.jenkins_project_name, xml_jenkins(repository_path, web_url, git_url))
31   - end
32   - #rescue JenkinsApi::Exceptions::ApiException
33   - #end
34   - end
35   -
36   - #FIXME
37   - def xml_jenkins(repository_path, web_url, git_url)
38   - "
39   - <maven2-moduleset plugin='maven-plugin@1.509'>
40   - <actions/>
41   - <description>Projeto criado para o repositório #{repository_path} do Gitlab - #{web_url}</description>
42   - <logRotator class='hudson.tasks.LogRotator'>
43   - <daysToKeep>-1</daysToKeep>
44   - <numToKeep>2</numToKeep>
45   - <artifactDaysToKeep>-1</artifactDaysToKeep>
46   - <artifactNumToKeep>-1</artifactNumToKeep>
47   - </logRotator>
48   - <keepDependencies>false</keepDependencies>
49   - <properties/>
50   - <scm class='hudson.plugins.git.GitSCM' plugin='git@2.2.1'>
51   - <configVersion>2</configVersion>
52   - <userRemoteConfigs>
53   - <hudson.plugins.git.UserRemoteConfig>
54   - <url>#{git_url}</url>
55   - </hudson.plugins.git.UserRemoteConfig>
56   - </userRemoteConfigs>
57   - <branches>
58   - <hudson.plugins.git.BranchSpec>
59   - <name>*/master</name>
60   - </hudson.plugins.git.BranchSpec>
61   - </branches>
62   - <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
63   - <submoduleCfg class='list'/>
64   - <extensions/>
65   - </scm>
66   - <canRoam>true</canRoam>
67   - <disabled>false</disabled>
68   - <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
69   - <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
70   - <jdk>(Inherit From Job)</jdk>
71   - <triggers class='vector'/>
72   - <concurrentBuild>false</concurrentBuild>
73   - <goals>clean package install deploy</goals>
74   - <aggregatorStyleBuild>true</aggregatorStyleBuild>
75   - <incrementalBuild>false</incrementalBuild>
76   - <perModuleEmail>true</perModuleEmail>
77   - <ignoreUpstremChanges>false</ignoreUpstremChanges>
78   - <archivingDisabled>false</archivingDisabled>
79   - <resolveDependencies>false</resolveDependencies>
80   - <processPlugins>false</processPlugins>
81   - <mavenValidationLevel>-1</mavenValidationLevel>
82   - <runHeadless>false</runHeadless>
83   - <disableTriggerDownstreamProjects>false</disableTriggerDownstreamProjects>
84   - <settings class='jenkins.mvn.DefaultSettingsProvider'/>
85   - <globalSettings class='jenkins.mvn.DefaultGlobalSettingsProvider'/>
86   - <reporters>
87   - <hudson.maven.reporters.MavenMailer>
88   - <recipients/>
89   - <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
90   - <sendToIndividuals>true</sendToIndividuals>
91   - <perModuleEmail>true</perModuleEmail>
92   - </hudson.maven.reporters.MavenMailer>
93   - </reporters>
94   - <publishers>
95   - <hudson.plugins.sonar.SonarPublisher plugin='sonar@2.1'>
96   - <jdk>(Inherit From Job)</jdk>
97   - <branch/>
98   - <language/>
99   - <mavenOpts/>
100   - <jobAdditionalProperties/>
101   - <settings class='jenkins.mvn.DefaultSettingsProvider'/>
102   - <globalSettings class='jenkins.mvn.DefaultGlobalSettingsProvider'/>
103   - <usePrivateRepository>false</usePrivateRepository>
104   - </hudson.plugins.sonar.SonarPublisher>
105   - </publishers>
106   - <buildWrappers/>
107   - <prebuilders/>
108   - <postbuilders/>
109   - <runPostStepsIfResult>
110   - <name>FAILURE</name>
111   - <ordinal>2</ordinal>
112   - <color>RED</color>
113   - </runPostStepsIfResult>
114   - </maven2-moduleset>
115   - "
116   - end
117   -end
plugins/serpro_integration/lib/serpro_integration_plugin/smile_block.rb
... ... @@ -1,102 +0,0 @@
1   -require 'open-uri'
2   -require 'json'
3   -
4   -class SerproIntegrationPlugin::SmileBlock < Block
5   -
6   -
7   - METRIC_SUCCESS_DENSITY = 'test_success_density'
8   - METRIC_LOC = 'ncloc'
9   - METRIC_UNCOVERED_LINE = 'uncovered_lines'
10   - METRIC_COVERAGE = 'coverage'
11   -
12   - #FIXME make this test
13   - settings_items :sonar_info, :type => Hash, :default => {}
14   -
15   - def self.description
16   - _('Sonar Smile')
17   - end
18   -
19   - def help
20   - _('This block adds a smile face that make tecnical debits visible with funny way.')
21   - end
22   -
23   - #FIXME make this test
24   - def sonar_host
25   - self.owner.sonar_plugin['host']
26   - end
27   -
28   - #FIXME make this test
29   - def sonar_project
30   - self.owner.sonar_plugin['project'] #|| ''
31   - end
32   -
33   -#FIXME make this test
34   - def smile_factor
35   - collect_sonar_information
36   - factor = 0
37   - if self.sonar_info[METRIC_COVERAGE] && self.sonar_info[METRIC_SUCCESS_DENSITY]
38   - factor = (self.sonar_info[METRIC_COVERAGE] * self.sonar_info[METRIC_SUCCESS_DENSITY]).to_f/1000
39   - end
40   - end
41   -
42   - #FIXME make this test
43   - def content(args={})
44   - smile_face_id = 'smileFace-' + self.id.to_s
45   -
46   - content_tag(:div,
47   - content_tag(:canvas, '', :id => smile_face_id, :width => '95%', :height => '95%' ) +
48   - "<script type='text/javascript'>drawFace('#{smile_face_id}', '#{self.smile_factor}')</script>",
49   - :class => 'smile'
50   - )
51   - end
52   -
53   - #FIXME make this test
54   - def self.metrics
55   - [
56   - METRIC_SUCCESS_DENSITY,
57   - METRIC_LOC,
58   - METRIC_UNCOVERED_LINE,
59   - METRIC_COVERAGE
60   - ]
61   - end
62   -
63   - private
64   -
65   - #FIXME make this test
66   - def collect_sonar_information
67   - return false unless cache_expired?
68   - begin
69   - data = open("#{self.sonar_host}/api/resources?resource=#{self.sonar_project}&metrics=ncloc,coverage,weighted_violations,uncovered_lines,test_success_density&format=json").read
70   - self.sonar_info = parse_sonar_resource(JSON.parse(data).first)
71   - rescue
72   - self.sonar_info = {}
73   - end
74   - self.sonar_info[:updated_at] = Time.now
75   - self.save
76   - end
77   -
78   - #FIXME make this test
79   - def parse_sonar_resource(data)
80   - parsed_data = {}
81   - return {} if data['msr'].nil?
82   - data['msr'].map do |metric|
83   - self.class.metrics.map do |defined_metric|
84   - parsed_data[defined_metric] = metric['val'] if metric['key'] == defined_metric
85   - end
86   - end
87   - parsed_data
88   - end
89   -
90   - #FIXME make this test
91   - def cache_expired?
92   - return true if self.sonar_info[:updated_at].nil?
93   - (Time.now - self.sonar_info[:updated_at]) > cache_timestamp
94   - end
95   -
96   - #FIXME make this test
97   - # Cach time to load new data in seconds
98   - def cache_timestamp
99   - 60 * 60
100   - end
101   -
102   -end
plugins/serpro_integration/lib/serpro_integration_plugin/sonar_widget_block.rb
... ... @@ -1,81 +0,0 @@
1   -class SerproIntegrationPlugin::SonarWidgetBlock < Block
2   -
3   - #FIXME make this test
4   - AVAILABLE_WIDGETS = {
5   - 'project_motion_chart' => 'Project Motion Chart',
6   - 'timeline' => 'Timeline',
7   - 'complexity' => 'Complexity'
8   - }
9   -
10   - #FIXME make this test. Make test for default widget
11   - settings_items :widget, :type => String, :default => 'timeline'
12   -
13   - def self.description
14   - _('Sonar Widgets')
15   - end
16   -
17   - def help
18   - _('This block adds sonar widgets on profile.')
19   - end
20   -
21   - #FIXME make this test
22   - def sonar_host
23   - self.owner.serpro_integration_plugin['host']
24   - end
25   -
26   - #FIXME make this test
27   - def sonar_project
28   - self.owner.serpro_integration_plugin['project']
29   - end
30   -
31   - #FIXME make this test
32   - def widget_url
33   - self.sonar_host + 'widget?id=' + self.widget + '&resource=' + self.sonar_project + '&metric1=complexity&metric2=ncloc'
34   - end
35   -
36   - #FIXME make this test
37   - def is_widget_well_formed_url?
38   - !self.widget_url.match(/http[s]?:\/\/[\w|.|\/]+\/widget\?id=[\w]+&resource=[\w|\W]+/).nil?
39   - end
40   -
41   - #FIXME make this test
42   - def widget_width
43   - case widget
44   - when 'project_motion_chart'
45   - '360px'
46   - when 'timeline'
47   - '100%'
48   - when 'complexity'
49   - '100%'
50   - else
51   - '300px'
52   - end
53   - end
54   -
55   - #FIXME make this test
56   - def widget_height
57   - case widget
58   - when 'project_motion_chart'
59   - '450px'
60   - when 'timeline'
61   - '205px'
62   - when 'complexity'
63   - '170px'
64   - else
65   - '300px'
66   - end
67   - end
68   -
69   - def content(args={})
70   -# render this url
71   -#http://sonar.serpro/widget?id=timeline&resource=br.gov.fazenda.coaf.siscoaf:siscoaf-parent&metric1=complexity&metric2=ncloc
72   -
73   - block = self
74   -
75   - proc do
76   - render :file => 'sonar_widget_block', :locals => { :block => block }
77   - end
78   -
79   - end
80   -
81   -end
plugins/serpro_integration/public/smile_face.js
... ... @@ -1,129 +0,0 @@
1   -function drawBaseFace(element_id) {
2   - var canvas = document.getElementById(element_id);
3   - var ctx = canvas.getContext("2d");
4   -
5   - var x = canvas.width / 2;
6   - var y = canvas.height / 2;
7   - var radius = canvas.width/2 - 1;
8   - var startAngle = 0;
9   - var endAngle = 2 * Math.PI;
10   -
11   - ctx.beginPath();
12   - ctx.arc(x, y, radius, startAngle, endAngle);
13   - ctx.stroke();
14   - ctx.fillStyle = "yellow";
15   - ctx.fill();
16   -}
17   -
18   -function drawSmile(element_id, factor){
19   - var canvas = document.getElementById(element_id);
20   - var ctx = canvas.getContext("2d");
21   - var x = canvas.width / 2;
22   - var y = canvas.height / 2
23   - var radius = canvas.width/2 - canvas.width/4;
24   -
25   - var startAngle = 0;
26   - var endAngle = 0;
27   - var delta = 0;
28   -
29   - ctx.beginPath();
30   - ctx.lineWidth = canvas.width/100 * 2;
31   -
32   - if (factor >= 0 && factor < 5){
33   - //Draw sadness mouth
34   - delta = 0.5 - factor* 0.1
35   - startAngle = (1.5 - delta) * Math.PI;
36   - endAngle = (1.5 + delta) * Math.PI;
37   - radius = radius - radius*delta;
38   - y = y + (radius + radius*(1 - delta));
39   - ctx.arc(x, y, radius, startAngle, endAngle);
40   - } else if (factor == 5) {
41   - //Draw normal mouth
42   - ctx.moveTo(x-canvas.width/8,y+canvas.width/8);
43   - ctx.lineTo(x-canvas.width/8+(canvas.width/4),y+canvas.width/8);
44   - } else if (factor > 5 && factor <= 10) {
45   - //Draw happiness mouth
46   - delta = 1 - factor * 0.1
47   - startAngle = delta * Math.PI;
48   - endAngle = (1 - delta) * Math.PI;
49   - radius = radius - radius*delta;
50   - y = y - (radius - radius*(1-delta));
51   - ctx.arc(x, y, radius, startAngle, endAngle);
52   - }else{
53   - //Draw scare mouth
54   - radius = radius*0.4
55   - y = y + radius;
56   - ctx.ellipse(x,y,radius*0.4, radius,0,0,2 * Math.PI, false);
57   - ctx.fill();
58   - }
59   -
60   -
61   - // line color
62   - ctx.strokeStyle = 'black';
63   - ctx.stroke();
64   -}
65   -
66   -function drawEyes(element_id){
67   - var canvas = document.getElementById(element_id);
68   - var ctx = canvas.getContext("2d");
69   - var centerX = canvas.width/5;
70   - var centerY = 0;
71   - var radius = canvas.width * 0.05;
72   -
73   - // save state
74   - ctx.save();
75   -
76   - // translate context so height is 1/3'rd from top of enclosing circle
77   - ctx.translate(canvas.width / 2, canvas.height / 3);
78   -
79   - // scale context horizontally by 50%
80   - ctx.scale(.5, 1);
81   -
82   - // draw circle which will be stretched into an oval
83   - ctx.beginPath();
84   - ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
85   -
86   - // restore to original state
87   - ctx.restore();
88   -
89   - // apply styling
90   - ctx.fillStyle = 'black';
91   - ctx.fill();
92   - ctx.lineWidth = 2;
93   - ctx.strokeStyle = 'black';
94   - ctx.stroke();
95   -
96   -
97   - //left eye
98   - centerX = centerX * -1;
99   -
100   - // save state
101   - ctx.save();
102   -
103   - // translate context so height is 1/3'rd from top of enclosing circle
104   - ctx.translate(canvas.width / 2, canvas.height / 3);
105   -
106   - // scale context horizontally by 50%
107   - ctx.scale(.5, 1);
108   -
109   - // draw circle which will be stretched into an oval
110   - ctx.beginPath();
111   - ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
112   -
113   - // restore to original state
114   - ctx.restore();
115   -
116   - // apply styling
117   - ctx.fillStyle = 'black';
118   - ctx.fill();
119   - ctx.lineWidth = 2;
120   - ctx.strokeStyle = 'black';
121   - ctx.stroke();
122   -}
123   -
124   -
125   -function drawFace(element_id, factor){
126   - drawBaseFace(element_id);
127   - drawEyes(element_id);
128   - drawSmile(element_id, factor);
129   -}
plugins/serpro_integration/public/style.css
... ... @@ -1,3 +0,0 @@
1   -.serpro-integration-plugin_smile-block .smile {
2   - text-align: center;
3   -}
plugins/serpro_integration/smile.html
... ... @@ -1,142 +0,0 @@
1   -<html>
2   - <head> </head>
3   - <body>
4   - <canvas id="smileFace" width="60" height="60"></canvas>
5   -<script>
6   -
7   -function drawBaseFace() {
8   - var canvas = document.getElementById("smileFace");
9   - var ctx = canvas.getContext("2d");
10   -
11   - var x = canvas.width / 2;
12   - var y = canvas.height / 2;
13   - var radius = canvas.width/2 - 1;
14   - var startAngle = 0;
15   - var endAngle = 2 * Math.PI;
16   -
17   - ctx.beginPath();
18   - ctx.arc(x, y, radius, startAngle, endAngle);
19   - ctx.stroke();
20   - ctx.fillStyle = "yellow";
21   - ctx.fill();
22   -}
23   -
24   -function drawSmile(factor){
25   - var canvas = document.getElementById("smileFace");
26   - var ctx = canvas.getContext("2d");
27   - var x = canvas.width / 2;
28   - var y = canvas.height / 2
29   - var radius = canvas.width/2 - canvas.width/4;
30   -
31   - var startAngle = 0;
32   - var endAngle = 0;
33   - var delta = 0;
34   -
35   - ctx.beginPath();
36   - ctx.lineWidth = canvas.width/100 * 2;
37   -
38   - if (factor >= 0 && factor < 5){
39   - //Draw sadness mouth
40   - delta = 0.5 - factor* 0.1
41   - startAngle = (1.5 - delta) * Math.PI;
42   - endAngle = (1.5 + delta) * Math.PI;
43   - radius = radius - radius*delta;
44   - y = y + (radius + radius*(1 - delta));
45   - ctx.arc(x, y, radius, startAngle, endAngle);
46   - } else if (factor == 5) {
47   - //Draw normal mouth
48   - ctx.moveTo(x-canvas.width/8,y+canvas.width/8);
49   - ctx.lineTo(x-canvas.width/8+(canvas.width/4),y+canvas.width/8);
50   - } else if (factor > 5 && factor <= 10) {
51   - //Draw happiness mouth
52   - delta = 1 - factor * 0.1
53   - startAngle = delta * Math.PI;
54   - endAngle = (1 - delta) * Math.PI;
55   - radius = radius - radius*delta;
56   - y = y - (radius - radius*(1-delta));
57   - ctx.arc(x, y, radius, startAngle, endAngle);
58   - }else{
59   - //Draw scare mouth
60   - radius = radius*0.4
61   - y = y + radius;
62   - ctx.ellipse(x,y,radius*0.4, radius,0,0,2 * Math.PI, false);
63   - ctx.fill();
64   - }
65   -
66   -
67   - // line color
68   - ctx.strokeStyle = 'black';
69   - ctx.stroke();
70   -}
71   -
72   -function drawEyes(){
73   - var canvas = document.getElementById("smileFace");
74   - var ctx = canvas.getContext("2d");
75   - var centerX = canvas.width/5;
76   - var centerY = 0;
77   - var radius = canvas.width * 0.05;
78   -
79   - // save state
80   - ctx.save();
81   -
82   - // translate context so height is 1/3'rd from top of enclosing circle
83   - ctx.translate(canvas.width / 2, canvas.height / 3);
84   -
85   - // scale context horizontally by 50%
86   - ctx.scale(.5, 1);
87   -
88   - // draw circle which will be stretched into an oval
89   - ctx.beginPath();
90   - ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
91   -
92   - // restore to original state
93   - ctx.restore();
94   -
95   - // apply styling
96   - ctx.fillStyle = 'black';
97   - ctx.fill();
98   - ctx.lineWidth = 2;
99   - ctx.strokeStyle = 'black';
100   - ctx.stroke();
101   -
102   -
103   - //left eye
104   - centerX = centerX * -1;
105   -
106   - // save state
107   - ctx.save();
108   -
109   - // translate context so height is 1/3'rd from top of enclosing circle
110   - ctx.translate(canvas.width / 2, canvas.height / 3);
111   -
112   - // scale context horizontally by 50%
113   - ctx.scale(.5, 1);
114   -
115   - // draw circle which will be stretched into an oval
116   - ctx.beginPath();
117   - ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
118   -
119   - // restore to original state
120   - ctx.restore();
121   -
122   - // apply styling
123   - ctx.fillStyle = 'black';
124   - ctx.fill();
125   - ctx.lineWidth = 2;
126   - ctx.strokeStyle = 'black';
127   - ctx.stroke();
128   -}
129   -
130   -
131   -function drawFace(factor){
132   - drawBaseFace();
133   - drawEyes();
134   - drawSmile(factor);
135   -}
136   -
137   -drawFace(9);
138   -
139   -</script>
140   -
141   - </body>
142   -</html>
plugins/serpro_integration/test/unit/sonar_plugin_test.rb
... ... @@ -1,5 +0,0 @@
1   -require File.dirname(__FILE__) + '/../../../../test/test_helper'
2   -
3   -class SonarPluginTest < ActiveSupport::TestCase
4   -
5   -end
plugins/serpro_integration/views/blocks/_gitlab_issue.html.erb
... ... @@ -1,6 +0,0 @@
1   -<li>
2   - <span><%= gitlab_issue.id %></span>
3   - <span><%= gitlab_issue.title %></span>
4   - <span><%= gitlab_url gitlab_issue %></span>
5   - <%= gitlab_issue.inspect %>
6   -</li>
plugins/serpro_integration/views/blocks/gitlab_issues.html.erb
... ... @@ -1,6 +0,0 @@
1   -
2   -<%= block_title(block.title) %>
3   -
4   -<ul>
5   - <%= render :partial => 'blocks/gitlab_issue', :collection => issues %>
6   -</ul>
plugins/serpro_integration/views/profile-editor-extras.html.erb
... ... @@ -1,8 +0,0 @@
1   -<% if profile.allow_serpro_integration? %>
2   - <div id='serpro-integration'>
3   - <h2><%= _('Serpro Integration') %></h2>
4   -
5   - <%= render :partial => 'gitlab' %>
6   - <%= render :partial => 'jenkins' %>
7   - </div>
8   -<% end %>
plugins/serpro_integration/views/profile_design/sonar_plugin/_sonar_widget_block.html.erb
... ... @@ -1,4 +0,0 @@
1   -
2   -<%= labelled_form_field(_('Widget'), select(:block, :widget, SerproIntegrationPlugin::SonarWidgetBlock::AVAILABLE_WIDGETS.map {|id, name| [name, id]} )) %>
3   -
4   -
plugins/serpro_integration/views/profile_editor/_gitlab.html.erb
... ... @@ -1,21 +0,0 @@
1   -<div id="gitlab">
2   -
3   -<h3>
4   - <%= _('Gitlab Integration') %>
5   -</h3>
6   -<ul class="gitlab">
7   - <li>
8   - <span class="label"><%= _('Server Host:') %><span>
9   - <span class="value"><%= profile.gitlab_host %><span>
10   -<!-- FIXME put the force button to works
11   - <%= link_to _('Force'), {:controller => 'serpro_integration_plugin_myprofile', :action => 'create_gitlab'}, {:remote => true} %>
12   --->
13   - </li>
14   - <li>
15   - <%= labelled_text_field(_('Group Name:'), 'profile_data[serpro_integration_plugin_gitlab][group]', profile.gitlab_group) %>
16   - </li>
17   - <li>
18   - <%= labelled_text_field(_('Project Name:'), 'profile_data[serpro_integration_plugin_gitlab][project_name]', profile.gitlab_project_name ) %>
19   - </li>
20   -</ul>
21   -</div>
plugins/serpro_integration/views/profile_editor/_jenkins.html.erb
... ... @@ -1,10 +0,0 @@
1   -<div id="jenkins">
2   -<h3>
3   - <%= _('Jenkins Integration') %>
4   -</h3>
5   -<ul class='jenkins'>
6   - <li>
7   - <%= labelled_text_field(_('Project Name:'), 'profile_data[serpro_integration_plugin_jenkins][project_name]', profile.jenkins_project_name ) %>
8   - </li>
9   -</ul>
10   -</div>
plugins/serpro_integration/views/serpro_integration_plugin_admin/index.html.erb
... ... @@ -1,34 +0,0 @@
1   -<h1><%= _('Serpro Integration Settings')%></h1>
2   -
3   -<%= form_for(:settings) do |f| %>
4   -
5   - <div class="community_settings">
6   - <h2><%= _('Community Templates')%></h2>
7   - <%= f.fields_for :communities, OpenStruct.new(@settings.communities) do |g| %>
8   - <%= labelled_form_field _('Communities where integrations will be applied'), g.select("templates", @environment.communities.templates.map{|t| [t.name, t.id]},{}, :multiple => true) %>
9   - <% end %>
10   - </div>
11   -
12   - <div class="gitlab_settings">
13   - <h2><%= _('Gitlab Settings')%></h2>
14   - <%= f.fields_for :gitlab, OpenStruct.new(@settings.gitlab) do |g| %>
15   - <%= labelled_form_field _('Server Host'), g.text_field("host") %>
16   - <%= labelled_form_field _('Private Token'), g.text_field(:private_token) %>
17   - <% end %>
18   - </div>
19   -
20   - <div class="jenkins_settings">
21   - <h2><%= _('Jenkins Settings')%></h2>
22   - <%= f.fields_for :jenkins, OpenStruct.new(@settings.jenkins) do |g| %>
23   - <%= labelled_form_field _('Server Host'), g.text_field("host") %>
24   - <%= labelled_form_field _('Server User'), g.text_field(:user) %>
25   - <%= labelled_form_field _('Private Token'), g.text_field(:private_token) %>
26   - <% end %>
27   - </div>
28   -
29   - <% button_bar do %>
30   - <%= submit_button(:save, _('Save'), :cancel => {:controller => 'plugins', :action => 'index'}) %>
31   - <% end %>
32   -
33   -<% end %>
34   -
plugins/serpro_integration/views/sonar_widget_block.html.erb
... ... @@ -1,10 +0,0 @@
1   -<div class='widget'>
2   - <% if block.is_widget_well_formed_url? %>
3   - <iframe width='<%=block.widget_width%>' height='<%=block.widget_height%>' src='<%=block.widget_url%>' frameborder="0" allowfullscreen></iframe>
4   - <% else %>
5   - <div class='wrong'>
6   - <iframe width='<%=block.widget_width%>' height='<%=block.widget_height%>' src='<%=block.widget_url%>' frameborder="0" allowfullscreen></iframe>
7   - <%= _('Something wrong happened. Please see your sonar configuration.') %>
8   - </div>
9   - <% end %>
10   -</div>