diff --git a/project-deployer.js b/client/projects.js
similarity index 56%
rename from project-deployer.js
rename to client/projects.js
index a175367..a55100c 100644
--- a/project-deployer.js
+++ b/client/projects.js
@@ -1,44 +1,3 @@
-Projects = new Mongo.Collection('projects');
-
-ProjectService = {
- insert: function(label, git_url, public_url, commands, callback) {
- Projects.insert({
- label: label,
- git_url: git_url,
- public_url: public_url,
- commands: commands
- }, callback);
- },
-
- update: function(id, label, git_url, public_url ,commands) {
- Projects.update(
- id,
- { $set: {
- label: label,
- git_url: git_url,
- public_url: public_url,
- commands: commands
- }
- }
- );
- },
-
- delete: function(id) {
- Projects.remove(id);
- },
-
- get: function(id) {
- return Projects.findOne({_id: id});
- },
-
- list: function() {
- return Projects.find({}, {sort: {label: 1}});
- }
-};
-
-if (Meteor.isClient) {
- Meteor.subscribe('projects');
-
Template.management.helpers({
projects: function () {
return ProjectService.list();
@@ -102,34 +61,4 @@ if (Meteor.isClient) {
Session.set('projectToEdit', result);
});
},
- });
-
-}
-
-if (Meteor.isServer) {
- Meteor.publish('projects', function() {
- return Projects.find({});
- });
-}
-
-Meteor.methods({
- listProjects: function() {
- return ProjectService.list();
- },
-
- getProject: function(id) {
- return ProjectService.get(id);
- },
-
- addProject: function(label, git_url, public_url ,commands) {
- ProjectService.insert(label, git_url, public_url ,commands);
- },
-
- editProject: function(id, label, git_url, public_url ,commands) {
- ProjectService.update(id, label, git_url, public_url ,commands);
- },
-
- deleteProject: function(id) {
- ProjectService.delete(id);
- }
-});
+ });
\ No newline at end of file
diff --git a/project-deployer.css b/client/style.css
similarity index 100%
rename from project-deployer.css
rename to client/style.css
diff --git a/client/subscriptions.js b/client/subscriptions.js
new file mode 100644
index 0000000..a25c3ef
--- /dev/null
+++ b/client/subscriptions.js
@@ -0,0 +1 @@
+Meteor.subscribe('projects');
\ No newline at end of file
diff --git a/lib/methods.js b/lib/methods.js
new file mode 100644
index 0000000..0afd4f5
--- /dev/null
+++ b/lib/methods.js
@@ -0,0 +1,21 @@
+Meteor.methods({
+ listProjects: function() {
+ return ProjectService.list();
+ },
+
+ getProject: function(id) {
+ return ProjectService.get(id);
+ },
+
+ addProject: function(label, git_url, public_url ,commands) {
+ ProjectService.insert(label, git_url, public_url ,commands);
+ },
+
+ editProject: function(id, label, git_url, public_url ,commands) {
+ ProjectService.update(id, label, git_url, public_url ,commands);
+ },
+
+ deleteProject: function(id) {
+ ProjectService.delete(id);
+ }
+});
diff --git a/lib/projects.js b/lib/projects.js
new file mode 100644
index 0000000..950b412
--- /dev/null
+++ b/lib/projects.js
@@ -0,0 +1,37 @@
+Projects = new Mongo.Collection('projects');
+
+ProjectService = {
+ insert: function(label, git_url, public_url, commands, callback) {
+ Projects.insert({
+ label: label,
+ git_url: git_url,
+ public_url: public_url,
+ commands: commands
+ }, callback);
+ },
+
+ update: function(id, label, git_url, public_url ,commands) {
+ Projects.update(
+ id,
+ { $set: {
+ label: label,
+ git_url: git_url,
+ public_url: public_url,
+ commands: commands
+ }
+ }
+ );
+ },
+
+ delete: function(id) {
+ Projects.remove(id);
+ },
+
+ get: function(id) {
+ return Projects.findOne({_id: id});
+ },
+
+ list: function() {
+ return Projects.find({}, {sort: {label: 1}});
+ }
+};
diff --git a/server/publications.js b/server/publications.js
new file mode 100644
index 0000000..8a28989
--- /dev/null
+++ b/server/publications.js
@@ -0,0 +1,3 @@
+Meteor.publish('projects', function() {
+ return ProjectService.list();
+});
\ No newline at end of file