Stop patentom na oprogramowanie!

Posted in Uncategorized tagi on Marzec 30, 2010 by pr0d1r2

Nie dajmy sobie zrobić halo jak w stanach: http://petition.stopsoftwarepatents.eu/

Przydatny skrypt do robienia tar.bz2

Posted in Gentoo, Linux on Luty 5, 2009 by pr0d1r2

Jak masz więcej jak jeden procesor (rdzeń) to się przyda (pbzip2 znaczy parallel bzip2).

http://gist.github.com/58903

#!/bin/dash

# Hacknished by Pr0d1r2 (pr0d1r2@gmail.com)

# dont forget to:

# on Gentoo:  sudo emerge pbzip2

# on MacOSX:  sudo port install pbzip2

for DIR in $@

do

if [ -d $DIR ]; then

OUTPUT=`dirname $DIR`/`basename $DIR`.tar.bz2

echo „tar cf – $DIR | pbzip2 -c9 > $OUTPUT”

tar cf – $DIR | pbzip2 -c9 > $OUTPUT

ERR=$?

if [ $ERR -eq 0 ]; then

echo „pbzip2 -t $OUTPUT  # Testing consistency …”

pbzip2 -t $OUTPUT

ERR=$?

if [ $ERR -gt 0 ]; then

echo „FAILED … reverting to non-parallel bzip2″

echo „tar cf – $DIR | bzip2 -c9 > $OUTPUT”

tar cf – $DIR | bzip2 -c9 > $OUTPUT

ERR=$?

fi

fi

if [ $ERR -eq 0 ]; then

echo „OK”

case $0 in

*/tbz2d)

rm -rf $DIR

;;

*)

touch $OUTPUT.ok

;;

esac

else

echo „FAILURE (propably no space on device or interrupted) … removing bad file”

rm -f $OUTPUT

fi

fi

done

Jak masz Gentoo i nie masz co robić z czasem

Posted in Uncategorized on Grudzień 28, 2008 by pr0d1r2

Używa ktoś blipa i gentoo?

Behold mighty … gblip :)

http://bugs.gentoo.org/show_bug.cgi?id=252851

Do tego jest jeszcze potrzebna biblioteczka:

https://bugs.gentoo.org/show_bug.cgi?id=252847

Ebuildy powstały w ramach technologicznego chilloutu.

PS: naUbuntu paczki dostaniesz na stronie domowej projektu: http://gblip.pl

Mój pierwszy Gem

Posted in Gem, Ruby tagi , on Listopad 10, 2008 by pr0d1r2

W ramach weekendowej jatki technologicznej postanowiłem nauczyć się „pisać” gemy.

Używamy narządzionka – no przecież nie chce mi sie robić struktury katalogów samemu.
Pocytajcie sobie: http://newgem.rubyforge.org/
$ sudo gem install newgem

Jak zwykle coś musi nie działać:
$ newgem logrotate_filename -T rspec
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:578:in `report_activate_error’: Could not find RubyGem echoe (>= 0) (Gem::LoadError)

No to jak chce to mu damy:
$ sudo gem install echoe

Another dependency-hell:
$ newgem logrotate_filename -T rspec
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:578:in `report_activate_error’: Could not find RubyGem cucumber (>= 0.1.8) (Gem::LoadError)

No to jak chce to mu damy:
$ sudo gem install cucumber

Sukces:
$ newgem logrotate_filename -T rspec
create
create doc
create lib
create script
create tasks
create lib/logrotate_filename
create History.txt
create Rakefile
create README.rdoc
create PostInstall.txt
create lib/logrotate_filename.rb
dependency install_rspec
create spec
exists tasks
create spec/logrotate_filename_spec.rb
create spec/spec.opts
create spec/spec_helper.rb
create tasks/rspec.rake
dependency install_rubigen_scripts
exists script
create script/generate
create script/destroy
create script/console
create Manifest.txt
readme readme
Important
=========

* Open Rakefile
* Update missing details (gem description, dependent gems, etc.)

Edytujemy Rakefile żeby zmienić autora i ewentualne zależności:

newgem edycja rakefile

newgem edycja rakefile

$ RSPEC=true autotest
I mamy działający autotest

TROSZKE Develimy (ale tylko troszke :) )

troszke develimy

troszke develimy

# Opis dodawania nowego gema na github
mv README.rdoc README.txt
rake gemspec
mv README.txt ../
git init
mv ../README.txt .
git add `ls`
git commit -m „first_commit”
git remote add origin git@github.com:Pr0d1r2/logrotate_filename.git
git push origin master
Na stronce: https://github.com/Pr0d1r2/logrotate_filename/edit zaznaczamy, że to RubyGem :)

Polecam lekturę jak postępować z gemami z githuba: http://gems.github.com/
No i wogóle o gicie: http://github.com/guides/git-cheat-sheet

Tutaj znajdziecie tego gema: http://github.com/Pr0d1r2/logrotate_filename/tree/master

Żeby sobie zrobić tego mojego gema to:
$ sudo gem sources -a http://gems.github.com # to tylko raz
$ sudo gem install logrotate_filename

RubyMine czyli wypasione IDE na IntelliJ od JetBrains

Posted in Ruby on Rails tagi , , on Listopad 4, 2008 by pr0d1r2

Dostałem dziś w swoje ręce nowe IDE przeznaczone dla RoR. Jego możliwości są równie imponujące jak jego zasobożerność (i tak jak na aplikację Java całkiem nieźle).

Wersja „Public Preview” oznaczona jako build 435 posiada wiele miłych właściwości. Oto kilka tych, które przypadły mi do gustu:

- Szybkie otwieranie pliku widoku bezpośrednio z kontrolera

- ikonki WebPreview w widoku do różnych przeglądarek

- Szukanie stringów TODO w projekcie

Zapowiada się ciekawa aplikacja na 1 kwartał przyszłego roku. Odstraszać może cena (biorąc pod uwagę ceny innych produktów JetBrains).

Jeśli masz Gentoo i chcesz spróbować to proszę ebuild:

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit eutils

DESCRIPTION="JetBrains RubyMine — new Ruby and Rails IDE built on years proven IntelliJ platform."
HOMEPAGE="http://www.jetbrains.com/ruby/index.html#linux"
MY_SRC_NAME="rubymine${PV}"
MY_SRC_FILE="${MY_SRC_NAME}.tar.gz"
SRC_URI="http://download.jetbrains.com/idea/${MY_SRC_FILE}"

SLOT="0"
LICENSE="IntelliJ IDEA, FREE 30 DAY TRIAL"
KEYWORDS="~amd64 ~x86"

RDEPEND="=dev-java/sun-jdk-1.6.0*"

src_unpack() {
true
}

src_compile() {
true
}

src_install() {
dodir /opt
tar xvfz ${DISTDIR}/${MY_SRC_FILE} -C ${D}/opt/
dodir /usr/bin
echo "#!/bin/sh" > ${D}/usr/bin/rubymine
echo /opt/${MY_SRC_NAME}/bin/rubymine.sh >> ${D}/usr/bin/rubymine
chmod 755 ${D}/usr/bin/rubymine
make_desktop_entry /usr/bin/rubymine
}

pkg_postinst() {
true
}

Linki:

http://www.jetbrains.com/ruby/index.html#linux

Jak developić Typo z BDD część 3 (powrót BDD-Jedi)

Posted in Ruby on Rails tagi on Listopad 3, 2008 by pr0d1r2

Pokonane błędy w specach odnośnie XML-RPC
http://github.com/Pr0d1r2/typo/commit/160938ecda2a82e0979d8fbb680694ce6b0e9a18
$ autotest
503 examples, 4 failures

Dodane czyszczenie cache do ustawień w adminie.
Wywalone nieprzechodzące testy związane z flashami.
http://github.com/Pr0d1r2/typo/commit/bbc7803b325b5db7ff3bfeab4f4d7539f55b936b
$ autotest
501 examples, 0 failures

Niech rozpocznie się BDD-devel:

Bierzemy sobie ticket:

http://typosphere.org/issues/show/1278

Rozwiązujemy kwestię w oparciu o BDD:
http://github.com/Pr0d1r2/typo/commit/dc62e0840ab0ca2a8c00c2fc570e3b3fbd01e28f

Pozbądźmy się wrednych warningów przy testach:
http://github.com/Pr0d1r2/typo/commit/a7decd57b7a7dcdebf04ae25ed6e74584cd91723

Jeszcze jedna rzecz, którą trzeba zrobić:
http://github.com/Pr0d1r2/typo/commit/f1c77437ee1b77bb9d268bac2cb25d2c64dbc389

Jak developić Typo z BDD część 2 (saga się kontynuuje)

Posted in Ruby on Rails tagi on Październik 31, 2008 by pr0d1r2

cd typo

Startujemy:
$ autotest
503 examples, 49 failures

Brak plugina will_paginate:
ruby script/plugin install git://github.com/mislav/will_paginate.git –force

Zobacz najpierw pierwszy komentarz pod:
http://pr0d1r2.wordpress.com/2008/10/30/jak-developic-typo-z-bdd-czesc-1/
$ autotest
503 examples, 39 failures

Nieprawidłowy markdown ze względu na wymianę Markdown/Textile na Coderay i nieuwzględnienie tego w specach:
Więcej na temat Coderay w typo:
http://licenser.de/articles/2006/07/29/typo-coderay
http://nullcreations.net/entries/general/coderay-helper-for-rails
Tutaj proszę komicik:
http://github.com/Pr0d1r2/typo/commit/7be6bfd5d4d865ba1bbf39af3ea7a115a9c84158

$ autotest
503 examples, 35 failures

Pozostałości w testach po starych paginatach:
http://github.com/Pr0d1r2/typo/commit/b298c36049e0d90886ba219db81c8bab0ed189a3

$ autotest
503 examples, 34 failures

Mały problem z includowaniem modułu helpera:
http://github.com/Pr0d1r2/typo/commit/00b127facb2ac64b4ec717ded295ef998b39d10c

$ autotest
503 examples, 32 failures

Błędy w związku z xmlrpc:
TEN BUG MOŻE BYĆ POWIĄZANY Z TYM: http://typosphere.org/issues/show/229

Takie coś jest w logach od test:
Processing BackendController#api (for 0.0.0.0 at 2008-10-31 07:25:41) [POST]
Session ID:
Parameters: {„action”=>”api”}
Trigger Load (0.6ms)   SELECT * FROM `triggers` WHERE (due_at <= ’2008-10-31 07:25:41′)
Blog Load (0.8ms)   SELECT * FROM `blogs` ORDER BY id LIMIT 1

ActionWebService::Dispatcher::DispatcherError (Malformed SOAP or XML-RPC protocol message):
/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:71:in `new’
/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:71:in `dispatch_web_service_request’
/app/controllers/backend_controller.rb:19:in `api’
/vendor/rails/actionpack/lib/action_controller/base.rb:1213:in `send’
/vendor/rails/actionpack/lib/action_controller/base.rb:1213:in `perform_action_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `run_before_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:206:in `call’
/vendor/rails/actionpack/lib/action_controller/filters.rb:206:in `around_proc’
/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `call’
/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `evaluate_method’
/vendor/rails/actionpack/lib/action_controller/filters.rb:184:in `call’
/vendor/rails/actionpack/lib/action_controller/filters.rb:635:in `run_before_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:615:in `call_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
/vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in `perform_action_without_caching’
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action’
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:48:in `cache’
/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache’
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action’
/vendor/rails/actionpack/lib/action_controller/base.rb:533:in `send’
/vendor/rails/actionpack/lib/action_controller/base.rb:533:in `process_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support’
/vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in `process_without_test’
/vendor/rails/actionpack/lib/action_controller/test_process.rb:18:in `process’
/vendor/actionwebservice/lib/action_web_service/test_invoke.rb:25:in `invoke_layered’
./spec/controllers/backend_controller_spec.rb:93:in `test_blogger_fail_authentication’
/usr/lib/ruby/1.8/test/unit/assertions.rb:123:in `assert_raise’
/usr/lib/ruby/1.8/test/unit/assertions.rb:47:in `assert_block’
/usr/lib/ruby/1.8/test/unit/assertions.rb:500:in `_wrap_assertion’
/usr/lib/ruby/1.8/test/unit/assertions.rb:46:in `assert_block’
/usr/lib/ruby/1.8/test/unit/assertions.rb:121:in `assert_raise’
/usr/lib/ruby/1.8/test/unit/assertions.rb:495:in `_wrap_assertion’
/usr/lib/ruby/1.8/test/unit/assertions.rb:111:in `assert_raise’
./spec/controllers/backend_controller_spec.rb:93:in `test_blogger_fail_authentication’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:335:in `__send__’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:335:in `add_method_examples’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:81:in `instance_eval’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:81:in `eval_block’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:15:in `execute’
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:12:in `execute’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:245:in `execute_examples’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:244:in `each’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:244:in `execute_examples’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:141:in `run’
/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:22:in `run’
/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in `each’
/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in `run’
/vendor/plugins/rspec/lib/spec/runner/options.rb:115:in `run_examples’
/vendor/plugins/rspec/lib/spec.rb:21:in `run’
/vendor/plugins/rspec/lib/spec/runner.rb:191:in `register_at_exit_hook’
spec/models/route_cache_spec.rb:5

Completed in 32ms (View: 0, DB: 3) | 500 Internal Server Error [http://test.host/]

W jakiś sposób nie rozpoznaje on requestu więc zacznijmy wrzucać raise w miejscach gdzie moze być coś nie tak:

PLICZEK: vendor/actionwebservice/lib/action_web_service/protocol/discovery.rb


def discover_web_service_request(action_pack_request)
(self.class.read_inheritable_attribute("web_service_protocols") || []).each do |protocol|
protocol = protocol.create(self)
request = protocol.decode_action_pack_request(action_pack_request)
raise StandardError, "discover_web_service_request(#{action_pack_request}): request is nil" if request.nil? ## TO JEST DODANA LINIA
return request unless request.nil?
end
nil
end
# BŁAD NIE JEST TUTAJ


# NO TO SPRAWDZAMY DALEJ
def discover_web_service_request(action_pack_request)
raise StandardError, "action_pack_request: #{action_pack_request.inspect}"
(self.class.read_inheritable_attribute("web_service_protocols") || []).each do |protocol|
protocol = protocol.create(self)
request = protocol.decode_action_pack_request(action_pack_request)
return request unless request.nil?
end
nil
end

W logach od test dostaniemy coś takiego:

StandardError (action_pack_request: #<ActionController::TestRequest:0xb6674358 @_memoized_request_method=[:post], @env={„HTTP_CONTENT_TYPE”=>”text/xml”, „REMOTE_ADDR”=>”0.0.0.0″, „RAW_POST_DATA”=>”<?xml version=\”1.0\” ?><methodCall><methodName>blogger.deletePost</methodName><params><param><value><string>foo</string></value></param><param><value><i4>960711747</i4></value></param><param><value><string>tobi</string></value></param><param><value><string>whatever</string></value></param><param><value><i4>1</i4></value></param></params></methodCall>\n”, „SERVER_PORT”=>80, „REQUEST_METHOD”=>”POST”}, @query_parameters={}, @path_parameters={}, @parameters={„action”=>”api”}, @request_uri=”/”, @user_agent=”Rails Testing”, @request_parameters={„action”=>”api”}, @_memoized_remote_ip=["0.0.0.0"], @session_options=false, @symbolized_path_parameters=nil, @host=”test.host”, @cookies={}, @session=#<ActionController::TestSession:0xb66742a4 @session_id=”", @attributes={„flash”=>{}}, @saved_attributes=nil>>):
/vendor/actionwebservice/lib/action_web_service/protocol/discovery.rb:18:in `discover_web_service_request’
/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:49:in `dispatch_web_service_request’
/app/controllers/backend_controller.rb:19:in `api’
/vendor/rails/actionpack/lib/action_controller/base.rb:1213:in `send’
/vendor/rails/actionpack/lib/action_controller/base.rb:1213:in `perform_action_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `run_before_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:206:in `call’
/vendor/rails/actionpack/lib/action_controller/filters.rb:206:in `around_proc’
/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `call’
/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `evaluate_method’
/vendor/rails/actionpack/lib/action_controller/filters.rb:184:in `call’
/vendor/rails/actionpack/lib/action_controller/filters.rb:635:in `run_before_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:615:in `call_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
/vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in `perform_action_without_caching’
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action’
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:48:in `cache’
/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache’
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action’
/vendor/rails/actionpack/lib/action_controller/base.rb:533:in `send’
/vendor/rails/actionpack/lib/action_controller/base.rb:533:in `process_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support’
/vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in `process_without_test’
/vendor/rails/actionpack/lib/action_controller/test_process.rb:18:in `process’
/vendor/actionwebservice/lib/action_web_service/test_invoke.rb:25:in `invoke_layered’
./spec/controllers/backend_controller_spec.rb:25:in `test_blogger_delete_post’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:335:in `__send__’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:335:in `add_method_examples’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:81:in `instance_eval’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:81:in `eval_block’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:15:in `execute’
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout’
/vendor/plugins/rspec/lib/spec/example/example_methods.rb:12:in `execute’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:245:in `execute_examples’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:244:in `each’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:244:in `execute_examples’
/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:141:in `run’
/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:22:in `run’
/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in `each’
/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in `run’
/vendor/plugins/rspec/lib/spec/runner/options.rb:115:in `run_examples’
/vendor/plugins/rspec/lib/spec.rb:21:in `run’
/vendor/plugins/rspec/lib/spec/runner.rb:191:in `register_at_exit_hook’
spec/models/route_cache_spec.rb:5

Completed in 35ms (View: 6, DB: 45) | 500 Internal Server Error [http://test.host/]

Na razie impas w postaci:
$ autotest
503 examples, 32 failures

Do rozwiązania jeszcze problem z XML-RPC. Ale to najwcześniej w części 3.

Jak developić Typo z BDD część 1

Posted in Ruby on Rails tagi on Październik 30, 2008 by pr0d1r2

Ściągamy sobie:
git clone git://github.com/fdv/typo.git

Wstępne rzeczy:

cd typo
Konfigurujemy bazę w: config/database.yml

Zobacz tutaj na „patcha”, który jest niezbędny do zrobienia migracji:
http://github.com/Pr0d1r2/typo/commit/dcb97f4d0fe3a189e2cb9bf799484b90d5c91af9

sudo /etc/init.d/mysql start # na Gentoo
RAILS_ENV=test rake db:drop
RAILS_ENV=test rake db:create
RAILS_ENV=test rake db:migrate

Rails:
cd vendor
rm -rf rails
git clone git://github.com/rails/rails.git
cd ..

ActionWebService:
cd vendor
rm -rf actionwebservice/
git clone git://github.com/datanoise/actionwebservice.git
cd ..

RSpec i RSpec-Rails:
rm -rf vendor/plugins/rspec && ruby script/plugin install git://github.com/dchelimsky/rspec.git
rm -rf vendor/plugins/rspec-rails && ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git
Jeśli tego nie zrobisz to:
$ autotest
Wywali:
loading autotest/rails_rspec
Autotest style autotest/rails_rspec doesn’t seem to exist. Aborting.

Dobrym zwyczajem chcę odpalić testy zanim zacznę devel:
autotest

Tu narazie mam impas bo:
503 examples, 49 failures
Ale Jeszcze jest zabawa z wersjami gemów i rzeczy w vendorze (kochany OpenSource). Więc ciąg dalszy nastąpi.

BDD has U(Me)

Posted in Ruby on Rails tagi on Październik 24, 2008 by pr0d1r2
bdd-spec

Dzisiaj cały dzionek to walka z BDD. Doszedłem do stanu, w którym czuję, że warto pisać spec`e zanim napisze się kod.

Wedle filozofii zawartej w „Agile Rails Development” zaczynamy od widoku jedziemy poprzez kontroler aż do modelu. Ważne jest aby całkowicie odseparować od siebie poszczególne warstwy. Pozwala to uniknąć „głupich” błędów gdy coś nie jest tam gdzie powinno (np. w pluginie restful_authentication w widoku jest operacja na zmiennych instancyjnych (te z @) a przecież powinno to się znaleźć w kontrolerze. Do separacji używamy oczywiście mock`ów (wirtualnych objektów). Sam styl separowania zawarty w dokumentacji od rspec pozwola bardzo dokładnie wprowadzić w życie model MVC wraz z jego wszystkimi zaletami.

Specyfikacje dostosowujemy do naszej logiki biznesowej projektu tak by obejmowały kluczowe elementy aplikacji.

Przydatne linki:

http://www.lukeredpath.co.uk/2006/8/29/developing-a-rails-model-using-bdd-and-rspec-part-1

Hello world!

Posted in Uncategorized on Październik 24, 2008 by pr0d1r2

Witojcie :)

Niech zacznie się technologiczna jatka.

Follow

Otrzymuj każdy nowy wpis na swoją skrzynkę e-mail.