Skip to content

Instantly share code, notes, and snippets.

View kristianmandrup's full-sized avatar

Kristian Mandrup kristianmandrup

  • Freelancer
  • Copenhagen
View GitHub Profile
Example - Upgrade an old Rails 2 app to Rails 3 app.
---
Copy existing project (just in case!)
Use Rails template approach combined with Rails generators and a special Code refactoring library with Code refactoring operations.
- define different types of artifacts
- rails ruby file (*.rb)
- model file (app/models/**/*.rb)
- view file (app/views/**/*.rb)
- environment (config/environment.rb)
# So far using patches/suggestions by tmilker
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
ENV["RAILS_ENV"] ||= 'test'
Capybara is very framework agnostic, it's all built on pure Rack. Check out this file, which contains all the rails specific code in Capybara:
http://github.com/jnicklas/capybara/blob/master/lib/capybara/rails.rb
As you can see, it's not a lot. Some changes would be necessary to that file for Rails 3 support, I think, since the Rack app for Rails has changed.
/jonasn
--
require 'capybara/rails'
require 'capybara/cucumber'
require 'capybara/session'
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax.
Capybara.default_selector = :css
Create Rails 3 app
------------------------------
$ rails cucumber-rails3-demo
$ cd cucumber-rails3-demo
------------------------------
Use Rspec as testing framework
------------------------------
$ mate config/application.rb
---
TEMPLATES:
apps: &app-origins
- foreign $DIR # apps created by others
-
mine: &maturity
- github_forked $DIR # forked rails apps from github
maturity:
Use cases:
- See all rails applications
- See all ruby applications
- See all Gems apps
- See all My rails 2 apps
- See all rails apps forked from github
- See all developer screencasts
- See all ruby screencasts
- See all rails 3 screencasts
- See all binaries
YAML structure for a complete Application developement structure for a select set of languages and frameworks.
Can be easily be extended to support more languages and frameworks using the same patterns!
---
TEMPLATES:
frameworks-root: &frameworks-root
_tags:
category: &frameworks-root-categories
- games
Thor tasks to be created to support App Dev Management (ADM)
== List
Lists all matching entries
xxxx:list [arguments] [options]
apps:list --category [c1,c2] --platform [p1,p2] --runtype [r1,r2] --environment [e1,e2] --os --use --origin --maturity
gems:list --category [c1,c2] --rubyv --frameworks --use --origin --maturity
Texer::Operate DSL examples
---------------------------
Will be changed to use Ripper2Ruby API in progress for much more flexibility and power!
include 'finder'
txt = %q{
gem 'a' do |b|
a