This document discusses Rails engines and gems. It explains that engines allow extracting common functionality into reusable modules. Engines use the Rails::Engine class and Railtie to integrate with Rails applications. The document also covers creating gems, testing engines, mounting engines to host apps, and overriding engine classes and views.
This talk covers a successful utilization of Rails Engines to share features that cut across the layers of MVC in different Rails 3 projects. Rails Engines thus provide the best of both worlds: improved productivity by reusing MVC code (including assets like Javascript, CSS, and Images) and better flexibility by allowing different applications to customize behavior as needed without reliance on application-dependent conditionals. Rails Engine patterns will be provided to guide developers on how to leverage Rails Engines' reusability and flexibility without sacrificing maintainability.
A brief introduction to Rails Eingines. The joy and shortcomings of building modular web apps the Rails way. Originally presented at the 22nd Athens Ruby Meetup.
This talk covers a successful utilization of Rails Engines to share features that cut across the layers of MVC in different Rails 3 projects. Rails Engines thus provide the best of both worlds: improved productivity by reusing MVC code (including assets like Javascript, CSS, and Images) and better flexibility by allowing different applications to customize behavior as needed without reliance on application-dependent conditionals. Rails Engine patterns will be provided to guide developers on how to leverage Rails Engines' reusability and flexibility without sacrificing maintainability.
A brief introduction to Rails Eingines. The joy and shortcomings of building modular web apps the Rails way. Originally presented at the 22nd Athens Ruby Meetup.
Marcin Grzywaczewski, co-author of successful "Rails meets React.js" and "React.js by Example" books describes React in a friendly way to all Rails developers who'd like to learn React, but can't find generic tutorials friendly enough.
In this presentation you'll learn React.js basics by comparing it to a typical Rails views stack - and recognize the problem React.js solves for you. There are also 'mental transition' stages of thinking about frontend explained.
Brief introduction to create a very simple application using AngularJS and Ruby on Rails. The app example is on Github:
https://github.com/elenatorro/BeersQuizz
Deploying configurable frontend web application containersJosé Moreira
Deploying containerized client-side web applications requires a different configuration strategy compared to system applications. The runtime of client-side web applications is the client-side web browser and, unlike other applications which can utilize environment values, configuration has to be hard-coded in the Javascript source code.
Marcin Grzywaczewski, co-author of successful "Rails meets React.js" and "React.js by Example" books describes React in a friendly way to all Rails developers who'd like to learn React, but can't find generic tutorials friendly enough.
In this presentation you'll learn React.js basics by comparing it to a typical Rails views stack - and recognize the problem React.js solves for you. There are also 'mental transition' stages of thinking about frontend explained.
Brief introduction to create a very simple application using AngularJS and Ruby on Rails. The app example is on Github:
https://github.com/elenatorro/BeersQuizz
Deploying configurable frontend web application containersJosé Moreira
Deploying containerized client-side web applications requires a different configuration strategy compared to system applications. The runtime of client-side web applications is the client-side web browser and, unlike other applications which can utilize environment values, configuration has to be hard-coded in the Javascript source code.
Agenda
Setting up an angular app.
Introduction to tools - Babel, Webpack
Alternative to Gulp, Grunt & Bower.
Writing Controllers, Services, Directives etc..
Testing Javascript with Jasmine.
Setting up Karma with Webpack.
Let’s understand code coverage.
An alternative: JEST
Improving build solutions dependency management with webpackNodeXperts
Do you know ? - " The fine art of Webpack "
Topics Covered :
- What are Build Tools ?
- What is a Dependency graph ?
- What is webpack & its impacts
- What is a webpack config file and how is it written ?
- Webpack VS Grunt/Gulp & Browserify
Similar to Rails Engine | Modular application (20)
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
6. Releasing Gem
change version
run `bundle`
commit changes
run `rake release`
$ rake release
stupid_spam_protection 0.0.2 built to pkg/stupid_spam_protection-0.0.2.gem
Tagged v0.0.2
Pushed git commits and tags
Pushed stupid_spam_protection 0.0.2 to rubygems.org
7. in-memory testing with sqlite
spec/spec_helper.rb
require "active_record"
require "sqlite3”
ActiveRecord::Base.establish_connectio
n{
:adapter => "sqlite3”,
:database => ":memory:”
}
load "db/schema.rb" db/schema.rb
ActiveRecord::Schema.define do
RSpec.configure do |config| create_table "items", :force => true do |t|
config.around do |example| t.string "name”
ActiveRecord::Base.transaction do t.datetime "created_at", :null => false
example.run t.datetime "updated_at", :null => false
raise ActiveRecord::Rollback end
end
end
end
8. testing with mysql
database
spec/spec_helper.rb
begin
ActiveRecord::Base.establish_connection(config)
rescue
ActiveRecord::Base.establish_connection(config.merge('database' => nil))
ActiveRecord::Base.connection.create_database(config['database'], {
:charset => 'utf8‟,
:collation => 'utf8_unicode_ci‟})
end config = HashWithIndifferentAccess.new({
:adapter => "mysql2",
load "db/schema.rb" :host => "127.0.0.1",
:username => "root",
RSpec.configure do |config| :password => "",
# the same from previous slide :database => ”database_name”
end })
9. Tie gem to Rails app
Rails::Railtie
extend Rails framework
load all needed dependencies
several hooks methods for all needs
require "wnm_support/railtie" if defined?(Rails) lib/wnm_support.rb
module WnmSupport lib/wnm_support/railtie.rb
class Railtie < Rails::Railtie
initializer "wnm_support.view_helpers" do
ActionView::Base.send :include,
BoolToHuman
end
end
end
10. Railtie hooks 1
Plugin hooks
initializer
generators
rake_tasks
console
initializer "wnm_support.active_record_ext" do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.send :include,
WnmSupport::ActiveRecordExt::DestroyValidation
end
end
11. Railtie hooks 2
Rails configuration hooks
to_prepare (once in production, every request in development)
before_initialize
after_initialize
app_middleware
before_configuration
before_eager_load
generators
config.to_prepare do
AppController.send(:include,
Controller::Authentication)
end
12. What is Rails Engine ?
every rails app is an engine
Rails::Engine < Rails::Railtie
all together
gem skeleton
railtie
structure for app
dummy app for testing
assets
14. Generating Engine
rails plugin new blorgh --mountable –
full
everything (assets, controller, models,
views) are inside Blorgh namespace
module Blorgh
class Engine < ::Rails::Engine
isolate_namespace Blorgh
end
end
15. Basics commands
in root directory of the engine
bundle
rake
rspec
rails generate # generate code for engine
in spec/dummy or test/dummy location
rails console
rails server
rails generate # generate code for dummy app
16. Testing
generally as in standard rails application
engine is tested inside dummy app
small problems with factory girl
explicite model class in factory girl
include routes for request tests
FactoryGirl.define do
factory :user, :class => Blorgh ::User do
sequence(:login) { |n| "admin_#{n}" } RSpec.configure do |config|
password "too_secret" config.include Blorgh ::Engine.routes.url_helper
password_confirmation { password } end
end
end
17. Mounting Engine to host
application
Gemfile
gem “blorgh”, :path => “~/Sites/blorgh”
install migration
`rake blorgh:install:migrations`
load seeds data
Blorgh::Engine.load_seed # in rails console
require assets if needed
*= require blorgh/application # assets/stylesheets/application.css
mount to routes.rb
mount Blorgh::Engine => "/blorgh"
18. Get to engine and get
back
routes to engine from host app
prefix with engine name
example engine “blorgh”
<%= link_to “Users”, blorgh.users_path %>
routes from engine to host app
prefix with main_app
example engine “blorgh”
<%= link_to “Home page”,main_app.root_path %>
19. Overriding engine classes
Controller, Model, etc.
reopening classes
class_eval, module_eval
module MySite
class Railtie < ::Rails::Railtie
config.to_prepare do
Dir["app/decorators/**/*.rb"].each do |path|
load path app/decorators/models/blorgh/article.rb
end
end Blorgh::Article.class_eval do
end has_many :users, :class_name => „User'
end end
20. Overriding engine views
simple copy and paste view file that you want to
override to the same location in host app
21. Application Modules with
Rails Engine
every new engine means new namespace
application modules means for us more engines with
same namespace
inspiration from refinerycms
22. The same namespace
different engines
module Wnm module Wnm
module Core module Pages
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
isolate_namespace Wnm isolate_namespace Wnm
engine_name :wnm_core engine_name :wnm_pages
end end
end end
rake wnm_core:install:migrations rake wnm_pages:install:migrations
Wnm::Core::Engine.load_seed Wnm::Pages::Engine.load_seed
both are nested in `Wnm` namespace
23. Developing from local
Production from git
bundler does not allow to have same package from
different sources in Gemfile
export LOAD_GEMS_FROM_LOCAL=1 .rvmrc
if ENV["LOAD_GEMS_FROM_LOCAL"] == "1" Gemfile
gem "wnm_core", :path => "~/Sites/wnm_core"
gem "wnm_pages", :path => "~/Sites/wnm_pages"
gem "wnm_customers", :path => "~/Sites/wnm_customers"
else
gem "wnm_core", :git => "git@…/wnm_core.git", :tag => "v1.0.0"
gem "wnm_pages", :git => "git@…/wnm_pages.git", :tag => "v1.0.0"
gem "wnm_customers", :git => "git@.../wnm_customers.git", :tag => "v1.0.0"
end
25. Tips
if you are overriding views heavily always prefix routes
path with engine module name
<%= link_to page.name, wnm_page.page_path(page), :title => page.name %>
use class methods instead of constants
always write full path to class/module if it is in
namespace
::ApplicationController instead of ApplicationController
testing is essential
26. Why use Rails::Engine ?
reusable code
code
hole application
assets
modular thinking
gem with MVC
faster test
testing gem in dummy app infrastructure
some well known engines
devise, kaminari, refinerycms
27. Problems
if you are bending engines weird thinks can happen
a lot of weird errors
application does not run in development mode from git
sources
tests passed, but in browser it is not running
in browser it is running but tests are throwing exceptions
overriding classes in host app
helper methods from host app does not work in overridden
views
some things from documentation does not work at all
28. Why we did this like that ?
a lot of our project are in general the same
build core for site quickly
“scaffold” for application
rails engine is infrastructure for modular application
we can have backend and frontend in the same
application module