xing-backend 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/deprecated_classes.rb +28 -0
- data/lib/xing/controllers/base.rb +40 -0
- data/lib/xing/controllers/root_resources_controller.rb +12 -0
- data/lib/xing/engine.rb +27 -0
- data/lib/xing/mappers/base.rb +135 -0
- data/lib/xing/mappers.rb +6 -0
- data/lib/xing/serializers/base.rb +50 -0
- data/lib/xing/serializers/root_resources.rb +9 -0
- data/lib/xing/serializers.rb +7 -0
- data/lib/xing/services/error_converter.rb +47 -0
- data/lib/xing/services/json_tree_lister.rb +56 -0
- data/lib/xing/services/snapshot_fetcher.rb +33 -0
- data/lib/xing/services/snapshot_writer.rb +19 -0
- data/lib/xing/services.rb +9 -0
- data/lib/xing-backend.rb +34 -0
- data/spec/deprecated_classes/active_model_error_converter_spec.rb +11 -0
- data/spec/deprecated_classes/base_serializer_spec.rb +11 -0
- data/spec/deprecated_classes/hypermedia_json_mapper_spec.rb +11 -0
- data/spec/deprecated_classes/json_tree_lister_spec.rb +14 -0
- data/spec/deprecated_classes/remote_snapshot_fetcher_spec.rb +8 -0
- data/spec/deprecated_classes/resources_serializer_spec.rb +12 -0
- data/spec/xing/controllers/base_spec.rb +7 -0
- data/spec/xing/controllers/root_resources_controller_spec.rb +8 -0
- data/spec/xing/mappers/base_spec.rb +56 -0
- data/spec/xing/serializers/base_spec.rb +32 -0
- data/spec/xing/serializers/root_resources_spec.rb +20 -0
- data/spec/xing/services/error_converter_spec.rb +61 -0
- data/spec/xing/services/json_tree_lister_spec.rb +109 -0
- data/spec/xing/services/snapshot_fetcher_spec.rb +75 -0
- data/spec/xing_spec.rb +7 -0
- data/spec_help/dummy/README.rdoc +28 -0
- data/spec_help/dummy/Rakefile +6 -0
- data/spec_help/dummy/app/assets/javascripts/application.js +13 -0
- data/spec_help/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec_help/dummy/app/controllers/application_controller.rb +5 -0
- data/spec_help/dummy/app/helpers/application_helper.rb +2 -0
- data/spec_help/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec_help/dummy/bin/bundle +3 -0
- data/spec_help/dummy/bin/rails +4 -0
- data/spec_help/dummy/bin/rake +4 -0
- data/spec_help/dummy/bin/setup +29 -0
- data/spec_help/dummy/config/application.rb +25 -0
- data/spec_help/dummy/config/boot.rb +5 -0
- data/spec_help/dummy/config/database.yml +25 -0
- data/spec_help/dummy/config/environment.rb +5 -0
- data/spec_help/dummy/config/environments/development.rb +41 -0
- data/spec_help/dummy/config/environments/production.rb +79 -0
- data/spec_help/dummy/config/environments/test.rb +42 -0
- data/spec_help/dummy/config/initializers/assets.rb +11 -0
- data/spec_help/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec_help/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec_help/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec_help/dummy/config/initializers/inflections.rb +16 -0
- data/spec_help/dummy/config/initializers/mime_types.rb +4 -0
- data/spec_help/dummy/config/initializers/session_store.rb +3 -0
- data/spec_help/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec_help/dummy/config/locales/en.yml +23 -0
- data/spec_help/dummy/config/routes.rb +56 -0
- data/spec_help/dummy/config/secrets.yml +22 -0
- data/spec_help/dummy/config.ru +4 -0
- data/spec_help/dummy/db/test.sqlite3 +0 -0
- data/spec_help/dummy/log/test.log +48 -0
- data/spec_help/dummy/public/404.html +67 -0
- data/spec_help/dummy/public/422.html +67 -0
- data/spec_help/dummy/public/500.html +66 -0
- data/spec_help/dummy/public/favicon.ico +0 -0
- data/spec_help/spec_helper.rb +29 -0
- metadata +222 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'xing/mappers/base'
|
2
|
+
|
3
|
+
describe Xing::Mappers::Base do
|
4
|
+
it "should exist" do
|
5
|
+
expect(Xing::Mappers::Base).to be_a(Module)
|
6
|
+
end
|
7
|
+
|
8
|
+
context "subclasses" do
|
9
|
+
let :record do
|
10
|
+
double("some record").tap do |obj|
|
11
|
+
allow(obj).to receive(:save).and_return(true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
let :json do
|
15
|
+
{ 'links'=> {},
|
16
|
+
'data'=> { some: "value"}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
before do
|
21
|
+
stub_const("ActiveModelErrorConverter", double('error converter')).tap do |stub|
|
22
|
+
allow(stub).to receive_message_chain(:new, :convert).and_return({})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should error if it doesn't have an update_record method and a record_class" do
|
27
|
+
class MyMapper < Xing::Mappers::Base
|
28
|
+
end
|
29
|
+
|
30
|
+
mapper = MyMapper.new(json)
|
31
|
+
mapper.record = record
|
32
|
+
|
33
|
+
expect do
|
34
|
+
mapper.save
|
35
|
+
end.to raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
it "shouldn't error if it does have an update_record and a record_class method" do
|
39
|
+
class MyBetterMapper < Xing::Mappers::Base
|
40
|
+
def update_record
|
41
|
+
end
|
42
|
+
def record_class
|
43
|
+
Object
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
mapper = MyBetterMapper.new(json)
|
48
|
+
mapper.record = record
|
49
|
+
|
50
|
+
expect do
|
51
|
+
mapper.save
|
52
|
+
end.not_to raise_error
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'xing/serializers/base'
|
2
|
+
require 'json_spec'
|
3
|
+
|
4
|
+
|
5
|
+
describe Xing::Serializers::Base do
|
6
|
+
include JsonSpec::Matchers
|
7
|
+
|
8
|
+
let :resource do
|
9
|
+
double("a mock activemodel").tap do |model|
|
10
|
+
allow(model).to receive(:read_attribute_for_serialization).with(:name).and_return("My Name!")
|
11
|
+
allow(model).to receive(:read_attribute_for_serialization).with(:position).and_return(2)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
context "a subclass" do
|
17
|
+
|
18
|
+
class MySerializer < Xing::Serializers::Base
|
19
|
+
attributes :name, :position
|
20
|
+
def links
|
21
|
+
{ :self => 'url_for_this_model' }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should generate a JSON with the proper links and self" do
|
26
|
+
json = MySerializer.new(resource).to_json
|
27
|
+
expect(json).to be_json_eql('"url_for_this_model"').at_path('links/self')
|
28
|
+
expect(json).to be_json_eql('"My Name!"').at_path('data/name')
|
29
|
+
expect(json).to be_json_eql('2').at_path('data/position')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'xing/serializers/root_resources'
|
2
|
+
|
3
|
+
describe Xing::Serializers::RootResources do
|
4
|
+
let :resources do
|
5
|
+
{
|
6
|
+
:page => "/pages/{url_slug}",
|
7
|
+
:menus => "menus"
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'as_json' do
|
12
|
+
subject :json do
|
13
|
+
Xing::Serializers::RootResources.new(resources).to_json
|
14
|
+
end
|
15
|
+
|
16
|
+
it { is_expected.to be_present}
|
17
|
+
it { is_expected.to have_json_path('links/page')}
|
18
|
+
it { is_expected.to have_json_path('links/menus')}
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'xing/services/error_converter'
|
2
|
+
require 'active_model'
|
3
|
+
require 'i18n'
|
4
|
+
|
5
|
+
describe Xing::Services::ErrorConverter do
|
6
|
+
it "should exist" do
|
7
|
+
expect(Xing::Services::ErrorConverter).not_to be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
before do
|
11
|
+
# ensure that I18n can find the translation file needed for error
|
12
|
+
# conversions
|
13
|
+
I18n.load_path += Dir[File.join(File.dirname(__FILE__),'../../..', 'config', 'locales', '*.{rb,yml}').tap do |dirn|
|
14
|
+
puts dirn
|
15
|
+
end]
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
class ActiveModelTest
|
20
|
+
include ActiveModel::Validations
|
21
|
+
|
22
|
+
attr_accessor :number, :cheese, :stale
|
23
|
+
validates_numericality_of :number, :greater_than => 7
|
24
|
+
validates_presence_of :cheese
|
25
|
+
validates_inclusion_of :stale, :in => ["stale", "not_stale"]
|
26
|
+
end
|
27
|
+
|
28
|
+
let :invalid_object do
|
29
|
+
obj = ActiveModelTest.new
|
30
|
+
obj.stale = "sorta stale but not really"
|
31
|
+
obj.number = 3
|
32
|
+
obj.cheese = nil
|
33
|
+
obj
|
34
|
+
end
|
35
|
+
|
36
|
+
let :expected_results do
|
37
|
+
{
|
38
|
+
:number => {
|
39
|
+
type: 'greater_than_7',
|
40
|
+
message: "must be greater than 7"
|
41
|
+
},
|
42
|
+
:cheese => {
|
43
|
+
type: 'required',
|
44
|
+
message: "can't be blank"
|
45
|
+
},
|
46
|
+
:stale => {
|
47
|
+
type: 'inclusion',
|
48
|
+
message: "is not included in the list"
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
subject :errors do
|
54
|
+
Xing::Services::ErrorConverter.new(invalid_object).convert
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should make the proper conversion" do
|
58
|
+
expect(errors).to eql(expected_results)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'xing/services/json_tree_lister'
|
2
|
+
|
3
|
+
describe Xing::Services::JsonTreeLister do
|
4
|
+
|
5
|
+
# This simulates a node returned by an ActsAsNestedSet instance,
|
6
|
+
# for purposes of JsonTreeLister, by simulating the is_ancestor_of?
|
7
|
+
# behavior of that module.
|
8
|
+
class FauxNode
|
9
|
+
attr_accessor :path, :name, :parent
|
10
|
+
def initialize(args)
|
11
|
+
self.path = args[:path]
|
12
|
+
self.name = args[:name]
|
13
|
+
self.parent = args[:parent]
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_ancestor_of?(other)
|
17
|
+
if other.parent.blank?
|
18
|
+
false
|
19
|
+
elsif self == other.parent
|
20
|
+
true
|
21
|
+
else
|
22
|
+
is_ancestor_of?(other.parent)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
let (:a) { FauxNode.new(:path => "a", :name => "a") }
|
28
|
+
let (:b) { FauxNode.new(:path => "b", :name => "b", :parent => a) }
|
29
|
+
let (:c) { FauxNode.new(:path => "c", :name => "c", :parent => b) }
|
30
|
+
let!(:d) { FauxNode.new(:path => "d", :name => "d", :parent => c) }
|
31
|
+
let!(:e) { FauxNode.new(:path => "e", :name => "e", :parent => a) }
|
32
|
+
let (:f) { FauxNode.new(:path => "f", :name => "f", :parent => a) }
|
33
|
+
let!(:g) { FauxNode.new(:path => "g", :name => "g", :parent => f) }
|
34
|
+
let!(:h) { FauxNode.new(:path => "h", :name => "h", :parent => f) }
|
35
|
+
|
36
|
+
let :expected_tree do
|
37
|
+
{
|
38
|
+
name: "a",
|
39
|
+
url: "a",
|
40
|
+
children: [
|
41
|
+
{
|
42
|
+
name: "b",
|
43
|
+
url: "b",
|
44
|
+
children: [
|
45
|
+
{
|
46
|
+
name: "c",
|
47
|
+
url: "c",
|
48
|
+
children: [
|
49
|
+
{
|
50
|
+
name: "d",
|
51
|
+
url: "d",
|
52
|
+
children: []
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
]
|
57
|
+
},
|
58
|
+
{
|
59
|
+
name: "e",
|
60
|
+
url: "e",
|
61
|
+
children: []
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: "f",
|
65
|
+
url: "f",
|
66
|
+
children: [
|
67
|
+
{
|
68
|
+
name: "g",
|
69
|
+
url: "g",
|
70
|
+
children: []
|
71
|
+
},
|
72
|
+
{
|
73
|
+
name: "h",
|
74
|
+
url: "h",
|
75
|
+
children: []
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
]
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
class SimpleNodeSerializer
|
84
|
+
def initialize(tree_node)
|
85
|
+
@tree_node = tree_node
|
86
|
+
end
|
87
|
+
|
88
|
+
attr_reader :tree_node
|
89
|
+
|
90
|
+
def as_json
|
91
|
+
{
|
92
|
+
:name => tree_node.node.name,
|
93
|
+
:url => tree_node.node.path,
|
94
|
+
:children => tree_node.children
|
95
|
+
}
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should produce a correct tree for a node with no childen" do
|
100
|
+
expect(d).to receive(:self_and_descendants).and_return([d])
|
101
|
+
expect(Xing::Services::JsonTreeLister.new(d.self_and_descendants, SimpleNodeSerializer).render).to eq({name: "d", url: "d", children: []})
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should produce a correct tree for a parent of a big tree" do
|
105
|
+
expect(a).to receive(:self_and_descendants).and_return([a, b, c, d, e, f, g, h])
|
106
|
+
expect(Xing::Services::JsonTreeLister.new(a.self_and_descendants, SimpleNodeSerializer).render).to eq(expected_tree)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'xing/services/snapshot_fetcher'
|
2
|
+
require 'typhoeus'
|
3
|
+
|
4
|
+
|
5
|
+
describe Xing::Services::SnapshotFetcher do
|
6
|
+
let :server_secrets do
|
7
|
+
{ 'url' => 'http://snapshot-server.com',
|
8
|
+
'user' => 'foobar',
|
9
|
+
'password' => 'my_password'
|
10
|
+
}
|
11
|
+
end
|
12
|
+
let :mock_hydra do double('a hydra object') end
|
13
|
+
let :mock_request do double('request') end
|
14
|
+
let :mock_response do double('a response') end
|
15
|
+
let :fetcher do
|
16
|
+
Xing::Services::SnapshotFetcher.new
|
17
|
+
end
|
18
|
+
|
19
|
+
before do
|
20
|
+
allow(Rails).to receive_message_chain(:application, :secrets, :snapshot_server)
|
21
|
+
.and_return(server_secrets)
|
22
|
+
allow(Addressable::URI).to receive(:join).and_return(
|
23
|
+
'http://xing-framework.com/backend/documentation.html'
|
24
|
+
)
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
context "a successful request" do
|
30
|
+
before do
|
31
|
+
expect(mock_response).to receive(:success?).and_return(true)
|
32
|
+
end
|
33
|
+
it "should make a correctly-formatted request to the snapshot server" do
|
34
|
+
expect(Typhoeus::Request).to receive(:new).with('http://snapshot-server.com',
|
35
|
+
{ userpwd: "foobar:my_password",
|
36
|
+
params: { url: 'http://xing-framework.com/backend/documentation.html' }
|
37
|
+
}
|
38
|
+
)
|
39
|
+
.and_return(mock_request)
|
40
|
+
expect(Typhoeus::Hydra).to receive(:new).and_return(mock_hydra)
|
41
|
+
expect(mock_hydra).to receive(:queue).with(mock_request)
|
42
|
+
expect(mock_hydra).to receive(:run)
|
43
|
+
expect(mock_request).to receive(:response).and_return(mock_response)
|
44
|
+
expect(mock_response).to receive(:body).and_return("body of snapshot")
|
45
|
+
expect(fetcher).to receive(:write).with('backend/documentation.html',
|
46
|
+
'body of snapshot')
|
47
|
+
fetcher.perform('http://xing-framework.com', 'backend/documentation.html' )
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "a failed request" do
|
52
|
+
before do
|
53
|
+
expect(mock_response).to receive(:success?).and_return(false)
|
54
|
+
end
|
55
|
+
it "should make a correctly-formatted request to the snapshot server" do
|
56
|
+
expect(Typhoeus::Request).to receive(:new).with('http://snapshot-server.com',
|
57
|
+
{ userpwd: "foobar:my_password",
|
58
|
+
params: { url: 'http://xing-framework.com/backend/documentation.html' }
|
59
|
+
})
|
60
|
+
.and_return(mock_request)
|
61
|
+
expect(Typhoeus::Hydra).to receive(:new).and_return(mock_hydra)
|
62
|
+
expect(mock_hydra).to receive(:queue).with(mock_request)
|
63
|
+
expect(mock_hydra).to receive(:run)
|
64
|
+
allow(mock_request).to receive(:response).and_return(mock_response)
|
65
|
+
allow(mock_response).to receive(:body).and_return("could not load content")
|
66
|
+
allow(mock_response).to receive(:status_message).and_return("500 server error")
|
67
|
+
expect(fetcher).not_to receive(:write)
|
68
|
+
|
69
|
+
expect do
|
70
|
+
fetcher.perform('http://xing-framework.com', 'backend/documentation.html' )
|
71
|
+
end.to raise_error(%r{http://snapshot-server.com.*backend/documentation.html}) #Don't like this, but error not custom
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
data/spec/xing_spec.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "xing-backend"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
+
# yet still be able to expire them through the digest params.
|
32
|
+
config.assets.digest = true
|
33
|
+
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
36
|
+
# Raises helpful error messages.
|
37
|
+
config.assets.raise_runtime_errors = true
|
38
|
+
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
41
|
+
end
|