ngannotate-rails 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6eb1737fcf0afa5ea00f1e82a330c7ab64770225
4
- data.tar.gz: fcfe26fd09d2ac827928d8474dc75dc89b4b6f44
3
+ metadata.gz: 7b20b739c3e3030db5fc4395a6a6da23f276ef70
4
+ data.tar.gz: 35c93f520f66479af352d0598c47de066ebe5c2e
5
5
  SHA512:
6
- metadata.gz: 732565bc3e8b91bf37ef22829345cb1c1543ae7cdca342dcd3983d696d17947728cbeddaf71a82b8e84cc5fbce1a9ffb38c5526c08bd19a304ae511718e69d25
7
- data.tar.gz: 136e610aaa587d154244d5ec10d40398081d34d1e1988c4a7ed89ef611c25a327ad7bbc7fae44c2ba9cd2e50830bf831a2aea407e1bbd4f82d825d497027336a
6
+ metadata.gz: 8e5613df37f327ef44ae601650a71c88cef6aa7617805e4fba78062be0bde33f264389d02dae4e4e70b79fa9ffd570d8aaf9183bcb4f2769eff5f3583545a0db
7
+ data.tar.gz: 6b4b6bc7939dd8423538c2df551fbf7f16b9419398a7d0608f563a9c64bc6c7d608b75926d90aaa96384768cc8813d7f4dee501e1ab166c77437ee43a8eeacb9
@@ -1,5 +1,5 @@
1
1
  module Ngannotate
2
2
  module Rails
3
- VERSION = "0.12.1"
3
+ VERSION = "0.13.0"
4
4
  end
5
5
  end
data/vendor/ngannotate.js CHANGED
@@ -1598,8 +1598,10 @@ function match(node, ctx, matchPlugins) {
1598
1598
 
1599
1599
  // matchInjectorInvoke must happen before matchRegular
1600
1600
  // to prevent false positive ($injector.invoke() outside module)
1601
+ // matchProvide must happen before matchRegular
1602
+ // to prevent regular from matching it as a short-form
1601
1603
  var matchMethodCalls = (isMethodCall &&
1602
- (matchInjectorInvoke(node) || matchRegular(node, ctx) || matchNgRoute(node) || matchNgUi(node) || matchHttpProvider(node)));
1604
+ (matchInjectorInvoke(node) || matchProvide(node, ctx) || matchRegular(node, ctx) || matchNgRoute(node) || matchMaterialShowModalOpen(node) || matchNgUi(node) || matchHttpProvider(node)));
1603
1605
 
1604
1606
  return matchMethodCalls ||
1605
1607
  (matchPlugins && matchPlugins(node)) ||
@@ -1607,6 +1609,29 @@ function match(node, ctx, matchPlugins) {
1607
1609
  matchProviderGet(node);
1608
1610
  }
1609
1611
 
1612
+ function matchMaterialShowModalOpen(node) {
1613
+ // $mdDialog.show({.. controller: fn, resolve: {f: function($scope) {}, ..}});
1614
+ // $mdToast.show({.. controller: fn, resolve: {f: function($scope) {}, ..}});
1615
+ // $mdBottomSheet.show({.. controller: fn, resolve: {f: function($scope) {}, ..}});
1616
+ // $modal.open({.. controller: fn, resolve: {f: function($scope) {}, ..}});
1617
+
1618
+ // we already know that node is a (non-computed) method call
1619
+ var callee = node.callee;
1620
+ var obj = callee.object; // identifier or expression
1621
+ var method = callee.property; // identifier
1622
+ var args = node.arguments;
1623
+
1624
+ if (obj.type === "Identifier" &&
1625
+ ((obj.name === "$modal" && method.name === "open") || (is.someof(obj.name, ["$mdDialog", "$mdToast", "$mdBottomSheet"]) && method.name === "show")) &&
1626
+ args.length === 1 && args[0].type === "ObjectExpression") {
1627
+ var props = args[0].properties;
1628
+ var res = [matchProp("controller", props)];
1629
+ res.push.apply(res, matchResolve(props));
1630
+ return res.filter(Boolean);
1631
+ }
1632
+ return false;
1633
+ }
1634
+
1610
1635
  function matchDirectiveReturnObject(node) {
1611
1636
  // only matches inside directives
1612
1637
  // return { .. controller: function($scope, $timeout), ...}
@@ -1693,7 +1718,7 @@ function matchNgUi(node) {
1693
1718
  //
1694
1719
  // $urlRouterProvider.when(.., function($scope) {})
1695
1720
  //
1696
- // $modal.open({.. controller: fn, resolve: {f: function($scope) {}, ..}});
1721
+ // $modal.open see matchMaterialShowModalOpen
1697
1722
 
1698
1723
  // we already know that node is a (non-computed) method call
1699
1724
  var callee = node.callee;
@@ -1701,15 +1726,6 @@ function matchNgUi(node) {
1701
1726
  var method = callee.property; // identifier
1702
1727
  var args = node.arguments;
1703
1728
 
1704
- // shortcut for $modal.open({.. controller: fn, resolve: {f: function($scope) {}, ..}});
1705
- if (obj.type === "Identifier" && obj.name === "$modal" && method.name === "open" &&
1706
- args.length === 1 && args[0].type === "ObjectExpression") {
1707
- var props = args[0].properties;
1708
- var res$0 = [matchProp("controller", props)];
1709
- res$0.push.apply(res$0, matchResolve(props));
1710
- return res$0.filter(Boolean);
1711
- }
1712
-
1713
1729
  // shortcut for $urlRouterProvider.when(.., function($scope) {})
1714
1730
  if (obj.$chained === chainedUrlRouterProvider || (obj.type === "Identifier" && obj.name === "$urlRouterProvider")) {
1715
1731
  node.$chained = chainedUrlRouterProvider;
@@ -1820,6 +1836,33 @@ function matchHttpProvider(node) {
1820
1836
  node.arguments.length >= 1 && node.arguments);
1821
1837
  }
1822
1838
 
1839
+ function matchProvide(node, ctx) {
1840
+ // $provide.decorator("foo", function($scope) {});
1841
+ // $provide.service("foo", function($scope) {});
1842
+ // $provide.factory("foo", function($scope) {});
1843
+ // $provide.provider("foo", function($scope) {});
1844
+
1845
+ // we already know that node is a (non-computed) method call
1846
+ var callee = node.callee;
1847
+ var obj = callee.object; // identifier or expression
1848
+ var method = callee.property; // identifier
1849
+ var args = node.arguments;
1850
+
1851
+ var target = obj.type === "Identifier" && obj.name === "$provide" &&
1852
+ is.someof(method.name, ["decorator", "service", "factory", "provider"]) &&
1853
+ args.length === 2 && args[1];
1854
+
1855
+ if (target) {
1856
+ target.$methodName = method.name;
1857
+
1858
+ if (ctx.rename) {
1859
+ // for eventual rename purposes
1860
+ return args;
1861
+ }
1862
+ }
1863
+ return target;
1864
+ }
1865
+
1823
1866
  function matchRegular(node, ctx) {
1824
1867
  // we already know that node is a (non-computed) method call
1825
1868
  var callee = node.callee;
@@ -1837,7 +1880,7 @@ function matchRegular(node, ctx) {
1837
1880
  }
1838
1881
 
1839
1882
  var matchAngularModule = (obj.$chained === chainedRegular || isReDef(obj, ctx) || isLongDef(obj)) &&
1840
- is.someof(method.name, ["provider", "value", "constant", "bootstrap", "config", "factory", "directive", "filter", "run", "controller", "service", "decorator", "animation", "invoke"]);
1883
+ is.someof(method.name, ["provider", "value", "constant", "bootstrap", "config", "factory", "directive", "filter", "run", "controller", "service", "animation", "invoke"]);
1841
1884
  if (!matchAngularModule) {
1842
1885
  return false;
1843
1886
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ngannotate-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kari Ikonen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails