asynk 0.0.1
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/.gitignore +18 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +172 -0
- data/README.md +168 -0
- data/asynk.gemspec +27 -0
- data/bin/asynk +12 -0
- data/bin/asynkctl +93 -0
- data/consumer.rb +52 -0
- data/lib/asynk/benchmark.rb +21 -0
- data/lib/asynk/broker.rb +33 -0
- data/lib/asynk/cli.rb +146 -0
- data/lib/asynk/config.rb +33 -0
- data/lib/asynk/consumer.rb +98 -0
- data/lib/asynk/logging.rb +97 -0
- data/lib/asynk/message.rb +30 -0
- data/lib/asynk/publisher.rb +28 -0
- data/lib/asynk/response.rb +57 -0
- data/lib/asynk/server.rb +62 -0
- data/lib/asynk/sync_publisher.rb +36 -0
- data/lib/asynk/test_helper.rb +52 -0
- data/lib/asynk/version.rb +3 -0
- data/lib/asynk/worker.rb +56 -0
- data/lib/asynk.rb +65 -0
- data/myapp/.gitignore +17 -0
- data/myapp/Gemfile +16 -0
- data/myapp/Gemfile.lock +175 -0
- data/myapp/README.rdoc +28 -0
- data/myapp/Rakefile +6 -0
- data/myapp/app/assets/images/.keep +0 -0
- data/myapp/app/assets/javascripts/application.js +16 -0
- data/myapp/app/assets/stylesheets/application.css +15 -0
- data/myapp/app/consumers/wallet_events_consumer.rb +22 -0
- data/myapp/app/controllers/application_controller.rb +5 -0
- data/myapp/app/controllers/concerns/.keep +0 -0
- data/myapp/app/helpers/application_helper.rb +2 -0
- data/myapp/app/mailers/.keep +0 -0
- data/myapp/app/models/.keep +0 -0
- data/myapp/app/models/concerns/.keep +0 -0
- data/myapp/app/models/user.rb +2 -0
- data/myapp/app/views/layouts/application.html.erb +14 -0
- data/myapp/bin/bundle +3 -0
- data/myapp/bin/rails +8 -0
- data/myapp/bin/rake +8 -0
- data/myapp/bin/setup +29 -0
- data/myapp/bin/spring +15 -0
- data/myapp/config/application.rb +26 -0
- data/myapp/config/boot.rb +3 -0
- data/myapp/config/database.yml +32 -0
- data/myapp/config/environment.rb +5 -0
- data/myapp/config/environments/development.rb +41 -0
- data/myapp/config/environments/production.rb +79 -0
- data/myapp/config/environments/test.rb +42 -0
- data/myapp/config/initializers/assets.rb +11 -0
- data/myapp/config/initializers/backtrace_silencers.rb +7 -0
- data/myapp/config/initializers/cookies_serializer.rb +3 -0
- data/myapp/config/initializers/filter_parameter_logging.rb +4 -0
- data/myapp/config/initializers/inflections.rb +16 -0
- data/myapp/config/initializers/mime_types.rb +4 -0
- data/myapp/config/initializers/session_store.rb +3 -0
- data/myapp/config/initializers/wrap_parameters.rb +14 -0
- data/myapp/config/locales/en.yml +23 -0
- data/myapp/config/routes.rb +56 -0
- data/myapp/config/secrets.yml +22 -0
- data/myapp/config.ru +4 -0
- data/myapp/db/migrate/20150826104429_create_users.rb +10 -0
- data/myapp/db/schema.rb +26 -0
- data/myapp/db/seeds.rb +7 -0
- data/myapp/lib/assets/.keep +0 -0
- data/myapp/lib/tasks/.keep +0 -0
- data/myapp/log/.keep +0 -0
- data/myapp/public/404.html +67 -0
- data/myapp/public/422.html +67 -0
- data/myapp/public/500.html +66 -0
- data/myapp/public/favicon.ico +0 -0
- data/myapp/public/robots.txt +5 -0
- data/myapp/test/controllers/.keep +0 -0
- data/myapp/test/fixtures/.keep +0 -0
- data/myapp/test/fixtures/users.yml +9 -0
- data/myapp/test/helpers/.keep +0 -0
- data/myapp/test/integration/.keep +0 -0
- data/myapp/test/mailers/.keep +0 -0
- data/myapp/test/models/.keep +0 -0
- data/myapp/test/models/user_test.rb +7 -0
- data/myapp/test/test_helper.rb +10 -0
- data/myapp/vendor/assets/javascripts/.keep +0 -0
- data/myapp/vendor/assets/stylesheets/.keep +0 -0
- data/publisher.rb +15 -0
- data/test/consumer_example.rb +31 -0
- data/test/consumer_testing_example_test.rb +21 -0
- data/test/test_helper.rb +7 -0
- metadata +271 -0
data/lib/asynk/worker.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Asynk
|
2
|
+
class Worker
|
3
|
+
include Celluloid::IO
|
4
|
+
|
5
|
+
def initialize(bunny_connection, consumer, instance_id)
|
6
|
+
@instance_id = instance_id
|
7
|
+
@consumer = consumer
|
8
|
+
@ch = bunny_connection.create_channel
|
9
|
+
@ch.prefetch(1)
|
10
|
+
|
11
|
+
@default_exchange = @ch.default_exchange
|
12
|
+
|
13
|
+
x = @ch.topic(Asynk.config[:mq_exchange])
|
14
|
+
q = @ch.queue(consumer.queue_name, @consumer.queue_options || {})
|
15
|
+
|
16
|
+
@consumer.routing_keys.each{ |routing_key| q.bind(x, routing_key: routing_key) }
|
17
|
+
q.subscribe(@consumer.subscribe_arguments || {}, &method(:on_event))
|
18
|
+
|
19
|
+
Asynk.logger.info ["#{@consumer.name}:#{@instance_id} worker accepting connections. ",
|
20
|
+
" mq_exchange: #{Asynk.config[:mq_exchange]}",
|
21
|
+
" queue_name: #{@consumer.queue_name}",
|
22
|
+
" queue_options: #{@consumer.queue_options}",
|
23
|
+
" routing_keys: #{@consumer.routing_keys}"
|
24
|
+
].join("\r\n")
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_event(delivery_info, properties, payload)
|
28
|
+
global_start_time = Asynk::Benchmark.start
|
29
|
+
message = Asynk::Message.new(delivery_info, properties, payload)
|
30
|
+
consumer_instance = @consumer.new(@ch, delivery_info) do |result|
|
31
|
+
@default_exchange.publish(convert_to_valid_json_string(result), routing_key: properties.reply_to, correlation_id: properties.correlation_id)
|
32
|
+
|
33
|
+
if Asynk.config[:respond_back_execution_time]
|
34
|
+
Asynk.logger.info "Responded to message #{message.routing_key}:#{message.message_id} In: #{Asynk::Benchmark.end(global_start_time)} ms."
|
35
|
+
end
|
36
|
+
|
37
|
+
Asynk.logger.debug "#{@consumer.name}:#{@instance_id} Respoding to message id: #{message.message_id} with: #{result.to_s}. "
|
38
|
+
end
|
39
|
+
|
40
|
+
Asynk.logger.info "#{@consumer.name}:#{@instance_id} Got message #{message.routing_key}:#{message.message_id} with payload: #{message.body}"
|
41
|
+
consumer_instance.invoke_processing(message)
|
42
|
+
end
|
43
|
+
|
44
|
+
def shutdown
|
45
|
+
Asynk.logger.info "#{@consumer.name}:#{@instance_id} stopping..."
|
46
|
+
@ch.close
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def convert_to_valid_json_string(data)
|
51
|
+
data = '' if data.nil?
|
52
|
+
data.is_a?(String) ? data : data.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/asynk.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'connection_pool'
|
2
|
+
require 'singleton'
|
3
|
+
require 'securerandom'
|
4
|
+
require 'bunny'
|
5
|
+
require 'active_support'
|
6
|
+
require 'asynk/config'
|
7
|
+
require 'asynk/publisher'
|
8
|
+
require 'asynk/broker'
|
9
|
+
require 'asynk/consumer'
|
10
|
+
require 'asynk/logging'
|
11
|
+
require 'asynk/server'
|
12
|
+
require 'asynk/message'
|
13
|
+
require 'asynk/response'
|
14
|
+
require 'asynk/benchmark'
|
15
|
+
require 'asynk/sync_publisher'
|
16
|
+
require 'asynk/test_helper'
|
17
|
+
|
18
|
+
module Asynk
|
19
|
+
|
20
|
+
DEFAULTS = {
|
21
|
+
require: '.',
|
22
|
+
environment: nil
|
23
|
+
}
|
24
|
+
|
25
|
+
class << self
|
26
|
+
def register_consumer(consumer)
|
27
|
+
return if Asynk.config[:ignored_consumers].include? consumer.name
|
28
|
+
self.consumers << consumer
|
29
|
+
end
|
30
|
+
|
31
|
+
def consumers
|
32
|
+
@consumers ||= []
|
33
|
+
end
|
34
|
+
|
35
|
+
def options
|
36
|
+
@options ||= DEFAULTS.dup
|
37
|
+
end
|
38
|
+
|
39
|
+
def options=(opts)
|
40
|
+
@options = opts
|
41
|
+
end
|
42
|
+
|
43
|
+
def logger
|
44
|
+
Asynk::Logging.logger
|
45
|
+
end
|
46
|
+
|
47
|
+
def logger=(log)
|
48
|
+
Asynk::Logging.logger = log
|
49
|
+
end
|
50
|
+
|
51
|
+
def server
|
52
|
+
Server.instance
|
53
|
+
end
|
54
|
+
|
55
|
+
def broker; Broker; end
|
56
|
+
|
57
|
+
def booted_inside?; @booted_inside; end
|
58
|
+
|
59
|
+
def booted_inside=(value)
|
60
|
+
@booted_inside = value
|
61
|
+
end
|
62
|
+
|
63
|
+
def config; Config.instance; end
|
64
|
+
end
|
65
|
+
end
|
data/myapp/.gitignore
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*
|
16
|
+
!/log/.keep
|
17
|
+
/tmp
|
data/myapp/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
|
4
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
5
|
+
gem 'rails', '4.2.3'
|
6
|
+
# Use sqlite3 as the database for Active Record
|
7
|
+
gem 'pg'
|
8
|
+
|
9
|
+
|
10
|
+
gem 'jbuilder', '~> 2.0'
|
11
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
12
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
13
|
+
|
14
|
+
|
15
|
+
gem 'asynk', path: '../'
|
16
|
+
|
data/myapp/Gemfile.lock
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
asynk (0.0.1)
|
5
|
+
activesupport
|
6
|
+
bunny
|
7
|
+
celluloid (~> 0.17.0)
|
8
|
+
celluloid-io
|
9
|
+
json (~> 1.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
actionmailer (4.2.3)
|
15
|
+
actionpack (= 4.2.3)
|
16
|
+
actionview (= 4.2.3)
|
17
|
+
activejob (= 4.2.3)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
20
|
+
actionpack (4.2.3)
|
21
|
+
actionview (= 4.2.3)
|
22
|
+
activesupport (= 4.2.3)
|
23
|
+
rack (~> 1.6)
|
24
|
+
rack-test (~> 0.6.2)
|
25
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (4.2.3)
|
28
|
+
activesupport (= 4.2.3)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubis (~> 2.7.0)
|
31
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
33
|
+
activejob (4.2.3)
|
34
|
+
activesupport (= 4.2.3)
|
35
|
+
globalid (>= 0.3.0)
|
36
|
+
activemodel (4.2.3)
|
37
|
+
activesupport (= 4.2.3)
|
38
|
+
builder (~> 3.1)
|
39
|
+
activerecord (4.2.3)
|
40
|
+
activemodel (= 4.2.3)
|
41
|
+
activesupport (= 4.2.3)
|
42
|
+
arel (~> 6.0)
|
43
|
+
activesupport (4.2.3)
|
44
|
+
i18n (~> 0.7)
|
45
|
+
json (~> 1.7, >= 1.7.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
48
|
+
tzinfo (~> 1.1)
|
49
|
+
amq-protocol (2.0.0)
|
50
|
+
arel (6.0.3)
|
51
|
+
builder (3.2.2)
|
52
|
+
bunny (2.1.0)
|
53
|
+
amq-protocol (>= 2.0.0)
|
54
|
+
celluloid (0.17.1.2)
|
55
|
+
bundler
|
56
|
+
celluloid-essentials
|
57
|
+
celluloid-extras
|
58
|
+
celluloid-fsm
|
59
|
+
celluloid-pool
|
60
|
+
celluloid-supervision
|
61
|
+
dotenv
|
62
|
+
nenv
|
63
|
+
rspec-logsplit (>= 0.1.2)
|
64
|
+
timers (>= 4.1.1)
|
65
|
+
celluloid-essentials (0.20.2.1)
|
66
|
+
bundler
|
67
|
+
dotenv
|
68
|
+
nenv
|
69
|
+
rspec-logsplit (>= 0.1.2)
|
70
|
+
timers (>= 4.1.1)
|
71
|
+
celluloid-extras (0.20.1)
|
72
|
+
bundler
|
73
|
+
dotenv
|
74
|
+
nenv
|
75
|
+
rspec-logsplit (>= 0.1.2)
|
76
|
+
timers (>= 4.1.1)
|
77
|
+
celluloid-fsm (0.20.1)
|
78
|
+
bundler
|
79
|
+
dotenv
|
80
|
+
nenv
|
81
|
+
rspec-logsplit (>= 0.1.2)
|
82
|
+
timers (>= 4.1.1)
|
83
|
+
celluloid-io (0.16.2)
|
84
|
+
celluloid (>= 0.16.0)
|
85
|
+
nio4r (>= 1.1.0)
|
86
|
+
celluloid-pool (0.20.1)
|
87
|
+
bundler
|
88
|
+
dotenv
|
89
|
+
nenv
|
90
|
+
rspec-logsplit (>= 0.1.2)
|
91
|
+
timers (>= 4.1.1)
|
92
|
+
celluloid-supervision (0.20.1.1)
|
93
|
+
bundler
|
94
|
+
dotenv
|
95
|
+
nenv
|
96
|
+
rspec-logsplit (>= 0.1.2)
|
97
|
+
timers (>= 4.1.1)
|
98
|
+
dotenv (2.0.2)
|
99
|
+
erubis (2.7.0)
|
100
|
+
globalid (0.3.6)
|
101
|
+
activesupport (>= 4.1.0)
|
102
|
+
hitimes (1.2.2)
|
103
|
+
i18n (0.7.0)
|
104
|
+
jbuilder (2.3.1)
|
105
|
+
activesupport (>= 3.0.0, < 5)
|
106
|
+
multi_json (~> 1.2)
|
107
|
+
json (1.8.3)
|
108
|
+
loofah (2.0.3)
|
109
|
+
nokogiri (>= 1.5.9)
|
110
|
+
mail (2.6.3)
|
111
|
+
mime-types (>= 1.16, < 3)
|
112
|
+
mime-types (2.6.1)
|
113
|
+
mini_portile (0.6.2)
|
114
|
+
minitest (5.8.0)
|
115
|
+
multi_json (1.11.2)
|
116
|
+
nenv (0.2.0)
|
117
|
+
nio4r (1.1.1)
|
118
|
+
nokogiri (1.6.6.2)
|
119
|
+
mini_portile (~> 0.6.0)
|
120
|
+
pg (0.18.1)
|
121
|
+
rack (1.6.4)
|
122
|
+
rack-test (0.6.3)
|
123
|
+
rack (>= 1.0)
|
124
|
+
rails (4.2.3)
|
125
|
+
actionmailer (= 4.2.3)
|
126
|
+
actionpack (= 4.2.3)
|
127
|
+
actionview (= 4.2.3)
|
128
|
+
activejob (= 4.2.3)
|
129
|
+
activemodel (= 4.2.3)
|
130
|
+
activerecord (= 4.2.3)
|
131
|
+
activesupport (= 4.2.3)
|
132
|
+
bundler (>= 1.3.0, < 2.0)
|
133
|
+
railties (= 4.2.3)
|
134
|
+
sprockets-rails
|
135
|
+
rails-deprecated_sanitizer (1.0.3)
|
136
|
+
activesupport (>= 4.2.0.alpha)
|
137
|
+
rails-dom-testing (1.0.7)
|
138
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
139
|
+
nokogiri (~> 1.6.0)
|
140
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
141
|
+
rails-html-sanitizer (1.0.2)
|
142
|
+
loofah (~> 2.0)
|
143
|
+
railties (4.2.3)
|
144
|
+
actionpack (= 4.2.3)
|
145
|
+
activesupport (= 4.2.3)
|
146
|
+
rake (>= 0.8.7)
|
147
|
+
thor (>= 0.18.1, < 2.0)
|
148
|
+
rake (10.4.2)
|
149
|
+
rdoc (4.2.0)
|
150
|
+
rspec-logsplit (0.1.3)
|
151
|
+
sdoc (0.4.1)
|
152
|
+
json (~> 1.7, >= 1.7.7)
|
153
|
+
rdoc (~> 4.0)
|
154
|
+
sprockets (3.3.3)
|
155
|
+
rack (~> 1.0)
|
156
|
+
sprockets-rails (2.3.2)
|
157
|
+
actionpack (>= 3.0)
|
158
|
+
activesupport (>= 3.0)
|
159
|
+
sprockets (>= 2.8, < 4.0)
|
160
|
+
thor (0.19.1)
|
161
|
+
thread_safe (0.3.5)
|
162
|
+
timers (4.1.1)
|
163
|
+
hitimes
|
164
|
+
tzinfo (1.2.2)
|
165
|
+
thread_safe (~> 0.1)
|
166
|
+
|
167
|
+
PLATFORMS
|
168
|
+
ruby
|
169
|
+
|
170
|
+
DEPENDENCIES
|
171
|
+
asynk!
|
172
|
+
jbuilder (~> 2.0)
|
173
|
+
pg
|
174
|
+
rails (= 4.2.3)
|
175
|
+
sdoc (~> 0.4.0)
|
data/myapp/README.rdoc
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>.
|
data/myapp/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,16 @@
|
|
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 jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= 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,22 @@
|
|
1
|
+
class WalletEventsConsumer
|
2
|
+
include Asynk::Consumer
|
3
|
+
|
4
|
+
set_consume 'gm_backend.kroter_wallet.*'
|
5
|
+
set_queue 'gm_backend.kroter_wallet_queue', durable: true, ack: true
|
6
|
+
set_subscribe_arguments manual_ack: true
|
7
|
+
set_concurrency 2
|
8
|
+
set_sync true
|
9
|
+
|
10
|
+
def process(msg)
|
11
|
+
# logger.info "Msg received: #{msg}"
|
12
|
+
# raise 'Inpropriate User' if msg[:name] == 'Insaf'
|
13
|
+
|
14
|
+
# user = User.create(name: msg['name'], surname: msg['surname'])
|
15
|
+
# logger.info ['count: ', User.count].join(' ')
|
16
|
+
ack!
|
17
|
+
Asynk::Response.new(status: :ok)
|
18
|
+
rescue Exception => e
|
19
|
+
reject!
|
20
|
+
Asynk::Response.new(status: :failed, error_message: e.message )
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>AsynkExample</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>
|
data/myapp/bin/bundle
ADDED
data/myapp/bin/rails
ADDED
data/myapp/bin/rake
ADDED
data/myapp/bin/setup
ADDED
@@ -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
|
data/myapp/bin/spring
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require "rubygems"
|
8
|
+
require "bundler"
|
9
|
+
|
10
|
+
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
|
11
|
+
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
12
|
+
gem "spring", match[1]
|
13
|
+
require "spring/binstub"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(*Rails.groups)
|
8
|
+
|
9
|
+
module AsynkExample
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
16
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
17
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
18
|
+
|
19
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
20
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
21
|
+
# config.i18n.default_locale = :de
|
22
|
+
|
23
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
24
|
+
config.active_record.raise_in_transactional_callbacks = true
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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: postgresql
|
9
|
+
username: dev
|
10
|
+
password:
|
11
|
+
pool: 10
|
12
|
+
timeout: 5000
|
13
|
+
encoding: utf-8
|
14
|
+
collation: en_US.UTF-8
|
15
|
+
ctype: en_US.UTF-8
|
16
|
+
template: template0
|
17
|
+
|
18
|
+
development:
|
19
|
+
<<: *default
|
20
|
+
database: 'asynk_example_dev'
|
21
|
+
|
22
|
+
# Warning: The database defined as "test" will be erased and
|
23
|
+
# re-generated from your development database when you run "rake".
|
24
|
+
# Do not set this db to the same as development or production.
|
25
|
+
test:
|
26
|
+
<<: *default
|
27
|
+
database: 'asynk_example_test'
|
28
|
+
|
29
|
+
production:
|
30
|
+
<<: *default
|
31
|
+
database: 'asynk_example_prod'
|
32
|
+
password: dev
|
@@ -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
|