У меня проблемы с настройкой приложения с использованием Thin и Sinatra.Я создал файл development-config.ru, который содержит следующие настройки:
# This is a rack configuration file to fire up the Sinatra application.
# This allows better control and configuration as we are using the modular
# approach here for controlling our application.
#
# Extend the Ruby load path with the root of the API and the lib folder
# so that we can automatically include all our own custom classes. This makes
# the requiring of files a bit cleaner and easier to maintain.
# This is basically what rails does as well.
# We also store the root of the API in the ENV settings to ensure we have
# always access to the root of the API when building paths.
ENV['API_ROOT'] = File.dirname(__FILE__)
$:.unshift ENV['API_ROOT']
$:.unshift File.expand_path(File.join(ENV['API_ROOT'], 'lib'))
$:.unshift File.expand_path(File.join(ENV['API_ROOT'], 'db'))
# Now we can require all the gems used for the entire API by simpling requiring
# them here. We can also include the classes that we have defined inside the lib
# folder.
require 'rubygems'
require 'bundler'
# Run Bundler to setup our gems properly. This will install all the missing gems on
# the system and ensure that the deployment environment is ready to run.
Bundler.require
# To make the loading easier for the application, we will now automatically load all
# models that have been defined inside the lib folder. This ensures that we do not need
# to load them anymore anywhere else in our application, as the models will be known to
# ruby everywhere.
Dir.glob(File.join(ENV['API_ROOT'], 'lib', '**', '*.rb')).each{|file| require file}
# Now we will configure the Sinatra application so that we can fire up the entire API.
# This requires some detailed settings like whether logging is allowed, the port to be
# used and some folder locations.
require 'sinatra'
require 'app'
set :logging, true
set :dump_errors, true
set :port, 3001
set :views, "#{ENV['API_ROOT']}/views"
set :public_folder, "#{ENV['API_ROOT']}/public"
set :environment, :test
# Start up the Sinatra application with all the settings that we have defined.
run App.new
Это основано на информации, которую я нашел на веб-сайте Sinatra.Однако проблема в том, что я не могу заставить приложение работать на порте 3001. Если я использую thin start -R development-config.ru , оно работает на порте 3000. Если я использую rackup config-development.ru он работает через порт 9696. Однако я никогда не вижу, чтобы Sinatra запускал или работал через порт 3000.
Мое приложение выглядит так:
# Author : Arne De Herdt
# Email :
# This is the actuall application that will be running under Sinatra
# to serve the requests for the billing middleware API.
# We use the modular approach here to allow control when deploying
# the application using Capistrano.
require 'sinatra/base'
require 'logger'
require 'savon'
require 'billcrux'
class App < Sinatra::Base
# This action responds to POST requests on the URI '/billcrux/register'
# and is responsible for handeling registration requests with the
# BillCrux payment system.
# The
post "/billcrux/register" do
# do stuff
end
end
Может кто-нибудь сказать мнеЯ делаю не так?