Skip to content

Instantly share code, notes, and snippets.

@jyr
jyr / path.md
Created July 11, 2012 00:28
professional path

The Professional Path

Overview

The path

  • Learn to use a software development tool about Source Code Management (git, mercurial, etc)
  • Build your development enviroment with vagrant ( could learn puppet or chef)
  • Create a new branch for the new feature
  • Write a feature (vim, Pair Programming) and Testing your feature (TDD or BDD)
@jyr
jyr / README.md
Created June 22, 2012 18:44
devops

First Steps

  1. Create image without puppet manifest, comment the next lines:
  Vagrant::Config.run do |config|
    config.vm.provision :puppet do |puppet|
      puppet.manifests_path = "./devops/manifests"
      puppet.module_path = "./devops/modules"
      puppet.manifest_file = "devops.pp"
 end
API::Application.routes.draw do
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
resources :packs, :except => [:new] do
resources :designs, :only => [:create]
end
end
end
mount Resque::Server, :at => "/resque"
When I send a POST request for "/api/v1/packs" with the values: # features/step_definitions/api_steps.rb:18
"""
pack_design_id=1&qty=100&buttons=1,2&address=ad1,ad2&button_type=pin
"""
undefined method `orders' for #<Item:0x000000058687d8> (NoMethodError)
./app/models/pack.rb:37:in `create_pack'
./app/models/pack.rb:20:in `record'
./app/controllers/api/v1/packs_controller.rb:12:in `create'
./features/step_definitions/api_steps.rb:19:in `/^I send a POST request for "(.*?)" with the values:$/'
features/v1/packs_descriptions.feature:16:in `When I send a POST request for "/api/v1/packs" with the values:'
class Appointment < ActiveRecord::Base
# - Relationships - #
belongs_to :doctor
belongs_to :patient
# - Validations - #
validates_presence_of :doctor_id
validates_presence_of :patient_id
end
class Pack < ActiveRecord::Base
attr_accessible :pack_design_id, :exec_callback
attr_accessor :exec_callback
has_one :pack_design
has_and_belongs_to_many :buttons
after_create :create_pack
after_save :update_pack
@api
Feature: Packs API service
In order to create a pack with a specific pack design and more stuff
As a API consumer
I want to provide a resource for interacting with packs
Scenario: Get packs by app
Given I send a GET request for "/api/v1/packs"
Then The response status code should be "200"
@jyr
jyr / .bash_profile
Created May 25, 2012 16:30
My bash profile
if [ -d $HOME/.rbenv ]; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
server {
listen 80;
server_name phpmyadmin.dev;
root /home/vagrant/project/phpmyadmin;
access_log /var/log/nginx/phpmyadmin.dev.access.log;
error_log /var/log/nginx/phpmyadmin.dev.error.log;
location / {
index index.html index.htm index.php;
location ~ .php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}