bee_go 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/build/README ADDED
@@ -0,0 +1,23 @@
1
+ = Bee_go
2
+
3
+ Go package for Bee
4
+
5
+ = Home Page
6
+
7
+ This software is hosted on RubyForge (thanks to them for their great job!)
8
+ at http://bee.rubyforge.org.
9
+
10
+ = Documentation
11
+
12
+ For more information about this software, please read the documentation
13
+ in "bee_go" section on Gem server (type "gem_server" and go at URL
14
+ http://localhost:8808) if you installed it using Gem.
15
+
16
+ = License
17
+
18
+ bee is Open Source and released under the Apache License (see LICENE file
19
+ or go to URL http://www.apache.org/licenses/LICENSE-2.0).
20
+
21
+ = Copyright
22
+
23
+ Bee_go version 0.0.1 (C) Michel Casabianca - 2014
@@ -0,0 +1,10 @@
1
+ - build: <%= name %>
2
+ description: "Go project"
3
+ extends:
4
+ - ":go:go.yml"
5
+
6
+ - properties:
7
+ name: "<%= name %>"
8
+ version: "0.0.1"
9
+ go_package: "<%= package %>"
10
+
@@ -0,0 +1,102 @@
1
+ #!/bin/bash
2
+
3
+ usage () {
4
+ echo "Don't run this script directly, instead type 'source goactivate'.
5
+
6
+ Script to set PATH, GOPATH and shell prompt for your project. Drop this script
7
+ in your PATH. To activate environment, go in the root directory of the project
8
+ and type:
9
+
10
+ source goactivate
11
+
12
+ This will set PATH to:
13
+
14
+ /project/home/bin:\$PATH
15
+
16
+ And it will also set GOPATH to:
17
+
18
+ /project/home/lib:/project/home
19
+
20
+ So that dependencies will be installed in your project home directory.
21
+ Furthermore, the shell prompt is modified so that it will show activated
22
+ project between brackets.
23
+
24
+ To deactivate the environment, type:
25
+
26
+ deactivate
27
+
28
+ This will restore your previous PATH, GOPATH and shell prompt."
29
+ }
30
+
31
+ [[ $_ == $0 ]] && usage
32
+
33
+ deactivate () {
34
+ # reset old environment variables
35
+ if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
36
+ PATH="$_OLD_VIRTUAL_PATH"
37
+ export PATH
38
+ unset _OLD_VIRTUAL_PATH
39
+ fi
40
+ if [ -n "$_OLD_VIRTUAL_GOPATH" ] ; then
41
+ GOPATH="$_OLD_VIRTUAL_GOPATH"
42
+ export GOPATH
43
+ unset _OLD_VIRTUAL_GOPATH
44
+ fi
45
+
46
+ # This should detect bash and zsh, which have a hash command that must
47
+ # be called to get it to forget past commands. Without forgetting
48
+ # past commands the $PATH changes we made may not be respected
49
+ if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
50
+ hash -r 2>/dev/null
51
+ fi
52
+
53
+ if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
54
+ PS1="$_OLD_VIRTUAL_PS1"
55
+ export PS1
56
+ unset _OLD_VIRTUAL_PS1
57
+ fi
58
+
59
+ unset VIRTUAL_ENV
60
+ if [ ! "$1" = "nondestructive" ] ; then
61
+ # Self destruct!
62
+ unset -f deactivate
63
+ fi
64
+ }
65
+
66
+ # unset irrelevant variables
67
+ deactivate nondestructive
68
+
69
+ VIRTUAL_ENV=`pwd`
70
+ export VIRTUAL_ENV
71
+
72
+ _OLD_VIRTUAL_PATH="$PATH"
73
+ PATH="$VIRTUAL_ENV/bin:$PATH"
74
+ export PATH
75
+
76
+ _OLD_VIRTUAL_GOPATH="$GOPATH"
77
+ GOPATH="$VIRTUAL_ENV/lib:$VIRTUAL_ENV"
78
+ export GOPATH
79
+
80
+ if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
81
+ _OLD_VIRTUAL_PS1="$PS1"
82
+ if [ "x" != x ] ; then
83
+ PS1="$PS1"
84
+ else
85
+ if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
86
+ # special case for Aspen magic directories
87
+ # see http://www.zetadev.com/software/aspen/
88
+ PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
89
+ else
90
+ PS1="[`basename \"$VIRTUAL_ENV\"`]$PS1"
91
+ fi
92
+ fi
93
+ export PS1
94
+ fi
95
+
96
+ # This should detect bash and zsh, which have a hash command that must
97
+ # be called to get it to forget past commands. Without forgetting
98
+ # past commands the $PATH changes we made may not be respected
99
+ if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
100
+ hash -r 2>/dev/null
101
+ fi
102
+
@@ -0,0 +1,10 @@
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ )
6
+
7
+ func main() {
8
+ fmt.Println("Hello World!")
9
+ }
10
+
@@ -0,0 +1,12 @@
1
+ package main
2
+
3
+ import (
4
+ "testing"
5
+ )
6
+
7
+ func TestTrue(t *testing.T) {
8
+ if true != true {
9
+ t.Error("Impossible failure!")
10
+ }
11
+ }
12
+
data/egg/project.yml ADDED
@@ -0,0 +1,63 @@
1
+ - build: go_template
2
+ default: all
3
+ description: "Generate a Go project"
4
+
5
+ - properties:
6
+ name: "project"
7
+ package: "github.com/user"
8
+ description: "This script will create a Go project."
9
+
10
+ - target: welcome
11
+ description: "Print information message"
12
+ script:
13
+ - print: :description
14
+
15
+ - target: prompt
16
+ depends: welcome
17
+ description: "Prompt for project information"
18
+ script:
19
+ - print: "Please answer following questions to generate the project:"
20
+ - prompt:
21
+ message: "What is the project's name?"
22
+ default: :name
23
+ property: name
24
+ - prompt:
25
+ message: "What is the project root package?"
26
+ default: :package
27
+ property: package
28
+
29
+ - target: generate
30
+ depends: prompt
31
+ description: "Generate project"
32
+ script:
33
+ - print: "Generating project..."
34
+ - rb: |
35
+ error "A directory named '#{name}' already exists, aborting" if
36
+ File.exists?("#{here}/#{name}")
37
+ - mkdir: "#{here}/#{name}"
38
+ - mkdir: "#{here}/#{name}/bin"
39
+ - mkdir: "#{here}/#{name}/pkg"
40
+ - mkdir: "#{here}/#{name}/lib"
41
+ - mkdir: "#{here}/#{name}/src/#{package}/#{name}"
42
+ - erb:
43
+ src: "#{base}/project/build.erb"
44
+ dest: "#{here}/#{name}/build.yml"
45
+ - cp:
46
+ src: "#{base}/project/*.go"
47
+ dest: "#{here}/#{name}/src/#{package}/#{name}/"
48
+ - cp:
49
+ src: "#{base}/project/goactivate"
50
+ dest: "#{here}/#{name}/"
51
+
52
+
53
+ - target: customization
54
+ depends: generate
55
+ description: "Print information about project customization"
56
+ script:
57
+ - print: |
58
+ Project has been generated in directory '#{name}'. Type 'bee -b'
59
+ to print information about generated build file. Enjoy!
60
+
61
+ - target: all
62
+ depends: [welcome, prompt, generate, customization]
63
+
data/go.yml ADDED
@@ -0,0 +1,89 @@
1
+ - build: go
2
+ description: Parent build file for GO projects
3
+ alias:
4
+ bin: go_bin
5
+ run: go_run
6
+ test: go_test
7
+ cover: go_cover
8
+ clean: go_clean
9
+ default:
10
+ - go_clean
11
+ - go_test
12
+
13
+ - properties:
14
+ name: ~
15
+ go_package: ~
16
+ go_build_dir: "build"
17
+ go_pkg_dir: "pkg"
18
+ go_bin_dir: "bin"
19
+ go_src_dir: "src"
20
+ go_lib_dir: "lib"
21
+ go_lib_pkg_dir: "#{go_lib_dir}/pkg"
22
+ go_main: "#{go_src_dir}/#{go_package}/main.go"
23
+ go_args: ""
24
+ # test coverage mode:
25
+ # - set: indicates which statement was run
26
+ # - count: counts the numbers of runs on a statement
27
+ # - atomic: precise count (for parallel algorithms)
28
+ go_cover_mode: "set"
29
+ go_clean_dirs:
30
+ - :go_build_dir
31
+ - :go_pkg_dir
32
+ - :go_lib_pkg_dir
33
+ go_clean_files:
34
+ - "#{go_bin_dir}/#{name}"
35
+
36
+ - target: go_bin
37
+ depends: go_clean
38
+ description: Make binary executable
39
+ script:
40
+ - print: "Building project #{name}..."
41
+ - "go build -o #{go_bin_dir}/#{name} #{go_main}"
42
+
43
+ - target: go_run
44
+ depends: go_bin
45
+ description: Run main executable
46
+ script:
47
+ - "#{go_bin_dir}/#{name} #{go_args}"
48
+
49
+ - target: go_test
50
+ depends: go_env
51
+ description: Run unit tests
52
+ script:
53
+ - "go test #{go_package}/..."
54
+
55
+ - target: go_cover
56
+ depends: go_clean
57
+ description: Generate coverage report
58
+ script:
59
+ - mkdir: :go_build_dir
60
+ - for: _dir
61
+ in: 'Dir.glob("#{go_src_dir}/#{go_package}/*").select{|f| File.directory? f}'
62
+ do:
63
+ - rb: '_pkg = _dir[go_src_dir.length+1..-1]'
64
+ - "go test -covermode=#{go_cover_mode} -coverprofile=#{go_build_dir}/coverage.out #{_pkg} > /dev/null"
65
+ - "go tool cover -html=#{go_build_dir}/coverage.out -o #{go_build_dir}/coverage.html"
66
+ - "go tool cover -func=#{go_build_dir}/coverage.out"
67
+ - print: "Test coverage report generated in file '#{go_build_dir}/coverage.html'"
68
+
69
+ - target: go_doc
70
+ description: Generate code documentation
71
+ script:
72
+ - "godoc #{go_package}"
73
+
74
+ - target: go_env
75
+ description: Check that we are running in virtualenv
76
+ script:
77
+ - if: "ENV['VIRTUAL_ENV'] != base"
78
+ then:
79
+ - raise: "You are not running in the project's Virtualenv, aborting"
80
+ else:
81
+ - print: "You are running in the project's Virtualenv, please proceed"
82
+
83
+ - target: go_clean
84
+ description: Clean generated files
85
+ script:
86
+ - rmdir: :go_clean_dirs
87
+ - rm: :go_clean_files
88
+ - mkdir: :go_pkg_dir
89
+ - mkdir: :go_lib_pkg_dir
@@ -0,0 +1,25 @@
1
+ require 'bee_task_package'
2
+
3
+ module Bee
4
+
5
+ module Task
6
+
7
+ # Package for Go tasks.
8
+ class Go < Package
9
+
10
+ # Sample hello task that prints greeting message on console.
11
+ #
12
+ # - who: who to greet.
13
+ #
14
+ # Example
15
+ #
16
+ # - go.hello: "World"
17
+ def hello(who)
18
+ puts "Hello #{who}!"
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+
25
+ end
data/test/build.yml ADDED
@@ -0,0 +1,16 @@
1
+ - build: package_test
2
+ default: all
3
+ description: Build file to test generated and installed package
4
+
5
+ - target: task
6
+ description: Test task for generated package
7
+ script:
8
+ - go.hello: "World"
9
+
10
+ - target: egg
11
+ description: Test egg for generated package
12
+ script:
13
+ - "bee -t 'go.hello'"
14
+
15
+ - target: all
16
+ depends: [task, egg]
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bee_build'
4
+ require 'test/unit'
5
+ $:.unshift(File.join(File.expand_path(File.dirname(__FILE__))))
6
+ require 'test_build'
7
+ require 'test_build_listener'
8
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
+ require 'bee_task_go'
10
+
11
+ # Test case for bee task.
12
+ class TestBeeTaskGo < Test::Unit::TestCase
13
+
14
+ # Create a context object and load tasks in it.
15
+ def setup
16
+ super
17
+ @context = Bee::Context.new(nil)
18
+ @listener = TestBuildListener.new
19
+ @build = TestBuild.new(@context, @listener)
20
+ @package = Bee::Task::Go.new(@build)
21
+ end
22
+
23
+ def test_hello
24
+ @package.hello('TEST')
25
+ assert_equal("Hello TEST!\n", @listener.output)
26
+ end
27
+
28
+ end
@@ -0,0 +1,26 @@
1
+ # Copyright 2006-2012 Michel Casabianca <michel.casabianca@gmail.com>
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Empty build for testing purpose. Contains a single context.
16
+ class TestBuild
17
+
18
+ attr_reader :context
19
+ attr_reader :listener
20
+
21
+ def initialize(context, listener)
22
+ @context = context
23
+ @listener = listener
24
+ end
25
+
26
+ end
@@ -0,0 +1,110 @@
1
+ # Copyright 2006-2012 Michel Casabianca <michel.casabianca@gmail.com>
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'rubygems'
16
+
17
+ class TestBuildListener
18
+
19
+ attr_reader :formatter
20
+ attr_reader :started
21
+ attr_reader :finished
22
+ attr_reader :targets
23
+ attr_reader :tasks
24
+ attr_reader :success
25
+ attr_reader :errors
26
+ attr_accessor :throw_error
27
+ attr_accessor :prompt
28
+
29
+ def initialize()
30
+ reset
31
+ end
32
+
33
+ def build_started(build, dry=false)
34
+ @started = true
35
+ end
36
+
37
+ def build_finished()
38
+ @finished = true
39
+ end
40
+
41
+ def target(target)
42
+ @targets << target
43
+ end
44
+
45
+ def task(task)
46
+ @tasks << task
47
+ end
48
+
49
+ def error(exception)
50
+ if throw_error
51
+ raise exception
52
+ else
53
+ @errors << exception
54
+ end
55
+ end
56
+
57
+ def recover
58
+ @success = true
59
+ end
60
+
61
+ def reset
62
+ @formatter = TestBuildFormatter.new(self)
63
+ @started = false
64
+ @finished = false
65
+ @targets = []
66
+ @tasks = []
67
+ @success = false
68
+ @errors = []
69
+ @throw_error = false
70
+ @prompt = ''
71
+ end
72
+
73
+ def output()
74
+ return @formatter.output
75
+ end
76
+
77
+ def clear()
78
+ @formatter.clear()
79
+ end
80
+
81
+ def error?
82
+ return @errors.length > 0
83
+ end
84
+
85
+ end
86
+
87
+ class TestBuildFormatter
88
+
89
+ attr_reader :verbose
90
+ attr_reader :output
91
+
92
+ def initialize(listener)
93
+ @listener = listener
94
+ @verbose = false
95
+ @output = ''
96
+ end
97
+
98
+ def print(text)
99
+ @output << text
100
+ end
101
+
102
+ def puts(text)
103
+ @output << text + "\n"
104
+ end
105
+
106
+ def clear()
107
+ @output = ''
108
+ end
109
+
110
+ end
data/test/ts_bee_go.rb ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2006-2012 Michel Casabianca <michel.casabianca@gmail.com>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Script that runs all tests in current directory (and subdirectories)
18
+ # in a single test suite.
19
+
20
+ require 'find'
21
+
22
+ Find.find(File.dirname(__FILE__)) do |path|
23
+ if File.file?(path) and path =~ /tc_.+\.rb$/
24
+ load path
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bee_go
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Michel Casabianca
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2014-06-06 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: bee
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 53
29
+ segments:
30
+ - 0
31
+ - 11
32
+ - 3
33
+ version: 0.11.3
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Bee package to manage Go projects
37
+ email: michel.casabianca@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - build/README
44
+ - LICENSE
45
+ files:
46
+ - lib/bee_task_go.rb
47
+ - test/build.yml
48
+ - test/test_build.rb
49
+ - test/test_build_listener.rb
50
+ - test/ts_bee_go.rb
51
+ - test/tc_bee_task_go.rb
52
+ - egg/project/build.erb
53
+ - egg/project/main_test.go
54
+ - egg/project/main.go
55
+ - egg/project/goactivate
56
+ - egg/project.yml
57
+ - go.yml
58
+ - build/README
59
+ - LICENSE
60
+ homepage: http://bee.rubyforge.org
61
+ licenses: []
62
+
63
+ post_install_message: Enjoy bee!
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ requirements: []
87
+
88
+ rubyforge_project: bee
89
+ rubygems_version: 1.8.11
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: Go package for Bee
93
+ test_files:
94
+ - test/ts_bee_go.rb