Skip to content

Commit

Permalink
Automated shyiko/homebrew-ktlint synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
shyiko committed Aug 1, 2016
1 parent fbad3ab commit bea1a38
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .deploy-to-homebrew
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -e

# settings.servers.github.privateKey
if [ "$GITHUB_TOKEN" == "" ]; then exit 1; fi

# project.version
if [ "$VERSION" == "" ]; then exit 1; fi

if [ ! -f target/ktlint ]; then echo "target/ktlint wasn't found"; exit 1; fi

HASH=$(shasum -a 256 target/ktlint | cut -d\ -f1)

CHECKOUT_DIR=$(mktemp -d /tmp/homebrew-ktlint.XXXXXX)
git clone https://${GITHUB_TOKEN}@github.com/shyiko/homebrew-ktlint.git $CHECKOUT_DIR

{
echo "class Ktlint < Formula"
echo " desc \"Kotlin linter\""
echo " homepage \"https://github.com/shyiko/ktlint\""
echo " url \"https://github.com/shyiko/ktlint/releases/download/$VERSION/ktlint\", :using => :nounzip"
echo " sha256 \"$HASH\""
echo " def install"
echo " bin.install \"ktlint\""
echo " end"
echo " test do"
echo " system bin/\"ktlint\", \"--version\""
echo " end"
echo "end"
} > $CHECKOUT_DIR/ktlint.rb

(cd $CHECKOUT_DIR && git commit -m $VERSION ktlint.rb && git tag $VERSION && git push origin $VERSION)
33 changes: 33 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,17 @@
./mvnw versions:set -DnewVersion=&lt;version&gt;
./mvnw -Ddeploy=maven-central
./mvnw -Ddeploy=github
./mvnw -Ddeploy=homebrew
</usage>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>com.github.shyiko.servers-maven-extension</groupId>
<artifactId>servers-maven-extension</artifactId>
<version>1.3.0</version>
</extension>
<extension>
<groupId>com.github.shyiko.usage-maven-plugin</groupId>
<artifactId>usage-maven-plugin</artifactId>
Expand Down Expand Up @@ -466,6 +472,33 @@
</plugins>
</build>
</profile>
<profile>
<id>deploy-to-homebrew</id>
<activation>
<property>
<name>deploy</name>
<value>homebrew</value>
</property>
</activation>
<build>
<defaultGoal>antrun:run</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<configuration>
<target name="deploy-to-homebrew">
<exec executable="${project.basedir}/.deploy-to-homebrew" failonerror="true">
<env key="VERSION" value="${project.version}"/>
<env key="GITHUB_TOKEN" value="${settings.servers.github.privateKey}"/>
</exec>
</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit bea1a38

Please sign in to comment.