Automatic Version and Publish Bash Scripts


#1

I wrote some helper bash scripts that will do some nice things to help with publishing packages to atmosphere. In particular, the publish-tool.sh has an automatic mode that will attempt to correct any errors that occur in the publishing process and try to publish again. This is mainly meant for if you have many packages that work together and you want to publish them all, as wildcard expansion works. For example, if I had a dozen packages I wanted to publish all at once, rather than doing it manually, I could use this tool as:

$ ./publish-tool.sh -a /path/to/packages/*

There is also a version-tool.sh that you can use to bump major, minor, or patch version numbers. This tool is used in publish-tool.sh automatic mode if the version in question has already been published to automatically increment the patch number and try again.

In the future, I intend to add the following functionality:

  • Automatically check to see if the package is using the most recent versions of the packages specified with api.use. I think this could be accomplished by creating a test meteor application, running meteor add PACKAGE for each package specified with api.use, then checking the version numbers against what exists in that test app after a meteor update.
  • Any other features that you think might be useful?

Let me know what you think!


#2

Very nice! The fact that we can’t use ‘meteor create’ or ‘meteor publish’ from within the packages directory is a pain, isn’t it?

I’ve been tinkering around with some scripts for starrynight that do a little bit of related functionality… mostly just creating and publishing packages. The autoincrement and multi-publish is interesting and useful functionality I hadn’t thought about.

This might be great functionality to roll into a node utility app, if you’re interested.


#3

It would certainly be nice to have it all done in JS (because I’ll bet the parsing code is a lot easier haha), I’m just not very good at native node programming. Do you have a link to your starrynight code that is similar so I could take a look and explore what you already have?


#4

Well, grab a copy of the StarryNight repository here:

The bin/starrynight.js file has most all the commands and libraries you’ll need to convert the bash script into a node utility. The -pattern command has maybe a good example of how to copy directories using command line arguments and callbacks.

bin/starrynight.js

If this seems like a direction you’re interested in, also have a look at the package.json file.
package.json

You can compile a new version of the utility by running ‘npm install -g .’ from the starrynight directory.

I’m on the road right now, and the package create/clone commands aren’t synced up to GitHub right now. I’ll probably push them up on Wednesday, as they’re sort of on front-burner right now.


#5

I know mrtbulkrelease from @raix is doing a great job with cfs packages.

How is this different?


#6

It’s actually inspired by that, but I the npm install failed for me. So I wrote this so that it didn’t need to depend on anything but bash. I tried for a while to get that working, but opted to just write one myself. Just another alternative!


#7

Oh, really? I’d be curious to see what the problem was and see whether opening an issue on the mbr repo could help solving the issue so others could use it without hitting the same wall…

I have a similar script to automatically publish useraccounts packages.
It’s not that elegant but it’s doing a good work :wink:


#8

I opened an issue with my problem.

I like what you’re doing with your script to automatically update version references inside of the package.js files. I was thinking of doing something similar, but more globally through the following process:

  1. grep "use(\w+:[\w-]+" package.js - get the list of all included packages and parse the names out of this list
  2. Create a meteor project in /tmp/meteor-version-test
  3. Run meteor add PACKAGE for all packages in the above list
  4. Run meteor update
  5. Parse versions.json for the most up-to-date version numbers
  6. Fix package.js to use most recent version numbers
  7. rm -rf /tmp/meteor-version-test

I think this is the simplest way of ensuring that the package uses the most recent versions of packages automatically. I wish this was something that was done by the core. Like while publishing, have a message that says “there is a more recent version of package XXXXXX”.