GitHub PushEvent at 2014-12-15 13:16:44
Repository: emotional-jenkins-plugin
Actor: rentalname
Payload: {"shas":[["e70e907e5a7e1a4ae649349ddeb423b8e0899f96","003bcbc3893846e86af0e314cdeedd755b209b71@gmail.com","[from now] 2014/12/10 15:16:52\n\ndiff --git a/src/main/webapp/images/anger.png b/src/main/webapp/images/anger.png\ndeleted file mode 100644\nindex 55ebc8e..0000000\nBinary files a/src/main/webapp/images/anger.png and /dev/null differ","rentalname",true],["2bad234cdaa081fc4ad2f791c6bd2f74303b5a78","003bcbc3893846e86af0e314cdeedd755b209b71@gmail.com","[from now] 2014/12/11 00:06:31\n\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java\nindex 83f4fd1..9473785 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java\n@@ -1,5 +1,6 @@\n package org.jenkinsci.plugins.emotional_mascot;\n\n+import hudson.model.AbstractBuild;\n import hudson.model.Result;\n\n /**\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java\nindex e87b507..1abd37b 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java\n@@ -1,9 +1,11 @@\n package org.jenkinsci.plugins.emotional_mascot;\n\n-import hudson.model.ProminentProjectAction;\n+import hudson.model.*;\n\n-public final class EmotionalMascotAction implements ProminentProjectAction {\n+import java.util.logging.Logger;\n\n+public final class EmotionalMascotAction implements Action {\n+    private static final Logger LOGGER = Logger.getLogger(EmotionalMascotRecorder.class.getName());\n     public Emotion   emotion;\n     public Character character;\n\n@@ -16,6 +18,41 @@ public final class EmotionalMascotAction implements ProminentProjectAction {\n         this.character = character;\n     }\n\n+    public EmotionalMascotAction(AbstractProject<?, ?> project) {\n+        super();\n+        int currentBuildNum = project.getNextBuildNumber() - 1;\n+        int successCount = 0;\n+        if(currentBuildNum >= 5){\n+            for(int i = 0; i < 5; i++){\n+                AbstractBuild<?, ?> build = project.getBuildByNumber(currentBuildNum - i);\n+                if(Result.SUCCESS.equals(build.getResult())){\n+                    successCount++;\n+                }\n+            }\n+            if(successCount >= 5){\n+                this.emotion = Emotion.GREAT;\n+            }else if(successCount >= 3){\n+                this.emotion = Emotion.WORRY;\n+            }else{\n+                this.emotion = Emotion.BAD;\n+            }\n+        }else{\n+            this.emotion = Emotion.get(project.getLastBuild().getResult());\n+        }\n+        this.character = Character.getCycle(currentBuildNum);\n+        LOGGER.info(Integer.toString(successCount));\n+    }\n+\n+    public Emotion getEmotion() {\n+        if(emotion == null) LOGGER.info(\"emotion is blank\");\n+        return emotion;\n+    }\n+\n+    public Character getCharacter() {\n+        if(character == null) LOGGER.info(\"character is blank\");\n+        return character;\n+    }\n+\n     public String getIconFileName() { return null;}\n\n     public String getDisplayName() {\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java\nindex b93d885..f625bf4 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java\n@@ -3,10 +3,13 @@ package org.jenkinsci.plugins.emotional_mascot;\n import hudson.Extension;\n import hudson.Launcher;\n import hudson.model.AbstractBuild;\n+import hudson.model.AbstractProject;\n+import hudson.model.Action;\n import hudson.model.BuildListener;\n import hudson.tasks.BuildStepDescriptor;\n import hudson.tasks.BuildStepMonitor;\n import hudson.tasks.Notifier;\n+import hudson.tasks.Publisher;\n import org.kohsuke.stapler.DataBoundConstructor;\n\n import java.io.IOException;\n@@ -32,7 +35,14 @@ public class EmotionalMascotNotifier extends Notifier {\n         return true;\n     }\n\n+    @Override\n+    public Action getProjectAction(AbstractProject<?, ?> project) {\n+        return new EmotionalMascotAction(project);\n+    }\n+\n     @Extension\n+    public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();\n+\n     public static class DescriptorImpl extends BuildStepDescriptor{\n\n         @Override\n@@ -45,4 +55,9 @@ public class EmotionalMascotNotifier extends Notifier {\n             return null;\n         }\n     }\n+\n+    @Override\n+    public BuildStepDescriptor<Publisher> getDescriptor() {\n+        return DESCRIPTOR;\n+    }\n }\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java\nindex 68c1222..df6cf74 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java\n@@ -19,36 +19,9 @@ public class EmotionalMascotRecorder extends Recorder {\n     @DataBoundConstructor\n     public EmotionalMascotRecorder(){}\n\n-    /*\n-     *\n-     */\n     @Override\n     public final Action getProjectAction(final AbstractProject<?, ?> project) {\n-        int currentBuildNum = project.getNextBuildNumber() - 1;\n-        int successCount = 0;\n-        Action action;\n-        Character character = Character.getCycle(currentBuildNum);\n-        if(currentBuildNum >= 5){\n-            for(int i = 0; i < 5; i++){\n-                AbstractBuild<?, ?> build = project.getBuildByNumber(currentBuildNum - i);\n-                if(Result.SUCCESS.equals(build.getResult())){\n-                    successCount++;\n-                }\n-            }\n-            if(successCount >= 5){\n-                action = new EmotionalMascotAction(Emotion.GREAT, character);\n-                LOGGER.info(\"GREAT\");\n-            }else if(successCount >= 3){\n-                action = new EmotionalMascotAction(Emotion.WORRY, character);\n-                LOGGER.info(\"WORRY\");\n-            }else{\n-                action = new EmotionalMascotAction(Emotion.BAD, character);\n-                LOGGER.info(\"BAD\");\n-            }\n-        }else{\n-            action = new EmotionalMascotAction(Emotion.get(project.getLastBuild().getResult()), character);\n-        }\n-        return action;\n+        return new EmotionalMascotAction(project);\n     }\n\n     /**\n@@ -65,6 +38,7 @@ public class EmotionalMascotRecorder extends Recorder {\n     public boolean perform(final AbstractBuild<?, ?> build,\n                            final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {\n         LOGGER.info(\"calling Recorder#perform\");\n+        LOGGER.info(\"buildNum:\" + build.getNumber());\n         Emotion emotion = Emotion.get(build.getResult());\n         Character character = Character.getCycle(build.getNumber());\n         build.addAction(new EmotionalMascotAction(emotion, character));\ndiff --git a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/floatingBox.jelly b/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/floatingBox.jelly\ndeleted file mode 100644\nindex 4fb9667..0000000\n--- a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/floatingBox.jelly\n+++ /dev/null\n@@ -1,24 +0,0 @@\n-<j:jelly xmlns:j=\"jelly:core\">\n-    <j:set var=\"emotion\" value=\"${from.emotion.toString().toLowerCase()}\"/>\n-    <j:set var=\"character\" value=\"${from.character.toString().toLowerCase()}\"/>\n-    <script>\n-        !function(){\n-            var css =\n-                '#side-panel{' +\n-                    \"background-image: url(${rootURL}/plugin/emotional-mascot-plugin/images/${character}.png);\" +\n-                    \"background-repeat: no-repeat;\" +\n-                    \"background-position: center top;\" +\n-                    \"min-height: 720px;\" +\n-                '}' +\n-                '#side-panel:before{' +\n-                    \"content: url(${rootURL}/plugin/emotional-mascot-plugin/images/${emotion}.png);\" +\n-                    \"position: absolute;\" +\n-                    \"top: 50px;\" +\n-                '}';\n-            var style = document.createElement('style');\n-            style.appendChild(document.createTextNode(css));\n-            document.getElementsByTagName('head')[0].appendChild(style);\n-            alert(\"call Action/floating\");\n-        }()\n-    </script>\n-</j:jelly>\ndiff --git a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/jobMain.jelly b/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/jobMain.jelly\nnew file mode 100644\nindex 0000000..edfd891\n--- /dev/null\n+++ b/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/jobMain.jelly\n@@ -0,0 +1,19 @@\n+<?jelly escape-by-default='true'?>\n+<j:jelly xmlns:j=\"jelly:core\" xmlns:l=\"/lib/layout\">\n+    <j:set var=\"emotion\" value=\"${it.emotion.toString().toLowerCase()}\"/>\n+    <j:set var=\"character\" value=\"${it.character.toString().toLowerCase()}\"/>\n+    <style>\n+        #main-panel{\n+            background-image: url(${rootURL}/plugin/emotional-mascot-plugin/images/${character}.png);\n+            background-repeat: no-repeat;\n+            background-position: right bottom;\n+            height: 720px;\n+        }\n+        #main-panel:before{\n+            content: url(${rootURL}/plugin/emotional-mascot-plugin/images/${emotion}.png);\n+            position: absolute;\n+            bottom: 400px;\n+            right:  0px;\n+        }\n+    </style>\n+</j:jelly>\ndiff --git a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/summary.jelly b/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/summary.jelly\nindex 4dea9b8..6d641f6 100644\n--- a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/summary.jelly\n+++ b/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction/summary.jelly\n@@ -1,4 +1,18 @@\n <j:jelly xmlns:j=\"jelly:core\">\n     <j:set var=\"emotion\" value=\"${it.emotion.toString().toLowerCase()}\"/>\n     <j:set var=\"character\" value=\"${it.character.toString().toLowerCase()}\"/>\n+    <style>\n+        #main-panel{\n+            background-image: url(${rootURL}/plugin/emotional-mascot-plugin/images/${character}.png);\n+            background-repeat: no-repeat;\n+            background-position: right bottom;\n+            height: 720px;\n+        }\n+        #main-panel:before{\n+            content: url(${rootURL}/plugin/emotional-mascot-plugin/images/${emotion}.png);\n+            position: absolute;\n+            bottom: 400px;\n+            right:  0px;\n+        }\n+    </style>\n </j:jelly>\ndiff --git a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier/config.jelly b/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier/config.jelly\ndeleted file mode 100644\nindex dbdcc16..0000000\n--- a/src/main/resources/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier/config.jelly\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-<j:jelly xmlns:j=\"jelly:core\">\n-    <j:set var=\"emotion\" value=\"${from.emotion.toString().toLowerCase()}\"/>\n-    <j:set var=\"character\" value=\"${from.character.toString().toLowerCase()}\"/>\n-    <script>\n-        !function(){\n-            var css =\n-                '#side-panel{' +\n-                    \"background-image: url(${rootURL}/plugin/emotional-mascot-plugin/images/${character}.png);\" +\n-                    \"background-repeat: no-repeat;\" +\n-                    \"background-position: center top;\" +\n-                    \"min-height: 720px;\" +\n-                '}' +\n-                '#side-panel:before{' +\n-                    \"content: url(${rootURL}/plugin/emotional-mascot-plugin/images/${emotion}.png);\" +\n-                    \"position: absolute;\" +\n-                    \"top: 50px;\" +\n-                    \"z-index: -1;\" +\n-                '}';\n-            var style = document.createElement('style');\n-            style.appendChild(document.createTextNode(css));\n-            document.getElementsByTagName('head')[0].appendChild(style);\n-            alert(\"call Notifire/floating\");\n-        }()\n-    </script>\n-</j:jelly>","rentalname",true],["4c5320071ef1cc3487ed9d7019d22c7447841a5c","003bcbc3893846e86af0e314cdeedd755b209b71@gmail.com","[from now] 2014/12/15 03:24:33\n\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/Character.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/Character.java\nindex 94168d9..f6895fd 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/Character.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/Character.java\n@@ -4,7 +4,7 @@ package org.jenkinsci.plugins.emotional_mascot;\n  * Created by hash on 2014/11/16.\n  */\n public enum Character {\n-    CONOHA, ANZU, PRONAMA, CLAUDIA, UNITY, QUERY;\n+    PRONAMA, CONOHA, ANZU, CLAUDIA, UNITY, QUERY;\n\n     public static Character getCycle(int num) {\n         Character[] list = Character.class.getEnumConstants();\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java\nindex 9473785..4b2456a 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/Emotion.java\n@@ -7,7 +7,7 @@ import hudson.model.Result;\n  * Created by Hi on 2014/11/15.\n  */\n public enum Emotion {\n-    GREAT, BAD, WORRY;\n+    GREAT, BAD, WORRY, WORKING;\n\n     public static Emotion get(final Result result) {\n         Emotion emotion;\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java\nindex 1abd37b..07dd322 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotAction.java\n@@ -2,15 +2,14 @@ package org.jenkinsci.plugins.emotional_mascot;\n\n import hudson.model.*;\n\n+import java.util.List;\n import java.util.logging.Logger;\n\n public final class EmotionalMascotAction implements Action {\n     private static final Logger LOGGER = Logger.getLogger(EmotionalMascotRecorder.class.getName());\n-    public Emotion   emotion;\n-    public Character character;\n-\n-    public EmotionalMascotAction() {\n-    }\n+    public  Emotion   emotion;\n+    public  Character character;\n+    private Project   project;\n\n     public EmotionalMascotAction(Emotion emotion, Character character) {\n         super();\n@@ -20,36 +19,27 @@ public final class EmotionalMascotAction implements Action {\n\n     public EmotionalMascotAction(AbstractProject<?, ?> project) {\n         super();\n-        int currentBuildNum = project.getNextBuildNumber() - 1;\n-        int successCount = 0;\n-        if(currentBuildNum >= 5){\n-            for(int i = 0; i < 5; i++){\n-                AbstractBuild<?, ?> build = project.getBuildByNumber(currentBuildNum - i);\n-                if(Result.SUCCESS.equals(build.getResult())){\n-                    successCount++;\n-                }\n-            }\n-            if(successCount >= 5){\n-                this.emotion = Emotion.GREAT;\n-            }else if(successCount >= 3){\n-                this.emotion = Emotion.WORRY;\n-            }else{\n-                this.emotion = Emotion.BAD;\n-            }\n-        }else{\n-            this.emotion = Emotion.get(project.getLastBuild().getResult());\n-        }\n-        this.character = Character.getCycle(currentBuildNum);\n-        LOGGER.info(Integer.toString(successCount));\n+        this.project = (Project) project;\n+        refreshFace(this.project);\n+    }\n+\n+    public EmotionalMascotAction(AbstractBuild<?, ?> build) {\n+        super();\n+        this.emotion = Emotion.get(build.getResult());\n+        this.character = Character.getCycle(build.getNumber());\n     }\n\n     public Emotion getEmotion() {\n-        if(emotion == null) LOGGER.info(\"emotion is blank\");\n+        if(this.project != null){\n+            refreshFace(this.project);\n+        }\n         return emotion;\n     }\n\n     public Character getCharacter() {\n-        if(character == null) LOGGER.info(\"character is blank\");\n+        if(this.project != null){\n+            refreshFace(this.project);\n+        }\n         return character;\n     }\n\n@@ -62,4 +52,35 @@ public final class EmotionalMascotAction implements Action {\n     public String getUrlName() {\n         return \"\";\n     }\n+\n+    private void refreshFace(Project project){\n+        int currentBuildNum = project.getNextBuildNumber() - 1;\n+        int successCount = 0;\n+        List builders = project.getBuilders();\n+\n+        if(builders.size() >= 5){\n+            int to = builders.size();\n+            int from = to - 5;\n+            List<Build> recentBuilds = builders.subList(from, to);\n+\n+            for(Build build: recentBuilds){\n+                if(Result.SUCCESS.equals(build.getResult())){\n+                    successCount++;\n+                }\n+            }\n+            if(successCount >= 5){\n+                this.emotion = Emotion.GREAT;\n+            }else if(successCount >= 3){\n+                this.emotion = Emotion.WORRY;\n+            }else{\n+                this.emotion = Emotion.BAD;\n+            }\n+        }else if(builders.size() == 0){\n+            this.emotion = Emotion.WORKING;\n+        }else{\n+            this.emotion = Emotion.get(project.getLastBuild().getResult());\n+        }\n+\n+        this.character = Character.getCycle(currentBuildNum);\n+    }\n }\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotDescriptor.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotDescriptor.java\ndeleted file mode 100644\nindex 2f55b7c..0000000\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotDescriptor.java\n+++ /dev/null\n@@ -1,27 +0,0 @@\n-package org.jenkinsci.plugins.emotional_mascot;\n-\n-import hudson.Extension;\n-import hudson.model.AbstractProject;\n-import hudson.tasks.BuildStepDescriptor;\n-import hudson.tasks.Publisher;\n-\n-/**\n- * Created by Hi on 2014/11/15.\n- */\n-@Extension\n-public class EmotionalMascotDescriptor extends BuildStepDescriptor<Publisher> {\n-\n-    public EmotionalMascotDescriptor() {\n-        super(EmotionalMascotRecorder.class);\n-    }\n-\n-    @Override\n-    public String getDisplayName() {\n-        return \"Summon Your Mascot\";\n-    }\n-\n-    @Override\n-    public boolean isApplicable(final Class<? extends AbstractProject> aClass) {\n-        return true;\n-    }\n-}\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java\ndeleted file mode 100644\nindex f625bf4..0000000\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotNotifier.java\n+++ /dev/null\n@@ -1,63 +0,0 @@\n-package org.jenkinsci.plugins.emotional_mascot;\n-\n-import hudson.Extension;\n-import hudson.Launcher;\n-import hudson.model.AbstractBuild;\n-import hudson.model.AbstractProject;\n-import hudson.model.Action;\n-import hudson.model.BuildListener;\n-import hudson.tasks.BuildStepDescriptor;\n-import hudson.tasks.BuildStepMonitor;\n-import hudson.tasks.Notifier;\n-import hudson.tasks.Publisher;\n-import org.kohsuke.stapler.DataBoundConstructor;\n-\n-import java.io.IOException;\n-\n-/**\n- * Created by hash on 2014/12/09.\n- */\n-public class EmotionalMascotNotifier extends Notifier {\n-\n-    @Override\n-    public BuildStepMonitor getRequiredMonitorService() {\n-        return BuildStepMonitor.NONE;\n-    }\n-\n-    @DataBoundConstructor\n-    public EmotionalMascotNotifier(){}\n-\n-    @Override\n-    public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {\n-        Emotion emotion = Emotion.get(build.getResult());\n-        Character character = Character.getCycle(build.getNumber());\n-        build.addAction(new EmotionalMascotAction(emotion, character));\n-        return true;\n-    }\n-\n-    @Override\n-    public Action getProjectAction(AbstractProject<?, ?> project) {\n-        return new EmotionalMascotAction(project);\n-    }\n-\n-    @Extension\n-    public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();\n-\n-    public static class DescriptorImpl extends BuildStepDescriptor{\n-\n-        @Override\n-        public boolean isApplicable(Class jobType) {\n-            return true;\n-        }\n-\n-        @Override\n-        public String getDisplayName() {\n-            return null;\n-        }\n-    }\n-\n-    @Override\n-    public BuildStepDescriptor<Publisher> getDescriptor() {\n-        return DESCRIPTOR;\n-    }\n-}\ndiff --git a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java\nindex df6cf74..cd15686 100644\n--- a/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java\n+++ b/src/main/java/org/jenkinsci/plugins/emotional_mascot/EmotionalMascotRecorder.java\n@@ -1,51 +1,76 @@\n package org.jenkinsci.plugins.emotional_mascot;\n\n+import hudson.Extension;\n import hudson.Launcher;\n-import hudson.model.*;\n-import hudson.model.Fingerprint.RangeSet;\n+import hudson.model.AbstractBuild;\n+import hudson.model.AbstractProject;\n+import hudson.model.Action;\n+import hudson.model.BuildListener;\n+import hudson.tasks.BuildStepDescriptor;\n import hudson.tasks.BuildStepMonitor;\n-import hudson.tasks.Builder;\n+import hudson.tasks.Publisher;\n import hudson.tasks.Recorder;\n+import net.sf.json.JSONObject;\n import org.kohsuke.stapler.DataBoundConstructor;\n+import org.kohsuke.stapler.StaplerRequest;\n\n import java.io.IOException;\n-import java.lang.reflect.Array;\n import java.util.logging.Logger;\n\n public class EmotionalMascotRecorder extends Recorder {\n\n-    private static final Logger LOGGER = Logger.getLogger(EmotionalMascotRecorder.class.getName());\n-\n     @DataBoundConstructor\n     public EmotionalMascotRecorder(){}\n\n     @Override\n-    public final Action getProjectAction(final AbstractProject<?, ?> project) {\n+    public Action getProjectAction(AbstractProject<?, ?> project) {\n         return new EmotionalMascotAction(project);\n     }\n\n-    /**\n-     * Adds RoundhouseAction to the build actions. This is applicable for each\n-     * build.\n-     *\n-     * @param build    the build\n-     * @param launcher the launcher\n-     * @param listener the listener\n-     * @return true\n-     * @throws InterruptedException when there's an interruption\n-     * @throws IOException          when there's an IO error\n-     */\n+    @Override\n+    public BuildStepDescriptor getDescriptor() {\n+        return DESCRIPTOR;\n+    }\n+\n     public boolean perform(final AbstractBuild<?, ?> build,\n                            final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {\n-        LOGGER.info(\"calling Recorder#perform\");\n-        LOGGER.info(\"buildNum:\" + build.getNumber());\n-        Emotion emotion = Emotion.get(build.getResult());\n-        Character character = Character.getCycle(build.getNumber());\n-        build.addAction(new EmotionalMascotAction(emotion, character));\n+        build.replaceAction(new EmotionalMascotAction(build));\n         return true;\n     }\n\n     public BuildStepMonitor getRequiredMonitorService() {\n         return BuildStepMonitor.BUILD;\n     }\n+\n+    @Extension\n+    public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();\n+\n+    public static final class DescriptorImpl extends BuildStepDescriptor<Publisher>{\n+\n+        DescriptorImpl(){\n+            super(EmotionalMascotRecorder.class);\n+            load();\n+        }\n+\n+        @Override\n+        public boolean isApplicable(Class<? extends AbstractProject> jobType) {\n+            return true;\n+        }\n+\n+        @Override\n+        public String getDisplayName() {\n+            return \"Summon Your Mascot\";\n+        }\n+\n+        @Override\n+        public boolean configure(StaplerRequest req, JSONObject json) throws FormException {\n+            save();\n+            return super.configure(req, json);\n+        }\n+\n+        @Override\n+        public Publisher newInstance(StaplerRequest req, JSONObject formData) throws FormException {\n+            return new EmotionalMascotRecorder();\n+        }\n+    }\n }","rentalname",true],["5478d31ae90d6d33b2a561788fff0cf3f2f20255","003bcbc3893846e86af0e314cdeedd755b209b71@gmail.com","[from now] 2014/12/15 03:24:44\n\ndiff --git a/src/main/webapp/images/working.png b/src/main/webapp/images/working.png\nnew file mode 100644\nindex 0000000..124d6b0\nBinary files /dev/null and b/src/main/webapp/images/working.png differ","rentalname",true],["66cfb760416f7965285794b6120cf5cc2975fe79","003bcbc3893846e86af0e314cdeedd755b209b71@gmail.com","とりあえずの実装を完了\n\nプロジェクト画面では, 過去5回分のビルド結果とビルド回数に応じて, メッセージとキャラクターが変わるようにした\n各ビルド結果画面では, ビルドの結果とビルド回数に応じて, メッセージとキャラクターが変わるようにした","rentalname",true]],"size":5,"ref":"refs/heads/dev","head":"66cfb760416f7965285794b6120cf5cc2975fe79"}