Skip to content

Commit

Permalink
cleanup maven snapshot repo on ci.jruby.org [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Jul 17, 2014
1 parent c8800bf commit abc85bb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
18 changes: 18 additions & 0 deletions maven/jruby-jars/Mavenfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,22 @@ build do
final_name "#{model.artifact_id}-#{version.sub(/-SNAPSHOT/, '')}"
end

profile :snapshots do

# this needs to be on a "leaf" of the maven module directory structure
# FIX-UPSTREAM those execute block do not work in parent pom

execute :cleanup_snapshot_repo, :phase => :deploy do |ctx|
# delete all files which are NOT from today
# and leave the metadata.xml in place
snapshots_dir = ctx.project.properties[ 'snapshots.dir' ].to_s
require 'date'
format = Date.today.strftime( '%Y%m%d' )
Dir[ snapshot_dir + '/**/*' ].each do |f|
if File.file?( f ) && ! ( f =~ /maven-metadata.xml/ || f =~ /-#{format}\./ )
File.delete( f )
end
end
end
end
# vim: syntax=Ruby
34 changes: 34 additions & 0 deletions maven/jruby-jars/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,38 @@ freezing to) a specific jruby-complete jar version.</description>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>snapshots</id>
<build>
<plugins>
<plugin>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-maven-plugin</artifactId>
<version>${tesla.version}</version>
<executions>
<execution>
<id>cleanup_snapshot_repo</id>
<phase>deploy</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>cleanup_snapshot_repo</taskId>
<nativePom>Mavenfile</nativePom>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-ruby</artifactId>
<version>${tesla.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
12 changes: 6 additions & 6 deletions pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
end

properties( 'minitest-excludes.version' => '1.0.2',
'tesla.version' => '0.0.8',
'tesla.version' => '0.1.1',
'rspec-core.version' => '2.14.2',
'jruby.basedir' => '${project.basedir}',
'minitest.version' => '5.0.7',
Expand Down Expand Up @@ -227,21 +227,21 @@
end

profile 'snapshots' do
snapshot_dir = '/builds/snapshots'
snapshots_dir = '/builds/snapshots'

properties 'snapshots.dir' => snapshots_dir
activation do
file( :exists => snapshot_dir )
file( :exists => snapshots_dir )
end

distribution_management do
repository( "file:#{snapshot_dir}/maven", :id => 'local releases' )
snapshot_repository( "file:#{snapshot_dir}/maven",
repository( "file:#{snapshots_dir}/maven", :id => 'local releases' )
snapshot_repository( "file:#{snapshots_dir}/maven",
:id => 'local snapshots' )
end
build do
default_goal :deploy
end

end

reporting do
Expand Down
5 changes: 4 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</distributionManagement>
<properties>
<minitest-excludes.version>1.0.2</minitest-excludes.version>
<tesla.version>0.0.8</tesla.version>
<tesla.version>0.1.1</tesla.version>
<rspec-core.version>2.14.2</rspec-core.version>
<jruby.basedir>${project.basedir}</jruby.basedir>
<minitest.version>5.0.7</minitest.version>
Expand Down Expand Up @@ -637,6 +637,9 @@
<url>file:/builds/snapshots/maven</url>
</snapshotRepository>
</distributionManagement>
<properties>
<snapshots.dir>/builds/snapshots</snapshots.dir>
</properties>
</profile>
</profiles>
</project>

0 comments on commit abc85bb

Please sign in to comment.