Пошто смо све припремили, хајде да напишемо програм! Отвори свој омиљени текст едитор и укуцај следеће:
puts 1+2Сачувај свој програм (да, то је програм!) као calc.rb (.rb
| Given /^I visit subdomain "(.+)"$/ do |sub| | |
| #host! "#{sub}.example.com" #for webrat | |
| Capybara.default_host = "#{sub}.example.com" #for Rack::Test | |
| Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity | |
| ################################################################################ | |
| # As far as I know, you have to put all the {sub}.example.com entries that you're | |
| # using in your /etc/hosts file for the Culerity tests. This didn't seem to be | |
| # required for Rack::Test | |
| ################################################################################ |
| #!/usr/bin/env ruby | |
| # quick and dirty way to generate a rails app | |
| my_gem_file =<<END | |
| group :development, :test do | |
| gem "rspec-rails" | |
| gem "capybara" | |
| gem "cucumber-rails" |
| <!-- layout file --> | |
| <% if current_user %> | |
| Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %> | |
| <% else %> | |
| <%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>. | |
| <% end %> |
| #!/usr/bin/env ruby | |
| # spit out a VCARD, stripping all the 'fluff' | |
| if ARGV.length == 0 | |
| puts "supply a file" | |
| exit 1 | |
| else | |
| file = ARGV[0] | |
| end |
| Warning (initialization): An error occurred while loading `/home/alex/.emacs.d/init.el': | |
| error: el-get: *git submodule update* Could not update git submodules | |
| To ensure normal operation, you should investigate and remove the | |
| cause of the error in your initialization file. Start Emacs with | |
| the `--debug-init' option to view a complete error backtrace. |
| Hi Steve, that didn't quite work for me for: | |
| ruby-1.9.2-p0 > | |
| prompt. | |
| So I did a bit of testing with the environments/versions of Ruby that I have available to me and I think this might be a better solution: | |
| "[[:alnum:]-\s.:\(\)]+\\(>\\{1,2\\}\\)\s" | |
| These are the environments I had available to me, might be useful to you along with 'regexp-builder' in Emacs to test. |
| rbx.platform.typedef.__int8_t = char | |
| rbx.platform.typedef.__uint8_t = uchar | |
| rbx.platform.typedef.__int16_t = short | |
| rbx.platform.typedef.__uint16_t = ushort | |
| rbx.platform.typedef.__int32_t = int | |
| rbx.platform.typedef.__uint32_t = uint | |
| rbx.platform.typedef.__int64_t = long_long | |
| rbx.platform.typedef.__uint64_t = ulong_long | |
| rbx.platform.typedef.__clock_t = ulong | |
| rbx.platform.typedef.__cpumask_t = uint |
| (cucumber | |
| "K" | |
| (("features/\\1\\.feature" . "features/step_definitions/\\1.rb") | |
| ("features/*.feature" . "features/step_definitions/*.rb") | |
| ;; .... some more matchers | |
| ) | |
| t) |
| ;; Instead of this | |
| (add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode)) | |