sidekiq 0.10.0 → 7.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. checksums.yaml +7 -0
  2. data/Changes.md +2047 -0
  3. data/LICENSE.txt +9 -0
  4. data/README.md +73 -27
  5. data/bin/sidekiq +25 -9
  6. data/bin/sidekiqload +247 -0
  7. data/bin/sidekiqmon +11 -0
  8. data/lib/generators/sidekiq/job_generator.rb +57 -0
  9. data/lib/generators/sidekiq/templates/job.rb.erb +9 -0
  10. data/lib/generators/sidekiq/templates/job_spec.rb.erb +6 -0
  11. data/lib/generators/sidekiq/templates/job_test.rb.erb +8 -0
  12. data/lib/sidekiq/api.rb +1145 -0
  13. data/lib/sidekiq/capsule.rb +127 -0
  14. data/lib/sidekiq/cli.rb +348 -109
  15. data/lib/sidekiq/client.rb +241 -41
  16. data/lib/sidekiq/component.rb +68 -0
  17. data/lib/sidekiq/config.rb +287 -0
  18. data/lib/sidekiq/deploy.rb +62 -0
  19. data/lib/sidekiq/embedded.rb +61 -0
  20. data/lib/sidekiq/fetch.rb +88 -0
  21. data/lib/sidekiq/job.rb +374 -0
  22. data/lib/sidekiq/job_logger.rb +51 -0
  23. data/lib/sidekiq/job_retry.rb +300 -0
  24. data/lib/sidekiq/job_util.rb +107 -0
  25. data/lib/sidekiq/launcher.rb +271 -0
  26. data/lib/sidekiq/logger.rb +131 -0
  27. data/lib/sidekiq/manager.rb +96 -103
  28. data/lib/sidekiq/metrics/query.rb +153 -0
  29. data/lib/sidekiq/metrics/shared.rb +95 -0
  30. data/lib/sidekiq/metrics/tracking.rb +136 -0
  31. data/lib/sidekiq/middleware/chain.rb +149 -38
  32. data/lib/sidekiq/middleware/current_attributes.rb +95 -0
  33. data/lib/sidekiq/middleware/i18n.rb +42 -0
  34. data/lib/sidekiq/middleware/modules.rb +21 -0
  35. data/lib/sidekiq/monitor.rb +146 -0
  36. data/lib/sidekiq/paginator.rb +55 -0
  37. data/lib/sidekiq/processor.rb +246 -61
  38. data/lib/sidekiq/rails.rb +60 -13
  39. data/lib/sidekiq/redis_client_adapter.rb +95 -0
  40. data/lib/sidekiq/redis_connection.rb +68 -15
  41. data/lib/sidekiq/ring_buffer.rb +29 -0
  42. data/lib/sidekiq/scheduled.rb +236 -0
  43. data/lib/sidekiq/sd_notify.rb +149 -0
  44. data/lib/sidekiq/systemd.rb +24 -0
  45. data/lib/sidekiq/testing/inline.rb +30 -0
  46. data/lib/sidekiq/testing.rb +304 -10
  47. data/lib/sidekiq/transaction_aware_client.rb +44 -0
  48. data/lib/sidekiq/version.rb +4 -1
  49. data/lib/sidekiq/web/action.rb +93 -0
  50. data/lib/sidekiq/web/application.rb +447 -0
  51. data/lib/sidekiq/web/csrf_protection.rb +180 -0
  52. data/lib/sidekiq/web/helpers.rb +370 -0
  53. data/lib/sidekiq/web/router.rb +104 -0
  54. data/lib/sidekiq/web.rb +143 -74
  55. data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
  56. data/lib/sidekiq.rb +120 -73
  57. data/sidekiq.gemspec +26 -23
  58. data/web/assets/images/apple-touch-icon.png +0 -0
  59. data/web/assets/images/favicon.ico +0 -0
  60. data/web/assets/images/logo.png +0 -0
  61. data/web/assets/images/status.png +0 -0
  62. data/web/assets/javascripts/application.js +162 -3
  63. data/web/assets/javascripts/base-charts.js +106 -0
  64. data/web/assets/javascripts/chart.min.js +13 -0
  65. data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
  66. data/web/assets/javascripts/dashboard-charts.js +168 -0
  67. data/web/assets/javascripts/dashboard.js +59 -0
  68. data/web/assets/javascripts/metrics.js +264 -0
  69. data/web/assets/stylesheets/application-dark.css +147 -0
  70. data/web/assets/stylesheets/application-rtl.css +153 -0
  71. data/web/assets/stylesheets/application.css +720 -7
  72. data/web/assets/stylesheets/bootstrap-rtl.min.css +9 -0
  73. data/web/assets/stylesheets/bootstrap.css +5 -0
  74. data/web/locales/ar.yml +87 -0
  75. data/web/locales/cs.yml +78 -0
  76. data/web/locales/da.yml +75 -0
  77. data/web/locales/de.yml +81 -0
  78. data/web/locales/el.yml +87 -0
  79. data/web/locales/en.yml +101 -0
  80. data/web/locales/es.yml +86 -0
  81. data/web/locales/fa.yml +80 -0
  82. data/web/locales/fr.yml +99 -0
  83. data/web/locales/gd.yml +99 -0
  84. data/web/locales/he.yml +80 -0
  85. data/web/locales/hi.yml +75 -0
  86. data/web/locales/it.yml +69 -0
  87. data/web/locales/ja.yml +91 -0
  88. data/web/locales/ko.yml +68 -0
  89. data/web/locales/lt.yml +83 -0
  90. data/web/locales/nb.yml +77 -0
  91. data/web/locales/nl.yml +68 -0
  92. data/web/locales/pl.yml +59 -0
  93. data/web/locales/pt-br.yml +96 -0
  94. data/web/locales/pt.yml +67 -0
  95. data/web/locales/ru.yml +83 -0
  96. data/web/locales/sv.yml +68 -0
  97. data/web/locales/ta.yml +75 -0
  98. data/web/locales/uk.yml +77 -0
  99. data/web/locales/ur.yml +80 -0
  100. data/web/locales/vi.yml +83 -0
  101. data/web/locales/zh-cn.yml +95 -0
  102. data/web/locales/zh-tw.yml +102 -0
  103. data/web/views/_footer.erb +23 -0
  104. data/web/views/_job_info.erb +105 -0
  105. data/web/views/_metrics_period_select.erb +12 -0
  106. data/web/views/_nav.erb +52 -0
  107. data/web/views/_paging.erb +25 -0
  108. data/web/views/_poll_link.erb +4 -0
  109. data/web/views/_status.erb +4 -0
  110. data/web/views/_summary.erb +40 -0
  111. data/web/views/busy.erb +148 -0
  112. data/web/views/dashboard.erb +115 -0
  113. data/web/views/dead.erb +34 -0
  114. data/web/views/filtering.erb +7 -0
  115. data/web/views/layout.erb +42 -0
  116. data/web/views/metrics.erb +82 -0
  117. data/web/views/metrics_for_job.erb +68 -0
  118. data/web/views/morgue.erb +74 -0
  119. data/web/views/queue.erb +55 -0
  120. data/web/views/queues.erb +40 -0
  121. data/web/views/retries.erb +79 -0
  122. data/web/views/retry.erb +34 -0
  123. data/web/views/scheduled.erb +56 -0
  124. data/web/views/scheduled_job_info.erb +8 -0
  125. metadata +159 -237
  126. data/.gitignore +0 -6
  127. data/.rvmrc +0 -4
  128. data/COMM-LICENSE +0 -75
  129. data/Gemfile +0 -10
  130. data/LICENSE +0 -22
  131. data/Rakefile +0 -9
  132. data/TODO.md +0 -1
  133. data/bin/client +0 -7
  134. data/bin/sidekiqctl +0 -43
  135. data/config.ru +0 -8
  136. data/examples/chef/cookbooks/sidekiq/README.rdoc +0 -11
  137. data/examples/chef/cookbooks/sidekiq/recipes/default.rb +0 -55
  138. data/examples/chef/cookbooks/sidekiq/templates/default/monitrc.conf.erb +0 -8
  139. data/examples/chef/cookbooks/sidekiq/templates/default/sidekiq.erb +0 -219
  140. data/examples/chef/cookbooks/sidekiq/templates/default/sidekiq.yml.erb +0 -22
  141. data/examples/config.yml +0 -9
  142. data/examples/monitrc.conf +0 -6
  143. data/examples/por.rb +0 -27
  144. data/examples/scheduling.rb +0 -37
  145. data/examples/sinkiq.rb +0 -57
  146. data/examples/web-ui.png +0 -0
  147. data/lib/sidekiq/capistrano.rb +0 -32
  148. data/lib/sidekiq/extensions/action_mailer.rb +0 -26
  149. data/lib/sidekiq/extensions/active_record.rb +0 -27
  150. data/lib/sidekiq/extensions/generic_proxy.rb +0 -21
  151. data/lib/sidekiq/middleware/client/unique_jobs.rb +0 -32
  152. data/lib/sidekiq/middleware/server/active_record.rb +0 -13
  153. data/lib/sidekiq/middleware/server/exception_handler.rb +0 -38
  154. data/lib/sidekiq/middleware/server/failure_jobs.rb +0 -24
  155. data/lib/sidekiq/middleware/server/logging.rb +0 -27
  156. data/lib/sidekiq/middleware/server/retry_jobs.rb +0 -59
  157. data/lib/sidekiq/middleware/server/unique_jobs.rb +0 -15
  158. data/lib/sidekiq/retry.rb +0 -57
  159. data/lib/sidekiq/util.rb +0 -61
  160. data/lib/sidekiq/worker.rb +0 -37
  161. data/myapp/.gitignore +0 -15
  162. data/myapp/Capfile +0 -5
  163. data/myapp/Gemfile +0 -19
  164. data/myapp/Gemfile.lock +0 -143
  165. data/myapp/Rakefile +0 -7
  166. data/myapp/app/controllers/application_controller.rb +0 -3
  167. data/myapp/app/controllers/work_controller.rb +0 -38
  168. data/myapp/app/helpers/application_helper.rb +0 -2
  169. data/myapp/app/mailers/.gitkeep +0 -0
  170. data/myapp/app/mailers/user_mailer.rb +0 -9
  171. data/myapp/app/models/.gitkeep +0 -0
  172. data/myapp/app/models/post.rb +0 -5
  173. data/myapp/app/views/layouts/application.html.erb +0 -14
  174. data/myapp/app/views/user_mailer/greetings.html.erb +0 -3
  175. data/myapp/app/views/work/index.html.erb +0 -1
  176. data/myapp/app/workers/hard_worker.rb +0 -9
  177. data/myapp/config/application.rb +0 -59
  178. data/myapp/config/boot.rb +0 -6
  179. data/myapp/config/database.yml +0 -25
  180. data/myapp/config/deploy.rb +0 -15
  181. data/myapp/config/environment.rb +0 -5
  182. data/myapp/config/environments/development.rb +0 -38
  183. data/myapp/config/environments/production.rb +0 -67
  184. data/myapp/config/environments/test.rb +0 -37
  185. data/myapp/config/initializers/backtrace_silencers.rb +0 -7
  186. data/myapp/config/initializers/inflections.rb +0 -15
  187. data/myapp/config/initializers/mime_types.rb +0 -5
  188. data/myapp/config/initializers/secret_token.rb +0 -7
  189. data/myapp/config/initializers/session_store.rb +0 -8
  190. data/myapp/config/initializers/sidekiq.rb +0 -6
  191. data/myapp/config/initializers/wrap_parameters.rb +0 -14
  192. data/myapp/config/locales/en.yml +0 -5
  193. data/myapp/config/routes.rb +0 -10
  194. data/myapp/config.ru +0 -4
  195. data/myapp/db/migrate/20120123214055_create_posts.rb +0 -10
  196. data/myapp/db/seeds.rb +0 -7
  197. data/myapp/lib/assets/.gitkeep +0 -0
  198. data/myapp/lib/tasks/.gitkeep +0 -0
  199. data/myapp/log/.gitkeep +0 -0
  200. data/myapp/script/rails +0 -6
  201. data/test/config.yml +0 -9
  202. data/test/fake_env.rb +0 -0
  203. data/test/helper.rb +0 -15
  204. data/test/test_cli.rb +0 -168
  205. data/test/test_client.rb +0 -105
  206. data/test/test_extensions.rb +0 -68
  207. data/test/test_manager.rb +0 -43
  208. data/test/test_middleware.rb +0 -92
  209. data/test/test_processor.rb +0 -32
  210. data/test/test_retry.rb +0 -83
  211. data/test/test_stats.rb +0 -78
  212. data/test/test_testing.rb +0 -65
  213. data/test/test_web.rb +0 -61
  214. data/web/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
  215. data/web/assets/images/bootstrap/glyphicons-halflings.png +0 -0
  216. data/web/assets/javascripts/vendor/bootstrap/bootstrap-alert.js +0 -91
  217. data/web/assets/javascripts/vendor/bootstrap/bootstrap-button.js +0 -98
  218. data/web/assets/javascripts/vendor/bootstrap/bootstrap-carousel.js +0 -154
  219. data/web/assets/javascripts/vendor/bootstrap/bootstrap-collapse.js +0 -136
  220. data/web/assets/javascripts/vendor/bootstrap/bootstrap-dropdown.js +0 -92
  221. data/web/assets/javascripts/vendor/bootstrap/bootstrap-modal.js +0 -210
  222. data/web/assets/javascripts/vendor/bootstrap/bootstrap-popover.js +0 -95
  223. data/web/assets/javascripts/vendor/bootstrap/bootstrap-scrollspy.js +0 -125
  224. data/web/assets/javascripts/vendor/bootstrap/bootstrap-tab.js +0 -130
  225. data/web/assets/javascripts/vendor/bootstrap/bootstrap-tooltip.js +0 -270
  226. data/web/assets/javascripts/vendor/bootstrap/bootstrap-transition.js +0 -51
  227. data/web/assets/javascripts/vendor/bootstrap/bootstrap-typeahead.js +0 -271
  228. data/web/assets/javascripts/vendor/bootstrap.js +0 -12
  229. data/web/assets/javascripts/vendor/jquery.js +0 -9266
  230. data/web/assets/stylesheets/vendor/bootstrap-responsive.css +0 -567
  231. data/web/assets/stylesheets/vendor/bootstrap.css +0 -3365
  232. data/web/views/index.slim +0 -62
  233. data/web/views/layout.slim +0 -24
  234. data/web/views/queue.slim +0 -11
@@ -1,38 +0,0 @@
1
- require 'sidekiq/util'
2
-
3
- module Sidekiq
4
- module Middleware
5
- module Server
6
- class ExceptionHandler
7
- include Util
8
- def call(*args)
9
- yield
10
- rescue => ex
11
- logger.warn ex
12
- logger.warn ex.backtrace.join("\n")
13
- send_to_airbrake(args[1], ex) if defined?(::Airbrake)
14
- send_to_exceptional(args[1], ex) if defined?(::Exceptional)
15
- send_to_exception_notifier(args[1], ex) if defined?(::ExceptionNotifier)
16
- raise
17
- end
18
-
19
- private
20
-
21
- def send_to_airbrake(msg, ex)
22
- ::Airbrake.notify(ex, :parameters => msg)
23
- end
24
-
25
- def send_to_exceptional(msg, ex)
26
- if ::Exceptional::Config.should_send_to_api?
27
- ::Exceptional.context(msg)
28
- ::Exceptional::Remote.error(::Exceptional::ExceptionData.new(ex))
29
- end
30
- end
31
-
32
- def send_to_exception_notifier(msg, ex)
33
- ::ExceptionNotifier::Notifier.background_exception_notification(ex, :data => { :message => msg })
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,24 +0,0 @@
1
- module Sidekiq
2
- module Middleware
3
- module Server
4
- class FailureJobs
5
- def call(*args)
6
- yield
7
- rescue => e
8
- data = {
9
- :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S %Z"),
10
- :payload => args[1],
11
- :exception => e.class.to_s,
12
- :error => e.to_s,
13
- :backtrace => e.backtrace,
14
- :worker => args[1]['class'],
15
- :queue => args[2]
16
- }
17
-
18
- Sidekiq.redis {|conn| conn.rpush(:failed, MultiJson.encode(data)) }
19
- raise
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,27 +0,0 @@
1
- module Sidekiq
2
- module Middleware
3
- module Server
4
- class Logging
5
- def call(*args)
6
- static = "#{args[0].class.to_s} MSG-#{args[0].object_id.to_s(36)}" if logger.info?
7
- start = Time.now
8
- logger.info { "#{static} start" }
9
- yield
10
- logger.info { "#{static} done: #{elapsed(start)} sec" }
11
- rescue
12
- logger.info { "#{static} fail: #{elapsed(start)} sec" }
13
- raise
14
- end
15
-
16
- def elapsed(start)
17
- (Time.now - start).to_f.round(3)
18
- end
19
-
20
- def logger
21
- Sidekiq::Util.logger
22
- end
23
- end
24
- end
25
- end
26
- end
27
-
@@ -1,59 +0,0 @@
1
- require 'sidekiq/retry'
2
-
3
- module Sidekiq
4
- module Middleware
5
- module Server
6
- ##
7
- # Automatically retry jobs that fail in Sidekiq.
8
- # A message looks like:
9
- #
10
- # { 'class' => 'HardWorker', 'args' => [1, 2, 'foo'] }
11
- #
12
- # We'll add a bit more data to the message to support retries:
13
- #
14
- # * 'queue' - the queue to use
15
- # * 'retry_count' - number of times we've retried so far.
16
- # * 'error_message' - the message from the exception
17
- # * 'error_class' - the exception class
18
- # * 'failed_at' - the first time it failed
19
- # * 'retried_at' - the last time it was retried
20
- #
21
- # We don't store the backtrace as that can add a lot of overhead
22
- # to the message and everyone is using Airbrake, right?
23
- class RetryJobs
24
- include Sidekiq::Util
25
- include Sidekiq::Retry
26
-
27
- def call(worker, msg, queue)
28
- yield
29
- rescue => e
30
- msg['queue'] = queue
31
- msg['error_message'] = e.message
32
- msg['error_class'] = e.class.name
33
- count = if msg['retry_count']
34
- msg['retried_at'] = Time.now.utc
35
- msg['retry_count'] += 1
36
- else
37
- msg['failed_at'] = Time.now.utc
38
- msg['retry_count'] = 0
39
- end
40
-
41
- if count <= MAX_COUNT
42
- delay = DELAY.call(count)
43
- logger.debug { "Failure! Retry #{count} in #{delay} seconds" }
44
- retry_at = Time.now.to_f + delay
45
- payload = MultiJson.encode(msg)
46
- Sidekiq.redis do |conn|
47
- conn.zadd('retry', retry_at.to_s, payload)
48
- end
49
- else
50
- # Goodbye dear message, you (re)tried your best I'm sure.
51
- logger.debug { "Dropping message after hitting the retry maximum: #{msg}" }
52
- end
53
- raise
54
- end
55
-
56
- end
57
- end
58
- end
59
- end
@@ -1,15 +0,0 @@
1
- module Sidekiq
2
- module Middleware
3
- module Server
4
- class UniqueJobs
5
- def call(*args)
6
- yield
7
- ensure
8
- json = MultiJson.encode(args[1])
9
- hash = Digest::MD5.hexdigest(json)
10
- Sidekiq.redis {|conn| conn.del(hash) }
11
- end
12
- end
13
- end
14
- end
15
- end
data/lib/sidekiq/retry.rb DELETED
@@ -1,57 +0,0 @@
1
- require 'sidekiq'
2
- require 'celluloid'
3
-
4
- module Sidekiq
5
- ##
6
- # Sidekiq's retry support assumes a typical development lifecycle:
7
- # 0. push some code changes with a bug in it
8
- # 1. bug causes message processing to fail, sidekiq's middleware captures
9
- # the message and pushes it onto a retry queue
10
- # 2. sidekiq retries messages in the retry queue multiple times with
11
- # an exponential delay, the message continues to fail
12
- # 3. after a few days, a developer deploys a fix. the message is
13
- # reprocessed successfully.
14
- # 4. if 3 never happens, sidekiq will eventually give up and throw the
15
- # message away.
16
- module Retry
17
-
18
- # delayed_job uses the same basic formula
19
- MAX_COUNT = 25
20
- DELAY = proc { |count| (count ** 4) + 15 }
21
- POLL_INTERVAL = 15
22
-
23
- ##
24
- # The Poller checks Redis every N seconds for messages in the retry
25
- # set have passed their retry timestamp and should be retried. If so, it
26
- # just pops the message back onto its original queue so the
27
- # workers can pick it up like any other message.
28
- class Poller
29
- include Celluloid
30
- include Sidekiq::Util
31
-
32
- def poll
33
- watchdog('retry poller thread died!') do
34
-
35
- Sidekiq.redis do |conn|
36
- # A message's "score" in Redis is the time at which it should be retried.
37
- # Just check Redis for the set of messages with a timestamp before now.
38
- messages = nil
39
- now = Time.now.to_f.to_s
40
- (messages, _) = conn.multi do
41
- conn.zrangebyscore('retry', '-inf', now)
42
- conn.zremrangebyscore('retry', '-inf', now)
43
- end
44
-
45
- messages.each do |message|
46
- logger.debug { "Retrying #{message}" }
47
- msg = MultiJson.decode(message)
48
- conn.rpush("queue:#{msg['queue']}", message)
49
- end
50
- end
51
-
52
- after(POLL_INTERVAL) { poll }
53
- end
54
- end
55
- end
56
- end
57
- end
data/lib/sidekiq/util.rb DELETED
@@ -1,61 +0,0 @@
1
- require 'time'
2
- require 'logger'
3
-
4
- module Sidekiq
5
- ##
6
- # This module is part of Sidekiq core and not intended for extensions.
7
- #
8
- module Util
9
-
10
- class Pretty < Logger::Formatter
11
- # Provide a call() method that returns the formatted message.
12
- def call(severity, time, program_name, message)
13
- "#{time.utc.iso8601} #{Process.pid} TID-#{Thread.current.object_id.to_s(36)} #{severity}: #{message}\n"
14
- end
15
- end
16
-
17
- def self.logger
18
- @logger ||= begin
19
- log = Logger.new(STDOUT)
20
- log.level = Logger::INFO
21
- log.formatter = Pretty.new
22
- log
23
- end
24
- end
25
-
26
- def self.logger=(log)
27
- @logger = (log ? log : Logger.new('/dev/null'))
28
- end
29
-
30
- def constantize(camel_cased_word)
31
- names = camel_cased_word.split('::')
32
- names.shift if names.empty? || names.first.empty?
33
-
34
- constant = Object
35
- names.each do |name|
36
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
37
- end
38
- constant
39
- end
40
-
41
- def watchdog(last_words)
42
- yield
43
- rescue => ex
44
- logger.error last_words
45
- logger.error ex
46
- logger.error ex.backtrace.join("\n")
47
- end
48
-
49
- def logger
50
- Sidekiq::Util.logger
51
- end
52
-
53
- def redis(&block)
54
- Sidekiq.redis(&block)
55
- end
56
-
57
- def process_id
58
- Process.pid
59
- end
60
- end
61
- end
@@ -1,37 +0,0 @@
1
- require 'sidekiq/client'
2
-
3
- module Sidekiq
4
-
5
- ##
6
- # Include this module in your worker class and you can easily create
7
- # asynchronous jobs:
8
- #
9
- # class HardWorker
10
- # include Sidekiq::Worker
11
- #
12
- # def perform(*args)
13
- # # do some work
14
- # end
15
- # end
16
- #
17
- # Then in your Rails app, you can do this:
18
- #
19
- # HardWorker.perform_async(1, 2, 3)
20
- #
21
- # Note that perform_async is a class method, perform is an instance method.
22
- module Worker
23
- def self.included(base)
24
- base.extend(ClassMethods)
25
- end
26
-
27
- module ClassMethods
28
- def perform_async(*args)
29
- Sidekiq::Client.push('class' => self.name, 'args' => args)
30
- end
31
-
32
- def queue(name)
33
- Sidekiq::Client.queue_mappings[self.name] = name.to_s
34
- end
35
- end
36
- end
37
- end
data/myapp/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- # See http://help.github.com/ignore-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
-
13
- # Ignore all logfiles and tempfiles.
14
- /log/*.log
15
- /tmp
data/myapp/Capfile DELETED
@@ -1,5 +0,0 @@
1
- load 'deploy'
2
- # Uncomment if you are using Rails' asset pipeline
3
- # load 'deploy/assets'
4
- Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
5
- load 'config/deploy' # remove this line to skip loading any of the default tasks
data/myapp/Gemfile DELETED
@@ -1,19 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- platforms :ruby do
4
- gem 'sqlite3'
5
- end
6
-
7
- platforms :jruby do
8
- gem 'jruby-openssl'
9
- gem 'activerecord-jdbcsqlite3-adapter'
10
- end
11
-
12
- gem 'rails', '3.2.2'
13
- gem 'sidekiq', :path => '..'
14
- gem 'capistrano'
15
-
16
- # sidekiq-web dependencies
17
- gem 'slim'
18
- gem 'sinatra'
19
- gem 'sprockets'
data/myapp/Gemfile.lock DELETED
@@ -1,143 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- sidekiq (0.10.0)
5
- celluloid
6
- connection_pool (~> 0.9.0)
7
- multi_json
8
- redis
9
- redis-namespace
10
-
11
- GEM
12
- remote: https://rubygems.org/
13
- specs:
14
- actionmailer (3.2.2)
15
- actionpack (= 3.2.2)
16
- mail (~> 2.4.0)
17
- actionpack (3.2.2)
18
- activemodel (= 3.2.2)
19
- activesupport (= 3.2.2)
20
- builder (~> 3.0.0)
21
- erubis (~> 2.7.0)
22
- journey (~> 1.0.1)
23
- rack (~> 1.4.0)
24
- rack-cache (~> 1.1)
25
- rack-test (~> 0.6.1)
26
- sprockets (~> 2.1.2)
27
- activemodel (3.2.2)
28
- activesupport (= 3.2.2)
29
- builder (~> 3.0.0)
30
- activerecord (3.2.2)
31
- activemodel (= 3.2.2)
32
- activesupport (= 3.2.2)
33
- arel (~> 3.0.2)
34
- tzinfo (~> 0.3.29)
35
- activerecord-jdbc-adapter (1.2.2)
36
- activerecord-jdbcsqlite3-adapter (1.2.2)
37
- activerecord-jdbc-adapter (~> 1.2.2)
38
- jdbc-sqlite3 (~> 3.7.2)
39
- activeresource (3.2.2)
40
- activemodel (= 3.2.2)
41
- activesupport (= 3.2.2)
42
- activesupport (3.2.2)
43
- i18n (~> 0.6)
44
- multi_json (~> 1.0)
45
- arel (3.0.2)
46
- bouncy-castle-java (1.5.0146.1)
47
- builder (3.0.0)
48
- capistrano (2.11.2)
49
- highline
50
- net-scp (>= 1.0.0)
51
- net-sftp (>= 2.0.0)
52
- net-ssh (>= 2.0.14)
53
- net-ssh-gateway (>= 1.1.0)
54
- celluloid (0.9.0)
55
- connection_pool (0.9.0)
56
- erubis (2.7.0)
57
- highline (1.6.11)
58
- hike (1.2.1)
59
- i18n (0.6.0)
60
- jdbc-sqlite3 (3.7.2)
61
- journey (1.0.3)
62
- jruby-openssl (0.7.6.1)
63
- bouncy-castle-java (>= 1.5.0146.1)
64
- json (1.6.5)
65
- json (1.6.5-java)
66
- mail (2.4.1)
67
- i18n (>= 0.4.0)
68
- mime-types (~> 1.16)
69
- treetop (~> 1.4.8)
70
- mime-types (1.17.2)
71
- multi_json (1.1.0)
72
- net-scp (1.0.4)
73
- net-ssh (>= 1.99.1)
74
- net-sftp (2.0.5)
75
- net-ssh (>= 2.0.9)
76
- net-ssh (2.3.0)
77
- net-ssh-gateway (1.1.0)
78
- net-ssh (>= 1.99.1)
79
- polyglot (0.3.3)
80
- rack (1.4.1)
81
- rack-cache (1.1)
82
- rack (>= 0.4)
83
- rack-protection (1.2.0)
84
- rack
85
- rack-ssl (1.3.2)
86
- rack
87
- rack-test (0.6.1)
88
- rack (>= 1.0)
89
- rails (3.2.2)
90
- actionmailer (= 3.2.2)
91
- actionpack (= 3.2.2)
92
- activerecord (= 3.2.2)
93
- activeresource (= 3.2.2)
94
- activesupport (= 3.2.2)
95
- bundler (~> 1.0)
96
- railties (= 3.2.2)
97
- railties (3.2.2)
98
- actionpack (= 3.2.2)
99
- activesupport (= 3.2.2)
100
- rack-ssl (~> 1.3.2)
101
- rake (>= 0.8.7)
102
- rdoc (~> 3.4)
103
- thor (~> 0.14.6)
104
- rake (0.9.2.2)
105
- rdoc (3.12)
106
- json (~> 1.4)
107
- redis (2.2.2)
108
- redis-namespace (1.1.0)
109
- redis (< 3.0.0)
110
- sinatra (1.3.2)
111
- rack (~> 1.3, >= 1.3.6)
112
- rack-protection (~> 1.2)
113
- tilt (~> 1.3, >= 1.3.3)
114
- slim (1.1.1)
115
- temple (~> 0.4.0)
116
- tilt (~> 1.3.2)
117
- sprockets (2.1.2)
118
- hike (~> 1.2)
119
- rack (~> 1.0)
120
- tilt (~> 1.1, != 1.3.0)
121
- sqlite3 (1.3.5)
122
- temple (0.4.0)
123
- thor (0.14.6)
124
- tilt (1.3.3)
125
- treetop (1.4.10)
126
- polyglot
127
- polyglot (>= 0.3.1)
128
- tzinfo (0.3.32)
129
-
130
- PLATFORMS
131
- java
132
- ruby
133
-
134
- DEPENDENCIES
135
- activerecord-jdbcsqlite3-adapter
136
- capistrano
137
- jruby-openssl
138
- rails (= 3.2.2)
139
- sidekiq!
140
- sinatra
141
- slim
142
- sprockets
143
- sqlite3
data/myapp/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- # Add your own tasks in files placed in lib/tasks ending in .rake,
3
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
-
5
- require File.expand_path('../config/application', __FILE__)
6
-
7
- Myapp::Application.load_tasks
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,38 +0,0 @@
1
- class WorkController < ApplicationController
2
- def index
3
- @count = rand(100)
4
- puts "Adding #{@count} jobs"
5
- @count.times do |x|
6
- HardWorker.perform_async('bubba', 0.01, x)
7
- end
8
- end
9
-
10
- def email
11
- UserMailer.delay.greetings(Time.now)
12
- render :nothing => true
13
- end
14
-
15
- def long
16
- 50.times do |x|
17
- HardWorker.perform_async('bob', 10, x)
18
- end
19
- render :text => 'enqueued'
20
- end
21
-
22
- def crash
23
- HardWorker.perform_async('crash', 1, Time.now.to_f)
24
- render :text => 'enqueued'
25
- end
26
-
27
- def delayed_post
28
- p = Post.first
29
- unless p
30
- p = Post.create!(:title => "Title!", :body => 'Body!')
31
- p2 = Post.create!(:title => "Other!", :body => 'Second Body!')
32
- else
33
- p2 = Post.second
34
- end
35
- p.delay.long_method(p2)
36
- render :nothing => true
37
- end
38
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
File without changes
@@ -1,9 +0,0 @@
1
- class UserMailer < ActionMailer::Base
2
- default from: "sidekiq@example.com"
3
-
4
- def greetings(now)
5
- @now = now
6
- @hostname = `hostname`.strip
7
- mail(:to => 'mperham@gmail.com', :subject => 'Ahoy Matey!')
8
- end
9
- end
File without changes
@@ -1,5 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- def long_method(other_post)
3
- puts "Running long method with #{self.id} and #{other_post.id}"
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Myapp</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- <p>
2
- Hi Mike, it's <%= @now %> and I'm at <%= @hostname %>.
3
- </p>
@@ -1 +0,0 @@
1
- Added <%= @count %> jobs!
@@ -1,9 +0,0 @@
1
- class HardWorker
2
- include Sidekiq::Worker
3
-
4
- def perform(name, count, salt)
5
- raise name if name == 'crash'
6
- print "#{Time.now}\n"
7
- sleep count
8
- end
9
- end
@@ -1,59 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- if defined?(Bundler)
6
- # If you precompile assets before deploying to production, use this line
7
- Bundler.require(*Rails.groups(:assets => %w(development test)))
8
- # If you want your assets lazily compiled in production, use this line
9
- # Bundler.require(:default, :assets, Rails.env)
10
- end
11
-
12
- module Myapp
13
- class Application < Rails::Application
14
- # Settings in config/environments/* take precedence over those specified here.
15
- # Application configuration should go into files in config/initializers
16
- # -- all .rb files in that directory are automatically loaded.
17
-
18
- # Custom directories with classes and modules you want to be autoloadable.
19
- # config.autoload_paths += %W(#{config.root}/extras)
20
-
21
- # Only load the plugins named here, in the order given (default is alphabetical).
22
- # :all can be used as a placeholder for all plugins not explicitly named.
23
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
-
25
- # Activate observers that should always be running.
26
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
-
28
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
- # config.time_zone = 'Central Time (US & Canada)'
31
-
32
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
- # config.i18n.default_locale = :de
35
-
36
- # Configure the default encoding used in templates for Ruby 1.9.
37
- config.encoding = "utf-8"
38
-
39
- # Configure sensitive parameters which will be filtered from the log file.
40
- config.filter_parameters += [:password]
41
-
42
- # Use SQL instead of Active Record's schema dumper when creating the database.
43
- # This is necessary if your schema can't be completely dumped by the schema dumper,
44
- # like if you have constraints or database-specific column types
45
- # config.active_record.schema_format = :sql
46
-
47
- # Enforce whitelist mode for mass assignment.
48
- # This will create an empty whitelist of attributes available for mass-assignment for all models
49
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
50
- # parameters by using an attr_accessible or attr_protected declaration.
51
- # config.active_record.whitelist_attributes = true
52
-
53
- # Enable the asset pipeline
54
- config.assets.enabled = true
55
-
56
- # Version of your assets, change this if you want to expire all your assets
57
- config.assets.version = '1.0'
58
- end
59
- end