Skip to content

Instantly share code, notes, and snippets.

@agenteo
agenteo / bue
Created Feb 11, 2015
BUE a bundle update enhancer for Rails component architectures
View bue
#!/bin/bash
# BUNDLE UPDATE ENHANCER
# Preconditions:
# all components must have a Gemfile
# all components must use RVM and have a .ruby-version and .ruby-gemset
if [ $# -eq 0 ]; then
echo "💔 No arguments supplied!"
echo "You must provide the name of the gem you want to update in your main app and all your components."
View bumpme
Wed Sep 28 22:21:18 UTC 2016
View test.sh
exit_code=0
echo ">>> Testing main app"
if [ -z "$(which bundle)" ]; then
gem install bundler
fi
bundle install | grep Installing
bundle exec rspec
exit_code+=$?
View build.sh
#!/bin/bash
# BEFORE RUNNING: remember to "cp .env-example .env" in order for the tests
# to pick up the required environment variables!
unset BUNDLE_GEMFILE
result=0
if [ "$CI" == "true" ]; then
BUNDLE_PATH="$HOME/vendor/bundle"
@agenteo
agenteo / gist:3779950
Created Sep 25, 2012
json-schema grouped specs
View gist:3779950
[
{
"description": "integer type",
"schema": {"type": "number", "maximum": 2012},
"tests": [
{
"description": "It should pass when number is less then maximum",
"data": 1981,
"valid": true
},
@agenteo
agenteo / gist:3779919
Created Sep 25, 2012
json-schema specs
View gist:3779919
[{
"description":"It should fail when number is greater then maximum.",
"schema":{
"type":"number",
"maximum":2012
},
"data":{
"dob": 2013
},
"valid": false
@agenteo
agenteo / route_extract.rb
Created Mar 7, 2011
Collects the first level of routes from a file containing the 'rake routes' output.
View route_extract.rb
require 'rubygems'
# Deletes standard route, standard route :format, root route
def delete_last_three_lines
3.times { @lines.delete_at(-1) } # TODO: change to .drop(3) when using Ruby 1.8.7
end
@paths = []
@lines = File.readlines('routes.txt')
@lines.delete_at(0)
View generate_display_name.rb
def generate_display_name
@display_name_candidate = generate_display_name_candidate
if Member.find_by_display_name(@display_name_candidate)
self.display_name = find_next_display_name_available
else
self.display_name = @display_name_candidate
end
return true
end
View .gitconfig
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
View gist:404489
arbon:cos enricoant$ gem install rack -v 1.0.1
/Users/enricoant/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:254: warning: getc is obsolete; use STDIN.getc instead
^CERROR: Interrupted
carbon:cos enricoant$ history | grep rack
135 gem list rack
139 gem install rack -v 1.0.1
145 gem install rack
146 history | grep rack
147 gem install rack -v 1.0.1
149 gem install rack -v 1.0.1