fanforce-plugin-factory 1.6.1 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/Rakefile +3 -1
  2. data/fanforce-plugin-factory.gemspec +21 -20
  3. data/lib/fanforce/app_factory/asset_framework/app_factory/_bootstrap_override.scss +1 -0
  4. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/base-footer/_base-footer.coffee +6 -0
  5. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/base-footer/_base-footer.scss +21 -0
  6. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/campaign-footer/_campaign-footer.coffee +15 -0
  7. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/campaign-footer/_campaign-footer.scss +4 -0
  8. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/initiative-added/_initiative-added.coffee +15 -0
  9. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/initiative-added/_initiative-added.scss +4 -0
  10. data/lib/fanforce/app_factory/asset_framework/app_factory/directives/page/_page.scss +6 -0
  11. data/lib/fanforce/app_factory/asset_framework/app_factory/vendors/moment.min.js +6 -0
  12. data/lib/fanforce/app_factory/directive_views/campaign-footer.haml +8 -0
  13. data/lib/fanforce/app_factory/directive_views/initiative-added.haml +8 -0
  14. data/lib/fanforce/app_factory/scaffolding/assets/css/._fembedded_native.scss.registry +4 -0
  15. data/lib/fanforce/app_factory/scaffolding/assets/css/fembedded_native.scss +21 -0
  16. data/lib/fanforce/app_factory/scaffolding/assets/js/._app-fembedded.coffee.registry +2 -0
  17. data/lib/fanforce/app_factory/scaffolding/assets/js/._fembedded_native.js.registry +2 -0
  18. data/lib/fanforce/app_factory/scaffolding/assets/js/fembedded_native.js +7 -0
  19. data/lib/fanforce/app_factory/scaffolding/layouts/._fembedded_native.haml.registry +3 -0
  20. data/lib/fanforce/app_factory/scaffolding/layouts/fembedded_native.haml +8 -0
  21. data/lib/fanforce/app_factory/sinatra/helper_routes/com_campaign.rb +11 -0
  22. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/initiative-footer/_initiative-footer.scss +1 -17
  23. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/initiative-searcher/_initiative-searcher.scss +4 -4
  24. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/loading/_loading.scss +1 -1
  25. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/start-arrow/_start-arrow.scss +3 -3
  26. data/lib/fanforce/plugin_factory/cli/lib/bitbucket.rb +1 -1
  27. data/lib/fanforce/plugin_factory/cli/lib/env.rb +1 -1
  28. data/lib/fanforce/plugin_factory/cli/lib/heroku.rb +67 -49
  29. data/lib/fanforce/plugin_factory/cli/lib/iron.rb +1 -3
  30. data/lib/fanforce/plugin_factory/cli/lib/scaffolding.rb +9 -3
  31. data/lib/fanforce/plugin_factory/cli/lib/scaffolding_file.rb +22 -8
  32. data/lib/fanforce/plugin_factory/cli/scripts/destroy.rb +11 -13
  33. data/lib/fanforce/plugin_factory/cli/scripts/push.rb +6 -12
  34. data/lib/fanforce/plugin_factory/cli/scripts/restart.rb +1 -7
  35. data/lib/fanforce/plugin_factory/core_config.rb +2 -2
  36. data/lib/fanforce/plugin_factory/directive_views/initiative-footer.haml +9 -8
  37. data/lib/fanforce/plugin_factory/plugin.rb +7 -0
  38. data/lib/fanforce/plugin_factory/scaffolding/._Gemfile.registry +1 -0
  39. data/lib/fanforce/plugin_factory/scaffolding/._Rakefile.registry +1 -0
  40. data/lib/fanforce/plugin_factory/scaffolding/._config.ru.registry +1 -0
  41. data/lib/fanforce/plugin_factory/scaffolding/._robots.txt.registry +1 -0
  42. data/lib/fanforce/plugin_factory/scaffolding/Gemfile +0 -1
  43. data/lib/fanforce/plugin_factory/scaffolding/Rakefile +0 -1
  44. data/lib/fanforce/plugin_factory/scaffolding/Routes.rb +5 -4
  45. data/lib/fanforce/plugin_factory/scaffolding/assets/css/._fembedded.scss.registry +1 -0
  46. data/lib/fanforce/plugin_factory/scaffolding/assets/css/fembedded.scss +1 -4
  47. data/lib/fanforce/plugin_factory/scaffolding/assets/js/._fembedded.js.registry +1 -0
  48. data/lib/fanforce/plugin_factory/scaffolding/assets/js/controllers/initialize.txt +2 -0
  49. data/lib/fanforce/plugin_factory/scaffolding/assets/js/fembedded.js +3 -1
  50. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/._filters.coffee.registry +1 -0
  51. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee +21 -1
  52. data/lib/fanforce/plugin_factory/scaffolding/assets/js/scripts/initialize.txt +2 -0
  53. data/lib/fanforce/plugin_factory/scaffolding/config.ru +6 -0
  54. data/lib/fanforce/plugin_factory/scaffolding/layouts/._fembedded.haml.registry +1 -0
  55. data/lib/fanforce/plugin_factory/scaffolding/layouts/fembedded.haml +11 -16
  56. data/lib/fanforce/plugin_factory/scaffolding/robots.txt +0 -1
  57. data/lib/fanforce/plugin_factory/sinatra/_load.rb +3 -3
  58. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_database.rb +4 -4
  59. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_initiative.rb +2 -1
  60. data/lib/fanforce/plugin_factory/version.rb +1 -1
  61. metadata +59 -25
  62. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/bootstrap/_bootstrap-overrides.scss +0 -18
  63. data/lib/fanforce/plugin_factory/scaffolding/assets/js/fembedded-app.coffee +0 -11
  64. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_broadcaster.rb +0 -7
data/Rakefile CHANGED
@@ -29,7 +29,9 @@ namespace :scaffolding do
29
29
  scaffolding_dir = File.expand_path('../lib/fanforce/plugin_factory/scaffolding', __FILE__)
30
30
 
31
31
  Dir.glob("#{scaffolding_dir}/**/*", File::FNM_DOTMATCH).each do |scaffold_filepath|
32
- next if scaffold_filepath =~ /\.registry/ or File.directory?(scaffold_filepath)
32
+ next if scaffold_filepath =~ /\.registry$/
33
+ next if scaffold_filepath =~ /\/initialize\.txt/
34
+ next if File.directory?(scaffold_filepath)
33
35
 
34
36
  file_parts = scaffold_filepath.split('/')
35
37
  registry_filepath = "#{file_parts[0...-1].join('/')}/._#{file_parts[-1]}.registry"
@@ -16,29 +16,30 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.add_runtime_dependency 'rake', '~> 10.3.2'
20
- gem.add_runtime_dependency 'redis', '~> 3.1.0'
21
- gem.add_runtime_dependency 'sinatra', '~> 1.4.5'
22
- gem.add_runtime_dependency 'sinatra-contrib', '~> 1.4.2'
23
- gem.add_runtime_dependency 'rack-contrib', '~> 1.1.0'
24
- gem.add_runtime_dependency 'haml', '~> 4.0.5'
25
- gem.add_runtime_dependency 'coffee-script', '~> 2.3.0'
26
- gem.add_runtime_dependency 'coffee-script-source', '~>1.8.0'
19
+ gem.add_runtime_dependency 'rake', '~> 10.3.2'
20
+ gem.add_runtime_dependency 'redis', '~> 3.1.0'
21
+ gem.add_runtime_dependency 'sinatra', '~> 1.4.5'
22
+ gem.add_runtime_dependency 'sinatra-contrib', '~> 1.4.2'
23
+ gem.add_runtime_dependency 'rack-contrib', '~> 1.2.0'
24
+ gem.add_runtime_dependency 'rack-cors', '~> 0.2'
25
+ gem.add_runtime_dependency 'haml', '~> 4.0.5'
26
+ gem.add_runtime_dependency 'coffee-script', '~> 2.3.0'
27
27
 
28
- gem.add_runtime_dependency 'sass', '~> 3.4.5'
29
- gem.add_runtime_dependency 'compass', '~> 1.0.1'
30
- gem.add_runtime_dependency 'sprockets', '~> 2.12.2'
31
- gem.add_runtime_dependency 'sprockets-sass', '~> 1.2.0'
32
- gem.add_runtime_dependency 'yui-compressor', '~> 0.12.0'
33
- gem.add_runtime_dependency 'uglifier', '~> 2.5.3'
34
- gem.add_runtime_dependency 'therubyracer', '~> 0.12.1'
28
+ gem.add_runtime_dependency 'sass', '~> 3.4.5'
29
+ gem.add_runtime_dependency 'compass', '~> 1.0.1'
30
+ gem.add_runtime_dependency 'sprockets', '~> 2.12.2'
31
+ gem.add_runtime_dependency 'sprockets-sass', '~> 1.2.0'
32
+ gem.add_runtime_dependency 'yui-compressor', '~> 0.12.0'
33
+ gem.add_runtime_dependency 'uglifier', '~> 2.5.3'
34
+ gem.add_runtime_dependency 'therubyracer', '~> 0.12.1'
35
35
 
36
- gem.add_runtime_dependency 'bugsnag', '~> 2.5.0'
37
- gem.add_runtime_dependency 'rack-jsonr', '~> 0.2.7'
36
+ gem.add_runtime_dependency 'bugsnag', '~> 2.5.0'
37
+ gem.add_runtime_dependency 'rack-jsonr', '~> 0.3.0'
38
+ gem.add_runtime_dependency 'rack-jquery-params','~> 0.1.1'
38
39
 
39
- gem.add_runtime_dependency 'rest_client', '= 1.7.3'
40
+ gem.add_runtime_dependency 'rest_client', '= 1.7.3'
40
41
 
41
42
  gem.add_runtime_dependency 'fanforce-base', '>= 1.6.0'
42
- gem.add_runtime_dependency 'fanforce-api', '>= 1.6.0'
43
- gem.add_runtime_dependency 'fanforce-plugin-worker', '>= 1.6.0'
43
+ gem.add_runtime_dependency 'fanforce-api', '>= 2.0.0.rc1'
44
+ gem.add_runtime_dependency 'fanforce-plugin-worker', '>= 2.0.0.rc1'
44
45
  end
@@ -0,0 +1 @@
1
+ @import 'app_factory/bootstrap/bootstrap_override';
@@ -0,0 +1,6 @@
1
+ App.directive('baseFooter', [() ->
2
+ restrict: 'E',
3
+ link: (($scope, $element, attrs) ->
4
+
5
+ )
6
+ ])
@@ -0,0 +1,21 @@
1
+ $module_path: '/assets/app_factory/directives/base-footer';
2
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
+
4
+ base-footer { position:absolute; bottom:0; left:0; padding:0 3px; @include box-sizing(border-box); text-align:left; width:100%; margin:0px; overflow:hidden; background: #F4F8FC; @include box-shadow(0 -1px 2px rgba(0,0,0,0.08));
5
+ &.disabled .footer { pointer-events: none;
6
+ label { @include opacity(.5); }
7
+ .input-wrapper { @include opacity(.5); cursor: not-allowed; }
8
+ button { @include opacity(.5); background: #c9d5e1; border-color: #a6b4c1; text-shadow: none; }
9
+ }
10
+ .footer { @include box-shadow(#ffffff 0 1px 0 inset); padding: 5px 0; border-top: 1px solid #e1e1e1;
11
+ label { font-weight:100; color:#666666; text-shadow:1px 1px 0 #ffffff; margin-left:20px; }
12
+ .input-wrapper { cursor: text; position:relative; display: inline-block; color: #555555; background: rgba(255, 255, 255, 0.75); @include border-radius(4px); border: 1px solid #CCCCCC; @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.075) inset);
13
+ .prefix { pointer-events: none; font-size: 12px; font-weight: normal; line-height: 1.5; height:28px; vertical-align: middle; padding: 5px 0 0 8px; display:inline-block; }
14
+ input { font-size: 12px; font-weight: normal; background: transparent; padding-left: 0px; border:none; height:28px; @include box-shadow(none); min-width:250px; width:auto; display:inline-block; vertical-align: middle; }
15
+ }
16
+ button { margin-top: 0; margin-left: 2px; padding-top: 5px; padding-bottom: 5px;
17
+ &[disabled] { @include opacity(0.25); }
18
+ i { margin-right: 5px; }
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,15 @@
1
+ App.directive('campaignFooter', [() ->
2
+ restrict: 'E',
3
+ templateUrl: '/app_factory/directives/campaign-footer'
4
+ scope: {
5
+ campaign_name: '=campaignName'
6
+ saveCallback: '=save'
7
+ }
8
+ link: (($scope, $element, attrs) ->
9
+
10
+ $scope.save = (()->
11
+ $scope.saveCallback()
12
+ )
13
+
14
+ )
15
+ ])
@@ -0,0 +1,4 @@
1
+ $module_path: '/assets/app_factory/directives/campaign-footer';
2
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
+
4
+ campaign-footer { display: block; }
@@ -0,0 +1,15 @@
1
+ App.directive('initiativeAdded', [() ->
2
+ restrict: 'E',
3
+ templateUrl: '/app_factory/directives/initiative-added'
4
+ scope: {
5
+ initiative_name: '=initiativeName'
6
+ prefix: '@'
7
+ }
8
+ link: (($scope, $element, attrs) ->
9
+
10
+ $scope.close = (->
11
+ FF.frame.close()
12
+ )
13
+
14
+ )
15
+ ])
@@ -0,0 +1,4 @@
1
+ $module_path: '/assets/app_factory/directives/initiative-added';
2
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
+
4
+ initiative-added { display: block; text-align: center; }
@@ -0,0 +1,6 @@
1
+ $module_path: '/assets/app_factory/directives/page';
2
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
+
4
+ page { display:block; overflow:hidden;
5
+ &.success { background: #eefcd8; }
6
+ }
@@ -0,0 +1,6 @@
1
+ // moment.js
2
+ // version : 2.0.0
3
+ // author : Tim Wood
4
+ // license : MIT
5
+ // momentjs.com
6
+ (function(e){function O(e,t){return function(n){return j(e.call(this,n),t)}}function M(e){return function(t){return this.lang().ordinal(e.call(this,t))}}function _(){}function D(e){H(this,e)}function P(e){var t=this._data={},n=e.years||e.year||e.y||0,r=e.months||e.month||e.M||0,i=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,o=e.hours||e.hour||e.h||0,u=e.minutes||e.minute||e.m||0,a=e.seconds||e.second||e.s||0,f=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=f+a*1e3+u*6e4+o*36e5,this._days=s+i*7,this._months=r+n*12,t.milliseconds=f%1e3,a+=B(f/1e3),t.seconds=a%60,u+=B(a/60),t.minutes=u%60,o+=B(u/60),t.hours=o%24,s+=B(o/24),s+=i*7,t.days=s%30,r+=B(s/30),t.months=r%12,n+=B(r/12),t.years=n}function H(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function B(e){return e<0?Math.ceil(e):Math.floor(e)}function j(e,t){var n=e+"";while(n.length<t)n="0"+n;return n}function F(e,t,n){var r=t._milliseconds,i=t._days,s=t._months,o;r&&e._d.setTime(+e+r*n),i&&e.date(e.date()+i*n),s&&(o=e.date(),e.date(1).month(e.month()+s*n).date(Math.min(o,e.daysInMonth())))}function I(e){return Object.prototype.toString.call(e)==="[object Array]"}function q(e,t){var n=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),i=0,s;for(s=0;s<n;s++)~~e[s]!==~~t[s]&&i++;return i+r}function R(e,t){return t.abbr=e,s[e]||(s[e]=new _),s[e].set(t),s[e]}function U(e){return e?(!s[e]&&o&&require("./lang/"+e),s[e]):t.fn._lang}function z(e){return e.match(/\[.*\]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function W(e){var t=e.match(a),n,r;for(n=0,r=t.length;n<r;n++)A[t[n]]?t[n]=A[t[n]]:t[n]=z(t[n]);return function(i){var s="";for(n=0;n<r;n++)s+=typeof t[n].call=="function"?t[n].call(i,e):t[n];return s}}function X(e,t){function r(t){return e.lang().longDateFormat(t)||t}var n=5;while(n--&&f.test(t))t=t.replace(f,r);return C[t]||(C[t]=W(t)),C[t](e)}function V(e){switch(e){case"DDDD":return p;case"YYYY":return d;case"YYYYY":return v;case"S":case"SS":case"SSS":case"DDD":return h;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return m;case"X":return b;case"Z":case"ZZ":return g;case"T":return y;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return c;default:return new RegExp(e.replace("\\",""))}}function $(e,t,n){var r,i,s=n._a;switch(e){case"M":case"MM":s[1]=t==null?0:~~t-1;break;case"MMM":case"MMMM":r=U(n._l).monthsParse(t),r!=null?s[1]=r:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":t!=null&&(s[2]=~~t);break;case"YY":s[0]=~~t+(~~t>68?1900:2e3);break;case"YYYY":case"YYYYY":s[0]=~~t;break;case"a":case"A":n._isPm=(t+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":s[3]=~~t;break;case"m":case"mm":s[4]=~~t;break;case"s":case"ss":s[5]=~~t;break;case"S":case"SS":case"SSS":s[6]=~~(("0."+t)*1e3);break;case"X":n._d=new Date(parseFloat(t)*1e3);break;case"Z":case"ZZ":n._useUTC=!0,r=(t+"").match(x),r&&r[1]&&(n._tzh=~~r[1]),r&&r[2]&&(n._tzm=~~r[2]),r&&r[0]==="+"&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}t==null&&(n._isValid=!1)}function J(e){var t,n,r=[];if(e._d)return;for(t=0;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];r[3]+=e._tzh||0,r[4]+=e._tzm||0,n=new Date(0),e._useUTC?(n.setUTCFullYear(r[0],r[1],r[2]),n.setUTCHours(r[3],r[4],r[5],r[6])):(n.setFullYear(r[0],r[1],r[2]),n.setHours(r[3],r[4],r[5],r[6])),e._d=n}function K(e){var t=e._f.match(a),n=e._i,r,i;e._a=[];for(r=0;r<t.length;r++)i=(V(t[r]).exec(n)||[])[0],i&&(n=n.slice(n.indexOf(i)+i.length)),A[t[r]]&&$(t[r],i,e);e._isPm&&e._a[3]<12&&(e._a[3]+=12),e._isPm===!1&&e._a[3]===12&&(e._a[3]=0),J(e)}function Q(e){var t,n,r,i=99,s,o,u;while(e._f.length){t=H({},e),t._f=e._f.pop(),K(t),n=new D(t);if(n.isValid()){r=n;break}u=q(t._a,n.toArray()),u<i&&(i=u,r=n)}H(e,r)}function G(e){var t,n=e._i;if(w.exec(n)){e._f="YYYY-MM-DDT";for(t=0;t<4;t++)if(S[t][1].exec(n)){e._f+=S[t][0];break}g.exec(n)&&(e._f+=" Z"),K(e)}else e._d=new Date(n)}function Y(t){var n=t._i,r=u.exec(n);n===e?t._d=new Date:r?t._d=new Date(+r[1]):typeof n=="string"?G(t):I(n)?(t._a=n.slice(0),J(t)):t._d=n instanceof Date?new Date(+n):new Date(n)}function Z(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function et(e,t,n){var i=r(Math.abs(e)/1e3),s=r(i/60),o=r(s/60),u=r(o/24),a=r(u/365),f=i<45&&["s",i]||s===1&&["m"]||s<45&&["mm",s]||o===1&&["h"]||o<22&&["hh",o]||u===1&&["d"]||u<=25&&["dd",u]||u<=45&&["M"]||u<345&&["MM",r(u/30)]||a===1&&["y"]||["yy",a];return f[2]=t,f[3]=e>0,f[4]=n,Z.apply({},f)}function tt(e,n,r){var i=r-n,s=r-e.day();return s>i&&(s-=7),s<i-7&&(s+=7),Math.ceil(t(e).add("d",s).dayOfYear()/7)}function nt(e){var n=e._i,r=e._f;return n===null||n===""?null:(typeof n=="string"&&(e._i=n=U().preparse(n)),t.isMoment(n)?(e=H({},n),e._d=new Date(+n._d)):r?I(r)?Q(e):K(e):Y(e),new D(e))}function rt(e,n){t.fn[e]=t.fn[e+"s"]=function(e){var t=this._isUTC?"UTC":"";return e!=null?(this._d["set"+t+n](e),this):this._d["get"+t+n]()}}function it(e){t.duration.fn[e]=function(){return this._data[e]}}function st(e,n){t.duration.fn["as"+e]=function(){return+this/n}}var t,n="2.0.0",r=Math.round,i,s={},o=typeof module!="undefined"&&module.exports,u=/^\/?Date\((\-?\d+)/i,a=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,f=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,l=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,c=/\d\d?/,h=/\d{1,3}/,p=/\d{3}/,d=/\d{1,4}/,v=/[+\-]?\d{1,6}/,m=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,g=/Z|[\+\-]\d\d:?\d\d/i,y=/T/i,b=/[\+\-]?\d+(\.\d{1,3})?/,w=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,E="YYYY-MM-DDTHH:mm:ssZ",S=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],x=/([\+\-]|\d\d)/gi,T="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),N={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},C={},k="DDD w W M D d".split(" "),L="M D H h m s w W".split(" "),A={M:function(){return this.month()+1},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return j(this.year()%100,2)},YYYY:function(){return j(this.year(),4)},YYYYY:function(){return j(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return j(~~(this.milliseconds()/10),2)},SSS:function(){return j(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(e/60),2)+":"+j(~~e%60,2)},ZZ:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(10*e/6),4)},X:function(){return this.unix()}};while(k.length)i=k.pop(),A[i+"o"]=M(A[i]);while(L.length)i=L.pop(),A[i+i]=O(A[i],2);A.DDDD=O(A.DDD,3),_.prototype={set:function(e){var t,n;for(n in e)t=e[n],typeof t=="function"?this[n]=t:this["_"+n]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var n,r,i,s;this._monthsParse||(this._monthsParse=[]);for(n=0;n<12;n++){this._monthsParse[n]||(r=t([2e3,n]),i="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[n]=new RegExp(i.replace(".",""),"i"));if(this._monthsParse[n].test(e))return n}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},meridiem:function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var n=this._calendar[e];return typeof n=="function"?n.apply(t):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,n,r){var i=this._relativeTime[n];return typeof i=="function"?i(e,t,n,r):i.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?"future":"past"];return typeof n=="function"?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return tt(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},t=function(e,t,n){return nt({_i:e,_f:t,_l:n,_isUTC:!1})},t.utc=function(e,t,n){return nt({_useUTC:!0,_isUTC:!0,_l:n,_i:e,_f:t})},t.unix=function(e){return t(e*1e3)},t.duration=function(e,n){var r=t.isDuration(e),i=typeof e=="number",s=r?e._data:i?{}:e,o;return i&&(n?s[n]=e:s.milliseconds=e),o=new P(s),r&&e.hasOwnProperty("_lang")&&(o._lang=e._lang),o},t.version=n,t.defaultFormat=E,t.lang=function(e,n){var r;if(!e)return t.fn._lang._abbr;n?R(e,n):s[e]||U(e),t.duration.fn._lang=t.fn._lang=U(e)},t.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),U(e)},t.isMoment=function(e){return e instanceof D},t.isDuration=function(e){return e instanceof P},t.fn=D.prototype={clone:function(){return t(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return t.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return this._isValid==null&&(this._a?this._isValid=!q(this._a,(this._isUTC?t.utc(this._a):t(this._a)).toArray()):this._isValid=!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var n=X(this,e||t.defaultFormat);return this.lang().postformat(n)},add:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,1),this},subtract:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,-1),this},diff:function(e,n,r){var i=this._isUTC?t(e).utc():t(e).local(),s=(this.zone()-i.zone())*6e4,o,u;return n&&(n=n.replace(/s$/,"")),n==="year"||n==="month"?(o=(this.daysInMonth()+i.daysInMonth())*432e5,u=(this.year()-i.year())*12+(this.month()-i.month()),u+=(this-t(this).startOf("month")-(i-t(i).startOf("month")))/o,n==="year"&&(u/=12)):(o=this-i-s,u=n==="second"?o/1e3:n==="minute"?o/6e4:n==="hour"?o/36e5:n==="day"?o/864e5:n==="week"?o/6048e5:o),r?u:B(u)},from:function(e,n){return t.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!n)},fromNow:function(e){return this.from(t(),e)},calendar:function(){var e=this.diff(t().startOf("day"),"days",!0),n=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(n,this))},isLeapYear:function(){var e=this.year();return e%4===0&&e%100!==0||e%400===0},isDST:function(){return this.zone()<t([this.year()]).zone()||this.zone()<t([this.year(),5]).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e==null?t:this.add({d:e-t})},startOf:function(e){e=e.replace(/s$/,"");switch(e){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return e==="week"&&this.day(0),this},endOf:function(e){return this.startOf(e).add(e.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)>+t(e).startOf(n)},isBefore:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)<+t(e).startOf(n)},isSame:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)===+t(e).startOf(n)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return t.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var n=r((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return e==null?n:this.add("d",e-n)},isoWeek:function(e){var t=tt(this,1,4);return e==null?t:this.add("d",(e-t)*7)},week:function(e){var t=this.lang().week(this);return e==null?t:this.add("d",(e-t)*7)},lang:function(t){return t===e?this._lang:(this._lang=U(t),this)}};for(i=0;i<T.length;i++)rt(T[i].toLowerCase().replace(/s$/,""),T[i]);rt("year","FullYear"),t.fn.days=t.fn.day,t.fn.weeks=t.fn.week,t.fn.isoWeeks=t.fn.isoWeek,t.duration.fn=P.prototype={weeks:function(){return B(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(e){var t=+this,n=et(t,!e,this.lang());return e&&(n=this.lang().pastFuture(t,n)),this.lang().postformat(n)},lang:t.fn.lang};for(i in N)N.hasOwnProperty(i)&&(st(i,N[i]),it(i.toLowerCase()));st("Weeks",6048e5),t.lang("en",{ordinal:function(e){var t=e%10,n=~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),o&&(module.exports=t),typeof ender=="undefined"&&(this.moment=t),typeof define=="function"&&define.amd&&define("moment",[],function(){return t})}).call(this);
@@ -0,0 +1,8 @@
1
+ %base-footer
2
+ .footer
3
+ %label Save campaign as...
4
+ .input-wrapper(onclick='$(this).find("input").focus()')
5
+ %input.form-control.input-sm(type='text' ng-disabled='is_disabled' ng-model='campaign_name')
6
+ %button.btn.btn-sm.btn-primary(ng-click='save()' ng-disabled='is_disabled')
7
+ %i.icon-plus.icon-white
8
+ Create
@@ -0,0 +1,8 @@
1
+ %h2
2
+ Success! Fanforce Is Now Tracking...<br/>
3
+ Browse google.com/
4
+ .text Open the initiative to begin mobilizing your fanforce into action, or add another one.
5
+ .buttons
6
+ %a.btn.btn-primary Add Another Initiative
7
+ %a.btn.btn-primary(href='//0.0.0.0:4567/#/initiatives/913c8300-7e0e-0132-7842-3c15c2b7e25e' target='_top') Open Initiative
8
+ %a.btn.btn-primary(ng-click='close()') Close Overlay
@@ -0,0 +1,4 @@
1
+ fanforce-app-factory-3.0.0.rc1:459434fb55492cc64c5781cd2b92f3c08c192898
2
+ fanforce-app-factory-3.0.0.rc1:75a7b4f09ee8ba749b2141272e95fd482b46f291
3
+ fanforce-app-factory-3.0.0.rc1:509bc7bca24f5e3baf4f0e23b2e151ccf25439cb
4
+ fanforce-app-factory-3.0.0.rc1:2a5b9a55d2e729cc71d8b0ae9d9547206ae604e7
@@ -0,0 +1,21 @@
1
+ // AppFactoryScaffolding : PARTIAL
2
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
+
4
+ @import 'compass/css3';
5
+ @import 'compass/utilities';
6
+
7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8
+
9
+ @import 'app_factory/bootstrap_override';
10
+ @import 'app_factory/common';
11
+ @import 'app_factory/ui-select';
12
+ @import 'app_factory/directives';
13
+
14
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
15
+
16
+ html.fembedded-layout {
17
+ body { overflow: hidden; background: white; }
18
+ page { height: auto; visibility: visible; }
19
+ }
20
+
21
+ // END PARTIAL /////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,2 @@
1
+ fanforce-app-factory-3.0.0.rc1:49e5ab520559287dc33746b792ceb437fc8aff12
2
+ fanforce-app-factory-3.0.0.rc1:614e7607e80451326d7ba5a791298045a3f601de
@@ -0,0 +1,2 @@
1
+ fanforce-app-factory-3.0.0.rc1:147e44eef875eda74e5363ba6d1543731a4c2043
2
+ fanforce-app-factory-3.0.0.rc1:b9361e4ec83b63617910db11e148118ff88656df
@@ -0,0 +1,7 @@
1
+ // AppFactoryScaffolding : PARTIAL
2
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
+ //= require ./fembedded
4
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5
+ angular.bootstrap(angular.element('body'), ['fembedded']);
6
+
7
+ // END PARTIAL /////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,3 @@
1
+ fanforce-app-factory-3.0.0.rc1:f93a960435a3776e00415deb6ce72517e72a1ccd
2
+ fanforce-app-factory-3.0.0.rc1:05d604b0736ee73c6e6f017d8b2191275d9de318
3
+ fanforce-app-factory-3.0.0.rc1:bbc7a316e0edb12545a1b9d123b2ab5826ad307e
@@ -0,0 +1,8 @@
1
+ -# AppFactoryScaffolding : FILE
2
+ -#######################################################################################################################
3
+ = stylesheet "#{request.base_url}/assets/fembedded_native.css"
4
+ = javascript "#{request.base_url}/assets/fembedded_native.js"
5
+ %loading(ng-hide='app_is_loaded') Page loading...
6
+ %page.ng-hide(class=page_classes ng-show='app_is_loaded' ng-class='{success: is_success}' ng-cloak)
7
+ %ng-view
8
+ = yield
@@ -0,0 +1,11 @@
1
+ class Fanforce::App::Sinatra
2
+
3
+ def route_add_campaign_ui
4
+ page :add_campaign, :layout => :fembedded, com_dir: params[:com_campaign_shortid]
5
+ end
6
+
7
+ def route_view_campaign_ui
8
+ page :view_campaign, :layout => :fembedded, com_dir: params[:com_campaign_shortid]
9
+ end
10
+
11
+ end
@@ -1,20 +1,4 @@
1
1
  $module_path: '/assets/plugin_factory/directives/initiative-footer';
2
2
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
3
 
4
- initiative-footer { position:absolute; bottom:0; left:0; padding:0 3px; @include box-sizing(border-box); text-align:left; width:100%; margin:0px; overflow:hidden;
5
- &.disabled .footer { pointer-events: none;
6
- label { @include opacity(.5); }
7
- .input-wrapper { @include opacity(.5); cursor: not-allowed; }
8
- button { @include opacity(.5); background: #c9d5e1; border-color: #a6b4c1; text-shadow: none; }
9
- }
10
- .footer { @include box-shadow(#ffffff 0 1px 0 inset); padding: 5px 0; border-top: 1px solid #e1e1e1;
11
- label { font-weight:100; color:#666666; text-shadow:1px 1px 0 #ffffff; margin-left:20px; }
12
- .input-wrapper { cursor: text; position:relative; display: inline-block; color: #555555; background: rgba(255, 255, 255, 0.75); @include border-radius(4px); border: 1px solid #CCCCCC; @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.075) inset);
13
- .prefix { pointer-events: none; font-size: 12px; font-weight: normal; line-height: 1.5; height:28px; vertical-align: middle; padding: 5px 0 0 8px; display:inline-block; }
14
- input { font-size: 12px; font-weight: normal; background: transparent; padding-left: 0px; border:none; height:28px; @include box-shadow(none); min-width:250px; width:auto; display:inline-block; vertical-align: middle; }
15
- }
16
- button { margin-top: 0; margin-left: 2px; padding-top: 5px; padding-bottom: 5px;
17
- i { margin-right: 5px; }
18
- }
19
- }
20
- }
4
+ initiative-footer { display: block; }
@@ -1,9 +1,9 @@
1
1
  $module_path: '/assets/plugin_factory/directives/initiative-searcher';
2
2
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
3
 
4
- initiative-searcher { display: block; position:relative; width:100%; padding:20px 20px 15px; overflow:hidden;
4
+ initiative-searcher { display: block; position:relative; width:100%; padding:20px 20px 0; overflow:hidden;
5
5
  &.supreme { @include ff-box(); }
6
- .header { padding:0; max-width:900px;
6
+ .header { padding:0 0 10px; max-width:900px;
7
7
  h2 { color:#505a62; text-shadow:#ffffff 1px 1px 0; margin-top:0; padding-bottom:5px; }
8
8
  .form-row { position:relative; margin:0; padding:0; z-index:5;
9
9
  .gigantic-input { width:auto;
@@ -16,12 +16,12 @@ initiative-searcher { display: block; position:relative; width:100%; padding:20p
16
16
  .searching { padding: 20px 0; font-weight: normal; color: #afb7c8;
17
17
  .spinner { width:20px; height:20px; background:url(#{$module_path}/spinner.gif) 0 0 no-repeat; float:left; margin-right:10px; }
18
18
  }
19
- .results-empty { padding:0 0 25px; max-width:900px; position:relative; clear:both;
19
+ .results-empty { padding:0 0 25px; max-width:900px; position:relative; clear:both; float:left; width: 100%;
20
20
  .module-error { padding-top:3px; top:-8px; position: absolute; width:100%; }
21
21
  .module-featuretip { position:absolute; width:400px; top:-10px; left:25px; .arrow { left:100px; } }
22
22
  button.primary { padding:5px 20px; }
23
23
  }
24
- .results-found { padding:0 0 25px; max-width:900px;
24
+ .results-found { padding:0 0 25px; max-width:900px; float:left; width: 100%; clear: both;
25
25
  .module-error { clear:both; }
26
26
  .search-results { overflow:hidden; position:relative; background:#e3eef8; @include border-radius(0 0 5px 5px); padding-top:15px; padding-bottom:7px; margin-bottom:20px;
27
27
  .prev-page, .next-page { position:absolute; top:50%; margin-top: -33px; cursor:pointer; display:block; width:25px; height:67px; background:url(#{$module_path}/sprite-arrows.png) 0 0 no-repeat; }
@@ -1,4 +1,4 @@
1
1
  $module_path: '/assets/plugin_factory/directives/loading';
2
2
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
3
 
4
- loading { display:block; color:#cccccc; font-size:15px; text-align: center; padding-top:45px; }
4
+ loading { display:block; color:#cccccc; font-size:15px; text-align: center; padding-top:45px; position: absolute; top: 0; left: 0; width: 100%; }
@@ -1,7 +1,7 @@
1
1
  $module_path: '/assets/plugin_factory/directives/start-arrow';
2
2
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
3
 
4
- start-arrow { padding: 10px 0 0 30px; position:relative;
5
- .arrow { width: 114px; height: 61px; background:url(#{$module_path}/arrow.png) 6px center no-repeat;}
6
- .text { color: #afb7c8; font-weight: bold; position:absolute; top: 78px; left: 125px; white-space: nowrap; }
4
+ start-arrow { position:relative; top: 10px; left: 6px;
5
+ .arrow { width: 114px; height: 61px; background:url(#{$module_path}/arrow.png) 0 center no-repeat;}
6
+ .text { color: #afb7c8; font-weight: bold; position:absolute; top: 62px; left: 122px; white-space: nowrap; }
7
7
  }
@@ -25,7 +25,7 @@ class Fanforce::PluginFactory::CLI::Bitbucket
25
25
  def setup
26
26
  repo_name = "plugin-#{plugin.dir_name}"
27
27
  error "Bitbucket repo does not exist (#{repo_name})" if !find_repo(repo_name)
28
- "#{'Found '.format(:green,:bold)}" + "#{repo_name} repository already exists on bitbucket"
28
+ "#{'Found '.format(:green,:bold)}" + "#{repo_name} repository already exists on bitbucket"
29
29
  setup_git_remote(repo_name)
30
30
  end
31
31
 
@@ -36,7 +36,7 @@ class Fanforce::PluginFactory::CLI::Env
36
36
  File.open("#{plugin.dir}/.pluginenv", 'w') {|f| f.write convert_hash_to_shell_env(vars) }
37
37
  else
38
38
  error 'could not find heroku in .fanforce-plugin-factory' if config[:heroku][environment].blank?
39
- Fanforce::PluginFactory::CLI::Heroku.new(plugin).update_config(environment, vars)
39
+ Fanforce::PluginFactory::CLI::Heroku.new(plugin, environment).update_config(vars)
40
40
  end
41
41
  end
42
42
 
@@ -1,94 +1,112 @@
1
1
  class Fanforce::PluginFactory::CLI::Heroku
2
2
  include Fanforce::PluginFactory::CLI::Utils
3
3
 
4
- attr_reader :plugin
4
+ attr_reader :plugin, :environment
5
5
 
6
6
  require_gem 'heroku-api', 'heroku-api'
7
7
 
8
- def initialize(plugin)
8
+ def initialize(plugin, environment)
9
9
  @plugin = plugin
10
+ @environment = environment.to_sym
10
11
  end
11
12
 
12
- def heroku(environment)
13
- @heroku ||= {}
14
- @heroku[environment] ||= Heroku::API.new(:username => config[:heroku][environment][:user], :password => config[:heroku][environment][:password])
13
+ def heroku
14
+ @heroku ||= Heroku::API.new(:username => config[:heroku][environment][:user], :password => config[:heroku][environment][:password])
15
15
  rescue Exception => e
16
16
  error "OOPS... #{environment.to_s.upcase}".format(:red,:bold) + ' has not been setup for Heroku' if config[:heroku].blank? or config[:heroku][environment].blank?
17
17
  #raise "Heroku user #{config[:heroku][environment][:user]} does not seem to exist: #{e.message}" if e.response.status == 404
18
18
  raise
19
19
  end
20
20
 
21
- def setup(environment)
22
- environment = environment.to_sym
23
- heroku = heroku(environment)
24
- heroku_app_name = heroku_app_name_by_env(environment)
21
+ def ensure_git_remote_exists
22
+ remote_name = "#{env}-heroku"
23
+ remote_url = "git@#{config[:heroku][environment][:git_ssh_domain] || 'heroku.com'}:#{app_name}.git"
25
24
 
26
- # Setup standard plugin domain
27
- domain = "#{plugin._id}.#{Fanforce::Base::DomainEnvironments.method(environment).call[:plugins_base]}"
28
- domain_found = heroku.get_domains(heroku_app_name).body.inject(false) {|result, d| d['domain'] == domain ? (break true) : false }
29
- if domain_found
30
- puts "#{'Found '.format(:green,:bold)}" + "#{domain} domain on #{environment}"
31
- else
32
- heroku.post_domain(heroku_app_name, domain)
33
- puts "#{'Added '.format(:green,:bold)}" + "#{domain} domain to #{environment}"
34
- end
35
-
36
- # Setup default short domain
37
- domain = "#{plugin._id}.#{Fanforce::Base::DomainEnvironments.method(environment).call[:default_short_domain]}"
38
- domain_found = heroku.get_domains(heroku_app_name).body.inject(false) {|result, d| d['domain'] == domain ? (break true) : false }
39
- if domain_found
40
- puts "#{'Found '.format(:green,:bold)}" + "#{domain} domain on #{environment}"
41
- else
42
- heroku.post_domain(heroku_app_name, domain)
43
- puts "#{'Added '.format(:green,:bold)}" + "#{domain} domain to #{environment}"
25
+ found_remote = false
26
+ found_valid_remote = false
27
+ (`git remote -v`).lines do |line|
28
+ next if line !~ Regexp.new("^#{remote_name}[\s\t]")
29
+ found_remote = true
30
+ found_valid_remote = true if line.include?(remote_url)
31
+ break
44
32
  end
45
33
 
46
- # Setup git remote
47
- remote_name = "#{env(environment)}-heroku"
48
- if (`git remote`).split(/\r?\n/).include?(remote_name)
49
- puts "#{'Updated '.format(:green,:bold)}" + "git remote for #{remote_name}"
34
+ if found_valid_remote
35
+ return log "#{'Found '.format(:green,:bold)}" + "git remote for #{remote_name}"
36
+ elsif found_remote
37
+ log "#{'Updated '.format(:green,:bold)}" + "git remote for #{remote_name}"
50
38
  `git remote rm #{remote_name}`
51
39
  else
52
- puts "#{'Created '.format(:green,:bold)}" + "git remote for #{remote_name}"
40
+ log "#{'Created '.format(:green,:bold)}" + "git remote for #{remote_name}"
53
41
  end
54
- `git remote add #{remote_name} git@#{config[:heroku][environment][:git_ssh_domain] || 'heroku.com'}:#{heroku_app_name}.git`
42
+ `git remote add #{remote_name} #{remote_url}`
43
+ end
44
+
45
+ def git_remote_name
46
+ "#{env}-heroku"
47
+ end
48
+
49
+ def restart
50
+ heroku.post_ps_restart(app_name)
55
51
  end
56
52
 
57
- def heroku_app_exists?(heroku, heroku_app_name)
58
- heroku.get_app(heroku_app_name)
53
+ def destroy
54
+ heroku.delete_app(app_name)
55
+ end
56
+
57
+ def app_exists?
58
+ heroku.get_app(app_name)
59
59
  return true
60
60
  rescue
61
61
  return false
62
62
  end
63
63
 
64
- def ensure_heroku_app_exists(environment)
65
- heroku = heroku(environment)
66
- heroku_app_name = heroku_app_name_by_env(environment)
67
- if heroku_app_exists?(heroku, heroku_app_name)
68
- puts "#{'Found '.format(:green,:bold)}" + "#{environment} plugin on heroku (#{heroku_app_name})"
64
+ def ensure_app_exists
65
+ return puts "#{'Found '.format(:green,:bold)}" + "#{environment} app on heroku (#{app_name})" if app_exists?
66
+ create_app
67
+ end
68
+
69
+ def create_app
70
+ heroku.post_app(name: app_name)
71
+ puts "#{'Created '.format(:green,:bold)}" + "#{environment} on heroku (#{app_name})"
72
+
73
+ # Setup standard app domain
74
+ domain = "#{plugin._id}.#{Fanforce::Base::DomainEnvironments.method(environment).call[:apps_base]}"
75
+ domain_found = heroku.get_domains(app_name).body.inject(false) {|result, d| d['domain'] == domain ? (break true) : false }
76
+ if domain_found
77
+ puts "#{'Found '.format(:green,:bold)}" + "#{domain} domain on #{environment}"
78
+ else
79
+ heroku.post_domain(app_name, domain)
80
+ puts "#{'Added '.format(:green,:bold)}" + "#{domain} domain to #{environment}"
81
+ end
82
+
83
+ # Setup default short domain
84
+ domain = "#{plugin._id}.#{Fanforce::Base::DomainEnvironments.method(environment).call[:default_short_domain]}"
85
+ domain_found = heroku.get_domains(app_name).body.inject(false) {|result, d| d['domain'] == domain ? (break true) : false }
86
+ if domain_found
87
+ puts "#{'Found '.format(:green,:bold)}" + "#{domain} domain on #{environment}"
69
88
  else
70
- heroku.post_app(name: heroku_app_name)
71
- puts "#{'Created '.format(:green,:bold)}" + "#{environment} on heroku (#{heroku_app_name})"
89
+ heroku.post_domain(app_name, domain)
90
+ puts "#{'Added '.format(:green,:bold)}" + "#{domain} domain to #{environment}"
72
91
  end
73
92
  end
74
93
 
75
- def update_config(environment, vars)
76
- heroku(environment).put_config_vars(heroku_app_name_by_env(environment), vars) if vars
94
+ def update_config(vars)
95
+ heroku.put_config_vars(app_name, vars) if vars
77
96
  end
78
97
 
79
- def env(environment)
98
+ def env
80
99
  case environment
81
100
  when :staging then env = :stg
82
101
  when :production then env = :prd
83
102
  end
84
103
  end
85
104
 
86
- def heroku_app_name_by_env(environment)
87
- environment = environment.to_sym
105
+ def app_name
88
106
  raise 'unknown environment' if ![:production, :staging].include?(environment)
89
107
 
90
- heroku_app_name = "#{env(environment)}-plgn-#{plugin.dir_name}"
91
- heroku_app_name.length > 30 ? heroku_app_name.gsub!(/(a|e|i|o|u)/, '') : heroku_app_name
108
+ app_name = plugin._id.length > 21 ? plugin._id.gsub(/(a|e|i|o|u)/, '') : plugin._id
109
+ "#{env}-plgn-#{app_name}"
92
110
  end
93
111
 
94
112
  end