Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheVinc committed Dec 4, 2014
2 parents b769001 + 22c047a commit aeb05bb
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 32 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"redis": "~0.8.3",
"request": "~2.33.0",
"restify": "~2.5.1",
"restify-oauth2-oauthd": "~2.2.0",
"rewire": "^2.1.0",
"rimraf": "^2.2.8",
"sugar": "^1.4.1",
Expand Down
3 changes: 2 additions & 1 deletion providers/23andme/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"install": {
"href": {
"provider": "https://23andme.com/",
"docs": "https://api.23andme.com/docs"
"docs": "https://api.23andme.com/docs",
"apps": "https://api.23andme.com/dev"
}
},
"sample": {
Expand Down
3 changes: 2 additions & 1 deletion providers/500px/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"install": {
"href": {
"provider": "http://500px.com/",
"docs": "https://github.com/500px/api-documentation"
"docs": "https://github.com/500px/api-documentation",
"apps": "http://500px.com/settings/applications"
}
},
"sample": {
Expand Down
53 changes: 53 additions & 0 deletions providers/angel_list/conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "AngelList",
"desc": "AngelList is a US website for startups, angel investors, and job-seekers looking to work at startups.",
"url": "https://api.angel.co/",
"oauth2": {
"authorize": {
"url": "https://angel.co/api/oauth/authorize",
"query": {
"response_type": "code",
"client_id": "{client_id}",
"state": "{{state}}",
"scope": "{scope}"
},
"format": "url"
},
"access_token": {
"url": "https://angel.co/api/oauth/token",
"query": {
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"grant_type": "authorization_code",
"code": "{{code}}"
},
"format": "json"
},
"request": {
"url": "https://api.angel.co/"
},
"refresh": {
"url": "https://angel.co/api/oauth/token",
"method": "post",
"query": {
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"grant_type": "refresh_token",
"refresh_token": "{{refresh_token}}"
}
},
"parameters": {
"client_id": "string",
"client_secret": "string",
"scope": {
"values": {
"comment": "gives your application permission to create and destroy likes and comments.",
"email": "gives your application access to the user's email address.",
"message": "gives your application access to the user's private messages, for reading and writing.",
"talent": "gives your application access to the user's presence on AngelList Talent."
},
"separator": " "
}
}
}
}
Binary file added providers/angel_list/config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added providers/angel_list/keys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added providers/angel_list/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions providers/angel_list/me.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var me = {
fetch: [

function(fetched_elts) {
return '/1/me';
}

],
params: {},
fields: {
id: "=",
email: "=",
location: "country",
name: "=",
avatar: function(me) {
return me.image;
}
}
};
module.exports = me;
23 changes: 23 additions & 0 deletions providers/angel_list/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"settings": {
"createApp": {
"url": "https://angel.co/api/oauth/clients",
"image": "config.png"
},
"copyingKey": {
"url": "https://angel.co/api/oauth/clients",
"image": "keys.png"
},
"install": {
"href": {
"provider": "https://angel.co/",
"docs": "https://angel.co/api",
"apps": "https://angel.co/api/oauth/clients"
}
},
"sample": {
"method": "get",
"url": "/1/me"
}
}
}
Binary file added providers/app_net/config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added providers/app_net/keys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added providers/app_net/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions providers/app_net/me.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var me = {
fetch: [

function(fetched_elts) {
return '/users/me';
}

],
params: {},
fields: {
id: function(me) {
return me.data.id;
},
location: function(me) {
return me.data.locale;
},
name: function(me) {
return me.data.username;
},
avatar: function(me) {
return me.data.avatar_image.url;
},
alias: function(me) {
return me.data.username;
}
}
};
module.exports = me;
23 changes: 23 additions & 0 deletions providers/app_net/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"settings": {
"createApp": {
"url": "https://developers.app.net/docs/guides/create-an-app/",
"image": "config.png"
},
"copyingKey": {
"url": "https://account.app.net/developer/apps/",
"image": "keys.png"
},
"install": {
"href": {
"provider": "https://app.net/",
"docs": "https://developers.app.net/reference/resources/",
"apps": "https://account.app.net/developer/apps/"
}
},
"sample": {
"method": "get",
"url": "/users/me"
}
}
}
3 changes: 2 additions & 1 deletion providers/asana/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"install": {
"href": {
"provider": "https://asana.com",
"docs": "http://developer.asana.com/documentation"
"docs": "http://developer.asana.com/documentation",
"apps": "http://app.asana.com/-/account_api"
}
},
"sample": {
Expand Down
6 changes: 3 additions & 3 deletions providers/bitbucket/settings.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"settings": {
"createApp": {
"url": "https://bitbucket.org/account",
"url": "https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket#OAuthonBitbucket-Step1.CreateanOAuthkeyandsecret",
"image": "config.png"
},
"copyingKey": {
"url": "https://bitbucket.org/account",
"url": "https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket#OAuthonBitbucket-Step1.CreateanOAuthkeyandsecret",
"image": "keys.png"
},
"install": {
"href": {
"provider": "https://bitbucket.org/",
"docs": "http://confluence.atlassian.com/display/BITBUCKET/Using+the+Bitbucket+REST+APIs"
"docs": "https://confluence.atlassian.com/display/BITBUCKET/Use+the+Bitbucket+REST+APIs"
}
},
"sample": {
Expand Down
3 changes: 3 additions & 0 deletions providers/github/me.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ var me = {
url: '/user',
params: {},
fields: {
id: function(me) {
return "" + me.id;
},
name: '=',
company: '=',
alias: 'login',
Expand Down
2 changes: 1 addition & 1 deletion providers/spotify/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"user-read-private": "Access your profile name, image and subscription details",
"user-read-email": "Get your real email address"
},
"separator": ","
"separator": " "
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion providers/spotify/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"install": {
"href": {
"provider": "https://www.spotify.com/",
"docs": "https://developer.spotify.com/web-api/"
"docs": "https://developer.spotify.com/web-api/",
"apps": "https://developer.spotify.com/my-applications"
}
},
"sample": {
Expand Down
8 changes: 5 additions & 3 deletions providers/uber/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
"settings": {
"createApp": {
"url": "https://login.uber.com/applications/new",
"image": "config.png"
},
"copyingKey": {
"url": "https://login.uber.com/applications",
"image": "keys.png"
},
"install": {
"href": {
"provider": "https://uber.com/",
"docs": "https://developer.uber.com/v1/api-reference/"
"docs": "https://developer.uber.com/v1/api-reference/",
"apps": "https://login.uber.com/applications"
}
},
"sample": {
Expand All @@ -21,7 +24,6 @@
"method": "get",
"url": "/v1/me"
}
},
"jsfiddle": "http://jsfiddle.net/willjcksn/2hb6B/embedded/"
}
}
}
2 changes: 2 additions & 0 deletions src/core/pluginsEngine/plugins.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ module.exports = (env) ->

pluginsEngine.init = (cwd, callback) ->
env.pluginsEngine.cwd = cwd

env.scaffolding.plugins.info.getPluginsJson({ activeOnly: true })
.then (obj) ->
if not obj?
Expand All @@ -94,6 +95,7 @@ module.exports = (env) ->
loadPlugin(global_interface)
return callback null
.fail (e) ->
console.log e
return callback e

pluginsEngine.list = (callback) ->
Expand Down
49 changes: 34 additions & 15 deletions src/data/base-entity.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,45 @@ module.exports = (env) ->

defer.promise

save: () ->
save: (overwrite, delete_unknown_keys) ->
overwrite ?= true
delete_unknown_keys ?= false
defer = Q.defer()

# hat function that actually saves
_save = (done) =>
multi = env.data.redis.multi()
for key, value of @props
if typeof value == 'string'
multi.set @prefix() + key, value
if typeof value == 'object' and not value?.length?
multi.hmset @prefix() + key, value
if typeof value == 'object' and value?.length?
multi.del @prefix() + key
for k, v of value
multi.sadd @prefix() + key, v

# actual save
multi.exec (e, res) =>
return done e if e
done()

@keys()
.then (keys) =>
if delete_unknown_keys
prefixedProps = []
for key in Object.keys(@props)
prefixedProps.push @prefix() + key
for key in keys
if key not in prefixedProps
multi.del key
for key, value of @props
if typeof value == 'string' or typeof value == 'number'
multi.set @prefix() + key, value
else if typeof value == 'object' and Array.isArray(value)
multi.del @prefix() + key
for k, v of value
multi.sadd @prefix() + key, v
else if value? and typeof value == 'object'
if overwrite
multi.del @prefix() + key
multi.hmset @prefix() + key, value
else
# TODO (value instanceof Boolean || typeof value == 'boolean')
console.log "not saved: type not found"

# actual save
multi.exec (e, res) =>
return done e if e
done()
.fail (e) =>
return done e if e

# checks if new entity or not. If no id found, increments ids
if not @id?
Expand Down
1 change: 0 additions & 1 deletion src/scaffolding/plugins/git.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = (env, plugin_name, fetch, cwd) ->
git =
getCurrentVersion: () ->
defer = Q.defer()

execGit ['branch -v'], (error, stdout, stderr) ->
return defer.reject error if error

Expand Down
4 changes: 4 additions & 0 deletions src/scaffolding/plugins/info.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = (env) ->
getPluginsJson: (opts) ->
defer = Q.defer()
opts ?= {}

fs.readFile process.cwd() + '/plugins.json', {encoding: 'UTF-8'}, (err, data) ->
return defer.reject err if err
try
Expand Down Expand Up @@ -50,6 +51,7 @@ module.exports = (env) ->
plugins_json[plugin_name] = value
next()
.fail (e) ->

plugins_json[plugin_name] = {
name: plugin_name,
active: true
Expand Down Expand Up @@ -133,6 +135,8 @@ module.exports = (env) ->
.then (v) ->
plugin_data.version = v.version
defer.resolve plugin_data
.fail () ->
defer.resolve plugin_data
catch err
defer.reject err

Expand Down
Loading

0 comments on commit aeb05bb

Please sign in to comment.