Open crowbot opened 8 years ago
As @davewhiteland points out, we could retain the shared code in the form of a gem.
We add in some rake tasks in the test environment https://github.com/mysociety/alaveteli/blob/e0fc3d2d6348e16b34471cdb7d8fad11e1b8b3cc/Rakefile#L8
These files must be executable Ruby files. Files that use bash or other interpreters will not work.
– http://guides.rubygems.org/specification-reference/#executables
Probably don't need to publish to rubygems – just use the git
option:
gem 'mysociety-commonlib', :git => 'https://github.com/mysociety/commonlib.git', :branch => 'master'
Need to check when this gets updated; may only be on gem update
.
Rakefile
Loads ruby specs
https://github.com/mysociety/alaveteli/blob/develop/Rakefile#L7-L9
Vagrantfile
install-site.sh
downloaded directly
config/crontab-example
Uses run-with-lockfile.sh
several times
https://github.com/mysociety/alaveteli/blob/develop/config/crontab-example#L15
config/httpd.conf-example
Makes jslib
available. Don't know if we use it?
https://github.com/mysociety/alaveteli/blob/develop/config/httpd.conf-example#L88-L93
config/initializers/alaveteli.rb
Makes rblib available to the app
https://github.com/mysociety/alaveteli/blob/develop/config/initializers/alaveteli.rb#L2-L5
lib/configuration.rb
Loads MySociety::Config
– a config parser that shells out to PHP?
lib/tasks/submodules.rake
Not a direct use of commonlib but checks whether it needs initializing/updating
https://github.com/mysociety/alaveteli/blob/develop/lib/tasks/submodules.rake
lib/tasks/themes.rake
Loads some ruby methods for inspecting git output. Might be able to do this through grit or rugged.
script/compact-xapian-database
Uses output-on-error
from commonlib
https://github.com/mysociety/alaveteli/blob/develop/script/compact-xapian-database#L19
script/handle-mail-replies.rb
Makes rblib available. Not sure what we use from commonlib here.
https://github.com/mysociety/alaveteli/blob/develop/script/handle-mail-replies.rb#L16
script/load-mail-server-logs
Loads shlib/deployfns
, I think to read config/general
.
https://github.com/mysociety/alaveteli/blob/develop/script/load-mail-server-logs#L6-L7
script/mailin
Loads shlib/deployfns
, I think to read config/general
.
https://github.com/mysociety/alaveteli/blob/develop/script/mailin#L12-L14
script/rails-deploy-before-down
Loads shlib/deployfns
, I think to read config/general
, and probably lots of other things.
https://github.com/mysociety/alaveteli/blob/develop/script/rails-deploy-before-down#L28-L29
script/request-creation-graph
Loads shlib/deployfns
– not sure anything is used from there.
https://github.com/mysociety/alaveteli/blob/develop/script/request-creation-graph#L18
script/site-specific-install.sh
Must be sourced from commonlib/bin/install-site.sh
; Probably uses lots of commonlib functions.
https://github.com/mysociety/alaveteli/blob/develop/script/site-specific-install.sh#L8-L15
script/user-use-graph
Loads shlib/deployfns
– not sure anything is used from there.
https://github.com/mysociety/alaveteli/blob/develop/script/user-use-graph#L17
spec/spec_helper.rb
Ignores commonlib from coverage output.
https://github.com/mysociety/alaveteli/blob/develop/spec/spec_helper.rb#L15
Maybe a better idea is packaging this in to a .deb
and make installing it one of the first steps of commonlib/bin/install-site.sh
(although, that's kinda weird that we'd wget
install-site.sh
, which then installs the lot of it in /usr/local
).
The submodule adds another level of complexity - is this worth it?