SlideShare a Scribd company logo
1 of 17
blueprints git:(master)ember g awesome
Ember-CLI Blueprints
for fun and profit
version: 2.6.2
installing awesome
create app/awesome/awesome.js
installing awesome-test
create tests/unit/awesome/awesome-test.js
Chris McCuller
@ultimatemonty
Who is this fella?
Software Engineer at Pardot
Pardot is B2B marketing automation by
Salesforce, a software-as-a-service application
built for marketing and sales departments.
Based in Atlanta, GA
Other boring details
● Disc sports enthusiast
● Atlanta sports enthusiast
● Games-where-you-throw-things-at-things
enthusiast
● Hat enthusiast
Obligatory family pics
What are Blueprints?
Ember CLI ships with “Blueprints”, snippet generators for
many of the entities - models, controllers, components,
and so on - that you’ll need in your app. Blueprints allow
us to share common Ember patterns in the community
and you can even define your own.
ember g --help
I can define my own Blueprints?
blueprints/thing
├── files
│ └── .gitkeep
└── index.js
ember g thing a-thing
Anatomy of the `g` command
ember g thing aThing propKey:propValue --
someOption=true
● thing: name of the blueprint to run
route, component, acceptance-test, etc...
● aThing propKey:propValue: anonymousOptions. No option key
needed. Accessible via options.entity.options
{ aThing: ‘’, propKey: ‘propValue’ }
● --someOption=true: availableOptions. Option key needed
Accessible via options.taskOptions
Anatomy of a Blueprint
blueprints/blueprint-name/index.js
● Set filenames
● Set template variables
● Installation/Uninstallation tasks
blueprints/blueprint-name/files/
● Templates for all files to be installed in the target
directory
● fileMapTokens for filenames
● locals for template variables
fileMapTokens (4 by default)
● __name__: dasherized name of the thing being generated e.g.
mirage-model
● __root__: root of the application
○ app/ folder for normal blueprints
addon/ for addon blueprints)
● __path__: substitued with blueprint name at generation. Generally used
with addons
● __test__: only used in pods. Appends -test the end of __name__
locals (5 by default)
● dasherizedPackageName: dasherized name of project e.g. tomster-
tracker
● classifiedPackageName: classified name of project e.g.
TomsterTracker
● dasherizedModuleName: dasherized name of thing generated e.g.
anchor-tag
● classifiedModuleName: classified name of thing being generated e.g.
AnchorTag
● camelizedModuleName: camelized name of thing being generated e.g.
anchorTag
index.js
Hooks:
● normalizeEntityName: normalize and validate entity name
● locals: setup template variables
● fileMapTokens: setup file names
● install: installs things. rarely overridden
● beforeInstall
● afterInstall
● beforeUninstall
● afterUninstall
Where the logic of your blueprint lives
index.js
Passing in options:
● anonymousOptions: options that are not preceded by --
optionName
ember g model user firstName:string lastName:string
● availableOptions: Explicitly defined options that are preceded by
--optionName
ember g component anchor-tag --test-type=unit
ember g component anchor-tag -u
Where the logic of your blueprint lives
index.js: The `options` hash
fileMapTokenslocals
ember g model user name:string isAdmin:boolean
{ entity: {
name: ‘user’,
options: {
name: ‘string’,
isAdmin: ‘boolean’
}
}
}
// other useful stuff
{ pod: false,
podPath: '',
hasPathToken: null,
inAddon: false,
inRepoAddon: null,
inDummy: false,
blueprintName: ‘model’,
originBlueprintName: ‘model’,
dasherizedModuleName: ‘user’,
locals: {
<entity.options from locals>
}
Let’s take a look
at one!
Please to make
offerings of praise to
demo gods on my
behalf.
Goals
● Generate a route and a component in the same command
● Use generated component in the route template
● Options for destructuring namespaces and providing a
name for the model property on the component
Further Reading
Ember’s default blueprints
https://github.com/emberjs/ember.js/tree/master/blueprints
Ember-Data’s default blueprints
https://github.com/emberjs/data/tree/master/blueprints
Ember-CLI Guides
http://www.ember-cli.com/extending/#generators-and-
blueprints
Demo app

More Related Content

Viewers also liked

Quality Testing and Agile at Salesforce
Quality Testing and Agile at Salesforce Quality Testing and Agile at Salesforce
Quality Testing and Agile at Salesforce Salesforce Engineering
 
Apache BookKeeper Distributed Store- a Salesforce use case
Apache BookKeeper Distributed Store- a Salesforce use caseApache BookKeeper Distributed Store- a Salesforce use case
Apache BookKeeper Distributed Store- a Salesforce use caseSalesforce Engineering
 
Salesforce's Trusted Enterprise Platform and Apache Phoenix
Salesforce's Trusted Enterprise Platform and Apache PhoenixSalesforce's Trusted Enterprise Platform and Apache Phoenix
Salesforce's Trusted Enterprise Platform and Apache PhoenixSalesforce Engineering
 
Production Readiness Testing Using Spark
Production Readiness Testing Using SparkProduction Readiness Testing Using Spark
Production Readiness Testing Using SparkSalesforce Engineering
 
Building Your Agile Coaching Practice
Building Your Agile Coaching Practice Building Your Agile Coaching Practice
Building Your Agile Coaching Practice Salesforce Engineering
 
Dream of the (blue) Effective Case Management System
Dream of the (blue) Effective Case Management SystemDream of the (blue) Effective Case Management System
Dream of the (blue) Effective Case Management SystemSalesforce Engineering
 
Information economics and big data
Information economics and big dataInformation economics and big data
Information economics and big dataMark Albala
 
Tutorial 5 georgia sakurai
Tutorial 5   georgia sakuraiTutorial 5   georgia sakurai
Tutorial 5 georgia sakuraiComm202
 
Yuwei 202 tutorial 3
Yuwei 202 tutorial 3Yuwei 202 tutorial 3
Yuwei 202 tutorial 3Comm202
 
Textos del Padre Federico Salvador Ramón – 61
Textos del Padre Federico Salvador Ramón – 61Textos del Padre Federico Salvador Ramón – 61
Textos del Padre Federico Salvador Ramón – 61Antonio García Megía
 
Mestrado e Doutorado
Mestrado e DoutoradoMestrado e Doutorado
Mestrado e DoutoradoElis Roselene
 
Michelle S Tutorial 5
Michelle S Tutorial 5Michelle S Tutorial 5
Michelle S Tutorial 5Comm202
 
Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)
Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)
Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)Comm202
 

Viewers also liked (20)

Microservices
MicroservicesMicroservices
Microservices
 
Tailoring the DITA Suit to Fit
Tailoring the DITA Suit to FitTailoring the DITA Suit to Fit
Tailoring the DITA Suit to Fit
 
Stacki - The1600+ Server Journey
Stacki - The1600+ Server JourneyStacki - The1600+ Server Journey
Stacki - The1600+ Server Journey
 
Content Strategy Workshop
Content Strategy WorkshopContent Strategy Workshop
Content Strategy Workshop
 
Quality Testing and Agile at Salesforce
Quality Testing and Agile at Salesforce Quality Testing and Agile at Salesforce
Quality Testing and Agile at Salesforce
 
Apache BookKeeper Distributed Store- a Salesforce use case
Apache BookKeeper Distributed Store- a Salesforce use caseApache BookKeeper Distributed Store- a Salesforce use case
Apache BookKeeper Distributed Store- a Salesforce use case
 
Salesforce's Trusted Enterprise Platform and Apache Phoenix
Salesforce's Trusted Enterprise Platform and Apache PhoenixSalesforce's Trusted Enterprise Platform and Apache Phoenix
Salesforce's Trusted Enterprise Platform and Apache Phoenix
 
Declarative Network Configuration
Declarative Network Configuration Declarative Network Configuration
Declarative Network Configuration
 
Orchestration, the conductor's score
Orchestration, the conductor's scoreOrchestration, the conductor's score
Orchestration, the conductor's score
 
Production Readiness Testing Using Spark
Production Readiness Testing Using SparkProduction Readiness Testing Using Spark
Production Readiness Testing Using Spark
 
The Future of Hbase
The Future of HbaseThe Future of Hbase
The Future of Hbase
 
Building Your Agile Coaching Practice
Building Your Agile Coaching Practice Building Your Agile Coaching Practice
Building Your Agile Coaching Practice
 
Dream of the (blue) Effective Case Management System
Dream of the (blue) Effective Case Management SystemDream of the (blue) Effective Case Management System
Dream of the (blue) Effective Case Management System
 
Information economics and big data
Information economics and big dataInformation economics and big data
Information economics and big data
 
Tutorial 5 georgia sakurai
Tutorial 5   georgia sakuraiTutorial 5   georgia sakurai
Tutorial 5 georgia sakurai
 
Yuwei 202 tutorial 3
Yuwei 202 tutorial 3Yuwei 202 tutorial 3
Yuwei 202 tutorial 3
 
Textos del Padre Federico Salvador Ramón – 61
Textos del Padre Federico Salvador Ramón – 61Textos del Padre Federico Salvador Ramón – 61
Textos del Padre Federico Salvador Ramón – 61
 
Mestrado e Doutorado
Mestrado e DoutoradoMestrado e Doutorado
Mestrado e Doutorado
 
Michelle S Tutorial 5
Michelle S Tutorial 5Michelle S Tutorial 5
Michelle S Tutorial 5
 
Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)
Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)
Comm202 - Tutorial 4 Peer Review Cover Letters (SarahBrennan)
 

Similar to Ember-CLI Blueprints for fun and profit

Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)DECK36
 
the productive programer: mechanics
the productive programer: mechanicsthe productive programer: mechanics
the productive programer: mechanicselliando dias
 
Terraform in production - experiences, best practices and deep dive- Piotr Ki...
Terraform in production - experiences, best practices and deep dive- Piotr Ki...Terraform in production - experiences, best practices and deep dive- Piotr Ki...
Terraform in production - experiences, best practices and deep dive- Piotr Ki...PROIDEA
 
SFDX – Myth Buster, Svatopluk Sejkora
SFDX – Myth Buster, Svatopluk SejkoraSFDX – Myth Buster, Svatopluk Sejkora
SFDX – Myth Buster, Svatopluk SejkoraCzechDreamin
 
From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2Alessandro Molina
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handlingSuite Solutions
 
Gradle - small introduction
Gradle - small introductionGradle - small introduction
Gradle - small introductionIgor Popov
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)DoiT International
 
Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbSenthilKumar Selvaraj
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Alessandro Molina
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you codeIzzet Mustafaiev
 
Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.gjdevos
 
Fuzzing softwares for bugs - OWASP Seasides
Fuzzing softwares for bugs - OWASP SeasidesFuzzing softwares for bugs - OWASP Seasides
Fuzzing softwares for bugs - OWASP SeasidesOWASPSeasides
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for GitJan Krag
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data scienceSovello Hildebrand
 

Similar to Ember-CLI Blueprints for fun and profit (20)

10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)
 
the productive programer: mechanics
the productive programer: mechanicsthe productive programer: mechanics
the productive programer: mechanics
 
Terraform in production - experiences, best practices and deep dive- Piotr Ki...
Terraform in production - experiences, best practices and deep dive- Piotr Ki...Terraform in production - experiences, best practices and deep dive- Piotr Ki...
Terraform in production - experiences, best practices and deep dive- Piotr Ki...
 
R sharing 101
R sharing 101R sharing 101
R sharing 101
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
SFDX – Myth Buster, Svatopluk Sejkora
SFDX – Myth Buster, Svatopluk SejkoraSFDX – Myth Buster, Svatopluk Sejkora
SFDX – Myth Buster, Svatopluk Sejkora
 
From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2
 
ICONUK 2015 - Gradle Up!
ICONUK 2015 - Gradle Up!ICONUK 2015 - Gradle Up!
ICONUK 2015 - Gradle Up!
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handling
 
Gradle - small introduction
Gradle - small introductionGradle - small introduction
Gradle - small introduction
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)
 
Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with Gdb
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you code
 
Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.
 
Fuzzing softwares for bugs - OWASP Seasides
Fuzzing softwares for bugs - OWASP SeasidesFuzzing softwares for bugs - OWASP Seasides
Fuzzing softwares for bugs - OWASP Seasides
 
Jedi Mind Tricks in Git
Jedi Mind Tricks in GitJedi Mind Tricks in Git
Jedi Mind Tricks in Git
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data science
 

More from Salesforce Engineering

Locker Service Ready Lightning Components With Webpack
Locker Service Ready Lightning Components With WebpackLocker Service Ready Lightning Components With Webpack
Locker Service Ready Lightning Components With WebpackSalesforce Engineering
 
Techniques to Effectively Monitor the Performance of Customers in the Cloud
Techniques to Effectively Monitor the Performance of Customers in the CloudTechniques to Effectively Monitor the Performance of Customers in the Cloud
Techniques to Effectively Monitor the Performance of Customers in the CloudSalesforce Engineering
 
Predictive System Performance Data Analysis
Predictive System Performance Data AnalysisPredictive System Performance Data Analysis
Predictive System Performance Data AnalysisSalesforce Engineering
 
Aspect Oriented Programming: Hidden Toolkit That You Already Have
Aspect Oriented Programming: Hidden Toolkit That You Already HaveAspect Oriented Programming: Hidden Toolkit That You Already Have
Aspect Oriented Programming: Hidden Toolkit That You Already HaveSalesforce Engineering
 
A Smarter Pig: Building a SQL interface to Pig using Apache Calcite
A Smarter Pig: Building a SQL interface to Pig using Apache CalciteA Smarter Pig: Building a SQL interface to Pig using Apache Calcite
A Smarter Pig: Building a SQL interface to Pig using Apache CalciteSalesforce Engineering
 
Implementing a Content Strategy Is Like Running 100 Miles
Implementing a Content Strategy Is Like Running 100 MilesImplementing a Content Strategy Is Like Running 100 Miles
Implementing a Content Strategy Is Like Running 100 MilesSalesforce Engineering
 
Salesforce Cloud Infrastructure and Challenges - A Brief Overview
Salesforce Cloud Infrastructure and Challenges - A Brief OverviewSalesforce Cloud Infrastructure and Challenges - A Brief Overview
Salesforce Cloud Infrastructure and Challenges - A Brief OverviewSalesforce Engineering
 
Operationalizing Big Data as a Service
Operationalizing Big Data as a ServiceOperationalizing Big Data as a Service
Operationalizing Big Data as a ServiceSalesforce Engineering
 

More from Salesforce Engineering (18)

Locker Service Ready Lightning Components With Webpack
Locker Service Ready Lightning Components With WebpackLocker Service Ready Lightning Components With Webpack
Locker Service Ready Lightning Components With Webpack
 
Scaling HBase for Big Data
Scaling HBase for Big DataScaling HBase for Big Data
Scaling HBase for Big Data
 
Techniques to Effectively Monitor the Performance of Customers in the Cloud
Techniques to Effectively Monitor the Performance of Customers in the CloudTechniques to Effectively Monitor the Performance of Customers in the Cloud
Techniques to Effectively Monitor the Performance of Customers in the Cloud
 
Predictive System Performance Data Analysis
Predictive System Performance Data AnalysisPredictive System Performance Data Analysis
Predictive System Performance Data Analysis
 
Apache HBase State of the Project
Apache HBase State of the ProjectApache HBase State of the Project
Apache HBase State of the Project
 
Hit the Trail with Trailhead
Hit the Trail with TrailheadHit the Trail with Trailhead
Hit the Trail with Trailhead
 
HBase/PHOENIX @ Scale
HBase/PHOENIX @ ScaleHBase/PHOENIX @ Scale
HBase/PHOENIX @ Scale
 
Scaling up data science applications
Scaling up data science applicationsScaling up data science applications
Scaling up data science applications
 
Containers and Security for DevOps
Containers and Security for DevOpsContainers and Security for DevOps
Containers and Security for DevOps
 
Aspect Oriented Programming: Hidden Toolkit That You Already Have
Aspect Oriented Programming: Hidden Toolkit That You Already HaveAspect Oriented Programming: Hidden Toolkit That You Already Have
Aspect Oriented Programming: Hidden Toolkit That You Already Have
 
Monitoring @ Scale in Salesforce
Monitoring @ Scale in SalesforceMonitoring @ Scale in Salesforce
Monitoring @ Scale in Salesforce
 
Performance Tuning with XHProf
Performance Tuning with XHProfPerformance Tuning with XHProf
Performance Tuning with XHProf
 
A Smarter Pig: Building a SQL interface to Pig using Apache Calcite
A Smarter Pig: Building a SQL interface to Pig using Apache CalciteA Smarter Pig: Building a SQL interface to Pig using Apache Calcite
A Smarter Pig: Building a SQL interface to Pig using Apache Calcite
 
Implementing a Content Strategy Is Like Running 100 Miles
Implementing a Content Strategy Is Like Running 100 MilesImplementing a Content Strategy Is Like Running 100 Miles
Implementing a Content Strategy Is Like Running 100 Miles
 
Salesforce Cloud Infrastructure and Challenges - A Brief Overview
Salesforce Cloud Infrastructure and Challenges - A Brief OverviewSalesforce Cloud Infrastructure and Challenges - A Brief Overview
Salesforce Cloud Infrastructure and Challenges - A Brief Overview
 
Koober Preduction IO Presentation
Koober Preduction IO PresentationKoober Preduction IO Presentation
Koober Preduction IO Presentation
 
Getting to NO NINES
Getting to NO NINESGetting to NO NINES
Getting to NO NINES
 
Operationalizing Big Data as a Service
Operationalizing Big Data as a ServiceOperationalizing Big Data as a Service
Operationalizing Big Data as a Service
 

Recently uploaded

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Recently uploaded (20)

★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 

Ember-CLI Blueprints for fun and profit

  • 1. blueprints git:(master)ember g awesome Ember-CLI Blueprints for fun and profit version: 2.6.2 installing awesome create app/awesome/awesome.js installing awesome-test create tests/unit/awesome/awesome-test.js Chris McCuller @ultimatemonty
  • 2. Who is this fella? Software Engineer at Pardot Pardot is B2B marketing automation by Salesforce, a software-as-a-service application built for marketing and sales departments. Based in Atlanta, GA
  • 3. Other boring details ● Disc sports enthusiast ● Atlanta sports enthusiast ● Games-where-you-throw-things-at-things enthusiast ● Hat enthusiast
  • 4.
  • 6. What are Blueprints? Ember CLI ships with “Blueprints”, snippet generators for many of the entities - models, controllers, components, and so on - that you’ll need in your app. Blueprints allow us to share common Ember patterns in the community and you can even define your own. ember g --help
  • 7. I can define my own Blueprints? blueprints/thing ├── files │ └── .gitkeep └── index.js ember g thing a-thing
  • 8. Anatomy of the `g` command ember g thing aThing propKey:propValue -- someOption=true ● thing: name of the blueprint to run route, component, acceptance-test, etc... ● aThing propKey:propValue: anonymousOptions. No option key needed. Accessible via options.entity.options { aThing: ‘’, propKey: ‘propValue’ } ● --someOption=true: availableOptions. Option key needed Accessible via options.taskOptions
  • 9. Anatomy of a Blueprint blueprints/blueprint-name/index.js ● Set filenames ● Set template variables ● Installation/Uninstallation tasks blueprints/blueprint-name/files/ ● Templates for all files to be installed in the target directory ● fileMapTokens for filenames ● locals for template variables
  • 10. fileMapTokens (4 by default) ● __name__: dasherized name of the thing being generated e.g. mirage-model ● __root__: root of the application ○ app/ folder for normal blueprints addon/ for addon blueprints) ● __path__: substitued with blueprint name at generation. Generally used with addons ● __test__: only used in pods. Appends -test the end of __name__
  • 11. locals (5 by default) ● dasherizedPackageName: dasherized name of project e.g. tomster- tracker ● classifiedPackageName: classified name of project e.g. TomsterTracker ● dasherizedModuleName: dasherized name of thing generated e.g. anchor-tag ● classifiedModuleName: classified name of thing being generated e.g. AnchorTag ● camelizedModuleName: camelized name of thing being generated e.g. anchorTag
  • 12. index.js Hooks: ● normalizeEntityName: normalize and validate entity name ● locals: setup template variables ● fileMapTokens: setup file names ● install: installs things. rarely overridden ● beforeInstall ● afterInstall ● beforeUninstall ● afterUninstall Where the logic of your blueprint lives
  • 13. index.js Passing in options: ● anonymousOptions: options that are not preceded by -- optionName ember g model user firstName:string lastName:string ● availableOptions: Explicitly defined options that are preceded by --optionName ember g component anchor-tag --test-type=unit ember g component anchor-tag -u Where the logic of your blueprint lives
  • 14. index.js: The `options` hash fileMapTokenslocals ember g model user name:string isAdmin:boolean { entity: { name: ‘user’, options: { name: ‘string’, isAdmin: ‘boolean’ } } } // other useful stuff { pod: false, podPath: '', hasPathToken: null, inAddon: false, inRepoAddon: null, inDummy: false, blueprintName: ‘model’, originBlueprintName: ‘model’, dasherizedModuleName: ‘user’, locals: { <entity.options from locals> }
  • 15. Let’s take a look at one! Please to make offerings of praise to demo gods on my behalf.
  • 16. Goals ● Generate a route and a component in the same command ● Use generated component in the route template ● Options for destructuring namespaces and providing a name for the model property on the component
  • 17. Further Reading Ember’s default blueprints https://github.com/emberjs/ember.js/tree/master/blueprints Ember-Data’s default blueprints https://github.com/emberjs/data/tree/master/blueprints Ember-CLI Guides http://www.ember-cli.com/extending/#generators-and- blueprints Demo app

Editor's Notes

  1. Not only can friendship and camraderie be forged over a casual game of horseshoes. So can world peace.
  2. The TLDR is that blueprints are a bundle of template files with optional install logic 44 total blueprints are shipped with Ember Ember-CLI comes with 10 default blueprints Ember comes with 26 default blueprints Ember-Data comes with 8 default blueprints Can be used in-app or for addons Blueprints tend to have a very narrow use case. The most common one is in addons where the addon author might want to provide the ability to easily generate addon related files. They are also used to install bower dependencies if needed for an addon. Mirage is a good example of this - it provides blueprints for mirage models, serializers, fixtures, and factories. In a broader sense, blueprints are useful when you are repeatedly creating a thing, usually made up of multiple files, that is defined by the values of it’s properties. Components are a great example. The default component blueprint creates 1 JS file, 1 HBS file, and 1 test. The point of this talk isn’t to convince you that blueprints are amazing and you should go create some in your app right now. Most Ember developers don’t have a good use case for blueprints because Ember ships with so many useful ones
  3. Fun fact: if we were to add an `thing-test` blueprint along side the `thing` blueprint for generating tests ember-cli would automatically run it when running the `thing` blueprint. The `-test` suffix also changes some behavior of some of the default tokens provided by ember-cli.
  4. You can have as many anonymous options as you want. They will always be keyed by key:value. Key required, value is not. Name is always the first anonymous option. aThing in this example availableOptions can have aliases ala component-test --test-type=[‘integration’,’unit’] or -i or -u
  5. fileMapTokens and locals both have predefined variables that can be accessed via the options hash. fileMapTokens: __name__: dasherized name of the thing being generated __root__: root of the application (app/ folder for normal blueprints, addon/ for addon blueprints) __path__: substitued with blueprint name at generation. Generally used with addons __test__: only used in pod scenarios
  6. Locals (template variables): dasherizedPackageName - dasherized name of project e.g. tomster-tracker classifiedPackageName - classified name of project e.g. TomsterTracker dasherizedModuleName - dasherized name of thing generated e.g. anchor-tag classifiedModuleName - classified name of thing being generated e.g. AnchorTag camelizedModuleName - camelized name of thing being generated e.g. anchorTag
  7. Run order is: normalizeEntityName locals fileMapTokens beforeInstall/unInstall install afterInstall/uninstall NormalizeEntityName by default checks to see if an entityName is specified and doesn’t contain a trailing slash. A good example of customization is the component blueprint. normalizeEntityName checks the entityName has a dash in it and throws an error otherwise.
  8. Anonymous options are defined as key:value and you can have as many of them as you like Available options require the --optionKey=value format. The can be loosely typed and can have aliases
  9. The options object is the lone argument for locals, fileMapTokens, and install. This is not the same as options for the blueprint. Some other potentially useful props on the locals options hash: Ui: gives you the ability to interact with the UI (write line to console, etc…) Project: access to project level properties like project path, installed addons, etc… taskOptions: access to pre-defined options in the `availableOptions` array
  10. Talk about the purpose of this blueprint: A common pattern is to have a top-level route component that receives the model from the route and contains all the logic you might normally put into a controller. This has the benefit of helping you get rid of controllers (unless you need query params) and also making your app a little easier to follow with one less layer of things to deal with. Currently this has to be done manually by first generating the route, then the component.
  11. Particularly interesting blueprints for further exploration: Ember’s route blueprint (modifies the router.js file along with generating the correct files) Ember’s resource blueprint (overrides install hook) Ember’s component blueprint (good example of availableOptions and alias use) Ember-Data’s model blueprint (good example of anonymousOptions use).