“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey
Senior Software Engineer, UK

Capybara Webkit QT is just bullshit

Capybara Webkit QT and annoyance.

An error occurred while installing capybara-webkit (1.8.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.8.0' --source 'http://rubygems.org/'` succeeds before bundling.

In Gemfile:
  capybara-webkit
New-MacBook-Pro:sard cex$ /usr/bin/xcodebuild
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
New-MacBook-Pro:sard cex$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
New-MacBook-Pro:sard cex$ sudo xcode-select --switch /Library/Developer/CommandLineTools
Password:

Postgresql just annoys me

I never seem to have any real joy from setting up Postgres.

Report bugs to <pgsql-bugs@postgresql.org>.
rails@li517-27:/var/www/mini-epic/current$ psql -U epic
psql: FATAL:  Peer authentication failed for user "epic"
rails@li517-27:/var/www/mini-epic/current$ sudo -u postgres psql
psql (9.4.18)
Type "help" for help.

postgres=# password epic
postgres-# 
postgres-# \q
rails@li517-27:/var/www/mini-epic/current$ sudo -u postgres psql
psql (9.4.18)
Type "help" for help.

postgres=# password epic epic
postgres-# ;
ERROR:  syntax error at or near "password"
LINE 1: password epic epic
        ^
postgres=# \password epic epic
;
Enter new password: 
Enter it again: 
Passwords didn't match.
postgres=# \password epic
Enter new password: 
Enter it again: 
postgres=# \q
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -P epic
\pset: unknown option: epic
psql: could not set printing parameter "epic"
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -Pepic
\pset: unknown option: epic
psql: could not set printing parameter "epic"
rails@li517-27:/var/www/mini-epic/current$ psql --help
psql is the PostgreSQL interactive terminal.

Usage:
  psql [OPTION]... [DBNAME [USERNAME]]

General options:
  -c, --command=COMMAND    run only single command (SQL or internal) and exit
  -d, --dbname=DBNAME      database name to connect to (default: "rails")
  -f, --file=FILENAME      execute commands from file, then exit
  -l, --list               list available databases, then exit
  -v, --set=, --variable=NAME=VALUE
                           set psql variable NAME to VALUE
  -V, --version            output version information, then exit
  -X, --no-psqlrc          do not read startup file (~/.psqlrc)
  -1 ("one"), --single-transaction
                           execute as a single transaction (if non-interactive)
  -?, --help               show this help, then exit

Input and output options:
  -a, --echo-all           echo all input from script
  -e, --echo-queries       echo commands sent to server
  -E, --echo-hidden        display queries that internal commands generate
  -L, --log-file=FILENAME  send session log to file
  -n, --no-readline        disable enhanced command line editing (readline)
  -o, --output=FILENAME    send query results to file (or |pipe)
  -q, --quiet              run quietly (no messages, only query output)
  -s, --single-step        single-step mode (confirm each query)
  -S, --single-line        single-line mode (end of line terminates SQL command)

Output format options:
  -A, --no-align           unaligned table output mode
  -F, --field-separator=STRING
                           field separator for unaligned output (default: "|")
  -H, --html               HTML table output mode
  -P, --pset=VAR[=ARG]     set printing option VAR to ARG (see \pset command)
  -R, --record-separator=STRING
                           record separator for unaligned output (default: newline)
  -t, --tuples-only        print rows only
  -T, --table-attr=TEXT    set HTML table tag attributes (e.g., width, border)
  -x, --expanded           turn on expanded table output
  -z, --field-separator-zero
                           set field separator for unaligned output to zero byte
  -0, --record-separator-zero
                           set record separator for unaligned output to zero byte

Connection options:
  -h, --host=HOSTNAME      database server host or socket directory (default: "/var/run/postgresql")
  -p, --port=PORT          database server port (default: "5432")
  -U, --username=USERNAME  database user name (default: "rails")
  -w, --no-password        never prompt for password
  -W, --password           force password prompt (should happen automatically)

For more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within psql, or consult the psql section in the PostgreSQL
documentation.

Report bugs to <pgsql-bugs@postgresql.org>.
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -W epic
Password for user epic: 
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -W
Password for user epic: 
psql: FATAL:  Peer authentication failed for user "epic"
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -W
Password for user epic: 
psql: FATAL:  Peer authentication failed for user "epic"
rails@li517-27:/var/www/mini-epic/current$ vi /etc/postgresql/9.4/main/
environment      pg_ctl.conf      pg_hba.conf      pg_ident.conf    postgresql.conf  start.conf
rails@li517-27:/var/www/mini-epic/current$ vi /etc/postgresql/9.4/main/pg_hba.conf 
rails@li517-27:/var/www/mini-epic/current$ sudo vi /etc/postgresql/9.4/main/pg_hba.conf 
rails@li517-27:/var/www/mini-epic/current$ /etc/init.d/postgresql restart
[....] Restarting postgresql (via systemctl): postgresql.serviceFailed to restart postgresql.service: Access denied
 failed!
rails@li517-27:/var/www/mini-epic/current$ sudo /etc/init.d/postgresql restart
[....] Restarting postgresql (via systemctl): postgresql.service
. ok 
rails@li517-27:/var/www/mini-epic/current$ 
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -W
Password for user epic: 
psql: FATAL:  Peer authentication failed for user "epic"
rails@li517-27:/var/www/mini-epic/current$ sudo vi /etc/postgresql/9.4/main/pg_hba.conf 
rails@li517-27:/var/www/mini-epic/current$ sudo /etc/init.d/postgresql restart
[ ok ] Restarting postgresql (via systemctl): postgresql.service.
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -W
Password for user epic: 
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
rails@li517-27:/var/www/mini-epic/current$ sudo vi /etc/postgresql/9.4/main/pg_hba.conf 
rails@li517-27:/var/www/mini-epic/current$ sudo /etc/init.d/postgresql restart
[ ok ] Restarting postgresql (via systemctl): postgresql.service.
rails@li517-27:/var/www/mini-epic/current$ psql -U epic -W
Password for user epic: 
psql (9.4.18)
Type "help" for help.
rails@li517-27:/var/www/mini-epic/current$ bundle install
Fetching gem metadata from https://rubygems.org/........
Using rake 10.5.0
Using CFPropertyList 2.3.1
Using concurrent-ruby 1.1.3
Using aasm 4.12.0
Using i18n 0.8.6
Using json 1.8.6
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.1
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.5
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 4.2.1
Using rack 1.6.11
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.4.1
Using activejob 4.2.1
Using mime-types 2.99.3
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.4
Using activerecord 4.2.1
Using addressable 2.3.8
Using extlib 0.9.16
Using multi_json 1.11.0
Using autoparse 0.3.3
Using json_pure 1.8.3
Using jmespath 1.2.4
Using aws-sdk-core 2.3.18
Using aws-sdk-resources 2.3.18
Using aws-sdk 2.3.18
Using xml-simple 1.1.5
Using aws-ses 0.6.0
Using multipart-post 2.0.0
Using faraday 0.9.2
Using ffi 1.9.18
Using ethon 0.10.1
Using typhoeus 1.3.0
Using aychttp 0.1.0 from https://github.com/braindeaf/aychttp (at master@8b14ea4)
Using bcrypt 3.1.7
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using rb-fsevent 0.9.8
Using rb-inotify 0.9.8
Using sass-listen 4.0.0
Using sass 3.7.2
Using thor 0.20.3
Using bourbon 3.2.4
Using browser 2.2.0
Using bugsnag 4.0.0
Using bundler 1.16.6
Using cancancan 1.9.1
Using highline 1.7.2
Using net-ssh 2.9.2
Using net-scp 1.2.1
Using net-sftp 2.1.2
Using net-ssh-gateway 1.2.0
Using capistrano 2.15.5
Using xpath 2.0.0
Using capybara 2.10.1
Using carrierwave 0.10.0
Using excon 0.45.3
Using formatador 0.2.5
Using fog-core 1.30.0
Using fog-xml 0.1.2
Using fog-atmos 0.1.0
Using fog-json 1.0.1
Using ipaddress 0.8.0
Using fog-aws 0.3.0
Using inflecto 0.0.2
Using fog-brightbox 0.7.1
Using fog-ecloud 0.1.1
Using fog-google 0.0.5
Using fog-local 0.2.1
Using fog-powerdns 0.1.1
Using fog-profitbricks 0.0.2
Using fog-radosgw 0.0.4
Using fog-riakcs 0.1.0
Using fog-sakuracloud 1.0.1
Using fog-serverlove 0.1.2
Using fog-softlayer 0.4.6
Using fog-storm_on_demand 0.1.1
Using fog-terremark 0.1.0
Using fission 0.5.0
Using fog-vmfusion 0.1.0
Using fog-voxel 0.1.0
Using fog 1.30.0
Using uuidtools 2.1.5
Using carrierwave_direct 0.0.15
Using childprocess 0.9.0
Using chronic 0.10.2
Using climate_control 0.1.0
Using cocaine 0.5.8
Using coderay 1.1.0
Using coffee-script-source 1.12.2
Using execjs 2.5.2
Using coffee-script 2.4.1
Using css_parser 1.6.0
Using daemons 1.2.4
Using database_cleaner 1.4.1
Using delayed_job 4.1.2
Using delayed_job_active_record 4.1.1
Using orm_adapter 0.5.0
Using railties 4.2.1
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.4.1
Using devise-async 0.10.1 from https://github.com/klacointe/devise-async (at devise4@f7a34c3)
Using diff-lcs 1.2.5
Using docile 1.1.5
Using unf_ext 0.0.7.1
Using unf 0.1.4
Using domain_name 0.5.24
Using enum_help 0.0.14
Using exception_notification 4.2.1
Using factory_girl 4.5.0
Using factory_girl_rails 4.5.0
Using font-awesome-rails 4.7.0.4
Using jwt 1.5.1
Using little-plugger 1.1.4
Using logging 2.1.0
Using memoist 0.14.0
Using os 0.9.6
Using signet 0.7.2
Using googleauth 0.5.1
Using launchy 2.4.3
Using retriable 1.4.1
Using google-api-client 0.8.6
Using oauth 0.5.1
Using multi_xml 0.5.5
Using oauth2 1.1.0
Using google_drive 1.0.6
Using listen 3.1.1
Using lumberjack 1.0.11
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.1
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.1
Using guard 2.14.1
Using guard-compat 1.2.1
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using guard-rspec 4.7.3
Using temple 0.8.0
Using tilt 2.0.8
Using haml 5.0.1
Using high_voltage 3.0.0
Using htmlentities 4.3.4
Using http-cookie 1.0.2
Using icalendar 2.3.0
Using interactor 3.1.0
Using intercom-rails 0.3.5
Using jbuilder 2.2.13
Using jquery-fileupload-rails 0.4.5
Using jquery-rails 4.0.3
Using jquery-infinite-pages 0.2.0
Using kaminari-core 1.0.1
Using kaminari-actionview 1.0.1
Using kaminari-activerecord 1.0.1
Using kaminari 1.0.1
Using letter_opener 1.3.0
Using mimemagic 0.3.2
Using subexec 0.2.3
Using mini_magick 3.7.0
Using sixarm_ruby_unaccent 1.1.1
Using money 6.8.2
Using monetize 1.6.0
Using money-rails 1.8.0
Using netrc 0.10.3
Using paperclip 5.1.0
Fetching pg 0.19.0
Installing pg 0.19.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/rails/.rvm/gems/ruby-2.2.2@epic-invite/gems/pg-0.19.0/ext
/home/rails/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20190301-25677-6k9l3v.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for
building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for
building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/home/rails/.rvm/rubies/ruby-2.2.2/bin/$(RUBY_BASE_NAME)
	--with-pg
	--without-pg
	--enable-windows-cross
	--disable-windows-cross
	--with-pg-config
	--without-pg-config
	--with-pg_config
	--without-pg_config
	--with-pg-dir
	--without-pg-dir
	--with-pg-include
	--without-pg-include=${pg-dir}/include
	--with-pg-lib
	--without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/rails/.rvm/gems/ruby-2.2.2@epic-invite/extensions/x86_64-linux/2.2.0/pg-0.19.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/rails/.rvm/gems/ruby-2.2.2@epic-invite/gems/pg-0.19.0 for
inspection.
Results logged to
/home/rails/.rvm/gems/ruby-2.2.2@epic-invite/extensions/x86_64-linux/2.2.0/pg-0.19.0/gem_make.out

An error occurred while installing pg (0.19.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.19.0' --source 'https://rubygems.org/'` succeeds before bundling.

https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem":https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem

rails@li517-27:/var/www/mini-epic/current$ sudo apt-get install libpq-dev
[sudo] password for rails: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  nginx-full
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-7
Suggested packages:
  doc-base krb5-doc krb5-user postgresql-doc-9.4
The following NEW packages will be installed:
  comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-7 libpq-dev
0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
Need to get 658 kB of archives.
After this operation, 2,552 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.linode.com/debian/ jessie/main libgssrpc4 amd64 1.12.1+dfsg-19+deb8u4 [86.5 kB]
Get:2 http://mirrors.linode.com/debian/ jessie/main libkadm5clnt-mit9 amd64 1.12.1+dfsg-19+deb8u4 [68.8 kB]
Get:3 http://mirrors.linode.com/debian/ jessie/main libkdb5-7 amd64 1.12.1+dfsg-19+deb8u4 [68.9 kB]
Get:4 http://mirrors.linode.com/debian/ jessie/main libkadm5srv-mit9 amd64 1.12.1+dfsg-19+deb8u4 [83.4 kB]
Get:5 http://mirrors.linode.com/debian/ jessie/main comerr-dev amd64 2.1-1.42.12-2+b1 [38.3 kB]
Get:6 http://mirrors.linode.com/debian/ jessie/main krb5-multidev amd64 1.12.1+dfsg-19+deb8u4 [145 kB]
Get:7 http://mirrors.linode.com/debian/ jessie/main libpq-dev amd64 9.4.18-0+deb8u1 [167 kB]
Fetched 658 kB in 0s (2,449 kB/s)
Selecting previously unselected package libgssrpc4:amd64.
(Reading database ... 45080 files and directories currently installed.)
Preparing to unpack .../libgssrpc4_1.12.1+dfsg-19+deb8u4_amd64.deb ...
Unpacking libgssrpc4:amd64 (1.12.1+dfsg-19+deb8u4) ...
Selecting previously unselected package libkadm5clnt-mit9:amd64.
Preparing to unpack .../libkadm5clnt-mit9_1.12.1+dfsg-19+deb8u4_amd64.deb ...
Unpacking libkadm5clnt-mit9:amd64 (1.12.1+dfsg-19+deb8u4) ...
Selecting previously unselected package libkdb5-7:amd64.
Preparing to unpack .../libkdb5-7_1.12.1+dfsg-19+deb8u4_amd64.deb ...
Unpacking libkdb5-7:amd64 (1.12.1+dfsg-19+deb8u4) ...
Selecting previously unselected package libkadm5srv-mit9:amd64.
Preparing to unpack .../libkadm5srv-mit9_1.12.1+dfsg-19+deb8u4_amd64.deb ...
Unpacking libkadm5srv-mit9:amd64 (1.12.1+dfsg-19+deb8u4) ...
Selecting previously unselected package comerr-dev.
Preparing to unpack .../comerr-dev_2.1-1.42.12-2+b1_amd64.deb ...
Unpacking comerr-dev (2.1-1.42.12-2+b1) ...
Selecting previously unselected package krb5-multidev.
Preparing to unpack .../krb5-multidev_1.12.1+dfsg-19+deb8u4_amd64.deb ...
Unpacking krb5-multidev (1.12.1+dfsg-19+deb8u4) ...
Selecting previously unselected package libpq-dev.
Preparing to unpack .../libpq-dev_9.4.18-0+deb8u1_amd64.deb ...
Unpacking libpq-dev (9.4.18-0+deb8u1) ...
Processing triggers for install-info (5.2.0.dfsg.1-6) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libgssrpc4:amd64 (1.12.1+dfsg-19+deb8u4) ...
Setting up libkadm5clnt-mit9:amd64 (1.12.1+dfsg-19+deb8u4) ...
Setting up libkdb5-7:amd64 (1.12.1+dfsg-19+deb8u4) ...
Setting up libkadm5srv-mit9:amd64 (1.12.1+dfsg-19+deb8u4) ...
Setting up comerr-dev (2.1-1.42.12-2+b1) ...
Setting up krb5-multidev (1.12.1+dfsg-19+deb8u4) ...
Setting up libpq-dev (9.4.18-0+deb8u1) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
rails@li517-27:/var/www/mini-epic/current$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake 10.5.0
Using CFPropertyList 2.3.1
Using concurrent-ruby 1.1.3
Using aasm 4.12.0
Using i18n 0.8.6
Using json 1.8.6
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.1
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.5
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 4.2.1
Using rack 1.6.11
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.4.1
Using activejob 4.2.1
Using mime-types 2.99.3
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.4
Using activerecord 4.2.1
Using addressable 2.3.8
Using extlib 0.9.16
Using multi_json 1.11.0
Using autoparse 0.3.3
Using json_pure 1.8.3
Using jmespath 1.2.4
Using aws-sdk-core 2.3.18
Using aws-sdk-resources 2.3.18
Using aws-sdk 2.3.18
Using xml-simple 1.1.5
Using aws-ses 0.6.0
Using multipart-post 2.0.0
Using faraday 0.9.2
Using ffi 1.9.18
Using ethon 0.10.1
Using typhoeus 1.3.0
Using aychttp 0.1.0 from https://github.com/braindeaf/aychttp (at master@8b14ea4)
Using bcrypt 3.1.7
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using rb-fsevent 0.9.8
Using rb-inotify 0.9.8
Using sass-listen 4.0.0
Using sass 3.7.2
Using thor 0.20.3
Using bourbon 3.2.4
Using browser 2.2.0
Using bugsnag 4.0.0
Using bundler 1.16.6
Using cancancan 1.9.1
Using highline 1.7.2
Using net-ssh 2.9.2
Using net-scp 1.2.1
Using net-sftp 2.1.2
Using net-ssh-gateway 1.2.0
Using capistrano 2.15.5
Using xpath 2.0.0
Using capybara 2.10.1
Using carrierwave 0.10.0
Using excon 0.45.3
Using formatador 0.2.5
Using fog-core 1.30.0
Using fog-xml 0.1.2
Using fog-atmos 0.1.0
Using fog-json 1.0.1
Using ipaddress 0.8.0
Using fog-aws 0.3.0
Using inflecto 0.0.2
Using fog-brightbox 0.7.1
Using fog-ecloud 0.1.1
Using fog-google 0.0.5
Using fog-local 0.2.1
Using fog-powerdns 0.1.1
Using fog-profitbricks 0.0.2
Using fog-radosgw 0.0.4
Using fog-riakcs 0.1.0
Using fog-sakuracloud 1.0.1
Using fog-serverlove 0.1.2
Using fog-softlayer 0.4.6
Using fog-storm_on_demand 0.1.1
Using fog-terremark 0.1.0
Using fission 0.5.0
Using fog-vmfusion 0.1.0
Using fog-voxel 0.1.0
Using fog 1.30.0
Using uuidtools 2.1.5
Using carrierwave_direct 0.0.15
Using childprocess 0.9.0
Using chronic 0.10.2
Using climate_control 0.1.0
Using cocaine 0.5.8
Using coderay 1.1.0
Using coffee-script-source 1.12.2
Using execjs 2.5.2
Using coffee-script 2.4.1
Using css_parser 1.6.0
Using daemons 1.2.4
Using database_cleaner 1.4.1
Using delayed_job 4.1.2
Using delayed_job_active_record 4.1.1
Using orm_adapter 0.5.0
Using railties 4.2.1
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.4.1
Using devise-async 0.10.1 from https://github.com/klacointe/devise-async (at devise4@f7a34c3)
Using diff-lcs 1.2.5
Using docile 1.1.5
Using unf_ext 0.0.7.1
Using unf 0.1.4
Using domain_name 0.5.24
Using enum_help 0.0.14
Using exception_notification 4.2.1
Using factory_girl 4.5.0
Using factory_girl_rails 4.5.0
Using font-awesome-rails 4.7.0.4
Using jwt 1.5.1
Using little-plugger 1.1.4
Using logging 2.1.0
Using memoist 0.14.0
Using os 0.9.6
Using signet 0.7.2
Using googleauth 0.5.1
Using launchy 2.4.3
Using retriable 1.4.1
Using google-api-client 0.8.6
Using oauth 0.5.1
Using multi_xml 0.5.5
Using oauth2 1.1.0
Using google_drive 1.0.6
Using listen 3.1.1
Using lumberjack 1.0.11
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.1
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.1
Using guard 2.14.1
Using guard-compat 1.2.1
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using guard-rspec 4.7.3
Using temple 0.8.0
Using tilt 2.0.8
Using haml 5.0.1
Using high_voltage 3.0.0
Using htmlentities 4.3.4
Using http-cookie 1.0.2
Using icalendar 2.3.0
Using interactor 3.1.0
Using intercom-rails 0.3.5
Using jbuilder 2.2.13
Using jquery-fileupload-rails 0.4.5
Using jquery-rails 4.0.3
Using jquery-infinite-pages 0.2.0
Using kaminari-core 1.0.1
Using kaminari-actionview 1.0.1
Using kaminari-activerecord 1.0.1
Using kaminari 1.0.1
Using letter_opener 1.3.0
Using mimemagic 0.3.2
Using subexec 0.2.3
Using mini_magick 3.7.0
Using sixarm_ruby_unaccent 1.1.1
Using money 6.8.2
Using monetize 1.6.0
Using money-rails 1.8.0
Using netrc 0.10.3
Using paperclip 5.1.0
Fetching pg 0.19.0
Installing pg 0.19.0 with native extensions
Fetching postageapp 1.3.1
Installing postageapp 1.3.1
Fetching premailer 1.11.1
Installing premailer 1.11.1
Fetching premailer-rails 1.10.1
Installing premailer-rails 1.10.1
Fetching pry-rails 0.3.4
Installing pry-rails 0.3.4
Fetching puma 3.6.0
Installing puma 3.6.0 with native extensions
Fetching quiet_assets 1.1.0
Installing quiet_assets 1.1.0
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Fetching rails 4.2.1
Installing rails 4.2.1
Using rdoc 4.2.0
Fetching remotipart 1.2.1
Installing remotipart 1.2.1
Fetching rest-client 1.8.0
Installing rest-client 1.8.0
Fetching rspec-rails 3.2.1
Installing rspec-rails 3.2.1
Fetching rubyzip 1.2.2
Installing rubyzip 1.2.2
Fetching sass-rails 5.0.7
Installing sass-rails 5.0.7
Fetching sdoc 0.4.1
Installing sdoc 0.4.1
Fetching selenium-webdriver 3.141.0
Installing selenium-webdriver 3.141.0
Fetching shoulda-matchers 2.8.0
Installing shoulda-matchers 2.8.0
Fetching simple_form 3.1.1
Installing simple_form 3.1.1
Fetching simplecov-html 0.10.0
Installing simplecov-html 0.10.0
Fetching simplecov 0.10.0
Installing simplecov 0.10.0
Fetching sitemap_generator 5.1.0
Installing sitemap_generator 5.1.0
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Using stripe 1.21.0 from https://github.com/stripe/stripe-ruby (at master@8ba1a0e)
Fetching time_splitter 1.1.0
Installing time_splitter 1.1.0
Fetching timecop 0.7.3
Installing timecop 0.7.3
Fetching uglifier 2.7.1
Installing uglifier 2.7.1
Fetching valid_email 0.0.11
Installing valid_email 0.0.11
Using wck 0.0.5 from source at `vendor/gems/wck-0.0.5`
Fetching whenever 0.9.4
Installing whenever 0.9.4
Fetching zencoder 2.5.1
Installing zencoder 2.5.1
Bundle complete! 67 Gemfile dependencies, 216 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from sitemap_generator:
NOTE: SitemapGenerator 4.x uses a new file naming scheme which is more standards-compliant.
If you're upgrading from 3.x, please see the release note in the README:

https://github.com/kjvarga/sitemap_generator#important-changes-in-version-4

The simple answer is that your index file is now called sitemap.xml.gz
and not sitemap_index.xml.gz, but please take a look and see what else has changed.

npm start hangs on React Native boilerplate Expo app.

Followed all the documentation to get this booted

Looking for JS files in
   /Users/cex/repos/GamingVideos 

Loading dependency graph, done.

It just hangs… This is apparently no that uncommon https://github.com/facebook/react-native/issues/25650 One suggestion is that node >= 12.5 has memory issues and that downgrading can help. I’m one of those people that tries to push the latest version of everthing and if you’ve ever dealt with huge amounts of legacy dependencies in Rails apps with lots of gem you’d probably agree this is mostly sane.

Not sure how you downgrade using Brew https://medium.com/@georgeenathomas/3-step-process-to-downgrade-node-version-using-homebrew-bc0b0a72ae27

New-MacBook-Pro:GamingVideos cex$ brew search node
==> Formulae
leafnode            node ✔              node@12             nodebrew
libbitcoin-node     node-build          node@8              nodeenv
llnode              node@10             node_exporter       nodenv

==> Casks
nodebox                    nodeclipse                 soundnode

If you meant "node" specifically:
true

Seems like I have version 12 installed.

New-MacBook-Pro:GamingVideos cex$ brew unlink node
Unlinking /usr/local/Cellar/node/13.1.0... 7 symlinks removed
New-MacBook-Pro:GamingVideos cex$ brew link node@12
Error: No such keg: /usr/local/Cellar/node@12

Well perhaps not…

New-MacBook-Pro:GamingVideos cex$ brew install node@12
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
bit                 ruby-build          swiftformat         vte3
gjs                 stellar-core        v8

==> Downloading https://homebrew.bintray.com/bottles/node@12-12.13.1.mojave.bott
==> Downloading from https://akamai.bintray.com/70/7080b09d842a2c05d7b61c2ac121f
######################################################################## 100.0%
==> Pouring node@12-12.13.1.mojave.bottle.tar.gz
==> Caveats
node@12 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have node@12 first in your PATH run:
  echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile

For compilers to find node@12 you may need to set:
  export LDFLAGS="-L/usr/local/opt/node@12/lib"
  export CPPFLAGS="-I/usr/local/opt/node@12/include"

==> Summary
  /usr/local/Cellar/node@12/12.13.1: 4,225 files, 52.8MB

Now to relink it

New-MacBook-Pro:GamingVideos cex$ brew link node@12
Warning: node@12 is keg-only and must be linked with --force

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile
New-MacBook-Pro:GamingVideos cex$ brew link node@12 --force
Linking /usr/local/Cellar/node@12/12.13.1... 
Error: Could not symlink bin/npm
Target /usr/local/bin/npm
already exists. You may want to remove it:
  rm '/usr/local/bin/npm'

To force the link and overwrite all conflicting files:
  brew link --overwrite node@12

To list all files that would be deleted:
  brew link --overwrite --dry-run node@12

I’ve got to wing it here because I don’t know what is going to happen.

New-MacBook-Pro:GamingVideos cex$ brew link --overwrite node@12 --force
Linking /usr/local/Cellar/node@12/12.13.1... 3744 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile
New-MacBook-Pro:GamingVideos cex$ node -v
v12.13.1

Looks like it’s done something right…. ok same damn thing. I am now going to nuke the project re-install everything and hopefully this time…

npm install -g expo-cli
expo init GamingVideos
cd GamingVideos
yarn android

Yeah….um…no.

New-MacBook-Pro:GamingVideos cex$ yarn android
yarn run v1.19.2
$ react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip

Exception in thread "main" javax.net.ssl.SSLException: Received fatal alert: protocol_version

Ok forget it. No React Native for me today.

Update: After incidentally upgrading to the latest MacOSX, the error message changes

<New-MacBook-Pro:GamingVideos cex$ yarn android
yarn run v1.19.2
$ react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)…
No Java runtime present, requesting install.
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with —verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Ok, now I need to install a Java Runtime, there was clearly one here before but hey, if that solves it…

https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html

New-MacBook-Pro:GamingVideos cex$ yarn android
yarn run v1.19.2
$ react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip
...............................................................................................................
Unzipping /Users/cex/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1-all.zip to /Users/cex/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd
Set executable permissions for: /Users/cex/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1/bin/gradle

Welcome to Gradle 4.10.1!

Here are the highlights of this release:
 - Incremental Java compilation by default
 - Periodic Gradle caches cleanup
 - Gradle Kotlin DSL 1.0-RC6
 - Nested included builds
 - SNAPSHOT plugin versions in the `plugins {}` block

For more details see https://docs.gradle.org/4.10.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
cache fileHashes.bin (/Users/cex/repos/GamingVideos/android/.gradle/4.10.1/fileHashes/fileHashes.bin) is corrupt. Discarding.

> Configure project :app

Installing unimodules:
 unimodules-core@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/@unimodules/core
 unimodules-react-native-adapter@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/@unimodules/react-native-adapter
 expo-app-loader-provider@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-app-loader-provider
 expo-constants@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-constants
 expo-file-system@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-file-system
 expo-font@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-font
 expo-keep-awake@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-keep-awake
 expo-linear-gradient@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-linear-gradient
 expo-location@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-location
 expo-permissions@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-permissions
 expo-sqlite@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-sqlite
 expo-web-browser@7.0.1 from /Users/cex/repos/GamingVideos/node_modules/expo-web-browser
 unimodules-barcode-scanner-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-barcode-scanner-interface
 unimodules-camera-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-camera-interface
 unimodules-constants-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-constants-interface
 unimodules-face-detector-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-face-detector-interface
 unimodules-file-system-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-file-system-interface
 unimodules-font-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-font-interface
 unimodules-image-loader-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-image-loader-interface
 unimodules-permissions-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-permissions-interface
 unimodules-sensors-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-sensors-interface
 unimodules-task-manager-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-task-manager-interface

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 45s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Maybe this can help.

https://stackoverflow.com/questions/32634352/react-native-android-build-failed-sdk-location-not-found

Ok, followed that, now getting a error to do with missing licences. I couldn’t see a way on forcing licences to install. and checking in Android Studio I can see that Android 10.0 (Q) was installed. I selected Android 9.0 (Pie) just to see if it forced me to click yes on a licence agreement.

It didn’t but now yarn android on my project is doing something more.

Checking the license for package Android SDK Build-Tools 28.0.3 in /Users/cex/Library/Android/sdk/licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
Installing Android SDK Build-Tools 28.0.3 in /Users/cex/Library/Android/sdk/build-tools/28.0.3
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.

But then…

> Task :app:installDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

Ok, so let’s start again on a different machine…and this is not making me happy. Documentation also says you can use npm start or expo start

Ok, so it was hanging because it needed permissions. Works. There was other wise nothing wrong at all. I love technology, it makes me happy.

Deploying application that includes Fog

I’ve deployed this app so many times and this time we’re missing libxml2

/home/rails/.rvm/rubies/ruby-2.3.0/bin/ruby -r
./siteconf20191124-17839-153ycdh.rb extconf.rb
checking for xml2-config... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/home/rails/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
	--with-libxml2-config
	--without-libxml2-config
	--with-pkg-config
	--without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)

I’m not sure why this has happened now but.

sudo apt-get install libxml2-dev

And now libcurl is missing.

/home/rails/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20191124-680-1dnvkzc.rb
extconf.rb
checking for xml2-config... yes
checking for curl-config... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/home/rails/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
	--with-libcurl-config
	--without-libcurl-config
	--with-pkg-config
	--without-pkg-config
extconf.rb:40:in `<main>': The "libcurl" package isn't available. (RuntimeError)

Not quite as simple a library to install apparently Ubuntu has got three different flavours. https://packages.ubuntu.com/bionic/libcurl-dev

sudo apt-get install libcurl4-openssl-dev

Deploying now…

I'm not angry but...

I spent much of yesterday trying to Paperclip working with some S3 extensions that I’ve used in countless projects and it just didn’t work. If you’re interested, well, here’s a slice of it.

module Paperclip
  module Storage
    S3.prepend(Module.new do
      def url(style_name = default_style, options = {})
        with_environment { super }
      end

      def expiring_url(time = 3600, style_name = default_style)
        with_environment { super }
      end
    end)
  end

  module Storage
    module S3
      def download_url(time = 3600, style_name = default_style)
        with_content_disposition("attachment; filename=#{instance_read(:file_name).without_extended_characters}") do
          expiring_url(time, style_name)
        end
      end

      def inline_url(time = 3600, style_name = default_style)
        with_content_disposition('inline') do
          expiring_url(time, style_name)
        end
      end

      private def with_content_disposition(disposition)
        @options[:s3_url_options] ||= {}
        @options[:s3_url_options][:response_content_disposition] = "attachment; filename=#{instance_read(:file_name).without_extended_characters}"
        yield
      ensure
        @options[:s3_url_options].delete(:response_content_disposition)
        @options.delete(:s3_url_options) if @options[:s3_url_options].empty?
      end

      # overrides s3 credentials to serve production assets when in
      # staging or development
      private def with_environment
        # only override if dev or staging
        return yield unless Rails.env.development? || Rails.env.staging?
        # only override if updated in the last day
        return yield if (instance_read(:updated_at) || 2.days.ago) > 1.day.ago

        begin
          @s3_interface = nil
          @bucket = nil
          @s3_bucket = nil
          @s3_credentials = parse_credentials(Settings.get(:s3, 'production-readonly')[:s3_credentials])

          yield
        ensure
          @s3_interface = nil
          @bucket = nil
          @s3_bucket = nil
          @s3_credentials = parse_credentials(Settings.get(:s3)[:s3_credentials])
        end
      end
    end
  end
end

With Settings to extract settings and cope with overriding different environments. Say, to display production images in development using the above. I’ve found it very useful.

module Settings
  def self.get(name, environment = Rails.env.to_s)
    fetch("#{name}.yml")[environment]
  end

  def self.fetch(config)
    yaml = paths(config).inject([]) do |yamls, path|
      yamls << IO.read(path)
    rescue Errno::ENOENT
      yamls
    end.reject(&:blank?).join("\n")

    if Rails.env.production? && yaml.include?('&defaults') && !yaml.include?("production:\n")
      yaml += "\nproduction:\n  <<: *defaults"
    end

    YAML.load(ERB.new(yaml).result)
  end

  def self.paths(config)
    [
      Rails.root.join('config', 'settings', config), # repo
      File.join(ENV['HOME'], application, 'shared', 'settings', config), # server
      File.join(ENV['HOME'], '.settings', application, config) # local
    ]
  end

  def self.application
    Rails.application.class.name.split('::')[0].underscore
  end
end

Except for yesterday when I forgot or didn’t realise that the storage option in Paperclip needs to be a symbol. If it’s a string it gets ignored.

def self.get(name, environment = Rails.env.to_s)
    fetch("#{name}.yml")[environment].deep_symbolize_keys # <---- hours wasted
  end

And finally the methods that extend Attachment::Storage::S3 don’t appear because it defaults to :filesystem unless you supply :s3 as a symbol. Ok, finally I am there… No.

AWS::S3::Errors::AccessDenied Access Denied

But I’ve added the Bucket Policy to use my IAM user, and set the correct permissions. I know this because I compared it to another policy I set up a week prior.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::1234567890:user/username"
            },
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketPolicy",
                "s3:PutBucketPolicy"
            ],
            "Resource": "arn:aws:s3:::bucketname"
        },
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::1234567890:user/username"
            },
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::bucketname/*"
        }
    ]
}

Files didn’t upload at all. S3 credentials are correct. But still the same error. As then as it turns out, S3 buckets can be on this occasion was set to Bucket and Objects not public. So eventually I realise that the Paperclip upload default is :public and if I am trying to do that then I get AWS::S3::Errors::AccessDenied Access Denied sigh

defaults: &defaults
  storage: :s3
  bucket: bucket
  s3_protocol: :https
  s3_permissions: :private
  s3_credentials:
    access_key_id: accesskey
    secret_access_key: secretaccesskey
    s3_region: us-east-1

development:
  <<: *defaults

production:
  <<: *defaults
  bucket: bucket

So finally…at 2am. This is where we are. I enjoy the chase, I also enjoy sleep.

We need a name for our new board game

We painstakingly put together this prototype in just under 10 mins.

Ruby 1.8.7 and Rails 1.2

We have recently been looking at hiring so I created a stupid question just to get a developer talking. When I first started working with Rails we were building Euro-reg.com with Ruby 1.8.6 and Rails 1.2.3 as far as I can recall. So the question ended up being…

Suppose we hired you and on day one said we have this Rails 1.2 Application on Ruby 1.8.7, using SQLite in production that is mission critical. How would you approach bringing it up to date?

Some feedback we got was “…Rails v1.0—2.1 are incompatible with Ruby v1.8.7…” which made me question my stupid question. Actually it’s been so long I can’t even remember. So 10 minutes later.

The flow was

  • install 1.8.7 under rvm
  • this installs Rubygems 2.0, so you need to revert that to 1.8
  • edit config/boot.rb and replace require_gem with gem

That was nicely quick, I guess it could have been horrible.

Want to find files with exactly the right size

Have you ever come across some files in your application that just appear to be generated by err…..a generator and actually do nothing. Well I find a couple of javascript files with the same content (and therefore the same size) and wondered if there were any more.

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

Well fortunately you can use find with a specific option

Robs-MBP:blah rl$ find app/assets/ -size 229c
app/assets//javascripts/some.js.coffee

Excellent, I can ditch that file too then.

HAML whitespace

I came across a weird HAML syntax in a client codebase that I was just confused about.

Haml::Engine.new(%q{
- title = '1'
.title== #{title}<br/>
}).to_html
=> <div class='title'>1<br/></div>

I found an alternative syntax, I am not sure I like it but it’s certainly better than the above.

Haml::Engine.new(%q{
- title = '1'
.title<
 #{title}
 %br>
}).to_html
=> <div class='title'>1<br></div>

Basically you can kill whitespace with < >

Bundle deprecations

If you want to search your bundle for anything in particular, in this case the deprecated Digest::Digest syntax

New-MacBook-Pro:that cex$ bundle show --paths | xargs grep -r Digest::Digest
/Users/cex/.rvm/gems/ruby-2.2.10@that/gems/aws-sdk-1.6.4/lib/aws/core/signer.rb:        OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new(digest), key, value)
/Users/cex/.rvm/gems/ruby-2.2.10@that/gems/fog-1.4.0/lib/fog/core/hmac.rb:      @digest = OpenSSL::Digest::Digest.new('sha1')
/Users/cex/.rvm/gems/ruby-2.2.10@that/gems/fog-1.4.0/lib/fog/core/hmac.rb:        @digest = OpenSSL::Digest::Digest.new('sha256')
/Users/cex/.rvm/gems/ruby-2.2.10@that/gems/fog-1.4.0/lib/fog/cloudstack.rb:    @@digest  = OpenSSL::Digest::Digest.new('sha1')
Binary file /Users/cex/.rvm/gems/ruby-2.2.10@that/gems/pry-doc-0.4.6/lib/pry-doc/core_docs_20/objects/root.dat matches
Binary file /Users/cex/.rvm/gems/ruby-2.2.10@that/gems/pry-doc-0.4.6/lib/pry-doc/core_docs_20/object_types matches
Binary file /Users/cex/.rvm/gems/ruby-2.2.10@that/gems/pry-doc-0.4.6/lib/pry-doc/core_docs_19/objects/root.dat matches
Binary file /Users/cex/.rvm/gems/ruby-2.2.10@that/gems/pry-doc-0.4.6/lib/pry-doc/core_docs_19/object_types matches
GPK of the Day Charred CHAD