Skip to content

Commit

Permalink
Merge pull request #419 from cvega/master
Browse files Browse the repository at this point in the history
[api] [dist] Add system methods, update travis.yml
  • Loading branch information
Marak authored Sep 8, 2017
2 parents 2562420 + cf74df1 commit 9ffe793
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
sudo: false
language: node_js
node_js:
- "6"
- "6.1"
- "5"
- "5.1"
- "4"
Expand Down
62 changes: 62 additions & 0 deletions lib/locales/en/system/directoryPaths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module['exports'] = [
"/Applications",
"/bin",
"/boot",
"/boot/defaults",
"/dev",
"/etc",
"/etc/defaults",
"/etc/mail",
"/etc/namedb",
"/etc/periodic",
"/etc/ppp",
"/home",
"/home/user",
"/home/user/dir",
"/lib",
"/Library",
"/lost+found",
"/media",
"/mnt",
"/net",
"/Network",
"/opt",
"/opt/bin",
"/opt/include",
"/opt/lib",
"/opt/sbin",
"/opt/share",
"/private",
"/private/tmp",
"/private/var",
"/proc",
"/rescue",
"/root",
"/sbin",
"/selinux",
"/srv",
"/sys",
"/System",
"/tmp",
"/Users",
"/usr",
"/usr/X11R6",
"/usr/bin",
"/usr/include",
"/usr/lib",
"/usr/libdata",
"/usr/libexec",
"/usr/local/bin",
"/usr/local/src",
"/usr/obj",
"/usr/ports",
"/usr/sbin",
"/usr/share",
"/usr/src",
"/var",
"/var/log",
"/var/mail",
"/var/spool",
"/var/tmp",
"/var/yp"
];
3 changes: 2 additions & 1 deletion lib/locales/en/system/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var system = {};
module['exports'] = system;
system.mimeTypes = require("./mimeTypes");
system.directoryPaths = require("./directoryPaths");
system.mimeTypes = require("./mimeTypes");
9 changes: 5 additions & 4 deletions lib/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,22 @@ function System (faker) {
};

/**
* not yet implemented
* returns directory path
*
* @method faker.system.directoryPath
*/
this.directoryPath = function () {
// TODO
var paths = faker.definitions.system.directoryPaths
return faker.random.arrayElement(paths);
};

/**
* not yet implemented
* returns file path
*
* @method faker.system.filePath
*/
this.filePath = function () {
// TODO
return faker.fake("{{system.directoryPath}}/{{system.fileName}}");
};

/**
Expand Down

0 comments on commit 9ffe793

Please sign in to comment.