Skip to content

Commit

Permalink
Move fixture data into reaction package, ensure proper load order
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjudd committed Apr 29, 2014
1 parent b2a01d6 commit e651cb0
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 42 deletions.
9 changes: 5 additions & 4 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ cfs-filesystem
handlebars-server
bootstrap-alerts
d3
cfs-gridfs
cfs-s3
ui-dropped-event
fast-render

#
#reaction packages
Expand All @@ -40,7 +44,4 @@ reaction-helloworld
reaction-google-analytics
reaction-paypal
reaction-mailgun
cfs-gridfs
cfs-s3
ui-dropped-event
fast-render

1 change: 1 addition & 0 deletions packages/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ headers
/cfs-collection-filters
/fast-render
/numeral
/moment
11 changes: 11 additions & 0 deletions packages/reaction-commerce/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Package.on_use(function (api, where) {
api.add_files([
"server/app.coffee",
"server/publications.coffee",
"server/fixtures.coffee",
"server/methods/methods.coffee",
"server/methods/cart/methods.coffee",
"server/methods/orders/methods.coffee",
Expand Down Expand Up @@ -310,6 +311,16 @@ Package.on_use(function (api, where) {

], ["client"]);

// Private fixture data
api.add_files('private/data/Products.json', 'server', {isAsset: true});
api.add_files('private/data/Shops.json', 'server', {isAsset: true});
api.add_files('private/data/Tags.json', 'server', {isAsset: true});
api.add_files('private/data/SystemConfig.json', 'server', {isAsset: true});
api.add_files('private/data/ConfigData.json', 'server', {isAsset: true});
api.add_files('private/data/roles.json', 'server', {isAsset: true});
api.add_files('private/data/users.json', 'server', {isAsset: true});
api.add_files('private/data/Orders.json', 'server', {isAsset: true});

api.export([
"PackagesHandle",
"CartWorkflow",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/reaction-commerce/private/data/Shops.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{ "_id" : "WvrKDomkYth3THbDD", "addressBook" : [ { "_id" : "vbzuG4HHFwNGpbjRY", "address1" : "1001 Santa Monica Blvd", "city" : "Los Angeles", "country" : "US", "fullName" : "Joe Admin", "isCommercial" : false, "phone" : "555-625-1199", "postal" : "90401", "region" : "CA" } ], "createdAt" : { "$date" : "2014-01-09T16:47:29.397-0800" }, "currency" : "USD", "customEmailSettings" : { "port" : 25 }, "domains" : [ "localhost", "reaction.meteor.com", "demo.reactioncommerce.com", "hello.reactioncommerce.com", "rtest.meteor.com" ], "email" : "[email protected]", "members" : [ { "isAdmin" : false, "permissions" : [ "dashboard/customers", "dashboard/products", "dashboard/settings", "dashboard/settings/account" ], "userId" : "Cpx5zeNixb9jmePQx" }, { "permissions" : [ "dashboard/orders", "dashboard/settings/account", "dashboard/products" ], "userId" : "WZNkqBaZLRqACDLZ2" } ], "moneyFormat" : "$ ", "moneyInEmailsFormat" : "$", "moneyWithCurrencyFormat" : "$ USD", "moneyWithCurrencyInEmailsFormat" : "$ USD", "name" : "REACTION Demo", "ownerId" : "ydFCbJ3TbRXcRJBQ2", "taxes" : [ { "taxesIncluded" : null, "taxShipping" : null, "countyTaxes" : true } ], "timezone" : "(GMT-08:00) Pacific Time (US & Canada)", "updatedAt" : { "$date" : "2014-03-07T19:10:42.112-0800" }, "useCustomEmailSettings" : false }]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

loadData = (collection) ->
console.log "Loading fixture data for "+collection._name
json = EJSON.parse Assets.getText("data/"+collection._name+".json")
json = EJSON.parse Assets.getText("private/data/"+collection._name+".json")
for item,value in json
collection._collection.insert item, (error, result) ->
console.log error if error?
Expand All @@ -17,12 +17,11 @@ loadData = (collection) ->
share.loadFixtures = ->
# Load data from json files
loadData Products unless Products.find().count()
loadData Customers unless Customers.find().count()
loadData Meteor.users unless Meteor.users.find().count()
loadData Shops unless Shops.find().count()
loadData Tags unless Tags.find().count()
loadData ConfigData unless ConfigData.find().count()
# loadData Roles unless Roles.find().count()
# loadData roles unless roles.find().count()
# loadImageData "Images" unless Images.find().count()


Expand Down
11 changes: 0 additions & 11 deletions packages/reaction-google-analytics/client/startup.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,3 @@ Meteor.startup ->
value: $element.data("event-value")
ga("send", "event", analyticsEvent.category, analyticsEvent.action, analyticsEvent.label, analyticsEvent.value)
share.AnalyticsEvents.insert(analyticsEvent)

###
# Fixture - we always want a record
###
Meteor.startup ->
unless Packages.findOne({name:"reaction-google-analytics"})
Shops.find().forEach (shop) ->
Packages.insert
shopId: shop._id
name: "reaction-google-analytics"
property: Meteor.settings?.googleAnalyticsProperty
15 changes: 7 additions & 8 deletions packages/reaction-google-analytics/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ Package.describe({

Package.on_use(function (api, where) {
api.use([
"reaction-commerce",
"standard-app-packages",
"coffeescript",
"simple-schema",
"collection2",
"autoform"
], ["client", "server"]);
api.use([
"autoform",
"less",
"iron-router",
"reaction-commerce"
], ["client"]);
"iron-router"
], ["client", "server"]);

api.add_files([
"lib/collections/AnalyticsEvents.coffee"
"common/collections.coffee"
], ["client", "server"]);
api.add_files([
"client/register.coffee",
Expand All @@ -29,6 +27,7 @@ Package.on_use(function (api, where) {
], ["client"]);
api.add_files([
"server/security/AnalyticsEvents.coffee",
"server/publications.coffee"
"server/publications.coffee",
"server/fixtures.coffee"
], ["server"]);
});
11 changes: 11 additions & 0 deletions packages/reaction-google-analytics/server/fixtures.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
###
# Fixture - we always want a record
###
Meteor.startup ->
unless Packages.findOne({name:"reaction-google-analytics"})
console.log "Adding google analytics fixture data:", Meteor.settings?.googleAnalyticsProperty
Shops.find().forEach (shop) ->
Packages.insert
shopId: shop._id
name: "reaction-google-analytics"
property: Meteor.settings?.googleAnalyticsProperty
2 changes: 1 addition & 1 deletion packages/reaction-mailgun/client/templates/mailgun.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2>Mailgun<small> Settings</small></h2>
<div class="col-md-6 well">
{{#autoForm collection="Packages" schema="MailgunConfigSchema" doc=packageData type="update" id="mailgun-update-form"}}
{{>afQuickField name='settings.host' autofocus='' value="smtp.mailgun.org" placeholder="smtp.mailgun.org"}}
{{>afQuickField name='settings.port' value="25" placeholder="25"}}
{{>afQuickField name='settings.port' value="25" options="allowed"}}
{{>afQuickField name='settings.username'}}
{{>afQuickField name='settings.password' type="password"}}
<button type="submit" class="btn btn-primary pull-right">Update</button>
Expand Down
8 changes: 2 additions & 6 deletions packages/reaction-paypal/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ Package.on_use(function (api, where) {
"simple-schema",
"autoform",
"underscore-string-latest",
], ["client", "server"]);

api.use([
"autoform",
"less",
"reaction-commerce"
], ["client"]);
], ["client", "server"]);

api.add_files("common/collections.coffee",["client","server"]);
api.add_files("lib/paypal.js",["client","server"]);
Expand All @@ -38,4 +34,4 @@ Package.on_use(function (api, where) {
"PaypalPackageSchema",
], ["client", "server"]);

});
});
1 change: 0 additions & 1 deletion private/data/Customers.json

This file was deleted.

1 change: 0 additions & 1 deletion private/data/ReactionSessions.json

This file was deleted.

1 change: 0 additions & 1 deletion private/data/Shops.json

This file was deleted.

12 changes: 6 additions & 6 deletions smart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
},
"autoform": {
"git": "https://github.com/aldeed/meteor-autoform.git",
"tag": "v0.7.2",
"commit": "5d3265ab2607949ca776a45411ce11072413546d"
"tag": "v0.8.0",
"commit": "54a820a4a561e7f49d6fbc05d24b75c3d8d2e9be"
},
"collection2": {
"git": "https://github.com/aldeed/meteor-collection2.git",
Expand Down Expand Up @@ -94,8 +94,8 @@
},
"fast-render": {
"git": "https://github.com/arunoda/meteor-fast-render.git",
"tag": "v0.2.3",
"commit": "d56bd4a4d222bf176241cd6e756aa349cb24c260"
"tag": "v0.2.4",
"commit": "160a64bd61792f53a7c8848c5e979a953be13564"
},
"blaze-layout": {
"git": "https://github.com/EventedMind/blaze-layout.git",
Expand All @@ -109,8 +109,8 @@
},
"moment": {
"git": "https://github.com/acreeger/meteor-moment.git",
"tag": "v2.5.1",
"commit": "8c9bc5d3fc96705057737cb9743d555417f6e551"
"tag": "v2.6.0",
"commit": "26156df681750fd6e6ed77043eef32b6653ebbdf"
},
"cfs-base-package": {
"git": "https://github.com/CollectionFS/Meteor-cfs-base-package.git",
Expand Down

0 comments on commit e651cb0

Please sign in to comment.