buildr-examples 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 +176 -0
- data/README.rdoc +35 -0
- data/examples/artifacts/install_upload/app.zip +0 -0
- data/examples/artifacts/install_upload/buildfile +29 -0
- data/examples/artifacts/install_upload/src/main/java/HelloWorld.java +5 -0
- data/examples/artifacts/shared/artifacts.rb +5 -0
- data/examples/artifacts/simple/buildfile +75 -0
- data/examples/artifacts/simple/src/main/java/HelloWorld.java +5 -0
- data/examples/building/apt/buildfile +8 -0
- data/examples/building/apt/run.sh +3 -0
- data/examples/building/apt/src/main/java/Example.java +9 -0
- data/examples/building/chaining/buildfile +13 -0
- data/examples/building/chaining/run.sh +2 -0
- data/examples/building/chaining/src/main/java/Example.java +5 -0
- data/examples/building/chaining/srcs/HelloWorld.java +5 -0
- data/examples/building/compiler/buildfile +42 -0
- data/examples/building/compiler/groovyproject/src/main/groovy/HelloWorld.groovy +9 -0
- data/examples/building/compiler/javaproject/src/main/java/HelloWorld.java +5 -0
- data/examples/building/compiler/run.sh +10 -0
- data/examples/building/compiler/scalaproject/src/main/scala/HelloWorld.scala +5 -0
- data/examples/building/extending_tasks/buildfile +24 -0
- data/examples/building/extending_tasks/run.sh +4 -0
- data/examples/building/extending_tasks/src/main/java/HelloWorld.java +5 -0
- data/examples/building/jjtree/buildfile +10 -0
- data/examples/building/jjtree/run.sh +3 -0
- data/examples/building/jjtree/src/main/jjtree/com/acme/Example.java +7 -0
- data/examples/building/resources/buildfile +23 -0
- data/examples/building/resources/profiles.yaml +12 -0
- data/examples/building/resources/run.sh +6 -0
- data/examples/building/resources/src/main/property-style/ant.txt +1 -0
- data/examples/building/resources/src/main/property-style/erb.txt +1 -0
- data/examples/building/resources/src/main/property-style/maven.txt +1 -0
- data/examples/building/resources/src/main/property-style/regex.txt +1 -0
- data/examples/building/resources/src/main/property-style/ruby.txt +1 -0
- data/examples/building/resources/src/main/resources/filter.txt +1 -0
- data/examples/installing/buildfile +7 -0
- data/examples/installing/run.sh +16 -0
- data/examples/ivy4r/simple/ant-scripts/ivysettings.xml +9 -0
- data/examples/ivy4r/simple/buildfile +10 -0
- data/examples/ivy4r/simple/ivy.xml +6 -0
- data/examples/ivy4r/simple/run.sh +2 -0
- data/examples/ivy4r/simple/src/main/java/HelloWorld.java +8 -0
- data/examples/packaging/include_exclude/README +1 -0
- data/examples/packaging/include_exclude/buildfile +62 -0
- data/examples/packaging/include_exclude/run.sh +4 -0
- data/examples/packaging/include_exclude/src/main/java/HelloWorld.java +5 -0
- data/examples/packaging/include_exclude/src/main/resources/include/some_resource.txt +0 -0
- data/examples/packaging/include_exclude/src/main/resources/some.include +0 -0
- data/examples/packaging/include_exclude/src/main/resources/some_exclude.clu +0 -0
- data/examples/packaging/include_exclude/src/main/resources/some_exclude.ex +0 -0
- data/examples/packaging/include_exclude/src/main/webapp/WEB-INF/web.xml +0 -0
- data/examples/packaging/meta/ADDITIONAL +1 -0
- data/examples/packaging/meta/DISCLAIMER +1 -0
- data/examples/packaging/meta/NOTICE +1 -0
- data/examples/packaging/meta/buildfile +25 -0
- data/examples/packaging/meta/run.sh +2 -0
- data/examples/packaging/meta/src/main/MANIFEST.MF +7 -0
- data/examples/packaging/meta/src/main/java/HelloWorld.java +5 -0
- data/examples/packaging/meta/src/main/resources/some_resource.txt +0 -0
- data/examples/packaging/meta/src/main/webapp/WEB-INF/web.xml +0 -0
- data/examples/packaging/multiple/buildfile +39 -0
- data/examples/packaging/multiple/run.sh +6 -0
- data/examples/packaging/multiple/src/main/java/HelloWorld.java +5 -0
- data/examples/packaging/multiple/src/main/resources/some_resource.txt +0 -0
- data/examples/packaging/multiple/src/main/webapp/WEB-INF/web.xml +0 -0
- data/examples/projects/foo-bar/buildfile +24 -0
- data/examples/projects/foo-bar/run.sh +2 -0
- data/examples/projects/killer-app/buildfile +82 -0
- data/examples/projects/killer-app/run.sh +27 -0
- data/examples/projects/killer-app/teh-api/src/main/java/Example.java +5 -0
- data/examples/projects/killer-app/teh-api/src/test/java/ExampleTest.java +8 -0
- data/examples/projects/killer-app/teh-impl/src/main/java/Example.java +5 -0
- data/examples/projects/killer-app/teh-impl/src/main/resources/META-INF/persistence.xml +18 -0
- data/examples/projects/killer-app/teh-impl/src/test/java/ExampleTest.java +8 -0
- data/examples/projects/silly/buildfile +15 -0
- data/examples/projects/silly/run.sh +2 -0
- data/examples/projects/task/buildfile +12 -0
- data/examples/projects/task/run.sh +5 -0
- data/examples/testing/failing/buildfile +11 -0
- data/examples/testing/failing/run.sh +7 -0
- data/examples/testing/failing/src/main/java/Example.java +5 -0
- data/examples/testing/failing/src/test/java/FailingExampleTest.java +8 -0
- data/examples/testing/frameworks/buildfile +12 -0
- data/examples/testing/frameworks/junit/src/main/java/Example.java +5 -0
- data/examples/testing/frameworks/junit/src/test/java/ExampleTest.java +8 -0
- data/examples/testing/frameworks/run.sh +5 -0
- data/examples/testing/frameworks/testng/src/main/java/Example.java +5 -0
- data/examples/testing/frameworks/testng/src/test/java/ExampleTest.java +9 -0
- data/examples/testing/include_exclude/buildfile +9 -0
- data/examples/testing/include_exclude/run.sh +2 -0
- data/examples/testing/include_exclude/src/main/java/Example.java +5 -0
- data/examples/testing/include_exclude/src/test/java/ExampleTest.java +8 -0
- data/examples/testing/include_exclude/src/test/java/FailingExampleTest.java +8 -0
- data/examples/testing/include_exclude/src/test/java/de/phoet/IncludeTest.java +10 -0
- data/examples/testing/integration/buildfile +12 -0
- data/examples/testing/integration/client/src/main/java/Example.java +5 -0
- data/examples/testing/integration/client/src/test/java/ClientExampleTest.java +8 -0
- data/examples/testing/integration/run.sh +2 -0
- data/examples/testing/integration/server/src/main/java/Example.java +5 -0
- data/examples/testing/integration/server/src/test/java/ServerExampleTest.java +8 -0
- data/examples/testing/running/buildfile +13 -0
- data/examples/testing/running/client/src/main/java/Example.java +5 -0
- data/examples/testing/running/client/src/test/java/ClientExampleTest.java +8 -0
- data/examples/testing/running/run.sh +26 -0
- data/examples/testing/running/server/src/main/java/Example.java +5 -0
- data/examples/testing/running/server/src/test/java/ServerExampleTest.java +8 -0
- data/features/artifacts.feature +42 -0
- data/features/step_definitions/artifacts_steps.rb +19 -0
- data/features/support/env.rb +11 -0
- metadata +213 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
echo "compile and enable debug ..."
|
|
2
|
+
buildr clean compile debug=on
|
|
3
|
+
|
|
4
|
+
echo "compile and disable debug ..."
|
|
5
|
+
echo "... when calling buildr with debug=off"
|
|
6
|
+
buildr clean compile debug=off
|
|
7
|
+
|
|
8
|
+
echo "... once until we change the variable with sysproperty"
|
|
9
|
+
export DEBUG=off
|
|
10
|
+
buildr compile
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
repositories.remote << "http://www.ibiblio.org/maven2/"
|
|
2
|
+
|
|
3
|
+
define "extending_tasks", :version=>"1.0.0" do
|
|
4
|
+
|
|
5
|
+
# extend the build task, the taks itself is yielded for the block
|
|
6
|
+
build do |build_task|
|
|
7
|
+
info "extending task #{build_task.inspect}"
|
|
8
|
+
mkdir _('staged')
|
|
9
|
+
touch _('staged/file.txt')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# extend the compile task for post-compilation work, the taks itself is yielded for the block
|
|
13
|
+
compile do |compile_task|
|
|
14
|
+
info "extending task #{compile_task.inspect}"
|
|
15
|
+
compile_task.sources.each {|s| info "source: #{s.inspect}"}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# extending the clean task to remove additional stuff, the taks itself is yielded for the block
|
|
19
|
+
clean do |clean_task|
|
|
20
|
+
info "extending task #{clean_task.inspect}"
|
|
21
|
+
rm_rf _('staged')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'buildr/javacc'
|
|
2
|
+
|
|
3
|
+
repositories.remote << "http://www.ibiblio.org/maven2/"
|
|
4
|
+
|
|
5
|
+
define "jjtree", :version=>"1.0.0" do
|
|
6
|
+
# use jjtree for compilation
|
|
7
|
+
# --> disabled, due to a missing example...
|
|
8
|
+
# jjtree = jjtree(_('src/main/jjtree'), :in_package=>'com.acme')
|
|
9
|
+
# compile.from javacc(jjtree, :in_package=>'com.acme'), jjtree
|
|
10
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
repositories.remote << "http://www.ibiblio.org/maven2/"
|
|
2
|
+
|
|
3
|
+
define "resources", :version=>"1.0.0" do
|
|
4
|
+
# filter the resources with defined param and filters defined in profiles.yaml
|
|
5
|
+
resources.filter.using 'date'=>Time.new
|
|
6
|
+
# this should force the expected behavior, see https://issues.apache.org/jira/browse/BUILDR-349
|
|
7
|
+
resources.filter.using( { 'date' => Time.new }.merge( Buildr.settings.profile['filter'] ))
|
|
8
|
+
|
|
9
|
+
# use a custom filter using ant-style properties like @key@
|
|
10
|
+
run_filter(:ant, :ant)
|
|
11
|
+
# use a custom filter using erb-style properties like <%=key=>
|
|
12
|
+
run_filter(:erb, :erb)
|
|
13
|
+
# use a custom filter using maven-style properties like ${key}
|
|
14
|
+
run_filter(:maven, :maven)
|
|
15
|
+
# use a custom filter using ruby-style properties like #{key}
|
|
16
|
+
run_filter(:ruby, :ruby)
|
|
17
|
+
# use a custom filter using a regex to match property like =key=
|
|
18
|
+
run_filter(:regex, /=(.*?)=/)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run_filter(name, type)
|
|
22
|
+
filter('src/main/property-style').include("#{name}.txt").into('target/resources').using(type, 'version'=>version, 'created'=>Time.now).run
|
|
23
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vrs: @version@ crt: @created@
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vrs: <%=version%> crt: <%=created%>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vrs: ${version} crt: ${created}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vrs: =version= crt: =created=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vrs: #{version} crt: #{created}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version: ${version} copyright: ${copyright} date: ${date}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
echo "process some buildr options"
|
|
2
|
+
echo "-f/--buildfile [file] Specify the buildfile."
|
|
3
|
+
buildr -f buildfile
|
|
4
|
+
buildr --buildfile buildfile
|
|
5
|
+
echo "-e/--environment [name] Environment name (e.g. development, test, production)."
|
|
6
|
+
buildr -e production
|
|
7
|
+
buildr --environment production
|
|
8
|
+
echo "-V/--version Display the program version."
|
|
9
|
+
buildr -V
|
|
10
|
+
buildr --version
|
|
11
|
+
echo "-T/--tasks [PATTERN] Display the tasks (matching optional PATTERN) with descriptions, then exit."
|
|
12
|
+
buildr -T
|
|
13
|
+
buildr --tasks
|
|
14
|
+
echo "-D, --describe [PATTERN] Describe the tasks (matching optional PATTERN), then exit."
|
|
15
|
+
buildr -D
|
|
16
|
+
buildr --describe
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<ivysettings>
|
|
2
|
+
<settings defaultResolver="chained"/>
|
|
3
|
+
<property name="java.net.maven.pattern" value="[organisation]/jars/[module]-[revision].[ext]"/>
|
|
4
|
+
<resolvers>
|
|
5
|
+
<chain name="chained" returnFirst="true">
|
|
6
|
+
<ibiblio name="ibiblio" m2compatible="true"/>
|
|
7
|
+
</chain>
|
|
8
|
+
</resolvers>
|
|
9
|
+
</ivysettings>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
RTFM!
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
repositories.remote << "http://www.ibiblio.org/maven2/"
|
|
2
|
+
|
|
3
|
+
define "include_exclude", :version=>"1.0.0" do
|
|
4
|
+
package(:zip).include _(:src, :main, :java, '*.java'), 'README'
|
|
5
|
+
|
|
6
|
+
# exclude pattern based on extension-name
|
|
7
|
+
package(:file=>_(:target, 'with_excludes.zip')).
|
|
8
|
+
include('src/main/resources').
|
|
9
|
+
exclude('**/*.ex')
|
|
10
|
+
|
|
11
|
+
# include any file with the provided extensions
|
|
12
|
+
package(:file=>_(:target, 'with_or_pattern.zip')).
|
|
13
|
+
include('src/main/resources/*.{clu,ex}')
|
|
14
|
+
|
|
15
|
+
# include any extension with the characters e and x
|
|
16
|
+
package(:file=>_(:target, 'with_characterpattern.zip')).
|
|
17
|
+
include('src/main/resources/*.[ex]*')
|
|
18
|
+
|
|
19
|
+
# include any extension with 2 characters starting with e
|
|
20
|
+
package(:file=>_(:target, 'with_any_character.zip')).
|
|
21
|
+
include('src/main/resources/*.e?')
|
|
22
|
+
|
|
23
|
+
# put included stuff to different path
|
|
24
|
+
package(:file=>_(:target, 'with_different_path.zip')).
|
|
25
|
+
include(_(:src, :main, :resources, '*'), :path=>"#{id}-#{version}")
|
|
26
|
+
|
|
27
|
+
# use the path repeatedly using 'tap'
|
|
28
|
+
package(:file=>_(:target, 'with_tap.zip')).path("#{id}-#{version}").tap do |path|
|
|
29
|
+
path.include 'src/main/resources/*.*'
|
|
30
|
+
path.include 'README'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# define the target-name of an include
|
|
34
|
+
package(:file=>_(:target, 'with_as_filename.zip')).
|
|
35
|
+
include('README', :as=>'readme.txt')
|
|
36
|
+
|
|
37
|
+
# this selects all files currently available in the include-directory (and sub-directory)
|
|
38
|
+
package(:file=>_(:target, 'direct_include.zip')).
|
|
39
|
+
include('target/resources/*')
|
|
40
|
+
# this selects the same but not at definition-time but at execution-time
|
|
41
|
+
package(:file=>_(:target, 'lazy_include.zip')).
|
|
42
|
+
include('target/resources', :as=>'.')
|
|
43
|
+
|
|
44
|
+
# extend the build-task to write some additional file
|
|
45
|
+
build do
|
|
46
|
+
write('target/resources/additional.txt', 'content')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# create an empty/cleaned zip
|
|
50
|
+
package(:file=>_(:target, 'empty.zip')).
|
|
51
|
+
include(_(:src, :main, :resources, '*')).
|
|
52
|
+
clean
|
|
53
|
+
|
|
54
|
+
# merge all the zips created yet
|
|
55
|
+
pkgs = packages.map{|p| "#{p}" }
|
|
56
|
+
package(:file=>_(:target, 'merged_all.zip')).
|
|
57
|
+
merge(pkgs)
|
|
58
|
+
|
|
59
|
+
# merge all but remove resources
|
|
60
|
+
package(:file=>_(:target, 'merged_all_without_resources.zip')).
|
|
61
|
+
merge(pkgs).exclude('resources/**')
|
|
62
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
additional
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
disclaimer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
notice
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
repositories.remote << "http://www.ibiblio.org/maven2/"
|
|
2
|
+
|
|
3
|
+
define "meta", :version=>"1.0.0" do
|
|
4
|
+
# set default manifest
|
|
5
|
+
manifest['Copyright'] = 'Default Inc (C) 2010'
|
|
6
|
+
# set default includes for meta directory
|
|
7
|
+
meta_inf << file('DISCLAIMER') << file('NOTICE')
|
|
8
|
+
|
|
9
|
+
package(:jar, :file=>_(:target, "manifest_default.jar"))
|
|
10
|
+
# merge default with hash
|
|
11
|
+
package(:jar, :file=>_(:target, "manifest_merge.jar")).with :manifest=>manifest.merge('Main-Class'=>'com.acme.Main')
|
|
12
|
+
|
|
13
|
+
# add more to meta directory
|
|
14
|
+
package(:jar, :file=>_(:target, "meta_additional.jar")).with :meta_inf=>file('ADDITIONAL')
|
|
15
|
+
|
|
16
|
+
# create from file
|
|
17
|
+
package(:jar, :file=>_(:target, "manifest_file.jar")).with :manifest=>_('src/main/MANIFEST.MF')
|
|
18
|
+
# create from hash
|
|
19
|
+
package(:jar, :file=>_(:target, "manifest_hash.jar")).with :manifest=>{ 'Copyright'=>'Hash Inc (C) 2010' }
|
|
20
|
+
# create from proc
|
|
21
|
+
package(:jar, :file=>_(:target, "manifest_proc.jar")).with :manifest=>Proc.new{|n|{ 'Copyright'=>'Proc Inc (C) 2010' }}
|
|
22
|
+
|
|
23
|
+
# dont create
|
|
24
|
+
package(:jar, :file=>_(:target, "manifest_none.jar")).with :manifest=>false
|
|
25
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
repositories.remote << "http://www.ibiblio.org/maven2/"
|
|
2
|
+
|
|
3
|
+
define "multiple", :version=>"1.0.0" do
|
|
4
|
+
# you can create multiple packages from one project
|
|
5
|
+
|
|
6
|
+
# create a jar
|
|
7
|
+
package :jar
|
|
8
|
+
# is equivalent to
|
|
9
|
+
package :type=>:jar
|
|
10
|
+
# or let buildr interfer a type from project
|
|
11
|
+
package
|
|
12
|
+
|
|
13
|
+
# create a war
|
|
14
|
+
package :war
|
|
15
|
+
|
|
16
|
+
# create a source-zip
|
|
17
|
+
package :sources
|
|
18
|
+
|
|
19
|
+
# create a zip
|
|
20
|
+
package :zip, :file=>_('target/multiple.zip')
|
|
21
|
+
|
|
22
|
+
# let buildr interfer a type from package-extension (.jar)
|
|
23
|
+
package :file=>_('target/multiple_with_extension.jar')
|
|
24
|
+
|
|
25
|
+
# override the project definition for an artifact (you cant define a file in this case!)
|
|
26
|
+
# other id
|
|
27
|
+
package :jar, :id=>'silly'
|
|
28
|
+
# other group
|
|
29
|
+
package :jar, :group=>'stupid'
|
|
30
|
+
# other version
|
|
31
|
+
package :war, :version=>'1.x'
|
|
32
|
+
# other classifier
|
|
33
|
+
package :zip, :classifier=>'sources'
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# print some package-information
|
|
38
|
+
puts project('multiple').packages.first
|
|
39
|
+
puts project('multiple').packages.select { |pkg| pkg.type == :zip }.inspect
|