Skip to content

Commit

Permalink
Move dependencies from node modules to assets (#78)
Browse files Browse the repository at this point in the history
* Move dependencies from node modules to assets

* add chromedriver in workflow

* Remove webdrivers gem

* add PRCHECKLIST config

---------
Co-authored-by: canderson-activatecare <[email protected]>
  • Loading branch information
aashishpsaini authored Oct 26, 2023
1 parent 965bda5 commit 2f049a1
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: nanasess/setup-chromedriver@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Generate lockfile
Expand All @@ -43,4 +44,4 @@ jobs:
- name: Create database
run: bundle exec rake db:create db:migrate
- name: Run tests
run: bundle exec rake test
run: bundle exec rake test
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,5 @@ group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
gem 'mocha'
end
29 changes: 29 additions & 0 deletions PRCHECKLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Checklist Buddy by Mibex Software https://www.mibexsoftware.com/

# To create a new task, use '+task+' followed by the task description.
# To create a reminder (a non-blocking comment), use '+comment+' followed by the comment text

# To filter when a task is applied, prepend the task/comment/title with one or more of the following filters:
# '--source' - the source branch pattners
# '--source-except' - all pull requests except those matching this pattern
# '--target' - the target/destination branch patterns
# '--files' - diff file pattern, similar to .gitignore

# When more than one task has the same filter settings, these are grouped as a checklist.
# Note: entries with the same filter settings will be grouped together, regardless of position in file

# To name a checklist, create a line entry with the desired filter settings and +title+ Your Checklist Title

# EXAMPLES https://github.com/mibexsoftware/checklist-buddy-demo/blob/main/PRCHECKLIST

# Checklist for Security Reviewer
--files /** +title+ Security Review (Not for PR Owner)
--files /** +task+ [Rails OWASP Checklist](https://www.notion.so/activatecare/OWASP-Top-Ten-Ruby-on-Rails-checklist-3460102fa3024d2db35e5503126b53c4?pvs=4) has been considered and no potential vulnerabilities found.

# Checklist for Coding Guidelines
+title+ Developer/Requestor Review
+task+ The code follows the Activate Care development guidelines.
+task+ There are appropriate tests, preferring unit tests to system tests.
+task+ Performance related impacts have been considered.
+task+ Commit messages follow our conventions.
+task+ If there is a migration needed, I have performed a staging migration test and updated development.sql.
4 changes: 2 additions & 2 deletions app/assets/javascripts/abraham/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//= require js-cookie/src/js.cookie
//= require shepherd.js/dist/js/shepherd
//= require js.cookie
//= require shepherd.min

var Abraham = new Object();

Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"name": "abraham",
"private": true,
"dependencies": {
"js-cookie": "^2.2.0",
"shepherd.js": "^6.0.0-beta"
}
"dependencies": {}
}
1 change: 0 additions & 1 deletion test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require "test_helper"
require "webdrivers"

Capybara.server = :webrick

Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Rails.application.config.assets.paths << Emoji.images_path

# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('../../node_modules')
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'javascripts')

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Expand Down
165 changes: 165 additions & 0 deletions vendor/assets/javascripts/js.cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*!
* JavaScript Cookie v2.2.0
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
}(function () {
function extend () {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}

function init (converter) {
function api (key, value, attributes) {
var result;
if (typeof document === 'undefined') {
return;
}

// Write

if (arguments.length > 1) {
attributes = extend({
path: '/'
}, api.defaults, attributes);

if (typeof attributes.expires === 'number') {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires;
}

// We're using "expires" because "max-age" is not supported by IE
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';

try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
} catch (e) {}

if (!converter.write) {
value = encodeURIComponent(String(value))
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
} else {
value = converter.write(value, key);
}

key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);

var stringifiedAttributes = '';

for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}

// Read

if (!key) {
result = {};
}

// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()"
var cookies = document.cookie ? document.cookie.split('; ') : [];
var rdecode = /(%[0-9A-Z]{2})+/g;
var i = 0;

for (; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var cookie = parts.slice(1).join('=');

if (!this.json && cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}

try {
var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent);

if (this.json) {
try {
cookie = JSON.parse(cookie);
} catch (e) {}
}

if (key === name) {
result = cookie;
break;
}

if (!key) {
result[name] = cookie;
}
} catch (e) {}
}

return result;
}

api.set = api;
api.get = function (key) {
return api.call(api, key);
};
api.getJSON = function () {
return api.apply({
json: true
}, [].slice.call(arguments));
};
api.defaults = {};

api.remove = function (key, attributes) {
api(key, '', extend(attributes, {
expires: -1
}));
};

api.withConverter = init;

return api;
}

return init(function () {});
}));
4 changes: 4 additions & 0 deletions vendor/assets/javascripts/shepherd.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions vendor/assets/javascripts/smoothscroll.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/assets/javascripts/tether.min.js

Large diffs are not rendered by default.

0 comments on commit 2f049a1

Please sign in to comment.