angular_velocity 0.0.5alpha → 0.0.6alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module AngularVelocity
2
- VERSION = "0.0.5alpha"
2
+ VERSION = "0.0.6alpha"
3
3
  end
@@ -17,15 +17,19 @@ module AngularVelocity
17
17
  else
18
18
  path = "app/assets/javascripts/#{application_name}"
19
19
  end
20
+ path = Rails.root.join(path)
20
21
  path
21
22
  end
22
23
 
23
24
  def angular_spec_path
25
+ path = ""
24
26
  if Rails.env == "test"
25
- "spec/tmp/spec/javascripts/#{application_name}"
27
+ path = "spec/tmp/spec/javascripts/#{application_name}"
26
28
  else
27
- "spec/javascripts/#{application_name}"
29
+ path ="spec/javascripts/#{application_name}"
28
30
  end
31
+ path = Rails.root.join(path)
32
+ path
29
33
  end
30
34
 
31
35
  end
@@ -27,6 +27,10 @@ module AngularVelocity
27
27
  template "main_controller_spec.coffee", "#{angular_spec_path}/controllers/main_controller_spec.coffee"
28
28
  end
29
29
 
30
+ def create_main_angular_service
31
+ template "main_angular_service.coffee", "#{angular_path}/services/#{application_name}_service.coffee"
32
+ end
33
+
30
34
  def create_main_rails_controller
31
35
  empty_directory "app/views/main"
32
36
  template "index.html.erb", "app/views/main/index.html.erb"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.5
2
+ * @license AngularJS v1.0.6
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -34,12 +34,12 @@ var uppercase = function(string){return isString(string) ? string.toUpperCase()
34
34
 
35
35
  var manualLowercase = function(s) {
36
36
  return isString(s)
37
- ? s.replace(/[A-Z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) | 32);})
37
+ ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
38
38
  : s;
39
39
  };
40
40
  var manualUppercase = function(s) {
41
41
  return isString(s)
42
- ? s.replace(/[a-z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) & ~32);})
42
+ ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
43
43
  : s;
44
44
  };
45
45
 
@@ -52,8 +52,6 @@ if ('i' !== 'I'.toLowerCase()) {
52
52
  uppercase = manualUppercase;
53
53
  }
54
54
 
55
- function fromCharCode(code) {return String.fromCharCode(code);}
56
-
57
55
 
58
56
  var /** holds major version number for IE or NaN for real browsers */
59
57
  msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
@@ -861,7 +859,7 @@ function encodeUriQuery(val, pctEncodeSpaces) {
861
859
  replace(/%3A/gi, ':').
862
860
  replace(/%24/g, '$').
863
861
  replace(/%2C/gi, ',').
864
- replace((pctEncodeSpaces ? null : /%20/g), '+');
862
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
865
863
  }
866
864
 
867
865
 
@@ -950,22 +948,38 @@ function angularInit(element, bootstrap) {
950
948
  * @returns {AUTO.$injector} Returns the newly created injector for this app.
951
949
  */
952
950
  function bootstrap(element, modules) {
953
- element = jqLite(element);
954
- modules = modules || [];
955
- modules.unshift(['$provide', function($provide) {
956
- $provide.value('$rootElement', element);
957
- }]);
958
- modules.unshift('ng');
959
- var injector = createInjector(modules);
960
- injector.invoke(
961
- ['$rootScope', '$rootElement', '$compile', '$injector', function(scope, element, compile, injector){
962
- scope.$apply(function() {
963
- element.data('$injector', injector);
964
- compile(element)(scope);
965
- });
966
- }]
967
- );
968
- return injector;
951
+ var resumeBootstrapInternal = function() {
952
+ element = jqLite(element);
953
+ modules = modules || [];
954
+ modules.unshift(['$provide', function($provide) {
955
+ $provide.value('$rootElement', element);
956
+ }]);
957
+ modules.unshift('ng');
958
+ var injector = createInjector(modules);
959
+ injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
960
+ function(scope, element, compile, injector) {
961
+ scope.$apply(function() {
962
+ element.data('$injector', injector);
963
+ compile(element)(scope);
964
+ });
965
+ }]
966
+ );
967
+ return injector;
968
+ };
969
+
970
+ var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
971
+
972
+ if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
973
+ return resumeBootstrapInternal();
974
+ }
975
+
976
+ window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
977
+ angular.resumeBootstrap = function(extraModules) {
978
+ forEach(extraModules, function(module) {
979
+ modules.push(module);
980
+ });
981
+ resumeBootstrapInternal();
982
+ };
969
983
  }
970
984
 
971
985
  var SNAKE_CASE_REGEXP = /[A-Z]/g;
@@ -1279,11 +1293,11 @@ function setupModuleLoader(window) {
1279
1293
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1280
1294
  */
1281
1295
  var version = {
1282
- full: '1.0.5', // all of these placeholder strings will be replaced by rake's
1283
- major: 1, // compile task
1296
+ full: '1.0.6', // all of these placeholder strings will be replaced by grunt's
1297
+ major: 1, // package task
1284
1298
  minor: 0,
1285
- dot: 5,
1286
- codeName: 'flatulent-propulsion'
1299
+ dot: 6,
1300
+ codeName: 'universal-irreversibility'
1287
1301
  };
1288
1302
 
1289
1303
 
@@ -2368,15 +2382,15 @@ function annotate(fn) {
2368
2382
  *
2369
2383
  * <pre>
2370
2384
  * // inferred (only works if code not minified/obfuscated)
2371
- * $inject.invoke(function(serviceA){});
2385
+ * $injector.invoke(function(serviceA){});
2372
2386
  *
2373
2387
  * // annotated
2374
2388
  * function explicit(serviceA) {};
2375
2389
  * explicit.$inject = ['serviceA'];
2376
- * $inject.invoke(explicit);
2390
+ * $injector.invoke(explicit);
2377
2391
  *
2378
2392
  * // inline
2379
- * $inject.invoke(['serviceA', function(serviceA){}]);
2393
+ * $injector.invoke(['serviceA', function(serviceA){}]);
2380
2394
  * </pre>
2381
2395
  *
2382
2396
  * ## Inference
@@ -2522,7 +2536,7 @@ function annotate(fn) {
2522
2536
  * @description
2523
2537
  *
2524
2538
  * Use `$provide` to register new providers with the `$injector`. The providers are the factories for the instance.
2525
- * The providers share the same name as the instance they create with the `Provider` suffixed to them.
2539
+ * The providers share the same name as the instance they create with `Provider` suffixed to them.
2526
2540
  *
2527
2541
  * A provider is an object with a `$get()` method. The injector calls the `$get` method to create a new instance of
2528
2542
  * a service. The Provider can have additional methods which would allow for configuration of the provider.
@@ -2870,6 +2884,7 @@ function createInjector(modulesToLoad) {
2870
2884
  };
2871
2885
  }
2872
2886
  }
2887
+
2873
2888
  /**
2874
2889
  * @ngdoc function
2875
2890
  * @name ng.$anchorScroll
@@ -3298,6 +3313,7 @@ function $BrowserProvider(){
3298
3313
  return new Browser($window, $document, $log, $sniffer);
3299
3314
  }];
3300
3315
  }
3316
+
3301
3317
  /**
3302
3318
  * @ngdoc object
3303
3319
  * @name ng.$cacheFactory
@@ -3625,7 +3641,7 @@ function $CompileProvider($provide) {
3625
3641
  COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
3626
3642
  CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
3627
3643
  MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ',
3628
- urlSanitizationWhitelist = /^\s*(https?|ftp|mailto):/;
3644
+ urlSanitizationWhitelist = /^\s*(https?|ftp|mailto|file):/;
3629
3645
 
3630
3646
 
3631
3647
  /**
@@ -3827,7 +3843,7 @@ function $CompileProvider($provide) {
3827
3843
 
3828
3844
  function compile($compileNodes, transcludeFn, maxPriority) {
3829
3845
  if (!($compileNodes instanceof jqLite)) {
3830
- // jquery always rewraps, where as we need to preserve the original selector so that we can modify it.
3846
+ // jquery always rewraps, whereas we need to preserve the original selector so that we can modify it.
3831
3847
  $compileNodes = jqLite($compileNodes);
3832
3848
  }
3833
3849
  // We can not compile top level text elements since text nodes can be merged and we will
@@ -3879,7 +3895,7 @@ function $CompileProvider($provide) {
3879
3895
  * functions return values - the linking functions - are combined into a composite linking
3880
3896
  * function, which is the a linking function for the node.
3881
3897
  *
3882
- * @param {NodeList} nodeList an array of nodes to compile
3898
+ * @param {NodeList} nodeList an array of nodes or NodeList to compile
3883
3899
  * @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the
3884
3900
  * scope argument is auto-generated to the new child of the transcluded parent scope.
3885
3901
  * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then the
@@ -3902,7 +3918,7 @@ function $CompileProvider($provide) {
3902
3918
  ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement)
3903
3919
  : null;
3904
3920
 
3905
- childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length)
3921
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes || !nodeList[i].childNodes.length)
3906
3922
  ? null
3907
3923
  : compileNodes(nodeList[i].childNodes,
3908
3924
  nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
@@ -4461,7 +4477,7 @@ function $CompileProvider($provide) {
4461
4477
 
4462
4478
  directives.unshift(derivedSyncDirective);
4463
4479
  afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn);
4464
- afterTemplateChildLinkFn = compileNodes($compileNode.contents(), childTranscludeFn);
4480
+ afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
4465
4481
 
4466
4482
 
4467
4483
  while(linkQueue.length) {
@@ -4726,7 +4742,7 @@ function $ControllerProvider() {
4726
4742
  * @description
4727
4743
  * `$controller` service is responsible for instantiating controllers.
4728
4744
  *
4729
- * It's just simple call to {@link AUTO.$injector $injector}, but extracted into
4745
+ * It's just a simple call to {@link AUTO.$injector $injector}, but extracted into
4730
4746
  * a service, so that one can override this service with {@link https://gist.github.com/1649788
4731
4747
  * BC version}.
4732
4748
  */
@@ -4967,7 +4983,7 @@ function $InterpolateProvider() {
4967
4983
  }];
4968
4984
  }
4969
4985
 
4970
- var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
4986
+ var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
4971
4987
  PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,
4972
4988
  HASH_MATCH = PATH_MATCH,
4973
4989
  DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
@@ -5046,7 +5062,8 @@ function convertToHashbangUrl(url, basePath, hashPrefix) {
5046
5062
  var match = matchUrl(url);
5047
5063
 
5048
5064
  // already hashbang url
5049
- if (decodeURIComponent(match.path) == basePath) {
5065
+ if (decodeURIComponent(match.path) == basePath && !isUndefined(match.hash) &&
5066
+ match.hash.indexOf(hashPrefix) === 0) {
5050
5067
  return url;
5051
5068
  // convert html5 url -> hashbang url
5052
5069
  } else {
@@ -7240,8 +7257,9 @@ function $RouteProvider(){
7240
7257
  * {@link ng.directive:ngView ngView} listens for the directive
7241
7258
  * to instantiate the controller and render the view.
7242
7259
  *
7260
+ * @param {Object} angularEvent Synthetic event object.
7243
7261
  * @param {Route} current Current route information.
7244
- * @param {Route} previous Previous route information.
7262
+ * @param {Route|Undefined} previous Previous route information, or undefined if current is first route entered.
7245
7263
  */
7246
7264
 
7247
7265
  /**
@@ -7339,7 +7357,7 @@ function $RouteProvider(){
7339
7357
  var next = parseRoute(),
7340
7358
  last = $route.current;
7341
7359
 
7342
- if (next && last && next.$route === last.$route
7360
+ if (next && last && next.$$route === last.$$route
7343
7361
  && equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
7344
7362
  last.params = next.params;
7345
7363
  copy(last.params, $routeParams);
@@ -7418,7 +7436,7 @@ function $RouteProvider(){
7418
7436
  match = inherit(route, {
7419
7437
  params: extend({}, $location.search(), params),
7420
7438
  pathParams: params});
7421
- match.$route = route;
7439
+ match.$$route = route;
7422
7440
  }
7423
7441
  });
7424
7442
  // No route matched; fallback to "otherwise" route
@@ -8608,10 +8626,14 @@ function $HttpProvider() {
8608
8626
  * - if XSRF prefix is detected, strip it (see Security Considerations section below)
8609
8627
  * - if json response is detected, deserialize it using a JSON parser
8610
8628
  *
8611
- * To override these transformation locally, specify transform functions as `transformRequest`
8612
- * and/or `transformResponse` properties of the config object. To globally override the default
8613
- * transforms, override the `$httpProvider.defaults.transformRequest` and
8614
- * `$httpProvider.defaults.transformResponse` properties of the `$httpProvider`.
8629
+ * To globally augment or override the default transforms, modify the `$httpProvider.defaults.transformRequest` and
8630
+ * `$httpProvider.defaults.transformResponse` properties of the `$httpProvider`. These properties are by default an
8631
+ * array of transform functions, which allows you to `push` or `unshift` a new transformation function into the
8632
+ * transformation chain. You can also decide to completely override any default transformations by assigning your
8633
+ * transformation functions to these properties directly without the array wrapper.
8634
+ *
8635
+ * Similarly, to locally override the request/response transforms, augment the `transformRequest` and/or
8636
+ * `transformResponse` properties of the config object passed into `$http`.
8615
8637
  *
8616
8638
  *
8617
8639
  * # Caching
@@ -9129,6 +9151,7 @@ function $HttpProvider() {
9129
9151
 
9130
9152
  }];
9131
9153
  }
9154
+
9132
9155
  var XHR = window.XMLHttpRequest || function() {
9133
9156
  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
9134
9157
  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
@@ -9441,7 +9464,7 @@ function $TimeoutProvider() {
9441
9464
  *
9442
9465
  * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To
9443
9466
  * achieve this a filter definition consists of a factory function which is annotated with dependencies and is
9444
- * responsible for creating a the filter function.
9467
+ * responsible for creating a filter function.
9445
9468
  *
9446
9469
  * <pre>
9447
9470
  * // Filter registration
@@ -9579,22 +9602,22 @@ function $FilterProvider($provide) {
9579
9602
 
9580
9603
  Search: <input ng-model="searchText">
9581
9604
  <table id="searchTextResults">
9582
- <tr><th>Name</th><th>Phone</th><tr>
9605
+ <tr><th>Name</th><th>Phone</th></tr>
9583
9606
  <tr ng-repeat="friend in friends | filter:searchText">
9584
9607
  <td>{{friend.name}}</td>
9585
9608
  <td>{{friend.phone}}</td>
9586
- <tr>
9609
+ </tr>
9587
9610
  </table>
9588
9611
  <hr>
9589
9612
  Any: <input ng-model="search.$"> <br>
9590
9613
  Name only <input ng-model="search.name"><br>
9591
9614
  Phone only <input ng-model="search.phone"å><br>
9592
9615
  <table id="searchObjResults">
9593
- <tr><th>Name</th><th>Phone</th><tr>
9616
+ <tr><th>Name</th><th>Phone</th></tr>
9594
9617
  <tr ng-repeat="friend in friends | filter:search">
9595
9618
  <td>{{friend.name}}</td>
9596
9619
  <td>{{friend.phone}}</td>
9597
- <tr>
9620
+ </tr>
9598
9621
  </table>
9599
9622
  </doc:source>
9600
9623
  <doc:scenario>
@@ -9913,7 +9936,8 @@ function timeZoneGetter(date) {
9913
9936
  var zone = -1 * date.getTimezoneOffset();
9914
9937
  var paddedZone = (zone >= 0) ? "+" : "";
9915
9938
 
9916
- paddedZone += padNumber(zone / 60, 2) + padNumber(Math.abs(zone % 60), 2);
9939
+ paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
9940
+ padNumber(Math.abs(zone % 60), 2);
9917
9941
 
9918
9942
  return paddedZone;
9919
9943
  }
@@ -9979,7 +10003,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
9979
10003
  * * `'ss'`: Second in minute, padded (00-59)
9980
10004
  * * `'s'`: Second in minute (0-59)
9981
10005
  * * `'a'`: am/pm marker
9982
- * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-1200)
10006
+ * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
9983
10007
  *
9984
10008
  * `format` string can also be one of the following predefined
9985
10009
  * {@link guide/i18n localizable formats}:
@@ -10291,12 +10315,12 @@ function limitToFilter(){
10291
10315
  (<a href ng-click="predicate = '-name'; reverse=false">^</a>)</th>
10292
10316
  <th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
10293
10317
  <th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th>
10294
- <tr>
10318
+ </tr>
10295
10319
  <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
10296
10320
  <td>{{friend.name}}</td>
10297
10321
  <td>{{friend.phone}}</td>
10298
10322
  <td>{{friend.age}}</td>
10299
- <tr>
10323
+ </tr>
10300
10324
  </table>
10301
10325
  </div>
10302
10326
  </doc:source>
@@ -12659,7 +12683,7 @@ var ngClassEvenDirective = classDirective('Even', 1);
12659
12683
  * `angular.min.js` files. Following is the css rule:
12660
12684
  *
12661
12685
  * <pre>
12662
- * [ng\:cloak], [ng-cloak], .ng-cloak {
12686
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
12663
12687
  * display: none;
12664
12688
  * }
12665
12689
  * </pre>
@@ -13552,7 +13576,7 @@ var ngRepeatDirective = ngDirective({
13552
13576
  // Same as lastOrder but it has the current state. It will become the
13553
13577
  // lastOrder on the next iteration.
13554
13578
  nextOrder = new HashQueueMap(),
13555
- arrayLength,
13579
+ arrayBound,
13556
13580
  childScope,
13557
13581
  key, value, // key/value of iteration
13558
13582
  array,
@@ -13573,7 +13597,7 @@ var ngRepeatDirective = ngDirective({
13573
13597
  array = collection || [];
13574
13598
  }
13575
13599
 
13576
- arrayLength = array.length;
13600
+ arrayBound = array.length-1;
13577
13601
 
13578
13602
  // we are not using forEach for perf reasons (trying to avoid #call)
13579
13603
  for (index = 0, length = array.length; index < length; index++) {
@@ -13610,7 +13634,7 @@ var ngRepeatDirective = ngDirective({
13610
13634
  childScope.$index = index;
13611
13635
 
13612
13636
  childScope.$first = (index === 0);
13613
- childScope.$last = (index === (arrayLength - 1));
13637
+ childScope.$last = (index === arrayBound);
13614
13638
  childScope.$middle = !(childScope.$first || childScope.$last);
13615
13639
 
13616
13640
  if (!last) {
@@ -13777,11 +13801,13 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
13777
13801
  * @description
13778
13802
  * Conditionally change the DOM structure.
13779
13803
  *
13780
- * @usageContent
13781
- * <ANY ng-switch-when="matchValue1">...</ANY>
13804
+ * @usage
13805
+ * <ANY ng-switch="expression">
13806
+ * <ANY ng-switch-when="matchValue1">...</ANY>
13782
13807
  * <ANY ng-switch-when="matchValue2">...</ANY>
13783
13808
  * ...
13784
13809
  * <ANY ng-switch-default>...</ANY>
13810
+ * </ANY>
13785
13811
  *
13786
13812
  * @scope
13787
13813
  * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
@@ -14270,7 +14296,7 @@ var scriptDirective = ['$templateCache', function($templateCache) {
14270
14296
 
14271
14297
  var ngOptionsDirective = valueFn({ terminal: true });
14272
14298
  var selectDirective = ['$compile', '$parse', function($compile, $parse) {
14273
- //00001111100000000000222200000000000000000000003333000000000000044444444444444444000000000555555555555555550000000666666666666666660000000000000007777
14299
+ //0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000077770
14274
14300
  var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,
14275
14301
  nullModelCtrl = {$setViewValue: noop};
14276
14302
 
@@ -14719,6 +14745,7 @@ var styleDirective = valueFn({
14719
14745
  restrict: 'E',
14720
14746
  terminal: true
14721
14747
  });
14748
+
14722
14749
  //try to bind to jquery now so that one can write angular.element().read()
14723
14750
  //but we will rebind on bootstrap again.
14724
14751
  bindJQuery();
@@ -0,0 +1 @@
1
+ angular.module('<%= application_name %>Service', [])
@@ -1,4 +1,4 @@
1
- angular.module('<%= application_name %>Service', []).factory( '<%= file_name.camelize %>', [ '$http', ($http, $scope) ->
1
+ angular.module('<%= application_name %>Service').factory( '<%= file_name.camelize %>', [ '$http', ($http, $scope) ->
2
2
  class <%=file_name.camelize %>
3
3
  constructor: (data) ->
4
4
  @instantiate(data)
@@ -14,17 +14,14 @@ describe AngularVelocity::Generators::ControllerGenerator do
14
14
  prepare_destination
15
15
  run_generator ["post"]
16
16
  end
17
-
18
- let(:angular_test_app_path) { "spec/tmp/#{angular_path}" }
19
- let(:angular_test_app_spec_path) { "spec/tmp/#{angular_spec_path}" }
20
17
 
21
18
 
22
19
  it "should generate a controller" do
23
- ("#{angular_test_app_path}/controllers/post_controller.coffee").should be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'PostCtrl', [ '$scope', PostController ])})
20
+ ("#{angular_path}/controllers/post_controller.coffee").should be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'PostCtrl', [ '$scope', PostController ])})
24
21
  end
25
22
 
26
23
  it "should generate a post controller spec" do
27
- controller_spec_path = "#{angular_test_app_spec_path}/controllers/post_controller_spec.coffee"
24
+ controller_spec_path = "#{angular_spec_path}/controllers/post_controller_spec.coffee"
28
25
  controller_spec_path.should be_a_file_containing_text(%{describe "Controller: PostCtrl", () ->})
29
26
  end
30
27
 
@@ -16,28 +16,33 @@ describe AngularVelocity::Generators::InstallGenerator do
16
16
  run_generator
17
17
  @angular_test_app_path = "spec/tmp/#{angular_path}"
18
18
  @test_app_path = "spec/tmp/app"
19
- @angular_spec_path = "spec/tmp/#{angular_spec_path}"
19
+ @angular_spec_path = "#{angular_spec_path}"
20
20
 
21
21
  end
22
22
 
23
23
  context "angular components" do
24
24
 
25
25
  it "should generate an angular application" do
26
- expect("#{@angular_test_app_path}/app.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp', [])})
26
+ pp angular_path
27
+ expect("#{angular_path}/app.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp', [])})
27
28
  expect("#{@test_app_path}/assets/javascripts/application.js").to be_a_file_containing_text(%{//= require ./AngularVelocityApp/angular.js})
28
- file_should_exist("#{@angular_test_app_path}/angular-mocks.js")
29
- file_should_exist("#{@angular_test_app_path}/angular-cookies.js")
30
- file_should_exist("#{@angular_test_app_path}/angular-resource.js")
31
- file_should_exist("#{@angular_test_app_path}/angular-sanitize.js")
29
+ file_should_exist("#{angular_path}/angular-mocks.js")
30
+ file_should_exist("#{angular_path}/angular-cookies.js")
31
+ file_should_exist("#{angular_path}/angular-resource.js")
32
+ file_should_exist("#{angular_path}/angular-sanitize.js")
32
33
  end
33
34
 
34
35
  it "should package the angular app in an easy to consume sprockets file" do
35
- expect("#{@angular_test_app_path}/AngularVelocityAppLoader.js").to be_a_file_containing_text("//= require ./app")
36
+ expect("#{angular_path}/AngularVelocityAppLoader.js").to be_a_file_containing_text("//= require ./app")
37
+ end
38
+
39
+ it "should create an empty service module for later services to use" do
40
+ expect("#{angular_path}/services/#{application_name}_service.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityAppService', [])})
36
41
  end
37
42
 
38
43
  it "should create a main_angular controller like yeoman and the seed does" do
39
- expect("#{@angular_test_app_path}/controllers/main_controller.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'MainCtrl'})
40
- expect("#{@angular_test_app_path}/views/main_control.html").to be_a_file_containing_text(%{ <li ng-repeat="thing in awesomeThings">{{thing}}</li>})
44
+ expect("#{angular_path}/controllers/main_controller.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'MainCtrl'})
45
+ expect("#{angular_path}/views/main_control.html").to be_a_file_containing_text(%{ <li ng-repeat="thing in awesomeThings">{{thing}}</li>})
41
46
  end
42
47
  end
43
48
 
@@ -18,19 +18,16 @@ describe AngularVelocity::Generators::ScaffoldGenerator do
18
18
  create_fixtures
19
19
  @resource_name = "scaffold_test"
20
20
  run_generator [@resource_name]
21
- @angular_test_app_path = "#{angular_path}"
22
- @test_app_path = "spec/tmp/app"
23
- @angular_spec_path = "#{angular_spec_path}"
24
21
  end
25
22
 
26
23
  it "should generate a controller" do
27
- ("#{@angular_test_app_path}/controllers/#{@resource_name}_controller.coffee").should be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( '#{@resource_name.camelize}Ctrl', [ '$scope', #{@resource_name.camelize}Controller ])})
28
- file_should_exist("#{@angular_spec_path}/controllers/#{@resource_name}_controller_spec.coffee")
24
+ ("#{angular_path}/controllers/#{@resource_name}_controller.coffee").should be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( '#{@resource_name.camelize}Ctrl', [ '$scope', #{@resource_name.camelize}Controller ])})
25
+ file_should_exist("#{angular_spec_path}/controllers/#{@resource_name}_controller_spec.coffee")
29
26
  end
30
27
 
31
28
  it "should generate a service" do
32
- file_should_exist "#{@angular_spec_path}/services/#{@resource_name}_service_spec.coffee"
33
- ("#{@angular_test_app_path}/services/#{@resource_name}_service.coffee").should be_a_file_containing_text(%{ class #{@resource_name.camelize}})
29
+ file_should_exist "#{angular_spec_path}/services/#{@resource_name}_service_spec.coffee"
30
+ ("#{angular_path}/services/#{@resource_name}_service.coffee").should be_a_file_containing_text(%{ class #{@resource_name.camelize}})
34
31
  end
35
32
  end
36
33
 
@@ -14,19 +14,16 @@ describe AngularVelocity::Generators::ServiceGenerator do
14
14
  prepare_destination
15
15
  run_generator ["post"]
16
16
  end
17
-
18
- let(:angular_test_app_path) { "spec/tmp/#{angular_path}" }
19
- let(:angular_test_app_spec_path) { "spec/tmp/#{angular_spec_path}" }
20
17
 
21
18
 
22
19
  it "should generator a post service" do
23
20
 
24
- ("#{angular_test_app_path}/services/post_service.coffee").should be_a_file_containing_text(%{ class Post})
21
+ ("#{angular_path}/services/post_service.coffee").should be_a_file_containing_text(%{ class Post})
25
22
  end
26
23
 
27
24
 
28
25
  it "should generate a post service spec" do
29
- service_spec_path = "#{angular_test_app_spec_path}/services/post_service_spec.coffee"
26
+ service_spec_path = "#{angular_spec_path}/services/post_service_spec.coffee"
30
27
  service_spec_path.should be_a_file_containing_text(%{describe "Service: Post", () ->})
31
28
  end
32
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_velocity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5alpha
4
+ version: 0.0.6alpha
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-26 00:00:00.000000000 Z
13
+ date: 2013-05-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -110,6 +110,7 @@ files:
110
110
  - lib/generators/angular_velocity/install/templates/app.coffee
111
111
  - lib/generators/angular_velocity/install/templates/index.html.erb
112
112
  - lib/generators/angular_velocity/install/templates/jasmine.yml
113
+ - lib/generators/angular_velocity/install/templates/main_angular_service.coffee
113
114
  - lib/generators/angular_velocity/install/templates/main_control.html
114
115
  - lib/generators/angular_velocity/install/templates/main_controller.coffee
115
116
  - lib/generators/angular_velocity/install/templates/main_controller.rb