Skip to content

Commit baf7411

Browse files
authored
Merge pull request #8 from MITLibraries/tasks_to_update_sass
Adds Makefile to synchronize, build and release gem
2 parents f6bf622 + 6b5cd3e commit baf7411

3 files changed

Lines changed: 61 additions & 2 deletions

File tree

Makefile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.PHONY: help fetch update cleanup dist publish
2+
SHELL=/bin/bash
3+
GEMSPEC=$(shell ls *.gemspec | head -1)
4+
VERSION=$(shell ruby -e 'puts Gem::Specification::load("$(GEMSPEC)").version')
5+
PROJECT=$(shell ruby -e 'puts Gem::Specification.load("$(GEMSPEC)").name')
6+
GEM=$(PROJECT)-$(VERSION).gem
7+
8+
help: ## Print this message
9+
@awk 'BEGIN { FS = ":.*##"; print "Usage: make <target>\n\nTargets:" } \
10+
/^[-_[:alpha:]]+:.?*##/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)
11+
12+
fetch: clean ## Grab latest from theme repo (auto runs clean first)
13+
mkdir -p tmp
14+
curl -o tmp/assets.zip https://codeload.github.com/MITLibraries/mitlib-style/zip/master
15+
unzip -o -d tmp tmp/assets.zip
16+
17+
update: fetch ## Synchronize latest (auto runs clean and fetch first)
18+
# cleanup targets first in case assets were removed
19+
rm -rf vendor/assets/images/
20+
rm -rf vendor/assets/stylesheets/
21+
22+
mkdir vendor/assets/images/
23+
mkdir vendor/assets/stylesheets/
24+
25+
cp -R tmp/mitlib-style-master/_assets/i/* vendor/assets/images
26+
cp -R tmp/mitlib-style-master/_assets/sass/* vendor/assets/stylesheets
27+
28+
@tput setaf 2
29+
@tput bold
30+
@echo "Assets updated. Make sure to update version in:"
31+
@echo " lib/mitlibraries/theme/version.rb"
32+
@echo "before building with 'make dist'"
33+
@tput sgr0
34+
35+
clean: ## Delete downloaded zip and extracted files
36+
rm -f tmp/assets.zip
37+
rm -rf tmp/mitlib-style-master
38+
39+
dist: ## Build the gem from the current gemspec
40+
gem build mitlibraries-theme.gemspec
41+
@tput setaf 2
42+
@tput bold
43+
@echo "Finished building gem. To test locally add to your project Gemfile:"
44+
@echo " gem 'mitlibraries-theme', '$(shell pwd)'"
45+
@tput sgr0
46+
47+
publish: ## Publish the gem version defined in the gemspec
48+
gem push "$(GEM)"

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,18 @@ called multiple times the results are concatenated.
7575

7676
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
7777

78-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
78+
Building and publishing this gem is handled via the `Makefile`.
79+
80+
Run `make help` for details.
81+
82+
If your goal is to fetch the latest assets from the style repo and publish the
83+
changes, this would get you there:
84+
- `make update`
85+
- manually update the version in `lib/mitlibraries/theme/version.rb`
86+
- `make dist`
87+
- test the gem in a local version of a site that uses it with the info the previous command provided on completion
88+
- commit and PR
89+
- `make publish`
7990

8091
## Contributing
8192

lib/mitlibraries/theme/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Mitlibraries
22
module Theme
3-
VERSION = '0.3.0'.freeze
3+
VERSION = '0.3.1.pre'.freeze
44
end
55
end

0 commit comments

Comments
 (0)