Skip to content

Commit 0c83c49

Browse files
committed
Add Ruby on Rails v6 example which uses Webpacker
1 parent e8c98f3 commit 0c83c49

File tree

93 files changed

+9200
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+9200
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ TradingView [Charting Library](https://www.tradingview.com/HTML5-stock-forex-bit
3838

3939
TradingView [Charting Library](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/) and [Ruby-on-Rails](http://rubyonrails.org/) Integration Example
4040

41+
### ruby-on-rails v6 (with webpacker)
42+
43+
TradingView [Charting Library](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/) and [Ruby-on-Rails](http://rubyonrails.org/) v6 (with webpacker) Integration Example
44+
4145
### vuejs
4246

4347
TradingView [Charting Library](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/) and [Vue.js](https://vuejs.org/) Integration Example

ruby-on-rails-v6/.browserslistrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
defaults

ruby-on-rails-v6/.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 all logfiles and tempfiles.
11+
/log/*
12+
/tmp/*
13+
!/log/.keep
14+
!/tmp/.keep
15+
16+
# Ignore pidfiles, but keep the directory.
17+
/tmp/pids/*
18+
!/tmp/pids/
19+
!/tmp/pids/.keep
20+
21+
22+
/public/assets
23+
.byebug_history
24+
25+
# Ignore master key for decrypting credentials and more.
26+
/config/master.key
27+
28+
/public/packs
29+
/public/packs-test
30+
/node_modules
31+
/yarn-error.log
32+
yarn-debug.log*
33+
.yarn-integrity

ruby-on-rails-v6/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-2.6.3

ruby-on-rails-v6/Gemfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby '2.6.3'
5+
6+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7+
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
8+
# Use Puma as the app server
9+
gem 'puma', '~> 4.1'
10+
# Use SCSS for stylesheets
11+
gem 'sass-rails', '>= 6'
12+
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
13+
gem 'webpacker', '~> 4.0'
14+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
15+
gem 'turbolinks', '~> 5'
16+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
17+
gem 'jbuilder', '~> 2.7'
18+
# Use Redis adapter to run Action Cable in production
19+
# gem 'redis', '~> 4.0'
20+
# Use Active Model has_secure_password
21+
# gem 'bcrypt', '~> 3.1.7'
22+
23+
# Reduces boot times through caching; required in config/boot.rb
24+
gem 'bootsnap', '>= 1.4.2', require: false
25+
26+
group :development, :test do
27+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
28+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
29+
end
30+
31+
group :development do
32+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
33+
gem 'web-console', '>= 3.3.0'
34+
gem 'listen', '~> 3.2'
35+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
36+
gem 'spring'
37+
gem 'spring-watcher-listen', '~> 2.0.0'
38+
end
39+
40+
group :test do
41+
# Adds support for Capybara system testing and selenium driver
42+
gem 'capybara', '>= 2.15'
43+
gem 'selenium-webdriver'
44+
# Easy installation and use of web drivers to run system tests with browsers
45+
gem 'webdrivers'
46+
end
47+
48+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
49+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

ruby-on-rails-v6/Gemfile.lock

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actioncable (6.0.3.4)
5+
actionpack (= 6.0.3.4)
6+
nio4r (~> 2.0)
7+
websocket-driver (>= 0.6.1)
8+
actionmailbox (6.0.3.4)
9+
actionpack (= 6.0.3.4)
10+
activejob (= 6.0.3.4)
11+
activerecord (= 6.0.3.4)
12+
activestorage (= 6.0.3.4)
13+
activesupport (= 6.0.3.4)
14+
mail (>= 2.7.1)
15+
actionmailer (6.0.3.4)
16+
actionpack (= 6.0.3.4)
17+
actionview (= 6.0.3.4)
18+
activejob (= 6.0.3.4)
19+
mail (~> 2.5, >= 2.5.4)
20+
rails-dom-testing (~> 2.0)
21+
actionpack (6.0.3.4)
22+
actionview (= 6.0.3.4)
23+
activesupport (= 6.0.3.4)
24+
rack (~> 2.0, >= 2.0.8)
25+
rack-test (>= 0.6.3)
26+
rails-dom-testing (~> 2.0)
27+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28+
actiontext (6.0.3.4)
29+
actionpack (= 6.0.3.4)
30+
activerecord (= 6.0.3.4)
31+
activestorage (= 6.0.3.4)
32+
activesupport (= 6.0.3.4)
33+
nokogiri (>= 1.8.5)
34+
actionview (6.0.3.4)
35+
activesupport (= 6.0.3.4)
36+
builder (~> 3.1)
37+
erubi (~> 1.4)
38+
rails-dom-testing (~> 2.0)
39+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40+
activejob (6.0.3.4)
41+
activesupport (= 6.0.3.4)
42+
globalid (>= 0.3.6)
43+
activemodel (6.0.3.4)
44+
activesupport (= 6.0.3.4)
45+
activerecord (6.0.3.4)
46+
activemodel (= 6.0.3.4)
47+
activesupport (= 6.0.3.4)
48+
activestorage (6.0.3.4)
49+
actionpack (= 6.0.3.4)
50+
activejob (= 6.0.3.4)
51+
activerecord (= 6.0.3.4)
52+
marcel (~> 0.3.1)
53+
activesupport (6.0.3.4)
54+
concurrent-ruby (~> 1.0, >= 1.0.2)
55+
i18n (>= 0.7, < 2)
56+
minitest (~> 5.1)
57+
tzinfo (~> 1.1)
58+
zeitwerk (~> 2.2, >= 2.2.2)
59+
addressable (2.7.0)
60+
public_suffix (>= 2.0.2, < 5.0)
61+
bindex (0.8.1)
62+
bootsnap (1.5.1)
63+
msgpack (~> 1.0)
64+
builder (3.2.4)
65+
byebug (11.1.3)
66+
capybara (3.33.0)
67+
addressable
68+
mini_mime (>= 0.1.3)
69+
nokogiri (~> 1.8)
70+
rack (>= 1.6.0)
71+
rack-test (>= 0.6.3)
72+
regexp_parser (~> 1.5)
73+
xpath (~> 3.2)
74+
childprocess (3.0.0)
75+
concurrent-ruby (1.1.7)
76+
crass (1.0.6)
77+
erubi (1.10.0)
78+
ffi (1.13.1)
79+
globalid (0.4.2)
80+
activesupport (>= 4.2.0)
81+
i18n (1.8.5)
82+
concurrent-ruby (~> 1.0)
83+
jbuilder (2.10.1)
84+
activesupport (>= 5.0.0)
85+
listen (3.3.1)
86+
rb-fsevent (~> 0.10, >= 0.10.3)
87+
rb-inotify (~> 0.9, >= 0.9.10)
88+
loofah (2.7.0)
89+
crass (~> 1.0.2)
90+
nokogiri (>= 1.5.9)
91+
mail (2.7.1)
92+
mini_mime (>= 0.1.1)
93+
marcel (0.3.3)
94+
mimemagic (~> 0.3.2)
95+
method_source (1.0.0)
96+
mimemagic (0.3.5)
97+
mini_mime (1.0.2)
98+
mini_portile2 (2.4.0)
99+
minitest (5.14.2)
100+
msgpack (1.3.3)
101+
nio4r (2.5.4)
102+
nokogiri (1.10.10)
103+
mini_portile2 (~> 2.4.0)
104+
public_suffix (4.0.6)
105+
puma (4.3.6)
106+
nio4r (~> 2.0)
107+
rack (2.2.3)
108+
rack-proxy (0.6.5)
109+
rack
110+
rack-test (1.1.0)
111+
rack (>= 1.0, < 3)
112+
rails (6.0.3.4)
113+
actioncable (= 6.0.3.4)
114+
actionmailbox (= 6.0.3.4)
115+
actionmailer (= 6.0.3.4)
116+
actionpack (= 6.0.3.4)
117+
actiontext (= 6.0.3.4)
118+
actionview (= 6.0.3.4)
119+
activejob (= 6.0.3.4)
120+
activemodel (= 6.0.3.4)
121+
activerecord (= 6.0.3.4)
122+
activestorage (= 6.0.3.4)
123+
activesupport (= 6.0.3.4)
124+
bundler (>= 1.3.0)
125+
railties (= 6.0.3.4)
126+
sprockets-rails (>= 2.0.0)
127+
rails-dom-testing (2.0.3)
128+
activesupport (>= 4.2.0)
129+
nokogiri (>= 1.6)
130+
rails-html-sanitizer (1.3.0)
131+
loofah (~> 2.3)
132+
railties (6.0.3.4)
133+
actionpack (= 6.0.3.4)
134+
activesupport (= 6.0.3.4)
135+
method_source
136+
rake (>= 0.8.7)
137+
thor (>= 0.20.3, < 2.0)
138+
rake (13.0.1)
139+
rb-fsevent (0.10.4)
140+
rb-inotify (0.10.1)
141+
ffi (~> 1.0)
142+
regexp_parser (1.8.2)
143+
rubyzip (2.3.0)
144+
sass-rails (6.0.0)
145+
sassc-rails (~> 2.1, >= 2.1.1)
146+
sassc (2.4.0)
147+
ffi (~> 1.9)
148+
sassc-rails (2.1.2)
149+
railties (>= 4.0.0)
150+
sassc (>= 2.0)
151+
sprockets (> 3.0)
152+
sprockets-rails
153+
tilt
154+
selenium-webdriver (3.142.7)
155+
childprocess (>= 0.5, < 4.0)
156+
rubyzip (>= 1.2.2)
157+
spring (2.1.1)
158+
spring-watcher-listen (2.0.1)
159+
listen (>= 2.7, < 4.0)
160+
spring (>= 1.2, < 3.0)
161+
sprockets (4.0.2)
162+
concurrent-ruby (~> 1.0)
163+
rack (> 1, < 3)
164+
sprockets-rails (3.2.2)
165+
actionpack (>= 4.0)
166+
activesupport (>= 4.0)
167+
sprockets (>= 3.0.0)
168+
thor (1.0.1)
169+
thread_safe (0.3.6)
170+
tilt (2.0.10)
171+
turbolinks (5.2.1)
172+
turbolinks-source (~> 5.2)
173+
turbolinks-source (5.2.0)
174+
tzinfo (1.2.8)
175+
thread_safe (~> 0.1)
176+
web-console (4.1.0)
177+
actionview (>= 6.0.0)
178+
activemodel (>= 6.0.0)
179+
bindex (>= 0.4.0)
180+
railties (>= 6.0.0)
181+
webdrivers (4.4.1)
182+
nokogiri (~> 1.6)
183+
rubyzip (>= 1.3.0)
184+
selenium-webdriver (>= 3.0, < 4.0)
185+
webpacker (4.3.0)
186+
activesupport (>= 4.2)
187+
rack-proxy (>= 0.6.1)
188+
railties (>= 4.2)
189+
websocket-driver (0.7.3)
190+
websocket-extensions (>= 0.1.0)
191+
websocket-extensions (0.1.5)
192+
xpath (3.2.0)
193+
nokogiri (~> 1.8)
194+
zeitwerk (2.4.1)
195+
196+
PLATFORMS
197+
ruby
198+
199+
DEPENDENCIES
200+
bootsnap (>= 1.4.2)
201+
byebug
202+
capybara (>= 2.15)
203+
jbuilder (~> 2.7)
204+
listen (~> 3.2)
205+
puma (~> 4.1)
206+
rails (~> 6.0.3, >= 6.0.3.4)
207+
sass-rails (>= 6)
208+
selenium-webdriver
209+
spring
210+
spring-watcher-listen (~> 2.0.0)
211+
turbolinks (~> 5)
212+
tzinfo-data
213+
web-console (>= 3.3.0)
214+
webdrivers
215+
webpacker (~> 4.0)
216+
217+
RUBY VERSION
218+
ruby 2.6.3p62
219+
220+
BUNDLED WITH
221+
2.1.4

ruby-on-rails-v6/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# README
2+
3+
## Setup TradingView
4+
5+
- Copy `charting_library/charting_library.js` into `app/javascript/packs/charting_library/charting_library.js`
6+
- Copy `datafeeds/udf/dist/*.js` into `app/javascript/packs/datafeeds/`
7+
- Copy `charting_library/*.html` into `public/charting_library/`
8+
- Copy `charting_library/bundles` into `public/charting_library/bundles`
9+
10+
## Run the app
11+
12+
No database migration is needed
13+
14+
```
15+
./bin/rails s
16+
./bin/webpack-dev-server
17+
```

ruby-on-rails-v6/Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//= link_tree ../images
2+
//= link_directory ../stylesheets .css

ruby-on-rails-v6/app/assets/images/.keep

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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, or any plugin's
6+
* 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+
*/
16+
17+
html, body {
18+
height: 100%;
19+
}
20+
21+
.page-tv-chart-container {
22+
height: 100%;
23+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Connection < ActionCable::Connection::Base
3+
end
4+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::Base
2+
end

ruby-on-rails-v6/app/controllers/concerns/.keep

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class HomeController < ApplicationController
2+
def index
3+
end
4+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end

0 commit comments

Comments
 (0)