integration_pal 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +81 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/config/integration_pal_manifest.js +2 -0
  6. data/app/assets/javascripts/integration_pal/application.js +13 -0
  7. data/app/assets/stylesheets/integration_pal/application.css +27 -0
  8. data/app/controllers/integration_pal/api/v1/jobs_controller.rb +29 -0
  9. data/app/controllers/integration_pal/api_controller.rb +16 -0
  10. data/app/controllers/integration_pal/application_controller.rb +8 -0
  11. data/app/controllers/integration_pal/jobs_controller.rb +62 -0
  12. data/app/controllers/integration_pal/workers_controller.rb +62 -0
  13. data/app/helpers/integration_pal/application_helper.rb +4 -0
  14. data/app/jobs/integration_pal/application_job.rb +4 -0
  15. data/app/mailers/integration_pal/application_mailer.rb +6 -0
  16. data/app/models/integration_pal/application_record.rb +5 -0
  17. data/app/models/integration_pal/job.rb +22 -0
  18. data/app/models/integration_pal/worker.rb +29 -0
  19. data/app/views/integration_pal/jobs/_form.html.erb +32 -0
  20. data/app/views/integration_pal/jobs/edit.html.erb +6 -0
  21. data/app/views/integration_pal/jobs/index.html.erb +25 -0
  22. data/app/views/integration_pal/jobs/new.html.erb +5 -0
  23. data/app/views/integration_pal/jobs/show.html.erb +19 -0
  24. data/app/views/integration_pal/workers/_form.html.erb +48 -0
  25. data/app/views/integration_pal/workers/edit.html.erb +6 -0
  26. data/app/views/integration_pal/workers/index.html.erb +32 -0
  27. data/app/views/integration_pal/workers/new.html.erb +5 -0
  28. data/app/views/integration_pal/workers/show.html.erb +14 -0
  29. data/app/views/layouts/_navbar.html.erb +24 -0
  30. data/app/views/layouts/integration_pal/application.html.erb +15 -0
  31. data/config/initializers/encryption.rb +2 -0
  32. data/config/initializers/jobs.rb +4 -0
  33. data/config/routes.rb +11 -0
  34. data/db/migrate/20170524203831_create_integration_pal_workers.rb +14 -0
  35. data/db/migrate/20170525153603_create_integration_pal_jobs.rb +14 -0
  36. data/lib/integration_pal/engine.rb +25 -0
  37. data/lib/integration_pal/version.rb +3 -0
  38. data/lib/integration_pal.rb +5 -0
  39. data/lib/tasks/integration_pal_tasks.rake +4 -0
  40. data/spec/controllers/integration_pal/api/v1/jobs_controller_spec.rb +74 -0
  41. data/spec/controllers/integration_pal/jobs_controller_spec.rb +107 -0
  42. data/spec/controllers/integration_pal/workers_controller_spec.rb +107 -0
  43. data/spec/dummy/Rakefile +6 -0
  44. data/spec/dummy/app/assets/config/manifest.js +5 -0
  45. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  46. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  47. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  48. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  49. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  50. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  51. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  52. data/spec/dummy/app/jobs/application_job.rb +2 -0
  53. data/spec/dummy/app/jobs/test_job.rb +7 -0
  54. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  55. data/spec/dummy/app/models/application_record.rb +3 -0
  56. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  57. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  58. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  59. data/spec/dummy/bin/bundle +3 -0
  60. data/spec/dummy/bin/rails +4 -0
  61. data/spec/dummy/bin/rake +4 -0
  62. data/spec/dummy/bin/setup +38 -0
  63. data/spec/dummy/bin/update +29 -0
  64. data/spec/dummy/bin/yarn +11 -0
  65. data/spec/dummy/config/application.rb +18 -0
  66. data/spec/dummy/config/boot.rb +5 -0
  67. data/spec/dummy/config/cable.yml +10 -0
  68. data/spec/dummy/config/database.yml +18 -0
  69. data/spec/dummy/config/environment.rb +5 -0
  70. data/spec/dummy/config/environments/development.rb +54 -0
  71. data/spec/dummy/config/environments/production.rb +91 -0
  72. data/spec/dummy/config/environments/test.rb +42 -0
  73. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  74. data/spec/dummy/config/initializers/assets.rb +14 -0
  75. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  76. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  77. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  78. data/spec/dummy/config/initializers/inflections.rb +16 -0
  79. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  80. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  81. data/spec/dummy/config/locales/en.yml +33 -0
  82. data/spec/dummy/config/puma.rb +56 -0
  83. data/spec/dummy/config/routes.rb +3 -0
  84. data/spec/dummy/config/secrets.yml +32 -0
  85. data/spec/dummy/config/spring.rb +6 -0
  86. data/spec/dummy/config.ru +5 -0
  87. data/spec/dummy/db/schema.rb +40 -0
  88. data/spec/dummy/log/development.log +38 -0
  89. data/spec/dummy/log/test.log +7232 -0
  90. data/spec/dummy/package.json +5 -0
  91. data/spec/dummy/public/404.html +67 -0
  92. data/spec/dummy/public/422.html +67 -0
  93. data/spec/dummy/public/500.html +66 -0
  94. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  95. data/spec/dummy/public/apple-touch-icon.png +0 -0
  96. data/spec/dummy/public/favicon.ico +0 -0
  97. data/spec/factories/integration_pal_jobs.rb +8 -0
  98. data/spec/factories/integration_pal_workers.rb +9 -0
  99. data/spec/models/integration_pal/job_spec.rb +21 -0
  100. data/spec/models/integration_pal/worker_spec.rb +29 -0
  101. data/spec/rails_helper.rb +61 -0
  102. data/spec/spec_helper.rb +100 -0
  103. metadata +349 -0
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at http://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,56 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ threads threads_count, threads_count
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT") { 3000 }
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ environment ENV.fetch("RAILS_ENV") { "development" }
17
+
18
+ # Specifies the number of `workers` to boot in clustered mode.
19
+ # Workers are forked webserver processes. If using threads and workers together
20
+ # the concurrency of the application would be max `threads` * `workers`.
21
+ # Workers do not work on JRuby or Windows (both of which do not support
22
+ # processes).
23
+ #
24
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25
+
26
+ # Use the `preload_app!` method when specifying a `workers` number.
27
+ # This directive tells Puma to first boot the application and load code
28
+ # before forking the application. This takes advantage of Copy On Write
29
+ # process behavior so workers use less memory. If you use this option
30
+ # you need to make sure to reconnect any threads in the `on_worker_boot`
31
+ # block.
32
+ #
33
+ # preload_app!
34
+
35
+ # If you are preloading your application and using Active Record, it's
36
+ # recommended that you close any connections to the database before workers
37
+ # are forked to prevent connection leakage.
38
+ #
39
+ # before_fork do
40
+ # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41
+ # end
42
+
43
+ # The code in the `on_worker_boot` will be called if you are using
44
+ # clustered mode by specifying a number of `workers`. After each worker
45
+ # process is booted, this block will be run. If you are using the `preload_app!`
46
+ # option, you will want to use this block to reconnect to any threads
47
+ # or connections that may have been created at application boot, as Ruby
48
+ # cannot share connections between processes.
49
+ #
50
+ # on_worker_boot do
51
+ # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52
+ # end
53
+ #
54
+
55
+ # Allow puma to be restarted by `rails restart` command.
56
+ plugin :tmp_restart
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount IntegrationPal::Engine => "/integration_pal"
3
+ end
@@ -0,0 +1,32 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rails secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ # Shared secrets are available across all environments.
14
+
15
+ # shared:
16
+ # api_key: a1B2c3D4e5F6
17
+
18
+ # Environmental secrets are only available for that specific environment.
19
+
20
+ development:
21
+ secret_key_base: 7c830920b703101394cf284d66b725156ffda401cee0601cddae20c575fb7c98623014a9e4a256418ab740d42c9a95dc45b02860d4940242d815b950b6aeb5ac
22
+
23
+ test:
24
+ secret_key_base: 591251335929df640bb9a05b6d9bcc1e4142870f10fb096c973da27c8110e639bf4212d64fc6177c0ebfee924bddf936a9a64cfe4616437c3e7fe986b9280a79
25
+
26
+ # Do not keep production secrets in the unencrypted secrets file.
27
+ # Instead, either read values from the environment.
28
+ # Or, use `bin/rails secrets:setup` to configure encrypted secrets
29
+ # and move the `production:` environment over there.
30
+
31
+ production:
32
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,6 @@
1
+ %w(
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ).each { |path| Spring.watch(path) }
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,40 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20170525153603) do
14
+
15
+ # These are extensions that must be enabled in order to support this database
16
+ enable_extension "plpgsql"
17
+
18
+ create_table "integration_pal_jobs", force: :cascade do |t|
19
+ t.text "job_params"
20
+ t.string "status"
21
+ t.datetime "started_at"
22
+ t.datetime "finished_at"
23
+ t.string "progress"
24
+ t.integer "worker_id"
25
+ t.datetime "created_at", null: false
26
+ t.datetime "updated_at", null: false
27
+ end
28
+
29
+ create_table "integration_pal_workers", force: :cascade do |t|
30
+ t.string "name"
31
+ t.string "access_id"
32
+ t.string "secret_key"
33
+ t.string "job_type"
34
+ t.text "encrypted_settings"
35
+ t.string "encrypted_settings_iv"
36
+ t.datetime "created_at", null: false
37
+ t.datetime "updated_at", null: false
38
+ end
39
+
40
+ end
@@ -0,0 +1,38 @@
1
+  (21.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2
+  (4.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3
+  (0.2ms) SELECT pg_try_advisory_lock(3791006887383934680);
4
+  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
5
+ Migrating to CreateIntegrationPalWorkers (20170524203831)
6
+  (0.1ms) BEGIN
7
+  (5.0ms) CREATE TABLE "integration_pal_workers" ("id" bigserial primary key, "name" character varying, "access_id" character varying, "secret_key" character varying, "job_type" character varying, "encrypted_settings" text, "encrypted_settings_iv" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
8
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170524203831"]]
9
+  (0.4ms) COMMIT
10
+ Migrating to CreateIntegrationPalJobs (20170525153603)
11
+  (0.2ms) BEGIN
12
+  (6.3ms) CREATE TABLE "integration_pal_jobs" ("id" bigserial primary key, "job_params" text, "status" character varying, "started_at" timestamp, "finished_at" timestamp, "progress" character varying, "worker_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
13
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170525153603"]]
14
+  (0.5ms) COMMIT
15
+ ActiveRecord::InternalMetadata Load (1.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
16
+  (0.2ms) BEGIN
17
+ SQL (0.5ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2017-05-25 21:27:34.579475"], ["updated_at", "2017-05-25 21:27:34.579475"]]
18
+  (0.4ms) COMMIT
19
+  (0.3ms) SELECT pg_advisory_unlock(3791006887383934680)
20
+  (0.2ms) SELECT pg_try_advisory_lock(3791006887383934680);
21
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
22
+ ActiveRecord::InternalMetadata Load (1.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
23
+  (0.2ms) BEGIN
24
+  (0.1ms) COMMIT
25
+  (0.3ms) SELECT pg_advisory_unlock(3791006887383934680)
26
+  (0.2ms) SELECT pg_try_advisory_lock(3791006887383934680);
27
+  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
28
+ ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
29
+  (0.1ms) BEGIN
30
+  (0.1ms) COMMIT
31
+  (0.2ms) SELECT pg_advisory_unlock(3791006887383934680)
32
+  (0.2ms) SELECT pg_try_advisory_lock(3791006887383934680);
33
+  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
34
+ ActiveRecord::InternalMetadata Load (1.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
35
+  (0.1ms) BEGIN
36
+  (0.1ms) COMMIT
37
+  (0.2ms) SELECT pg_advisory_unlock(3791006887383934680)
38
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC