prepared stuff for easier deployment

This commit is contained in:
Edin Dazdarevic
2015-02-16 21:36:14 +01:00
parent d82274d1e1
commit 40f7f8512a
9 changed files with 61 additions and 12 deletions

View File

@@ -1,4 +1,8 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
if Rails.env.production?
run Rack::URLMap.new("/backoffice" => Rails::application)
else
run Rails.application
end

View File

@@ -37,7 +37,7 @@ development:
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
host: localhost
# The TCP port the server listens on. Defaults to 5432.
# If your server runs on a different port number, change accordingly.
@@ -80,6 +80,7 @@ test:
#
production:
<<: *default
database: ribicabackoffice_production
username: ribicabackoffice
password: <%= ENV['RIBICABACKOFFICE_DATABASE_PASSWORD'] %>
database: ribica
username: postgres
password: testni_hamo2
host: localhost

View File

@@ -76,4 +76,6 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.relative_url_root = "/backoffice"
end

View File

@@ -19,4 +19,4 @@ test:
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_key_base: 747e8584786929d2b34d2b9fccb257dcc9f718fec7619baef4ec00aac60140b34e6396836222e3c18ba7b9bb08638c78fed39974c96ce147fc439c85f94302f6

View File

@@ -1,2 +1,6 @@
require './app'
run Sinatra::Application
if settings.environment == :production
run Rack::URLMap.new("/api" => Sinatra::Application.new)
else
run Sinatra::Application
end

View File

@@ -34,6 +34,35 @@ module.exports = function(grunt) {
}
}
},
config: {
dev: {
options: {
variables: {
apiEndpoint: 'http://localhost:4567'
}
}
},
prod: {
options: {
variables: {
apiEndpoint: '/api'
}
}
}
},
replace: {
dist: {
options: {
variables: {
'apiEndpoint': '<%= grunt.config.get("apiEndpoint") %>'
},
force: true
},
files: [
{expand: true, flatten: true, src: ['build/ribica.bundle.js'], dest: 'build/'}
]
}
},
concat: {
css: {
src: [
@@ -56,7 +85,14 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-config');
grunt.loadNpmTasks('grunt-replace');
grunt.registerTask('default', []);
grunt.registerTask('dev', ['browserify', 'concat:css', 'concat:js', 'connect:server:keepalive']);
grunt.registerTask('config-dev', ['config:dev', 'replace']);
grunt.registerTask('config-prod', ['config:prod', 'replace']);
grunt.registerTask('dev', ['browserify', 'config-dev','concat:css', 'concat:js', 'connect:server:keepalive']);
grunt.registerTask('build', ['browserify', 'config-prod', 'concat:css', 'concat:js']);
};

View File

@@ -1,5 +1,5 @@
module.exports = {
ApiUrl: 'http://localhost:4567',
ApiUrl: '@@apiEndpoint',
DefaultPageSize: 18,
FormatCurrency: function(amount_s) {
var amount = parseFloat(amount_s);

View File

@@ -1,6 +1,6 @@
var Backbone = require('backbone');
var Globals = require('../globals');
var Mutators = require('backbone.mutators');
var Mutators = require('Backbone.Mutators');
var ItemWithDetails = Backbone.Model.extend({
@@ -19,4 +19,4 @@ var ItemWithDetails = Backbone.Model.extend({
});
module.exports = ItemWithDetails;
module.exports = ItemWithDetails;

View File

@@ -21,7 +21,9 @@
"grunt-contrib-watch": "~0.6.1",
"reactify": "~0.17.1",
"underscore": "^1.7.0",
"Backbone.Mutators": "~0.4.4"
"Backbone.Mutators": "~0.4.4",
"grunt-config": "~0.2.2",
"grunt-replace": "~0.8.0"
},
"dependencies": {
"react": "~0.12.2",