Skip to content

Instantly share code, notes, and snippets.

> chruby system
> /opt/chef/bin/knife bootstrap ulises --sudo -x vagrant -P vagrant -N "target1" -p 3333
Bootstrapping Chef on ulises
ulises /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-log-1.4.1/lib/mixlib/log.rb:97:in `level=': Log level must be one of :debug, :info, :warn, :error, or :fatal (ArgumentError)
ulises from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.18.2/lib/chef/application.rb:119:in `configure_logging'
ulises from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.18.2/lib/chef/application/client.rb:239:in `configure_logging'
ulises from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.18.2/lib/chef/application.rb:65:in `reconfigure'
ulises from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.18.2/lib/chef/application/client.rb:194:in `reconfigure'
ulises from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.18.2/lib/chef/application.rb:70:in `run'
ulises from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.18.2/bin/chef-client:26:in `<top (required)>'
require 'virtus'
# This Works!
class User
include Virtus.model
attribute :name, String
attribute :group, String
end
# Class User trying to make private attributes
# unicorn
description "unicorn ruby app server"
start on (local-filesystems and net-device-up IFACE=lo and runlevel [2345])
stop on runlevel [!2345]
env WORKDIR=/data
env PIDFILE=/data/tmp/pids/unicorn.pid
env CFGFILE=/data/config/unicorn.rb
@fgarcia
fgarcia / git.cap
Created March 10, 2014 16:04 — forked from corny/git.cap
# Save this file as lib/capistrano/tasks/git.cap
namespace :git do
desc 'Copy repo to releases'
task create_release: :'git:update' do
on roles(:all) do
with fetch(:git_environmental_variables) do
within repo_path do
execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path
end
@fgarcia
fgarcia / gist:9854667
Created March 29, 2014 13:41
Padrino Helper Testing

There is great introduction here:

http://wikimatze.de/testing-helpers-in-padrino.html

However do not forget that helpers are a Sinatra feature, so you might want to search for "sinatra helper testing":

http://stackoverflow.com/a/8575684

Both links are the best way for your "spec/unit" tests. However once my own helpers evolve, I start depending on other helpers (Padrino::Helpers) and features/variables/extensions from my Padrino::Application.

Error detected while processing function <SNR>84_BufEnterHook..289:
line 13:
E806: using Float as a String
E15: Invalid expression: -1.0
line 15:
E121: Undefined variable: b:syntastic_signs_timestamp
E116: Invalid arguments for function 260
E15: Invalid expression: a:loclist.isNewer(b:syntastic_{type}_timestamp)
line 13:
E806: using Float as a String
@fgarcia
fgarcia / gist:c2e310d99e1fcb2f75f1
Last active August 29, 2015 14:05
Pademo Rough Edges

Current load_path defaults

Padrino.load! does a recursive require in the whole ./lib folder, but normally I expect gems to take care of their own loading with the './lib/my-gem' file. Sometimes some things are left out:

Here is a case where I had some problems to share some test code.

Gem generation

Padrino and Bundler have a different style of subgem generation. In Pademo there are subgems named with the 'pademo-' prefix. Generating 'pademo-hello' will be:

@fgarcia
fgarcia / gist:2cc553132a07a07914e0
Last active August 29, 2015 14:05
A good pipeline?
# What a normal pipeline must have
- Provide URL api 'http://.../assets/' to reach image / js / css files
- File transformation encoded in file name
style.css.sass
code.js.coffee
# Not so common features
@fgarcia
fgarcia / gist:f065a1ee83c83f887dbc
Last active August 29, 2015 14:05
Project idea

A Padrino layer having opinionated decisions about the configuration of a large Padrino app based on multiple gems.

Convention over configuration AND opinionated decissions... as long as it restricts only the workflow for configuration of a "large SOA" style project, not the architecture and/or gems of the apps.

Maybe it will be liberating having some layout/config conventions to quickly test some ideas. Later more research could be done about what is needed for Padrino to implement the same thing in a more generic way.

Some opinions:

  • reserve the '/assets' path
  • some "core" gem must exist when loading a gemified app
❯ curl http://127.0.0.1:3000
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body { text-align:center;font-family:helvetica,arial;font-size:22px;
color:#888;margin:20px}
#c {margin:0 auto;width:500px;text-align:left}
</style>