xing-framework 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/default_configuration/base_app/API_DOC/README +23 -0
  3. data/default_configuration/base_app/API_DOC/admin-menus +167 -0
  4. data/default_configuration/base_app/API_DOC/admin-pages +173 -0
  5. data/default_configuration/base_app/API_DOC/content-block +10 -0
  6. data/default_configuration/base_app/API_DOC/navigation +54 -0
  7. data/default_configuration/base_app/API_DOC/page +38 -0
  8. data/default_configuration/base_app/CHANGELOG.md +122 -0
  9. data/default_configuration/base_app/Capfile +26 -0
  10. data/default_configuration/base_app/Gemfile +7 -0
  11. data/default_configuration/base_app/Gemfile.lock +155 -0
  12. data/default_configuration/base_app/README.md +24 -0
  13. data/default_configuration/base_app/Rakefile +25 -0
  14. data/default_configuration/base_app/backend/Gemfile +45 -0
  15. data/default_configuration/base_app/backend/Gemfile.lock +292 -0
  16. data/default_configuration/base_app/backend/README +12 -0
  17. data/default_configuration/base_app/backend/Rakefile +10 -0
  18. data/default_configuration/base_app/backend/app/controllers/application_controller.rb +3 -0
  19. data/default_configuration/base_app/backend/app/controllers/confirmations_controller.rb +3 -0
  20. data/default_configuration/base_app/backend/app/controllers/passwords_controller.rb +3 -0
  21. data/default_configuration/base_app/backend/app/controllers/registrations_controller.rb +15 -0
  22. data/default_configuration/base_app/backend/app/models/ability.rb +13 -0
  23. data/default_configuration/base_app/backend/app/models/role/admin.rb +8 -0
  24. data/default_configuration/base_app/backend/app/models/user.rb +43 -0
  25. data/default_configuration/base_app/backend/autotest/discover.rb +2 -0
  26. data/default_configuration/base_app/backend/bin/bundle +3 -0
  27. data/default_configuration/base_app/backend/bin/rails +4 -0
  28. data/default_configuration/base_app/backend/bin/rake +4 -0
  29. data/default_configuration/base_app/backend/config.ru +6 -0
  30. data/default_configuration/base_app/backend/config/application.rb +71 -0
  31. data/default_configuration/base_app/backend/config/boot.rb +4 -0
  32. data/default_configuration/base_app/backend/config/database.yml.ci +9 -0
  33. data/default_configuration/base_app/backend/config/database.yml.example +22 -0
  34. data/default_configuration/base_app/backend/config/environment.rb +5 -0
  35. data/default_configuration/base_app/backend/config/environments/development.rb +45 -0
  36. data/default_configuration/base_app/backend/config/environments/production.rb +78 -0
  37. data/default_configuration/base_app/backend/config/environments/staging.rb +48 -0
  38. data/default_configuration/base_app/backend/config/environments/test.rb +47 -0
  39. data/default_configuration/base_app/backend/config/initializers/assets.rb +8 -0
  40. data/default_configuration/base_app/backend/config/initializers/backtrace_silencers.rb +7 -0
  41. data/default_configuration/base_app/backend/config/initializers/constants.rb +1 -0
  42. data/default_configuration/base_app/backend/config/initializers/cookies_serializer.rb +3 -0
  43. data/default_configuration/base_app/backend/config/initializers/devise.rb +241 -0
  44. data/default_configuration/base_app/backend/config/initializers/devise_token_auth.rb +22 -0
  45. data/default_configuration/base_app/backend/config/initializers/filter_parameter_logging.rb +4 -0
  46. data/default_configuration/base_app/backend/config/initializers/inflections.rb +16 -0
  47. data/default_configuration/base_app/backend/config/initializers/mime_types.rb +4 -0
  48. data/default_configuration/base_app/backend/config/initializers/session_store.rb +3 -0
  49. data/default_configuration/base_app/backend/config/initializers/smtp.rb +25 -0
  50. data/default_configuration/base_app/backend/config/initializers/time_formats.rb +12 -0
  51. data/default_configuration/base_app/backend/config/initializers/wrap_parameters.rb +14 -0
  52. data/default_configuration/base_app/backend/config/locales/en.yml +23 -0
  53. data/default_configuration/base_app/backend/config/locales/json.yml +29 -0
  54. data/default_configuration/base_app/backend/config/routes.rb +33 -0
  55. data/default_configuration/base_app/backend/config/secrets.yml.ci +22 -0
  56. data/default_configuration/base_app/backend/config/secrets.yml.example +57 -0
  57. data/default_configuration/base_app/backend/config/sidekiq.yml +4 -0
  58. data/default_configuration/base_app/backend/db/sample_data/users.rake +10 -0
  59. data/default_configuration/base_app/backend/db/seeds.rb +14 -0
  60. data/default_configuration/base_app/backend/lib/static-app.rb +15 -0
  61. data/default_configuration/base_app/backend/public/404.html +26 -0
  62. data/default_configuration/base_app/backend/public/422.html +26 -0
  63. data/default_configuration/base_app/backend/public/500.html +26 -0
  64. data/default_configuration/base_app/backend/public/favicon.ico +0 -0
  65. data/default_configuration/base_app/backend/public/index.html +0 -0
  66. data/default_configuration/base_app/backend/public/robots.txt +5 -0
  67. data/default_configuration/base_app/backend/script/rails +6 -0
  68. data/default_configuration/base_app/backend/spec/factories/user_sessions_factory.rb +6 -0
  69. data/default_configuration/base_app/backend/spec/factories/users_factory.rb +35 -0
  70. data/default_configuration/base_app/backend/spec/features/user_sends_reset_password_email_spec.rb +30 -0
  71. data/default_configuration/base_app/backend/spec/features/user_signs_up_spec.rb +32 -0
  72. data/default_configuration/base_app/backend/spec/models/role/admin_spec.rb +12 -0
  73. data/default_configuration/base_app/backend/spec/models/role_spec.rb +48 -0
  74. data/default_configuration/base_app/backend/spec/models/user_spec.rb +59 -0
  75. data/default_configuration/base_app/backend/spec/requests/resources_index_spec.rb +22 -0
  76. data/default_configuration/base_app/backend/spec/spec_helper.rb +65 -0
  77. data/default_configuration/base_app/backend/spec/support/devise_helper.rb +78 -0
  78. data/default_configuration/base_app/backend/spec/support/log_tests.rb +5 -0
  79. data/default_configuration/base_app/backend/spec/support/session_helpers.rb +67 -0
  80. data/default_configuration/base_app/backend/spec/tasks/sample_data_rake_spec.rb +17 -0
  81. data/default_configuration/base_app/backend/static-app.ru +3 -0
  82. data/default_configuration/base_app/codeclimate.yml +7 -0
  83. data/default_configuration/base_app/config/compass.rb +21 -0
  84. data/default_configuration/base_app/config/deploy.rb +157 -0
  85. data/default_configuration/base_app/config/deploy/bundle-config +4 -0
  86. data/default_configuration/base_app/config/deploy/production.rb +7 -0
  87. data/default_configuration/base_app/config/deploy/staging.rb +6 -0
  88. data/default_configuration/base_app/doc/01_fail_resources.txt +173 -0
  89. data/default_configuration/base_app/doc/02_fail_auth.txt +165 -0
  90. data/default_configuration/base_app/doc/03_fail_menus.txt +174 -0
  91. data/default_configuration/base_app/dummy-api/admin/menu_items/10.json +15 -0
  92. data/default_configuration/base_app/dummy-api/admin/menu_items/11.json +15 -0
  93. data/default_configuration/base_app/dummy-api/admin/menu_items/12.json +15 -0
  94. data/default_configuration/base_app/dummy-api/admin/menu_items/13.json +15 -0
  95. data/default_configuration/base_app/dummy-api/admin/menu_items/14.json +15 -0
  96. data/default_configuration/base_app/dummy-api/admin/menu_items/15.json +15 -0
  97. data/default_configuration/base_app/dummy-api/admin/menu_items/16.json +15 -0
  98. data/default_configuration/base_app/dummy-api/admin/menus.json +23 -0
  99. data/default_configuration/base_app/dummy-api/admin/menus/1.json +118 -0
  100. data/default_configuration/base_app/dummy-api/admin/menus/2.json +8 -0
  101. data/default_configuration/base_app/dummy-api/admin/pages.json +105 -0
  102. data/default_configuration/base_app/dummy-api/admin/pages/about_us.json +45 -0
  103. data/default_configuration/base_app/dummy-api/admin/pages/contact_us.json +36 -0
  104. data/default_configuration/base_app/dummy-api/admin/pages/gallery.json +36 -0
  105. data/default_configuration/base_app/dummy-api/admin/pages/home.json +36 -0
  106. data/default_configuration/base_app/dummy-api/admin/pages/homepage.json +18 -0
  107. data/default_configuration/base_app/dummy-api/admin/pages/links.json +36 -0
  108. data/default_configuration/base_app/dummy-api/admin/pages/newsletter.json +54 -0
  109. data/default_configuration/base_app/dummy-api/homepage.json +14 -0
  110. data/default_configuration/base_app/dummy-api/navigation/main.json +119 -0
  111. data/default_configuration/base_app/dummy-api/pages/about_us.json +41 -0
  112. data/default_configuration/base_app/dummy-api/pages/contact_us.json +32 -0
  113. data/default_configuration/base_app/dummy-api/pages/gallery.json +32 -0
  114. data/default_configuration/base_app/dummy-api/pages/home.json +32 -0
  115. data/default_configuration/base_app/dummy-api/pages/homepage.json +14 -0
  116. data/default_configuration/base_app/dummy-api/pages/links.json +32 -0
  117. data/default_configuration/base_app/dummy-api/pages/newsletter.json +50 -0
  118. data/default_configuration/base_app/dump.rdb +0 -0
  119. data/default_configuration/base_app/example-lrd-dev-tmux.conf +17 -0
  120. data/default_configuration/base_app/frontend/CHANGELOG.md +125 -0
  121. data/default_configuration/base_app/frontend/Gemfile +5 -0
  122. data/default_configuration/base_app/frontend/Gemfile.lock +34 -0
  123. data/default_configuration/base_app/frontend/Gruntfile.js +3 -0
  124. data/default_configuration/base_app/frontend/LICENSE +19 -0
  125. data/default_configuration/base_app/frontend/README.md +5 -0
  126. data/default_configuration/base_app/frontend/bin/index.html +0 -0
  127. data/default_configuration/base_app/frontend/build.config.js +110 -0
  128. data/default_configuration/base_app/frontend/changelog.tpl +23 -0
  129. data/default_configuration/base_app/frontend/config/compass.rb +33 -0
  130. data/default_configuration/base_app/frontend/config/environments/development.js +4 -0
  131. data/default_configuration/base_app/frontend/config/environments/integration.js +4 -0
  132. data/default_configuration/base_app/frontend/config/environments/production.js +3 -0
  133. data/default_configuration/base_app/frontend/config/environments/test.js +4 -0
  134. data/default_configuration/base_app/frontend/create +0 -0
  135. data/default_configuration/base_app/frontend/karma/karma-unit.tpl.js +80 -0
  136. data/default_configuration/base_app/frontend/module.prefix +1 -0
  137. data/default_configuration/base_app/frontend/module.suffix +1 -0
  138. data/default_configuration/base_app/frontend/npm-shrinkwrap.json +4334 -0
  139. data/default_configuration/base_app/frontend/package.json +75 -0
  140. data/default_configuration/base_app/frontend/sprockets/index.tpl.js +2 -0
  141. data/default_configuration/base_app/frontend/src/README.md +48 -0
  142. data/default_configuration/base_app/frontend/src/app/README.md +68 -0
  143. data/default_configuration/base_app/frontend/src/app/app.js +47 -0
  144. data/default_configuration/base_app/frontend/src/app/appConfig.js +19 -0
  145. data/default_configuration/base_app/frontend/src/app/auth/auth.js +66 -0
  146. data/default_configuration/base_app/frontend/src/app/auth/config.js +22 -0
  147. data/default_configuration/base_app/frontend/src/app/auth/confirmations/confirmations-success.tpl.html +1 -0
  148. data/default_configuration/base_app/frontend/src/app/auth/confirmations/confirmations.js +8 -0
  149. data/default_configuration/base_app/frontend/src/app/auth/confirmations/confirmationsStates.js +12 -0
  150. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-request-success.tpl.html +3 -0
  151. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-request.tpl.html +16 -0
  152. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-update-success.tpl.html +3 -0
  153. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-update.tpl.html +21 -0
  154. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords.js +11 -0
  155. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js +47 -0
  156. data/default_configuration/base_app/frontend/src/app/auth/passwords/passwordsStates.js +38 -0
  157. data/default_configuration/base_app/frontend/src/app/auth/registrations/registrations-success.tpl.html +1 -0
  158. data/default_configuration/base_app/frontend/src/app/auth/registrations/registrations.js +14 -0
  159. data/default_configuration/base_app/frontend/src/app/auth/registrations/registrations.tpl.html +37 -0
  160. data/default_configuration/base_app/frontend/src/app/auth/registrations/registrationsControllers.js +25 -0
  161. data/default_configuration/base_app/frontend/src/app/auth/registrations/registrationsStates.js +18 -0
  162. data/default_configuration/base_app/frontend/src/app/auth/sessions/sessions-success.tpl.html +1 -0
  163. data/default_configuration/base_app/frontend/src/app/auth/sessions/sessions.js +18 -0
  164. data/default_configuration/base_app/frontend/src/app/auth/sessions/sessions.tpl.html +25 -0
  165. data/default_configuration/base_app/frontend/src/app/auth/sessions/sessionsControllers.js +26 -0
  166. data/default_configuration/base_app/frontend/src/app/auth/sessions/sessionsStates.js +20 -0
  167. data/default_configuration/base_app/frontend/src/app/homepage/homepage-show.tpl.html +2 -0
  168. data/default_configuration/base_app/frontend/src/app/homepage/homepage.js +10 -0
  169. data/default_configuration/base_app/frontend/src/app/homepage/homepage.tpl.html +13 -0
  170. data/default_configuration/base_app/frontend/src/app/homepage/homepageControllers.js +9 -0
  171. data/default_configuration/base_app/frontend/src/app/homepage/homepageStates.js +22 -0
  172. data/default_configuration/base_app/frontend/src/app/inner.tpl.html +16 -0
  173. data/default_configuration/base_app/frontend/src/app/root.tpl.html +2 -0
  174. data/default_configuration/base_app/frontend/src/app/rootController.js +8 -0
  175. data/default_configuration/base_app/frontend/src/app/rootStates.js +20 -0
  176. data/default_configuration/base_app/frontend/src/assets/README.md +4 -0
  177. data/default_configuration/base_app/frontend/src/assets/icons/alert.svg +1 -0
  178. data/default_configuration/base_app/frontend/src/common/README.md +19 -0
  179. data/default_configuration/base_app/frontend/src/common/components/OnLoginDirective/OnLoginDirective.js +17 -0
  180. data/default_configuration/base_app/frontend/src/common/components/adminOnly/admin-only.tpl.html +4 -0
  181. data/default_configuration/base_app/frontend/src/common/components/adminOnly/adminOnly.js +23 -0
  182. data/default_configuration/base_app/frontend/src/common/components/sessionLinks/session-links.tpl.html +5 -0
  183. data/default_configuration/base_app/frontend/src/common/components/sessionLinks/sessionLinks.js +25 -0
  184. data/default_configuration/base_app/frontend/src/common/components/signOut/signOut.js +19 -0
  185. data/default_configuration/base_app/frontend/src/common/config.js +27 -0
  186. data/default_configuration/base_app/frontend/src/index.html +86 -0
  187. data/default_configuration/base_app/frontend/src/styles/_constants.sass +14 -0
  188. data/default_configuration/base_app/frontend/src/styles/main.sass +52 -0
  189. data/default_configuration/base_app/frontend/src/styles/partials/_footer.sass +18 -0
  190. data/default_configuration/base_app/frontend/src/styles/partials/_forms.sass +9 -0
  191. data/default_configuration/base_app/frontend/src/styles/partials/_layout.sass +17 -0
  192. data/default_configuration/base_app/frontend/src/styles/partials/_navbar.sass +10 -0
  193. data/default_configuration/base_app/frontend/src/styles/partials/_typography.sass +18 -0
  194. data/default_configuration/base_app/frontend/src/styles/states/_errorFallback.sass +7 -0
  195. data/default_configuration/base_app/frontend/src/styles/states/_root_homepage.sass +8 -0
  196. data/default_configuration/base_app/frontend/test-help/xpath.js +9 -0
  197. data/default_configuration/base_app/frontend/test/app.js +24 -0
  198. data/default_configuration/base_app/frontend/test/auth/confirmations/confirmationsStates.js +46 -0
  199. data/default_configuration/base_app/frontend/test/auth/passwords/passwordsControllers.js +193 -0
  200. data/default_configuration/base_app/frontend/test/auth/passwords/passwordsStates.js +108 -0
  201. data/default_configuration/base_app/frontend/test/auth/registrations/registrationsControllers.js +117 -0
  202. data/default_configuration/base_app/frontend/test/auth/registrations/registrationsStates.js +64 -0
  203. data/default_configuration/base_app/frontend/test/auth/sessions/sessionsControllers.js +95 -0
  204. data/default_configuration/base_app/frontend/test/auth/sessions/sessionsStates.js +67 -0
  205. data/default_configuration/base_app/frontend/test/specHelper.js +33 -0
  206. data/default_configuration/base_app/frontend/test/support/mockDirective.js +13 -0
  207. data/default_configuration/base_app/frontend/test/support/stateResolveFn.js +3 -0
  208. data/default_configuration/base_app/frontend/test/support/testStates.js +20 -0
  209. data/default_configuration/base_app/frontend/tools.md +223 -0
  210. data/default_configuration/base_app/lib/capistrano/tasks/sidekiq.rake +218 -0
  211. data/default_configuration/base_app/static-app.ru +3 -0
  212. data/default_configuration/base_app/tmux-windows +68 -0
  213. data/default_configuration/base_app/tmux-windows.txt +53 -0
  214. data/lib/xing/cli.rb +8 -3
  215. data/lib/xing/cli/generators/new_project.rb +48 -13
  216. metadata +219 -7
@@ -0,0 +1,95 @@
1
+ import {appName} from 'config';
2
+ import {} from '../../../src/app/auth/sessions/sessions.js';
3
+
4
+ describe( 'Sessions controllers', function() {
5
+
6
+ beforeEach( module( `${appName}.auth.sessions` ) );
7
+
8
+ var $scope, $stateMock, $authMock, $toastMock;
9
+
10
+ beforeEach(inject(function($q) {
11
+ $toastMock = {};
12
+ $toastMock.error = jasmine.createSpy('error');
13
+ $toastMock.errorList = jasmine.createSpy('errorList');
14
+
15
+ $stateMock = {
16
+ go(state){}
17
+ };
18
+
19
+ spyOn($stateMock, 'go').and.callThrough();
20
+
21
+ $authMock = {
22
+ submitLogin(session) {
23
+ if ((session.user.email == "bob") && (session.user.password = "password")) {
24
+ return $q((resolve, reject) => {
25
+ resolve();
26
+ });
27
+ } else {
28
+ return $q((resolve, reject) => {
29
+ reject({errors: "Invalid Login"});
30
+ });
31
+ }
32
+ }
33
+ };
34
+
35
+ spyOn($authMock, 'submitLogin').and.callThrough();
36
+
37
+ }));
38
+
39
+ describe("Sessions Controller", function() {
40
+
41
+ beforeEach( inject(function($controller, $rootScope) {
42
+ $scope = $rootScope.$new();
43
+ $controller('SessionsCtrl', {
44
+ $scope: $scope,
45
+ $state: $stateMock,
46
+ $auth: $authMock,
47
+ $lrdToast: $toastMock
48
+ });
49
+ $scope.$apply();
50
+ }));
51
+
52
+ it('should assign session', function(){
53
+ expect($scope.session).toEqualData({email: "", password: ""});
54
+ });
55
+
56
+ it('should assign humanAuthKey', function () {
57
+ expect($scope.humanAuthKey).toEqual("Email");
58
+ });
59
+
60
+ describe("sessionSubmit", function() {
61
+ describe("with valid login", function() {
62
+ beforeEach(function() {
63
+ $scope.session = { email: "bob", password: "password" };
64
+ $scope.sessionSubmit();
65
+ $scope.$apply();
66
+ });
67
+
68
+ it ("should call the auth service", function() {
69
+ expect($authMock.submitLogin).toHaveBeenCalled();
70
+ });
71
+
72
+ it ("should redirect to the sign in success page", function() {
73
+ expect($stateMock.go).toHaveBeenCalledWith("root.inner.sessionsSuccess");
74
+ });
75
+
76
+ });
77
+
78
+ describe("with invalid login", function() {
79
+ beforeEach(function() {
80
+ $scope.session = { email: "jill", password: "wrong password" };
81
+ $scope.sessionSubmit();
82
+ $scope.$apply();
83
+ });
84
+
85
+ it ("should call the auth service", function() {
86
+ expect($authMock.submitLogin).toHaveBeenCalled();
87
+ });
88
+
89
+ it ("should set the toast error message", function() {
90
+ expect($toastMock.error).toHaveBeenCalledWith("Invalid Login");
91
+ });
92
+ });
93
+ });
94
+ });
95
+ });
@@ -0,0 +1,67 @@
1
+ import {appName} from 'config';
2
+ import {} from '../../../src/app/auth/sessions/sessions.js';
3
+ import {} from '../../support/testStates.js';
4
+ import {LoggedInOnlyState} from 'stateClasses';
5
+
6
+ describe('Sessions states', function() {
7
+
8
+ var $rootScope, $state, $injector, state, $auth, $q;
9
+
10
+ beforeEach(function() {
11
+
12
+ module(`${appName}.testStates`);
13
+
14
+ module(`${appName}.auth.sessions`);
15
+
16
+ inject(function(_$rootScope_, _$state_, _$injector_, $templateCache, _$q_, _$auth_) {
17
+ $rootScope = _$rootScope_;
18
+ $state = _$state_;
19
+ $injector = _$injector_;
20
+ $q = _$q_;
21
+
22
+ $auth = _$auth_;
23
+
24
+ $templateCache.put('auth/sessions/sessions.tpl.html', '');
25
+ $templateCache.put('auth/sessions/sessions-success.tpl.html', '');
26
+ });
27
+ });
28
+
29
+ describe("sessions", function() {
30
+
31
+ beforeEach(function() {
32
+ state = $state.get('root.inner.sessions');
33
+ });
34
+
35
+ it('should respond to URL', function() {
36
+ expect($state.href(state)).toEqual('#/sign-in');
37
+ });
38
+
39
+ it('should render the sessions template', function() {
40
+ expect(state.templateUrl).toEqual('auth/sessions/sessions.tpl.html');
41
+ });
42
+
43
+ it('should use the sessions controller', function() {
44
+ expect(state.controller).toEqual('SessionsCtrl');
45
+ });
46
+
47
+ });
48
+
49
+ describe("sessionsSuccess", function() {
50
+
51
+ beforeEach(function() {
52
+ state = $state.get('root.inner.sessionsSuccess');
53
+ });
54
+
55
+ it('should extend LoggedInOnlyState', function() {
56
+ expect(state instanceof LoggedInOnlyState).toBe(true);
57
+ });
58
+
59
+ it('should respond to URL', function() {
60
+ expect($state.href(state)).toEqual('#/signed-in');
61
+ });
62
+
63
+ it('should render the sessions template', function() {
64
+ expect(state.templateUrl).toEqual('auth/sessions/sessions-success.tpl.html');
65
+ });
66
+ });
67
+ });
@@ -0,0 +1,33 @@
1
+
2
+ beforeEach(function () {
3
+ jasmine.addMatchers({
4
+ toEqualData: function () {
5
+ return {
6
+ compare: function(actual, expected) {
7
+ return {
8
+ pass: angular.equals(actual, expected)
9
+ };
10
+ }
11
+ };
12
+ },
13
+ toBeFunction: function () {
14
+ return {
15
+ compare: function(actual) {
16
+ return {
17
+ pass: angular.isFunction(actual)
18
+ };
19
+ }
20
+ };
21
+ },
22
+ toBeInstanceOf: function () {
23
+ return {
24
+ compare: function(actual, expected) {
25
+ return {
26
+ pass: actual instanceof expected
27
+ };
28
+ }
29
+ };
30
+ }
31
+
32
+ });
33
+ });
@@ -0,0 +1,13 @@
1
+ export default function mockDirective(directiveName, innerContent) {
2
+ module(function($compileProvider) {
3
+ $compileProvider.directive(directiveName, function() {
4
+ var mockDir = {
5
+ priority: 9999,
6
+ terminal: true,
7
+ restrict: 'EAC',
8
+ template: `<div class='mock'>${innerContent}</div>`
9
+ };
10
+ return mockDir;
11
+ });
12
+ });
13
+ }
@@ -0,0 +1,3 @@
1
+ export default function resolveFn(state, property) {
2
+ return state.resolve[property][state.resolve[property].length-1];
3
+ }
@@ -0,0 +1,20 @@
1
+ import {appName} from 'config';
2
+
3
+ angular.module(`${appName}.testStates`, ['ui.router']).config([
4
+ '$stateProvider',
5
+ '$urlRouterProvider',
6
+ function ($stateProvider, $urlRouterProvider){
7
+ // For any unmatched url, redirect to /
8
+ $urlRouterProvider.otherwise('/');
9
+
10
+ $stateProvider
11
+ .state('root', {
12
+ abstract: true,
13
+ template: '<ui-view/>'
14
+ })
15
+ .state('root.inner', {
16
+ abstract: true,
17
+ template: '<ui-view/>'
18
+ });
19
+ }
20
+ ]);
@@ -0,0 +1,223 @@
1
+ # The Tools Used in `ngBoilerplate`
2
+
3
+ ## Introduction
4
+
5
+ `ngBoilerplate` is standards-based, so it uses all the usual tools to manage
6
+ and develop client-side code. If you've developed modern, highly-organized
7
+ JavaScript projects before, you are probably already familiar with at least most
8
+ of these tools. What follows is a simple description of the tools of which this
9
+ project makes use and how they fit in to the `ngBoilerplate` picture.
10
+
11
+ ## Git
12
+
13
+ [Git](http://git-scm.com/) is a distributed version control system.
14
+ `ngBoilerplate` uses git to manage its codebase. While in theory you don't have
15
+ to use Git once you download `ngBoilerplate`, this project makes the assumption
16
+ that you do. If you're on GitHub, I assume you already have a basic
17
+ understanding of Git, which is all you need to make effective use of this
18
+ project. You just need to be able to commit and push and junk - nothing funky.
19
+ If you're not familiar with it, check out the documentation linked to above.
20
+ GitHub also has a great [help section](https://help.github.com/).
21
+
22
+ ## Node.js & NPM
23
+
24
+ [Node.js](http://nodejs.org) is a platform based on Chrome's JavaScript runtime,
25
+ called [V8](http://code.google.com/p/v8/). It allows you to develop all kinds of
26
+ software using the JavaScript you already know and love.
27
+
28
+ A great feature of Node.js is its wide variety of existing libraries and tools.
29
+ As the developer community is absolutely massive and incredibly active, Node.js
30
+ has a basic package manager called NPM that you can use to install Node.js-based
31
+ software and libraries from the command line.
32
+
33
+ While `ngBoilerplate` makes heavy use of Node.js behind the scenes, you as the
34
+ application developer don't need to really think about it much. Most of the
35
+ interaction with Node.js will occur through Grunt (see next section), so you
36
+ really only need to know how get the initial setup working.
37
+
38
+ `package.json` is an NPM package description file written in JSON. It contains
39
+ basic metadata about your application, like its name, version, and dependencies.
40
+ By default, several packages are required for the build process to work; so when
41
+ you first start with `ngBoilerplate` you have to tell NPM to install the
42
+ packages; this is covered in detail in the [main README](README.md). Some of
43
+ the required packages are Grunt build tasks (see below), while others are
44
+ command-line tools either we (or the build system) need, like Karma, Grunt, and
45
+ Bower.
46
+
47
+ Don't worry about knowing Node.js in order to use `ngBoilerplate`; Grunt is
48
+ where the magic happens.
49
+
50
+ ## Grunt.js
51
+
52
+ [Grunt](http://gruntjs.com) is a JavaScript task runner that runs on top of
53
+ Node.js. Most importantly, Grunt brings us automation. There are lots of steps
54
+ that go into taking our manageable codebase and making it into a
55
+ production-ready website; we must gather, lint, test, annotate, and copy files
56
+ about. Instead of doing all of that manually, we write (and use others') Grunt
57
+ tasks to do things for us.
58
+
59
+ When we want to build our site, we can just type:
60
+
61
+ ```sh
62
+ $ grunt
63
+ ```
64
+
65
+ This will do everything needed and place our built code inside a folder called
66
+ `bin/`. Even more magical, we can tell Grunt to watch for file changes we make
67
+ so it can re-build our site on-the-fly:
68
+
69
+ ```sh
70
+ $ grunt watch
71
+ ```
72
+
73
+ The built files will be in `build/`. See the main [README](README.md) for more
74
+ info.
75
+
76
+ The next time we change a source file, Grunt will re-build the changed parts of
77
+ the site. If you have a Live Reload plugin installed in your browser, it will
78
+ even auto-refresh your browser for you. You lazy bum.
79
+
80
+ Grunt is controlled through `Gruntfile.js`. This file is heavily documented in
81
+ the source, so I will only provide a high-altitude overview here. Also note that
82
+ unless you need to modify the build process, you don't need to know anything
83
+ else from this section. The two commands above really are all you need to know
84
+ to get started with `ngBoilerplate`. But for those curious or looking to go a
85
+ little more advanced, here's what you'll find.
86
+
87
+ First, we tell Grunt which tasks we might want to use:
88
+
89
+ ```js
90
+ // ...
91
+ grunt.loadNpmTasks('grunt-recess');
92
+ grunt.loadNpmTasks('grunt-contrib-clean');
93
+ grunt.loadNpmTasks('grunt-contrib-copy');
94
+ grunt.loadNpmTasks('grunt-contrib-jshint');
95
+ // ...
96
+ ```
97
+
98
+ Each of these tasks must already be installed. Remember the dependencies from
99
+ `package.json` that NPM installed for us? Well, this is where they get used!
100
+
101
+ Then we get the opportunity to tell the tasks to behave like we want by
102
+ defining a configuration object. While we can (and do) define all sorts of
103
+ custom configuration values that we reference later on, tasks look for
104
+ configuration properties of their own name. For example, the `clean` task just
105
+ takes an array of files to delete when the task runs:
106
+
107
+ ```js
108
+ clean: [ '<%= build_dir %>', '<%= compile_dir %>' ],
109
+ ```
110
+
111
+ In Grunt, the `<%= varName %>` is a way of re-using configuration variables.
112
+ In the `build.config.js`, we defined what `build_dir` meant:
113
+
114
+ ```js
115
+ build_dir: 'build',
116
+ ```
117
+
118
+ When the clean task runs, it will delete the `build/` folder entirely so that
119
+ when our new build runs, we don't encounter any problems with stale or old
120
+ files. Most tasks, however, have considerably more complicated configuration
121
+ requirements, but I've tried to document what each one is doing and what the
122
+ configuration properties mean. If I was vague or ambiguous or just plain
123
+ unclear, please file an issue and I'll get it fixed. Boom - problem solved.
124
+
125
+ After our configuration is complete, we can define some of our own tasks. For
126
+ example, we could do the build by running all of the separate tasks that we
127
+ installed from NPM and configured as above:
128
+
129
+ ```sh
130
+ $ grunt clean
131
+ $ grunt html2js
132
+ $ grunt jshint
133
+ $ grunt karma:continuous
134
+ $ grunt concat
135
+ $ grunt ngmin:dist
136
+ $ grunt uglify
137
+ $ grunt recess
138
+ $ grunt index
139
+ $ grunt copy
140
+ ```
141
+
142
+ But how automated is that? So instead we define a composite task that executes
143
+ all that for us. The commands above make up the `default` tasks, which can be
144
+ run by typing *either* of these commands:
145
+
146
+ ```js
147
+ $ grunt
148
+ $ grunt default
149
+ ```
150
+
151
+ We also define the `watch` task discussed earlier. This is covered in more
152
+ detail in the main (README)[README.md].
153
+
154
+ Grunt is the engine behind `ngBoilerplate`. It's the magic that makes it move.
155
+ Just getting started, you won't need to alter `Gruntfile.js` at all, but
156
+ as you get into more advanced application development, you will probably need to
157
+ add more tasks and change some steps around to make this build your own.
158
+ Hopefully, this readme and the documentation within `Gruntfile.js` (as well as
159
+ of course the documentation at gruntjs.com) will set you on the right path.
160
+
161
+ ## Bower
162
+
163
+ [Bower](bower.io) is a package manager for the web. It's similar in many
164
+ respects to NPM, though it is significantly simpler and only contains code for
165
+ web projects, like Twitter Bootstrap and its AngularJS counterpart Angular
166
+ Bootstrap. Bower allows us to say that our app depends in some way on these
167
+ other libraries so that we can manage all of them in one simple place.
168
+
169
+ `ngBoilerplate` comes with a `bower.json` file that looks something like this:
170
+
171
+ ```js
172
+ {
173
+ "name": "ng-boilerplate",
174
+ "version": "0.2.0-SNAPSHOT",
175
+ "devDependencies": {
176
+ "angular": "~1.0.7",
177
+ "angular-mocks": "~1.0.7",
178
+ "bootstrap": "~2.3.2",
179
+ "angular-bootstrap": "~0.3.0",
180
+ "angular-ui-router": "~0.0.1",
181
+ "angular-ui-utils": "~0.0.3"
182
+ },
183
+ "dependencies": {}
184
+ }
185
+ ```
186
+
187
+ This file is fairly self-explanatory; it gives the package name and version
188
+ (duplicated from `package.json`, but this is unavoidable) as well as a list of
189
+ dependencies our application needs in order to work. If we simply call
190
+
191
+ ```sh
192
+ $ bower install
193
+ ```
194
+
195
+ it will read these three dependencies and install them into the `vendor/` folder
196
+ (along with any dependencies they have) so that we can use them in our app. If
197
+ we want to add a new package like AngularUI's
198
+ [ngGrid](http://angular-ui.github.io/ng-grid/), then we can tell Bower to
199
+ install that from the web, place it into the `vendor/` folder for us to use, and
200
+ then add it as a dependency to `bower.json`:
201
+
202
+ ```js
203
+ $ bower install angular-grid --save-dev
204
+ ```
205
+
206
+ Bower can also update all of our packages for us at a later date, though that
207
+ and its many other awesome features are beyond the scope of this simple
208
+ overview.
209
+
210
+ One last thing to note is that packages installed with Bower are not
211
+ standardized, so we cannot automatically add them to the build process; anything
212
+ installed with Bower (or placed in the `vendor/` directory manually) *must* be
213
+ added to your `build.config.js` file manually; look for the Bower libs included
214
+ in `ngBoilerplate` by default in there to see what I mean.
215
+
216
+ ## Where to Go From Here
217
+
218
+ That's it! Now that you have a basic understanding of the tools involved, read
219
+ through the [main README](README.md) to dive another level deeper and apply what
220
+ you've learned for great good. I promise it will all make sense it short order.
221
+
222
+ Happy programming!
223
+