kafka_command 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/.circleci/config.yml +179 -0
- data/.env +1 -0
- data/.env.test +1 -0
- data/.gitignore +41 -0
- data/.rspec +1 -0
- data/.rubocop.yml +12 -0
- data/.ruby-version +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +194 -0
- data/LICENSE +21 -0
- data/README.md +138 -0
- data/Rakefile +34 -0
- data/app/assets/config/manifest.js +3 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/kafka_command/cluster_view.png +0 -0
- data/app/assets/images/kafka_command/kafka.png +0 -0
- data/app/assets/images/kafka_command/topic_view.png +0 -0
- data/app/assets/javascripts/kafka_command/application.js +14 -0
- data/app/assets/stylesheets/kafka_command/application.css +27 -0
- data/app/assets/stylesheets/kafka_command/clusters.css +8 -0
- data/app/assets/stylesheets/kafka_command/topics.css +3 -0
- data/app/channels/application_cable/channel.rb +6 -0
- data/app/channels/application_cable/connection.rb +6 -0
- data/app/controllers/kafka_command/application_controller.rb +96 -0
- data/app/controllers/kafka_command/brokers_controller.rb +26 -0
- data/app/controllers/kafka_command/clusters_controller.rb +46 -0
- data/app/controllers/kafka_command/consumer_groups_controller.rb +44 -0
- data/app/controllers/kafka_command/topics_controller.rb +187 -0
- data/app/helpers/kafka_command/application_helper.rb +29 -0
- data/app/helpers/kafka_command/consumer_group_helper.rb +13 -0
- data/app/jobs/application_job.rb +6 -0
- data/app/mailers/application_mailer.rb +8 -0
- data/app/models/kafka_command/broker.rb +47 -0
- data/app/models/kafka_command/client.rb +102 -0
- data/app/models/kafka_command/cluster.rb +172 -0
- data/app/models/kafka_command/consumer_group.rb +142 -0
- data/app/models/kafka_command/consumer_group_partition.rb +23 -0
- data/app/models/kafka_command/group_member.rb +18 -0
- data/app/models/kafka_command/partition.rb +36 -0
- data/app/models/kafka_command/topic.rb +153 -0
- data/app/views/kafka_command/brokers/index.html.erb +38 -0
- data/app/views/kafka_command/clusters/_tabs.html.erb +9 -0
- data/app/views/kafka_command/clusters/index.html.erb +54 -0
- data/app/views/kafka_command/clusters/new.html.erb +115 -0
- data/app/views/kafka_command/configuration_error.html.erb +1 -0
- data/app/views/kafka_command/consumer_groups/index.html.erb +32 -0
- data/app/views/kafka_command/consumer_groups/show.html.erb +115 -0
- data/app/views/kafka_command/shared/_alert.html.erb +13 -0
- data/app/views/kafka_command/shared/_search_bar.html.erb +31 -0
- data/app/views/kafka_command/shared/_title.html.erb +6 -0
- data/app/views/kafka_command/topics/_form_fields.html.erb +49 -0
- data/app/views/kafka_command/topics/edit.html.erb +17 -0
- data/app/views/kafka_command/topics/index.html.erb +46 -0
- data/app/views/kafka_command/topics/new.html.erb +36 -0
- data/app/views/kafka_command/topics/show.html.erb +126 -0
- data/app/views/layouts/kafka_command/application.html.erb +50 -0
- data/bin/rails +16 -0
- data/config/initializers/kafka.rb +13 -0
- data/config/initializers/kafka_command.rb +11 -0
- data/config/routes.rb +11 -0
- data/docker-compose.yml +18 -0
- data/kafka_command.gemspec +27 -0
- data/lib/assets/.keep +0 -0
- data/lib/core_extensions/kafka/broker/attr_readers.rb +11 -0
- data/lib/core_extensions/kafka/broker_pool/attr_readers.rb +11 -0
- data/lib/core_extensions/kafka/client/attr_readers.rb +11 -0
- data/lib/core_extensions/kafka/cluster/attr_readers.rb +11 -0
- data/lib/core_extensions/kafka/protocol/metadata_response/partition_metadata/attr_readers.rb +15 -0
- data/lib/kafka_command/configuration.rb +150 -0
- data/lib/kafka_command/engine.rb +11 -0
- data/lib/kafka_command/errors.rb +6 -0
- data/lib/kafka_command/version.rb +5 -0
- data/lib/kafka_command.rb +13 -0
- data/lib/tasks/.keep +0 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +19 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +61 -0
- data/spec/dummy/config/environments/production.rb +94 -0
- data/spec/dummy/config/environments/test.rb +46 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/kafka_command.yml +18 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/ssl/test_ca_cert +1 -0
- data/spec/dummy/config/ssl/test_client_cert +1 -0
- data/spec/dummy/config/ssl/test_client_cert_key +1 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/schema.rb +42 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/hey.log +0 -0
- data/spec/dummy/log/test.log +2227 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/examples.txt +165 -0
- data/spec/fast_helper.rb +20 -0
- data/spec/fixtures/files/kafka_command_sasl.yml +10 -0
- data/spec/fixtures/files/kafka_command_ssl.yml +10 -0
- data/spec/fixtures/files/kafka_command_ssl_file_paths.yml +11 -0
- data/spec/fixtures/files/kafka_command_staging.yml +8 -0
- data/spec/lib/kafka_command/configuration_spec.rb +311 -0
- data/spec/models/kafka_command/broker_spec.rb +83 -0
- data/spec/models/kafka_command/client_spec.rb +306 -0
- data/spec/models/kafka_command/cluster_spec.rb +163 -0
- data/spec/models/kafka_command/consumer_group_partition_spec.rb +43 -0
- data/spec/models/kafka_command/consumer_group_spec.rb +236 -0
- data/spec/models/kafka_command/partition_spec.rb +95 -0
- data/spec/models/kafka_command/topic_spec.rb +311 -0
- data/spec/rails_helper.rb +63 -0
- data/spec/requests/json/brokers_spec.rb +50 -0
- data/spec/requests/json/clusters_spec.rb +58 -0
- data/spec/requests/json/consumer_groups_spec.rb +139 -0
- data/spec/requests/json/topics_spec.rb +274 -0
- data/spec/spec_helper.rb +109 -0
- data/spec/support/factory_bot.rb +5 -0
- data/spec/support/json_helper.rb +13 -0
- data/spec/support/kafka_helper.rb +93 -0
- metadata +326 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'core_extensions/kafka/broker/attr_readers'
|
|
4
|
+
require 'core_extensions/kafka/broker_pool/attr_readers'
|
|
5
|
+
require 'core_extensions/kafka/client/attr_readers'
|
|
6
|
+
require 'core_extensions/kafka/cluster/attr_readers'
|
|
7
|
+
require 'core_extensions/kafka/protocol/metadata_response/partition_metadata/attr_readers'
|
|
8
|
+
|
|
9
|
+
Kafka::Broker.include CoreExtensions::Kafka::Broker::AttrReaders
|
|
10
|
+
Kafka::BrokerPool.include CoreExtensions::Kafka::BrokerPool::AttrReaders
|
|
11
|
+
Kafka::Client.include CoreExtensions::Kafka::Client::AttrReaders
|
|
12
|
+
Kafka::Cluster.include CoreExtensions::Kafka::Cluster::AttrReaders
|
|
13
|
+
Kafka::Protocol::MetadataResponse::PartitionMetadata.include CoreExtensions::Kafka::Protocol::MetadataResponse::PartitionMetadata::AttrReaders
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'yaml'
|
|
4
|
+
|
|
5
|
+
config_file_path = "#{Rails.root}/config/kafka_command.yml"
|
|
6
|
+
|
|
7
|
+
if File.exists?(config_file_path)
|
|
8
|
+
KafkaCommand::Configuration.load!(config_file_path)
|
|
9
|
+
else
|
|
10
|
+
puts 'kafka_command.yml not found. KafkaCommand not configured via a yml file.'
|
|
11
|
+
end
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
KafkaCommand::Engine.routes.draw do
|
|
4
|
+
root 'clusters#index'
|
|
5
|
+
|
|
6
|
+
resources :clusters, only: [:index, :show] do
|
|
7
|
+
resources :brokers, only: [:index, :show]
|
|
8
|
+
resources :topics, id: /([^\/])+?/, format: /html|json/
|
|
9
|
+
resources :consumer_groups, only: [:index, :show], id: /([^\/])+?/, format: /html|json/
|
|
10
|
+
end
|
|
11
|
+
end
|
data/docker-compose.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
version: '3'
|
|
2
|
+
services:
|
|
3
|
+
zookeeper:
|
|
4
|
+
image: wurstmeister/zookeeper
|
|
5
|
+
ports:
|
|
6
|
+
- "2181:2181"
|
|
7
|
+
kafka:
|
|
8
|
+
depends_on:
|
|
9
|
+
- zookeeper
|
|
10
|
+
image: wurstmeister/kafka:2.12-2.1.0
|
|
11
|
+
ports:
|
|
12
|
+
- "9092:9092"
|
|
13
|
+
environment:
|
|
14
|
+
KAFKA_ADVERTISED_HOST_NAME: localhost
|
|
15
|
+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
|
16
|
+
KAFKA_DELETE_TOPIC_ENABLE: 'true'
|
|
17
|
+
volumes:
|
|
18
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
$:.push File.expand_path('lib', __dir__)
|
|
4
|
+
|
|
5
|
+
# Maintain your gem's version:
|
|
6
|
+
require 'kafka_command/version'
|
|
7
|
+
|
|
8
|
+
# Describe your gem and declare its dependencies:
|
|
9
|
+
Gem::Specification.new do |s|
|
|
10
|
+
s.name = 'kafka_command'
|
|
11
|
+
s.version = KafkaCommand::VERSION
|
|
12
|
+
s.authors = ['jasondoc3']
|
|
13
|
+
s.email = ['jasondoc3@gmail.com']
|
|
14
|
+
s.homepage = 'https://github.com/jasondoc3/kafka_command'
|
|
15
|
+
s.summary = 'A simple Kafka management UI.'
|
|
16
|
+
s.description = 'A simple Kafka management UI.'
|
|
17
|
+
s.license = 'MIT'
|
|
18
|
+
|
|
19
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
20
|
+
s.bindir = 'exe'
|
|
21
|
+
s.require_paths = ['lib']
|
|
22
|
+
s.test_files = Dir['spec/**/*']
|
|
23
|
+
|
|
24
|
+
s.add_dependency 'rails', '>= 4'
|
|
25
|
+
s.add_dependency 'ruby-kafka', '> 0.6.3'
|
|
26
|
+
s.add_dependency 'rails-ujs'
|
|
27
|
+
end
|
data/lib/assets/.keep
ADDED
|
File without changes
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KafkaCommand
|
|
4
|
+
def self.config=(config_hash)
|
|
5
|
+
@config ||= Configuration.new(config_hash)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.config
|
|
9
|
+
@config
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class ConfigurationError < StandardError; end
|
|
13
|
+
class Configuration
|
|
14
|
+
HOST_REGEX = /[^\:]+:[0-9]{1,5}/
|
|
15
|
+
attr_reader :config, :clusters, :errors
|
|
16
|
+
|
|
17
|
+
CLUSTER_KEYS = %w(
|
|
18
|
+
protocol
|
|
19
|
+
description
|
|
20
|
+
version
|
|
21
|
+
seed_brokers
|
|
22
|
+
ssl_ca_cert
|
|
23
|
+
ssl_ca_cert_file_path
|
|
24
|
+
ssl_client_cert
|
|
25
|
+
ssl_client_cert_file_path
|
|
26
|
+
ssl_client_cert_key
|
|
27
|
+
ssl_client_cert_key_file_path
|
|
28
|
+
sasl_scram_username
|
|
29
|
+
sasl_scram_password
|
|
30
|
+
socket_timeout
|
|
31
|
+
connect_timeout
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def initialize(config_hash)
|
|
35
|
+
@config = config_hash[ENV['RAILS_ENV']]
|
|
36
|
+
@clusters = config['clusters'] if config.present?
|
|
37
|
+
@errors = []
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid?
|
|
41
|
+
@errors = []
|
|
42
|
+
|
|
43
|
+
if config.blank?
|
|
44
|
+
errors << 'No config specified for environment'
|
|
45
|
+
return false
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
validate!
|
|
49
|
+
errors.none?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def invalid?
|
|
53
|
+
!valid?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.parse_yaml(file_path)
|
|
57
|
+
YAML.load(ERB.new(File.read(file_path)).result(binding))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.load!(file_path)
|
|
61
|
+
KafkaCommand.config = parse_yaml(file_path)
|
|
62
|
+
|
|
63
|
+
if KafkaCommand.config.invalid?
|
|
64
|
+
puts "KafkaCommand improperly configured. #{KafkaCommand.config.errors}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
def validate!
|
|
71
|
+
validate_clusters
|
|
72
|
+
rescue => e
|
|
73
|
+
errors << 'Kafka Command is configured incorrectly'
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def validate_clusters
|
|
77
|
+
if clusters.blank?
|
|
78
|
+
errors << 'Cluster must be provided'
|
|
79
|
+
return
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
clusters.each do |_, cluster_hash|
|
|
83
|
+
validate_cluster(cluster_hash)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def validate_cluster(cluster)
|
|
88
|
+
cluster.keys.each do |key|
|
|
89
|
+
unless CLUSTER_KEYS.include?(key)
|
|
90
|
+
errors << "Invalid cluster option, #{key}"
|
|
91
|
+
return
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
seed_brokers = cluster['seed_brokers']
|
|
96
|
+
seed_brokers = seed_brokers.split(',') if seed_brokers.is_a?(String)
|
|
97
|
+
|
|
98
|
+
if seed_brokers&.compact.blank?
|
|
99
|
+
errors << 'Must specify a list of seed brokers'
|
|
100
|
+
return
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
seed_brokers.each(&method(:validate_broker))
|
|
104
|
+
validate_ssl(cluster)
|
|
105
|
+
validate_sasl(cluster)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def validate_broker(broker)
|
|
109
|
+
unless broker&.match?(HOST_REGEX)
|
|
110
|
+
errors << 'Broker must be a valid host/port combination'
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def validate_ssl(cluster)
|
|
115
|
+
ca_cert = certificate_authority(cluster)
|
|
116
|
+
client_cert = client_certificate(cluster)
|
|
117
|
+
client_cert_key = client_certificate_key(cluster)
|
|
118
|
+
|
|
119
|
+
if ca_cert
|
|
120
|
+
if client_cert && !client_cert_key
|
|
121
|
+
errors << 'Initialized with `ssl_client_cert` but no `ssl_client_cert_key`. Please provide both.'
|
|
122
|
+
elsif !client_cert && client_cert_key
|
|
123
|
+
errors << 'Initialized with `ssl_client_cert_key`, but no `ssl_client_cert`. Please provide both.'
|
|
124
|
+
end
|
|
125
|
+
elsif client_cert || client_cert_key
|
|
126
|
+
errors << 'Cannot provide client certificate/key without a certificate authority'
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def validate_sasl(cluster)
|
|
131
|
+
if cluster['sasl_scram_username'].present? && cluster['sasl_scram_password'].blank?
|
|
132
|
+
errors << 'Initialized with `sasl_scram_username` but no `sasl_scram_password`. Please provide both.'
|
|
133
|
+
elsif cluster['sasl_scram_username'].blank? && cluster['sasl_scram_password'].present?
|
|
134
|
+
errors << 'Initialized with `sasl_scram_password` but no `sasl_scram_username`. Please provide both.'
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def certificate_authority(cluster)
|
|
139
|
+
cluster['ssl_ca_cert'] || cluster['ssl_ca_cert_file_path']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def client_certificate(cluster)
|
|
143
|
+
cluster['ssl_client_cert'] || cluster['ssl_client_cert_file_path']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def client_certificate_key(cluster)
|
|
147
|
+
cluster['ssl_client_cert_key'] || cluster['ssl_client_cert_key_file_path']
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'kafka_command/engine'
|
|
4
|
+
require 'kafka'
|
|
5
|
+
require 'kafka_command/configuration'
|
|
6
|
+
require 'kafka_command/errors'
|
|
7
|
+
|
|
8
|
+
if defined?(Rails) && Rails::VERSION::MAJOR < 5
|
|
9
|
+
require 'rails-ujs'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module KafkaCommand
|
|
13
|
+
end
|
data/lib/tasks/.keep
ADDED
|
File without changes
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require rails-ujs
|
|
14
|
+
//= require activestorage
|
|
15
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
|
3
|
+
//
|
|
4
|
+
//= require action_cable
|
|
5
|
+
//= require_self
|
|
6
|
+
//= require_tree ./channels
|
|
7
|
+
|
|
8
|
+
(function() {
|
|
9
|
+
this.App || (this.App = {});
|
|
10
|
+
|
|
11
|
+
App.cable = ActionCable.createConsumer();
|
|
12
|
+
|
|
13
|
+
}).call(this);
|
|
@@ -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 other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= csrf_meta_tags %>
|
|
6
|
+
<%= csp_meta_tag %>
|
|
7
|
+
|
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
|
9
|
+
<%= javascript_include_tag 'application' %>
|
|
10
|
+
</head>
|
|
11
|
+
|
|
12
|
+
<body>
|
|
13
|
+
<%= yield %>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/rake
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
include FileUtils
|
|
4
|
+
|
|
5
|
+
# path to your application root.
|
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
|
7
|
+
|
|
8
|
+
def system!(*args)
|
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
chdir APP_ROOT do
|
|
13
|
+
# This script is a starting point to setup your application.
|
|
14
|
+
# Add necessary setup steps to this file.
|
|
15
|
+
|
|
16
|
+
puts '== Installing dependencies =='
|
|
17
|
+
system! 'gem install bundler --conservative'
|
|
18
|
+
system('bundle check') || system!('bundle install')
|
|
19
|
+
|
|
20
|
+
# Install JavaScript dependencies if using Yarn
|
|
21
|
+
# system('bin/yarn')
|
|
22
|
+
|
|
23
|
+
# puts "\n== Copying sample files =="
|
|
24
|
+
# unless File.exist?('config/database.yml')
|
|
25
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
|
26
|
+
# end
|
|
27
|
+
|
|
28
|
+
puts "\n== Preparing database =="
|
|
29
|
+
system! 'bin/rails db:setup'
|
|
30
|
+
|
|
31
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
32
|
+
system! 'bin/rails log:clear tmp:clear'
|
|
33
|
+
|
|
34
|
+
puts "\n== Restarting application server =="
|
|
35
|
+
system! 'bin/rails restart'
|
|
36
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
include FileUtils
|
|
4
|
+
|
|
5
|
+
# path to your application root.
|
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
|
7
|
+
|
|
8
|
+
def system!(*args)
|
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
chdir APP_ROOT do
|
|
13
|
+
# This script is a way to update your development environment automatically.
|
|
14
|
+
# Add necessary update steps to this file.
|
|
15
|
+
|
|
16
|
+
puts '== Installing dependencies =='
|
|
17
|
+
system! 'gem install bundler --conservative'
|
|
18
|
+
system('bundle check') || system!('bundle install')
|
|
19
|
+
|
|
20
|
+
# Install JavaScript dependencies if using Yarn
|
|
21
|
+
# system('bin/yarn')
|
|
22
|
+
|
|
23
|
+
puts "\n== Updating database =="
|
|
24
|
+
system! 'bin/rails db:migrate'
|
|
25
|
+
|
|
26
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
27
|
+
system! 'bin/rails log:clear tmp:clear'
|
|
28
|
+
|
|
29
|
+
puts "\n== Restarting application server =="
|
|
30
|
+
system! 'bin/rails restart'
|
|
31
|
+
end
|
data/spec/dummy/bin/yarn
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
|
3
|
+
Dir.chdir(APP_ROOT) do
|
|
4
|
+
begin
|
|
5
|
+
exec "yarnpkg", *ARGV
|
|
6
|
+
rescue Errno::ENOENT
|
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
|
9
|
+
exit 1
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require_relative 'boot'
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
Bundler.require(*Rails.groups)
|
|
6
|
+
require "kafka_command"
|
|
7
|
+
|
|
8
|
+
module Dummy
|
|
9
|
+
class Application < Rails::Application
|
|
10
|
+
# Initialize configuration defaults for originally generated Rails version.
|
|
11
|
+
config.load_defaults 5.2
|
|
12
|
+
|
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
14
|
+
# Application configuration can go into files in config/initializers
|
|
15
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
|
16
|
+
# the framework and any gems in your application.
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
@@ -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: <%= ENV.fetch("RAILS_MAX_THREADS") { 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
|