Skip to content

Commit

Permalink
address #18 by injecting a Directive.or metaclass method
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanKrueger committed Jan 30, 2013
1 parent aa29b3d commit c413a25
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v1.4 -
=================
* issue #18: add syntactic sugar to easily combine file type
directives with a logical or (|)

v1.3 - 2013-01-08
=================
* bugfix: RPM_ARCH and RPM_OS were being added to the scripts in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ derived from RedHat. It leverages [Redline](http://redline-rpm.org/) Java libra
fileMode = 0550
}
from('src/main/resources') {
fileType = CONFIG
fileType = CONFIG | NOREPLACE
into 'conf'
}
from('home') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ package com.trigonic.gradle.plugins.rpm
import java.lang.reflect.Field

import org.freecompany.redline.Builder
import org.gradle.api.Plugin;
import org.freecompany.redline.payload.Directive
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.internal.file.copy.CopySpecImpl
import org.gradle.api.plugins.BasePlugin
Expand All @@ -43,5 +44,9 @@ class RpmPlugin implements Plugin<Project> {
Builder.metaClass.getDefaultSourcePackage() {
format.getLead().getName() + "-src.rpm"
}

Directive.metaClass.or = { Directive other ->
new Directive(delegate.flag | other.flag)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class RpmPluginTest {

from(srcDir.toString() + '/main/groovy') {
createDirectoryEntry = true
fileType = CONFIG
fileType = CONFIG | NOREPLACE
}

from(noParentsDir) {
Expand Down

0 comments on commit c413a25

Please sign in to comment.