Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  bin
  lib
  Gemfile
  README.md
  uoy-faculty-rake.gemspec
Size: Mime:
  README.md

Rake

Installation

Add the following to your Gemfile:

source 'https://gem.fury.io/universityofyork/' do
  group :development do
    gem 'uoy-faculty-rake', '~> 0.1'
  end
end

And then execute:

$ bundle

Or install it yourself as:

$ gem install --source https://gem.fury.io/universityofyork/ uoy-faculty-rake

Usage

In your Rakefile:

require 'faculty/rake'

Then you can initialise rake tasks as required:

Faculty::Rake::BaseUpdate.new 'path-to-base-remote-repository'

# For gems
Faculty::Rake::GemRename.new

# For sinatra apps
Faculty::Rake::DockerTasks.new
Faculty::Rake::NodeTasks.new
Faculty::Rake::SinatraInit.new

# For AWS apps
Faculty::Rake::Deploy.new

Faculty::Rake::Deploy.new parameters

Some aspects of the rake deploy:to task can be set by passing arguments to the Deploy class constructor in the project's Rakefile. Generally, sensible defaults are configured, and deployment can still occur without these being manually set.

The following (named) parameters are available:

  • stack_name: String. Sets the CloudFormation stack name. Defaults to '#{repository_name}'.
  • tag_name: String. Sets the value of the york/name tag for the CloudFormation stack, and is automatically prefixed with 'Faculty Dev'. Defaults to repostory_name to give a default tag of 'Faculty Dev #{repository_name}'.
  • parameter_overrides: Hash. Sets parameter overrides for the CloudFormation template parameters. Defaults to an empty hash ({}).

repository_name is the unqualified name of the repository in GitHub e.g. faculty-dev-sinatra-base for the Sinatra Base repository.

Below is an example Rakefile snippet that sets a unique stack and york/name tag for the made-up project, and will override the CF template default parameters SendFromEmail and EmailSourceArn:

parameter_overrides = { SendFromEmail: 'do-not-reply@york.ac.uk', EmailSourceArn: 'arn:aws:ses:region:123456789012:foo/example.com' }

Faculty::Rake::Deploy.new(stack_name: 'faculty-my-app', tag_name: 'My App', parameter_overrides: )

The resulting deployment will have 'faculty-my-app' as the stack name, and Faculty Dev My App for the york/name tag's value.

Development

Versioning

Your Gem's version is picked up automatically from lib/faculty/rake.rb. When any changes are pushed to master, after the normal CI tasks the pipeline will push to gemfury automatically. The usual workflow is:

  • For minor changes, update VERSION and make the change in a single commit

  • For anything else, create a branch and set VERSION to the version you're aiming to release for. Make the changes; when the branch is merged, the gem will be uploaded.

Note that gemfury will never overwrite an existing gem version, even if the old one is yanked!

Running tests

Tests can be run via rake: rake spec - this doesn't run performance tests; they can be run separately via rake perf.

You can also run rspec normally e.g. bundle exec rspec -fd.

Identifying Performance Tests

If you have performance tests that take a while, tag the context / describe block like this:

context 'when foo is bar baz', :perf do
  ...
end

Contributing

Bug reports and pull requests are welcome at https://github.com/university-of-york/faculty-dev-rake-gem