├── .gitignore ├── .idea ├── .name ├── encodings.xml ├── misc.xml ├── modules.xml ├── starterapp.iml ├── typescript-compiler.xml └── workspace.xml ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ └── application.js │ └── stylesheets │ │ └── application.css ├── controllers │ ├── application_controller.rb │ └── concerns │ │ └── .keep ├── helpers │ └── application_helper.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ └── concerns │ │ └── .keep └── views │ └── layouts │ └── application.html.erb ├── bin ├── bundle ├── rails ├── rake └── setup ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── routes.rb └── secrets.yml ├── db └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── package.json ├── public ├── 404.html ├── 422.html ├── 500.html ├── app │ ├── app_router.component.js │ ├── app_router.component.js.map │ ├── app_router.component.ts │ ├── boot.js │ ├── boot.js.map │ ├── boot.ts │ ├── home.component.html │ ├── home.component.js │ ├── home.component.js.map │ └── home.component.ts ├── favicon.ico ├── index.html └── robots.txt ├── test ├── controllers │ └── .keep ├── fixtures │ └── .keep ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ └── .keep └── test_helper.rb ├── tsconfig.json ├── typings.json ├── typings ├── browser.d.ts ├── browser │ └── ambient │ │ ├── es6-shim │ │ └── index.d.ts │ │ └── jasmine │ │ └── index.d.ts ├── main.d.ts └── main │ └── ambient │ ├── es6-shim │ └── index.d.ts │ └── jasmine │ └── index.d.ts └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | !/log/.keep 17 | /tmp 18 | node_modules -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | starterapp -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/starterapp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /.idea/typescript-compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 137 | 138 | 139 | 156 | 157 | 158 | 159 | 160 | true 161 | 162 | 163 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 202 | 203 | 204 | 205 | 208 | 209 | 212 | 213 | 214 | 215 | 218 | 219 | 222 | 223 | 226 | 227 | 228 | 229 | 232 | 233 | 236 | 237 | 240 | 241 | 244 | 245 | 246 | 247 | 250 | 251 | 254 | 255 | 258 | 259 | 260 | 261 | 264 | 265 | 268 | 269 | 272 | 273 | 274 | 275 | 278 | 279 | 282 | 283 | 286 | 287 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 1463426630780 532 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 565 | 568 | 569 | 570 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '4.2.6' 6 | # Use sqlite3 as the database for Active Record 7 | gem 'sqlite3' 8 | gem 'sprockets' 9 | gem 'rack-cors' 10 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 11 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 12 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.2.6) 5 | actionpack (= 4.2.6) 6 | actionview (= 4.2.6) 7 | activejob (= 4.2.6) 8 | mail (~> 2.5, >= 2.5.4) 9 | rails-dom-testing (~> 1.0, >= 1.0.5) 10 | actionpack (4.2.6) 11 | actionview (= 4.2.6) 12 | activesupport (= 4.2.6) 13 | rack (~> 1.6) 14 | rack-test (~> 0.6.2) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 17 | actionview (4.2.6) 18 | activesupport (= 4.2.6) 19 | builder (~> 3.1) 20 | erubis (~> 2.7.0) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 23 | activejob (4.2.6) 24 | activesupport (= 4.2.6) 25 | globalid (>= 0.3.0) 26 | activemodel (4.2.6) 27 | activesupport (= 4.2.6) 28 | builder (~> 3.1) 29 | activerecord (4.2.6) 30 | activemodel (= 4.2.6) 31 | activesupport (= 4.2.6) 32 | arel (~> 6.0) 33 | activesupport (4.2.6) 34 | i18n (~> 0.7) 35 | json (~> 1.7, >= 1.7.7) 36 | minitest (~> 5.1) 37 | thread_safe (~> 0.3, >= 0.3.4) 38 | tzinfo (~> 1.1) 39 | arel (6.0.3) 40 | builder (3.2.2) 41 | concurrent-ruby (1.0.2) 42 | erubis (2.7.0) 43 | globalid (0.3.6) 44 | activesupport (>= 4.1.0) 45 | i18n (0.7.0) 46 | json (1.8.3) 47 | loofah (2.0.3) 48 | nokogiri (>= 1.5.9) 49 | mail (2.6.4) 50 | mime-types (>= 1.16, < 4) 51 | mime-types (3.0) 52 | mime-types-data (~> 3.2015) 53 | mime-types-data (3.2016.0221) 54 | mini_portile2 (2.0.0) 55 | minitest (5.8.4) 56 | nokogiri (1.6.7.2-x64-mingw32) 57 | mini_portile2 (~> 2.0.0.rc2) 58 | rack (1.6.4) 59 | rack-cors (0.4.0) 60 | rack-test (0.6.3) 61 | rack (>= 1.0) 62 | rails (4.2.6) 63 | actionmailer (= 4.2.6) 64 | actionpack (= 4.2.6) 65 | actionview (= 4.2.6) 66 | activejob (= 4.2.6) 67 | activemodel (= 4.2.6) 68 | activerecord (= 4.2.6) 69 | activesupport (= 4.2.6) 70 | bundler (>= 1.3.0, < 2.0) 71 | railties (= 4.2.6) 72 | sprockets-rails 73 | rails-deprecated_sanitizer (1.0.3) 74 | activesupport (>= 4.2.0.alpha) 75 | rails-dom-testing (1.0.7) 76 | activesupport (>= 4.2.0.beta, < 5.0) 77 | nokogiri (~> 1.6.0) 78 | rails-deprecated_sanitizer (>= 1.0.1) 79 | rails-html-sanitizer (1.0.3) 80 | loofah (~> 2.0) 81 | railties (4.2.6) 82 | actionpack (= 4.2.6) 83 | activesupport (= 4.2.6) 84 | rake (>= 0.8.7) 85 | thor (>= 0.18.1, < 2.0) 86 | rake (11.1.2) 87 | sprockets (3.6.0) 88 | concurrent-ruby (~> 1.0) 89 | rack (> 1, < 3) 90 | sprockets-rails (3.0.4) 91 | actionpack (>= 4.0) 92 | activesupport (>= 4.0) 93 | sprockets (>= 3.0.0) 94 | sqlite3 (1.3.11-x64-mingw32) 95 | thor (0.19.1) 96 | thread_safe (0.3.5) 97 | tzinfo (1.2.2) 98 | thread_safe (~> 0.1) 99 | tzinfo-data (1.2016.4) 100 | tzinfo (>= 1.0.0) 101 | 102 | PLATFORMS 103 | x64-mingw32 104 | 105 | DEPENDENCIES 106 | rack-cors 107 | rails (= 4.2.6) 108 | sprockets 109 | sqlite3 110 | tzinfo-data 111 | 112 | BUNDLED WITH 113 | 1.11.2 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | Boilerplate for starting your Angular 2 app with Ruby on Rails 5 API back-end. 4 | The root of the Angular 2 application is located in: 5 | ```bash 6 | public/app 7 | ``` 8 | 9 | ## Installation 10 | 1. Run `bundle install` 11 | 2. Run `npm install` 12 | 13 | ## Requirements 14 | - Ruby 2.2.4^ 15 | - Node 4.2.0 16 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | 5 | protect_from_forgery with: :exception 6 | 7 | def index 8 | respond_to do |format| 9 | format.json { render json: {some: 'data'} } 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/app/mailers/.keep -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/app/models/.keep -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Starterapp 5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Starterapp 10 | class Application < Rails::Application 11 | 12 | config.middleware.insert_before 0, 'Rack::Cors' do 13 | allow do 14 | origins '*' 15 | resource '*', :headers => :any, :methods => [:get, :post, :options] 16 | end 17 | end 18 | 19 | config.assets.paths << Rails.root.join('node_modules') 20 | config.assets.enabled = true 21 | 22 | config.active_record.raise_in_transactional_callbacks = true 23 | 24 | 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | end 42 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | # config.log_tags = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_starterapp_session' 4 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | get '/api' => 'application#index', defaults: { format: :json } 3 | end 4 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: e22a55885c1bc0e000bba6c0d0bc89f2b2e1f4a4e948b32d86123bfe8319050557797145fee5ce856ee6fece6aae0c8b1cc8cbe10260fd459b7bebf86103e147 15 | 16 | test: 17 | secret_key_base: e6d988201698d64b1b11962c7eefafaabc991ab7685f4c0e5bf2f84224a705e8fd9c7c405cbe6bc14f16844790f6e3a94ecd1f0e56abb0d9ef67830b4c1b5794 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rails-ng2", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "tsc": "tsc", 6 | "tsc:w": "tsc -w", 7 | "typings": "typings", 8 | "postinstall": "typings install" 9 | }, 10 | "license": "ISC", 11 | "dependencies": { 12 | "angular2": "2.0.0-beta.15", 13 | "systemjs": "0.19.26", 14 | "es6-shim": "^0.35.0", 15 | "reflect-metadata": "0.1.2", 16 | "rxjs": "5.0.0-beta.2", 17 | "zone.js": "0.6.10", 18 | "intl": "^1.0.1" 19 | }, 20 | "engines": { 21 | "node": "4.2.0" 22 | }, 23 | "devDependencies": { 24 | "typescript": "^1.8.10", 25 | "typings":"^0.7.12" 26 | } 27 | } -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/app/app_router.component.js: -------------------------------------------------------------------------------- 1 | System.register(['angular2/core', 'angular2/router', './home.component'], function(exports_1) { 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var core_1, router_1, home_component_1; 12 | var AppRouterComponent; 13 | return { 14 | setters:[ 15 | function (core_1_1) { 16 | core_1 = core_1_1; 17 | }, 18 | function (router_1_1) { 19 | router_1 = router_1_1; 20 | }, 21 | function (home_component_1_1) { 22 | home_component_1 = home_component_1_1; 23 | }], 24 | execute: function() { 25 | AppRouterComponent = (function () { 26 | function AppRouterComponent() { 27 | } 28 | AppRouterComponent = __decorate([ 29 | core_1.Component({ 30 | selector: 'app-router', 31 | template: '', 32 | directives: [router_1.ROUTER_DIRECTIVES], 33 | styles: [] 34 | }), 35 | router_1.RouteConfig([ 36 | { path: '/', name: 'Home', component: home_component_1.HomeComponent } 37 | ]), 38 | __metadata('design:paramtypes', []) 39 | ], AppRouterComponent); 40 | return AppRouterComponent; 41 | })(); 42 | exports_1("AppRouterComponent", AppRouterComponent); 43 | } 44 | } 45 | }); 46 | //# sourceMappingURL=app_router.component.js.map -------------------------------------------------------------------------------- /public/app/app_router.component.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"app_router.component.js","sourceRoot":"","sources":["app_router.component.ts"],"names":["AppRouterComponent","AppRouterComponent.constructor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;YAIA;gBAAAA;gBASiCC,CAACA;gBATlCD;oBAACA,gBAASA,CAACA;wBACPA,QAAQA,EAAEA,YAAYA;wBACtBA,QAAQA,EAAEA,iCAAiCA;wBAC3CA,UAAUA,EAAEA,CAACA,0BAAiBA,CAACA;wBAC/BA,MAAMA,EAACA,EAAEA;qBACZA,CAACA;oBACDA,oBAAWA,CAACA;wBACTA,EAAEA,IAAIA,EAAEA,GAAGA,EAAEA,IAAIA,EAAEA,MAAMA,EAAEA,SAASA,EAAEA,8BAAaA,EAAEA;qBACxDA,CAACA;;uCACgCA;gBAADA,yBAACA;YAADA,CAACA,AATlC,IASkC;YATlC,mDASkC,CAAA"} -------------------------------------------------------------------------------- /public/app/app_router.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from 'angular2/core' 2 | import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router' 3 | import {HomeComponent} from './home.component' 4 | 5 | @Component({ 6 | selector: 'app-router', 7 | template: '', 8 | directives: [ROUTER_DIRECTIVES], 9 | styles:[] 10 | }) 11 | @RouteConfig([ 12 | { path: '/', name: 'Home', component: HomeComponent } 13 | ]) 14 | export class AppRouterComponent {} -------------------------------------------------------------------------------- /public/app/boot.js: -------------------------------------------------------------------------------- 1 | System.register(['angular2/platform/browser', './app_router.component', 'angular2/http', 'angular2/router'], function(exports_1) { 2 | var browser_1, app_router_component_1, http_1, router_1; 3 | return { 4 | setters:[ 5 | function (browser_1_1) { 6 | browser_1 = browser_1_1; 7 | }, 8 | function (app_router_component_1_1) { 9 | app_router_component_1 = app_router_component_1_1; 10 | }, 11 | function (http_1_1) { 12 | http_1 = http_1_1; 13 | }, 14 | function (router_1_1) { 15 | router_1 = router_1_1; 16 | }], 17 | execute: function() { 18 | browser_1.bootstrap(app_router_component_1.AppRouterComponent, [ 19 | http_1.HTTP_PROVIDERS, 20 | router_1.ROUTER_PROVIDERS 21 | ]); 22 | } 23 | } 24 | }); 25 | //# sourceMappingURL=boot.js.map -------------------------------------------------------------------------------- /public/app/boot.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"boot.js","sourceRoot":"","sources":["boot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;YAMA,mBAAS,CACL,yCAAkB,EAClB;gBACI,qBAAc;gBACd,yBAAgB;aACnB,CACJ,CAAC"} -------------------------------------------------------------------------------- /public/app/boot.ts: -------------------------------------------------------------------------------- 1 | import {provide} from 'angular2/core' 2 | import {bootstrap} from 'angular2/platform/browser' 3 | import {AppRouterComponent} from './app_router.component' 4 | import {HTTP_PROVIDERS} from 'angular2/http' 5 | import {ROUTER_PROVIDERS} from 'angular2/router' 6 | 7 | bootstrap( 8 | AppRouterComponent, 9 | [ 10 | HTTP_PROVIDERS, 11 | ROUTER_PROVIDERS 12 | ] 13 | ); -------------------------------------------------------------------------------- /public/app/home.component.html: -------------------------------------------------------------------------------- 1 |

Rails Angular 2

2 | {{message}} -------------------------------------------------------------------------------- /public/app/home.component.js: -------------------------------------------------------------------------------- 1 | System.register(['angular2/core', 'angular2/http'], function(exports_1) { 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var core_1, http_1; 12 | var HomeComponent; 13 | return { 14 | setters:[ 15 | function (core_1_1) { 16 | core_1 = core_1_1; 17 | }, 18 | function (http_1_1) { 19 | http_1 = http_1_1; 20 | }], 21 | execute: function() { 22 | HomeComponent = (function () { 23 | function HomeComponent(http) { 24 | var _this = this; 25 | this.http = http; 26 | this.http.get('http://localhost:3000/api') 27 | .subscribe(function (data) { return _this.message = data.json().some; }, function (err) { return console.log(err); }); 28 | } 29 | HomeComponent = __decorate([ 30 | core_1.Component({ 31 | selector: 'home', 32 | templateUrl: '/app/home.component.html' 33 | }), 34 | __metadata('design:paramtypes', [http_1.Http]) 35 | ], HomeComponent); 36 | return HomeComponent; 37 | })(); 38 | exports_1("HomeComponent", HomeComponent); 39 | } 40 | } 41 | }); 42 | //# sourceMappingURL=home.component.js.map -------------------------------------------------------------------------------- /public/app/home.component.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"home.component.js","sourceRoot":"","sources":["home.component.ts"],"names":["HomeComponent","HomeComponent.constructor"],"mappings":";;;;;;;;;;;;;;;;;;;;;YAGA;gBAMIA,uBAAoBA,IAAUA;oBANlCC,iBAgBCA;oBAVuBA,SAAIA,GAAJA,IAAIA,CAAMA;oBAC1BA,IAAIA,CAACA,IAAIA,CAACA,GAAGA,CAACA,2BAA2BA,CAACA;yBACrCA,SAASA,CACNA,UAAAA,IAAIA,IAAIA,OAAAA,KAAIA,CAACA,OAAOA,GAAGA,IAAIA,CAACA,IAAIA,EAAEA,CAACA,IAAIA,EAA/BA,CAA+BA,EACvCA,UAAAA,GAAGA,IAAIA,OAAAA,OAAOA,CAACA,GAAGA,CAACA,GAAGA,CAACA,EAAhBA,CAAgBA,CAC1BA,CAACA;gBACVA,CAACA;gBAZLD;oBAACA,gBAASA,CAACA;wBACPA,QAAQA,EAAEA,MAAMA;wBAChBA,WAAWA,EAAEA,0BAA0BA;qBAC1CA,CAACA;;kCAaDA;gBAADA,oBAACA;YAADA,CAACA,AAhBD,IAgBC;YAhBD,yCAgBC,CAAA"} -------------------------------------------------------------------------------- /public/app/home.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from 'angular2/core' 2 | import {RouteParams} from 'angular2/router' 3 | import {Http, HTTP_PROVIDERS} from 'angular2/http'; 4 | @Component({ 5 | selector: 'home', 6 | templateUrl: '/app/home.component.html' 7 | }) 8 | export class HomeComponent { 9 | message: string; 10 | constructor( public http: Http){ 11 | this.http.get('http://localhost:3000/api') 12 | .subscribe( 13 | data => this.message = data.json().some, 14 | err => console.log(err) 15 | ); 16 | } 17 | 18 | 19 | 20 | } -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/test/controllers/.keep -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/test/fixtures/.keep -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/test/models/.keep -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "system", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false, 11 | "rootDir":"public" 12 | }, 13 | "exclude": [ 14 | "node_modules", 15 | "typings/main", 16 | "typings/main.d.ts" 17 | ] 18 | } -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd", 4 | "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b" 5 | } 6 | } -------------------------------------------------------------------------------- /typings/browser.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /typings/browser/ambient/es6-shim/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/es6-shim/es6-shim.d.ts 3 | // Type definitions for es6-shim v0.31.2 4 | // Project: https://github.com/paulmillr/es6-shim 5 | // Definitions by: Ron Buckton 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | declare type PropertyKey = string | number | symbol; 9 | 10 | interface IteratorResult { 11 | done: boolean; 12 | value?: T; 13 | } 14 | 15 | interface IterableShim { 16 | /** 17 | * Shim for an ES6 iterable. Not intended for direct use by user code. 18 | */ 19 | "_es6-shim iterator_"(): Iterator; 20 | } 21 | 22 | interface Iterator { 23 | next(value?: any): IteratorResult; 24 | return?(value?: any): IteratorResult; 25 | throw?(e?: any): IteratorResult; 26 | } 27 | 28 | interface IterableIteratorShim extends IterableShim, Iterator { 29 | /** 30 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. 31 | */ 32 | "_es6-shim iterator_"(): IterableIteratorShim; 33 | } 34 | 35 | interface StringConstructor { 36 | /** 37 | * Return the String value whose elements are, in order, the elements in the List elements. 38 | * If length is 0, the empty string is returned. 39 | */ 40 | fromCodePoint(...codePoints: number[]): string; 41 | 42 | /** 43 | * String.raw is intended for use as a tag function of a Tagged Template String. When called 44 | * as such the first argument will be a well formed template call site object and the rest 45 | * parameter will contain the substitution values. 46 | * @param template A well-formed template string call site representation. 47 | * @param substitutions A set of substitution values. 48 | */ 49 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; 50 | } 51 | 52 | interface String { 53 | /** 54 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point 55 | * value of the UTF-16 encoded code point starting at the string element at position pos in 56 | * the String resulting from converting this object to a String. 57 | * If there is no element at that position, the result is undefined. 58 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. 59 | */ 60 | codePointAt(pos: number): number; 61 | 62 | /** 63 | * Returns true if searchString appears as a substring of the result of converting this 64 | * object to a String, at one or more positions that are 65 | * greater than or equal to position; otherwise, returns false. 66 | * @param searchString search string 67 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. 68 | */ 69 | includes(searchString: string, position?: number): boolean; 70 | 71 | /** 72 | * Returns true if the sequence of elements of searchString converted to a String is the 73 | * same as the corresponding elements of this object (converted to a String) starting at 74 | * endPosition – length(this). Otherwise returns false. 75 | */ 76 | endsWith(searchString: string, endPosition?: number): boolean; 77 | 78 | /** 79 | * Returns a String value that is made from count copies appended together. If count is 0, 80 | * T is the empty String is returned. 81 | * @param count number of copies to append 82 | */ 83 | repeat(count: number): string; 84 | 85 | /** 86 | * Returns true if the sequence of elements of searchString converted to a String is the 87 | * same as the corresponding elements of this object (converted to a String) starting at 88 | * position. Otherwise returns false. 89 | */ 90 | startsWith(searchString: string, position?: number): boolean; 91 | 92 | /** 93 | * Returns an HTML anchor element and sets the name attribute to the text value 94 | * @param name 95 | */ 96 | anchor(name: string): string; 97 | 98 | /** Returns a HTML element */ 99 | big(): string; 100 | 101 | /** Returns a HTML element */ 102 | blink(): string; 103 | 104 | /** Returns a HTML element */ 105 | bold(): string; 106 | 107 | /** Returns a HTML element */ 108 | fixed(): string 109 | 110 | /** Returns a HTML element and sets the color attribute value */ 111 | fontcolor(color: string): string 112 | 113 | /** Returns a HTML element and sets the size attribute value */ 114 | fontsize(size: number): string; 115 | 116 | /** Returns a HTML element and sets the size attribute value */ 117 | fontsize(size: string): string; 118 | 119 | /** Returns an HTML element */ 120 | italics(): string; 121 | 122 | /** Returns an HTML element and sets the href attribute value */ 123 | link(url: string): string; 124 | 125 | /** Returns a HTML element */ 126 | small(): string; 127 | 128 | /** Returns a HTML element */ 129 | strike(): string; 130 | 131 | /** Returns a HTML element */ 132 | sub(): string; 133 | 134 | /** Returns a HTML element */ 135 | sup(): string; 136 | 137 | /** 138 | * Shim for an ES6 iterable. Not intended for direct use by user code. 139 | */ 140 | "_es6-shim iterator_"(): IterableIteratorShim; 141 | } 142 | 143 | interface ArrayConstructor { 144 | /** 145 | * Creates an array from an array-like object. 146 | * @param arrayLike An array-like object to convert to an array. 147 | * @param mapfn A mapping function to call on every element of the array. 148 | * @param thisArg Value of 'this' used to invoke the mapfn. 149 | */ 150 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 151 | 152 | /** 153 | * Creates an array from an iterable object. 154 | * @param iterable An iterable object to convert to an array. 155 | * @param mapfn A mapping function to call on every element of the array. 156 | * @param thisArg Value of 'this' used to invoke the mapfn. 157 | */ 158 | from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 159 | 160 | /** 161 | * Creates an array from an array-like object. 162 | * @param arrayLike An array-like object to convert to an array. 163 | */ 164 | from(arrayLike: ArrayLike): Array; 165 | 166 | /** 167 | * Creates an array from an iterable object. 168 | * @param iterable An iterable object to convert to an array. 169 | */ 170 | from(iterable: IterableShim): Array; 171 | 172 | /** 173 | * Returns a new array from a set of elements. 174 | * @param items A set of elements to include in the new array object. 175 | */ 176 | of(...items: T[]): Array; 177 | } 178 | 179 | interface Array { 180 | /** 181 | * Returns the value of the first element in the array where predicate is true, and undefined 182 | * otherwise. 183 | * @param predicate find calls predicate once for each element of the array, in ascending 184 | * order, until it finds one where predicate returns true. If such an element is found, find 185 | * immediately returns that element value. Otherwise, find returns undefined. 186 | * @param thisArg If provided, it will be used as the this value for each invocation of 187 | * predicate. If it is not provided, undefined is used instead. 188 | */ 189 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; 190 | 191 | /** 192 | * Returns the index of the first element in the array where predicate is true, and undefined 193 | * otherwise. 194 | * @param predicate find calls predicate once for each element of the array, in ascending 195 | * order, until it finds one where predicate returns true. If such an element is found, find 196 | * immediately returns that element value. Otherwise, find returns undefined. 197 | * @param thisArg If provided, it will be used as the this value for each invocation of 198 | * predicate. If it is not provided, undefined is used instead. 199 | */ 200 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; 201 | 202 | /** 203 | * Returns the this object after filling the section identified by start and end with value 204 | * @param value value to fill array section with 205 | * @param start index to start filling the array at. If start is negative, it is treated as 206 | * length+start where length is the length of the array. 207 | * @param end index to stop filling the array at. If end is negative, it is treated as 208 | * length+end. 209 | */ 210 | fill(value: T, start?: number, end?: number): T[]; 211 | 212 | /** 213 | * Returns the this object after copying a section of the array identified by start and end 214 | * to the same array starting at position target 215 | * @param target If target is negative, it is treated as length+target where length is the 216 | * length of the array. 217 | * @param start If start is negative, it is treated as length+start. If end is negative, it 218 | * is treated as length+end. 219 | * @param end If not specified, length of the this object is used as its default value. 220 | */ 221 | copyWithin(target: number, start: number, end?: number): T[]; 222 | 223 | /** 224 | * Returns an array of key, value pairs for every entry in the array 225 | */ 226 | entries(): IterableIteratorShim<[number, T]>; 227 | 228 | /** 229 | * Returns an list of keys in the array 230 | */ 231 | keys(): IterableIteratorShim; 232 | 233 | /** 234 | * Returns an list of values in the array 235 | */ 236 | values(): IterableIteratorShim; 237 | 238 | /** 239 | * Shim for an ES6 iterable. Not intended for direct use by user code. 240 | */ 241 | "_es6-shim iterator_"(): IterableIteratorShim; 242 | } 243 | 244 | interface NumberConstructor { 245 | /** 246 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 247 | * that is representable as a Number value, which is approximately: 248 | * 2.2204460492503130808472633361816 x 10‍−‍16. 249 | */ 250 | EPSILON: number; 251 | 252 | /** 253 | * Returns true if passed value is finite. 254 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a 255 | * number. Only finite values of the type number, result in true. 256 | * @param number A numeric value. 257 | */ 258 | isFinite(number: number): boolean; 259 | 260 | /** 261 | * Returns true if the value passed is an integer, false otherwise. 262 | * @param number A numeric value. 263 | */ 264 | isInteger(number: number): boolean; 265 | 266 | /** 267 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a 268 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter 269 | * to a number. Only values of the type number, that are also NaN, result in true. 270 | * @param number A numeric value. 271 | */ 272 | isNaN(number: number): boolean; 273 | 274 | /** 275 | * Returns true if the value passed is a safe integer. 276 | * @param number A numeric value. 277 | */ 278 | isSafeInteger(number: number): boolean; 279 | 280 | /** 281 | * The value of the largest integer n such that n and n + 1 are both exactly representable as 282 | * a Number value. 283 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. 284 | */ 285 | MAX_SAFE_INTEGER: number; 286 | 287 | /** 288 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as 289 | * a Number value. 290 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). 291 | */ 292 | MIN_SAFE_INTEGER: number; 293 | 294 | /** 295 | * Converts a string to a floating-point number. 296 | * @param string A string that contains a floating-point number. 297 | */ 298 | parseFloat(string: string): number; 299 | 300 | /** 301 | * Converts A string to an integer. 302 | * @param s A string to convert into a number. 303 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. 304 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 305 | * All other strings are considered decimal. 306 | */ 307 | parseInt(string: string, radix?: number): number; 308 | } 309 | 310 | interface ObjectConstructor { 311 | /** 312 | * Copy the values of all of the enumerable own properties from one or more source objects to a 313 | * target object. Returns the target object. 314 | * @param target The target object to copy to. 315 | * @param sources One or more source objects to copy properties from. 316 | */ 317 | assign(target: any, ...sources: any[]): any; 318 | 319 | /** 320 | * Returns true if the values are the same value, false otherwise. 321 | * @param value1 The first value. 322 | * @param value2 The second value. 323 | */ 324 | is(value1: any, value2: any): boolean; 325 | 326 | /** 327 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. 328 | * @param o The object to change its prototype. 329 | * @param proto The value of the new prototype or null. 330 | * @remarks Requires `__proto__` support. 331 | */ 332 | setPrototypeOf(o: any, proto: any): any; 333 | } 334 | 335 | interface RegExp { 336 | /** 337 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. 338 | * The characters in this string are sequenced and concatenated in the following order: 339 | * 340 | * - "g" for global 341 | * - "i" for ignoreCase 342 | * - "m" for multiline 343 | * - "u" for unicode 344 | * - "y" for sticky 345 | * 346 | * If no flags are set, the value is the empty string. 347 | */ 348 | flags: string; 349 | } 350 | 351 | interface Math { 352 | /** 353 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. 354 | * @param x A numeric expression. 355 | */ 356 | clz32(x: number): number; 357 | 358 | /** 359 | * Returns the result of 32-bit multiplication of two numbers. 360 | * @param x First number 361 | * @param y Second number 362 | */ 363 | imul(x: number, y: number): number; 364 | 365 | /** 366 | * Returns the sign of the x, indicating whether x is positive, negative or zero. 367 | * @param x The numeric expression to test 368 | */ 369 | sign(x: number): number; 370 | 371 | /** 372 | * Returns the base 10 logarithm of a number. 373 | * @param x A numeric expression. 374 | */ 375 | log10(x: number): number; 376 | 377 | /** 378 | * Returns the base 2 logarithm of a number. 379 | * @param x A numeric expression. 380 | */ 381 | log2(x: number): number; 382 | 383 | /** 384 | * Returns the natural logarithm of 1 + x. 385 | * @param x A numeric expression. 386 | */ 387 | log1p(x: number): number; 388 | 389 | /** 390 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of 391 | * the natural logarithms). 392 | * @param x A numeric expression. 393 | */ 394 | expm1(x: number): number; 395 | 396 | /** 397 | * Returns the hyperbolic cosine of a number. 398 | * @param x A numeric expression that contains an angle measured in radians. 399 | */ 400 | cosh(x: number): number; 401 | 402 | /** 403 | * Returns the hyperbolic sine of a number. 404 | * @param x A numeric expression that contains an angle measured in radians. 405 | */ 406 | sinh(x: number): number; 407 | 408 | /** 409 | * Returns the hyperbolic tangent of a number. 410 | * @param x A numeric expression that contains an angle measured in radians. 411 | */ 412 | tanh(x: number): number; 413 | 414 | /** 415 | * Returns the inverse hyperbolic cosine of a number. 416 | * @param x A numeric expression that contains an angle measured in radians. 417 | */ 418 | acosh(x: number): number; 419 | 420 | /** 421 | * Returns the inverse hyperbolic sine of a number. 422 | * @param x A numeric expression that contains an angle measured in radians. 423 | */ 424 | asinh(x: number): number; 425 | 426 | /** 427 | * Returns the inverse hyperbolic tangent of a number. 428 | * @param x A numeric expression that contains an angle measured in radians. 429 | */ 430 | atanh(x: number): number; 431 | 432 | /** 433 | * Returns the square root of the sum of squares of its arguments. 434 | * @param values Values to compute the square root for. 435 | * If no arguments are passed, the result is +0. 436 | * If there is only one argument, the result is the absolute value. 437 | * If any argument is +Infinity or -Infinity, the result is +Infinity. 438 | * If any argument is NaN, the result is NaN. 439 | * If all arguments are either +0 or −0, the result is +0. 440 | */ 441 | hypot(...values: number[]): number; 442 | 443 | /** 444 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. 445 | * If x is already an integer, the result is x. 446 | * @param x A numeric expression. 447 | */ 448 | trunc(x: number): number; 449 | 450 | /** 451 | * Returns the nearest single precision float representation of a number. 452 | * @param x A numeric expression. 453 | */ 454 | fround(x: number): number; 455 | 456 | /** 457 | * Returns an implementation-dependent approximation to the cube root of number. 458 | * @param x A numeric expression. 459 | */ 460 | cbrt(x: number): number; 461 | } 462 | 463 | interface PromiseLike { 464 | /** 465 | * Attaches callbacks for the resolution and/or rejection of the Promise. 466 | * @param onfulfilled The callback to execute when the Promise is resolved. 467 | * @param onrejected The callback to execute when the Promise is rejected. 468 | * @returns A Promise for the completion of which ever callback is executed. 469 | */ 470 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; 471 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; 472 | } 473 | 474 | /** 475 | * Represents the completion of an asynchronous operation 476 | */ 477 | interface Promise { 478 | /** 479 | * Attaches callbacks for the resolution and/or rejection of the Promise. 480 | * @param onfulfilled The callback to execute when the Promise is resolved. 481 | * @param onrejected The callback to execute when the Promise is rejected. 482 | * @returns A Promise for the completion of which ever callback is executed. 483 | */ 484 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; 485 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; 486 | 487 | /** 488 | * Attaches a callback for only the rejection of the Promise. 489 | * @param onrejected The callback to execute when the Promise is rejected. 490 | * @returns A Promise for the completion of the callback. 491 | */ 492 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise; 493 | catch(onrejected?: (reason: any) => void): Promise; 494 | } 495 | 496 | interface PromiseConstructor { 497 | /** 498 | * A reference to the prototype. 499 | */ 500 | prototype: Promise; 501 | 502 | /** 503 | * Creates a new Promise. 504 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 505 | * a resolve callback used resolve the promise with a value or the result of another promise, 506 | * and a reject callback used to reject the promise with a provided reason or error. 507 | */ 508 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; 509 | 510 | /** 511 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 512 | * resolve, or rejected when any Promise is rejected. 513 | * @param values An array of Promises. 514 | * @returns A new Promise. 515 | */ 516 | all(values: IterableShim>): Promise; 517 | 518 | /** 519 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 520 | * or rejected. 521 | * @param values An array of Promises. 522 | * @returns A new Promise. 523 | */ 524 | race(values: IterableShim>): Promise; 525 | 526 | /** 527 | * Creates a new rejected promise for the provided reason. 528 | * @param reason The reason the promise was rejected. 529 | * @returns A new rejected Promise. 530 | */ 531 | reject(reason: any): Promise; 532 | 533 | /** 534 | * Creates a new rejected promise for the provided reason. 535 | * @param reason The reason the promise was rejected. 536 | * @returns A new rejected Promise. 537 | */ 538 | reject(reason: any): Promise; 539 | 540 | /** 541 | * Creates a new resolved promise for the provided value. 542 | * @param value A promise. 543 | * @returns A promise whose internal state matches the provided promise. 544 | */ 545 | resolve(value: T | PromiseLike): Promise; 546 | 547 | /** 548 | * Creates a new resolved promise . 549 | * @returns A resolved promise. 550 | */ 551 | resolve(): Promise; 552 | } 553 | 554 | declare var Promise: PromiseConstructor; 555 | 556 | interface Map { 557 | clear(): void; 558 | delete(key: K): boolean; 559 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 560 | get(key: K): V; 561 | has(key: K): boolean; 562 | set(key: K, value?: V): Map; 563 | size: number; 564 | entries(): IterableIteratorShim<[K, V]>; 565 | keys(): IterableIteratorShim; 566 | values(): IterableIteratorShim; 567 | } 568 | 569 | interface MapConstructor { 570 | new (): Map; 571 | new (iterable: IterableShim<[K, V]>): Map; 572 | prototype: Map; 573 | } 574 | 575 | declare var Map: MapConstructor; 576 | 577 | interface Set { 578 | add(value: T): Set; 579 | clear(): void; 580 | delete(value: T): boolean; 581 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 582 | has(value: T): boolean; 583 | size: number; 584 | entries(): IterableIteratorShim<[T, T]>; 585 | keys(): IterableIteratorShim; 586 | values(): IterableIteratorShim; 587 | } 588 | 589 | interface SetConstructor { 590 | new (): Set; 591 | new (iterable: IterableShim): Set; 592 | prototype: Set; 593 | } 594 | 595 | declare var Set: SetConstructor; 596 | 597 | interface WeakMap { 598 | delete(key: K): boolean; 599 | get(key: K): V; 600 | has(key: K): boolean; 601 | set(key: K, value?: V): WeakMap; 602 | } 603 | 604 | interface WeakMapConstructor { 605 | new (): WeakMap; 606 | new (iterable: IterableShim<[K, V]>): WeakMap; 607 | prototype: WeakMap; 608 | } 609 | 610 | declare var WeakMap: WeakMapConstructor; 611 | 612 | interface WeakSet { 613 | add(value: T): WeakSet; 614 | delete(value: T): boolean; 615 | has(value: T): boolean; 616 | } 617 | 618 | interface WeakSetConstructor { 619 | new (): WeakSet; 620 | new (iterable: IterableShim): WeakSet; 621 | prototype: WeakSet; 622 | } 623 | 624 | declare var WeakSet: WeakSetConstructor; 625 | 626 | declare namespace Reflect { 627 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 628 | function construct(target: Function, argumentsList: ArrayLike): any; 629 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 630 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 631 | function enumerate(target: any): IterableIteratorShim; 632 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 633 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 634 | function getPrototypeOf(target: any): any; 635 | function has(target: any, propertyKey: PropertyKey): boolean; 636 | function isExtensible(target: any): boolean; 637 | function ownKeys(target: any): Array; 638 | function preventExtensions(target: any): boolean; 639 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 640 | function setPrototypeOf(target: any, proto: any): boolean; 641 | } 642 | 643 | declare module "es6-shim" { 644 | var String: StringConstructor; 645 | var Array: ArrayConstructor; 646 | var Number: NumberConstructor; 647 | var Math: Math; 648 | var Object: ObjectConstructor; 649 | var Map: MapConstructor; 650 | var Set: SetConstructor; 651 | var WeakMap: WeakMapConstructor; 652 | var WeakSet: WeakSetConstructor; 653 | var Promise: PromiseConstructor; 654 | namespace Reflect { 655 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 656 | function construct(target: Function, argumentsList: ArrayLike): any; 657 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 658 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 659 | function enumerate(target: any): Iterator; 660 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 661 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 662 | function getPrototypeOf(target: any): any; 663 | function has(target: any, propertyKey: PropertyKey): boolean; 664 | function isExtensible(target: any): boolean; 665 | function ownKeys(target: any): Array; 666 | function preventExtensions(target: any): boolean; 667 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 668 | function setPrototypeOf(target: any, proto: any): boolean; 669 | } 670 | } -------------------------------------------------------------------------------- /typings/browser/ambient/jasmine/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5c182b9af717f73146399c2485f70f1e2ac0ff2b/jasmine/jasmine.d.ts 3 | // Type definitions for Jasmine 2.2 4 | // Project: http://jasmine.github.io/ 5 | // Definitions by: Boris Yankov , Theodore Brown , David Pärsson 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts 10 | 11 | declare function describe(description: string, specDefinitions: () => void): void; 12 | declare function fdescribe(description: string, specDefinitions: () => void): void; 13 | declare function xdescribe(description: string, specDefinitions: () => void): void; 14 | 15 | declare function it(expectation: string, assertion?: () => void, timeout?: number): void; 16 | declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 17 | declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; 18 | declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 19 | declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; 20 | declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 21 | 22 | /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ 23 | declare function pending(reason?: string): void; 24 | 25 | declare function beforeEach(action: () => void, timeout?: number): void; 26 | declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; 27 | declare function afterEach(action: () => void, timeout?: number): void; 28 | declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; 29 | 30 | declare function beforeAll(action: () => void, timeout?: number): void; 31 | declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; 32 | declare function afterAll(action: () => void, timeout?: number): void; 33 | declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; 34 | 35 | declare function expect(spy: Function): jasmine.Matchers; 36 | declare function expect(actual: any): jasmine.Matchers; 37 | 38 | declare function fail(e?: any): void; 39 | /** Action method that should be called when the async work is complete */ 40 | interface DoneFn extends Function { 41 | (): void; 42 | 43 | /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ 44 | fail: (message?: Error|string) => void; 45 | } 46 | 47 | declare function spyOn(object: any, method: string): jasmine.Spy; 48 | 49 | declare function runs(asyncMethod: Function): void; 50 | declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; 51 | declare function waits(timeout?: number): void; 52 | 53 | declare namespace jasmine { 54 | 55 | var clock: () => Clock; 56 | 57 | function any(aclass: any): Any; 58 | function anything(): Any; 59 | function arrayContaining(sample: any[]): ArrayContaining; 60 | function objectContaining(sample: any): ObjectContaining; 61 | function createSpy(name: string, originalFn?: Function): Spy; 62 | function createSpyObj(baseName: string, methodNames: any[]): any; 63 | function createSpyObj(baseName: string, methodNames: any[]): T; 64 | function pp(value: any): string; 65 | function getEnv(): Env; 66 | function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 67 | function addMatchers(matchers: CustomMatcherFactories): void; 68 | function stringMatching(str: string): Any; 69 | function stringMatching(str: RegExp): Any; 70 | 71 | interface Any { 72 | 73 | new (expectedClass: any): any; 74 | 75 | jasmineMatches(other: any): boolean; 76 | jasmineToString(): string; 77 | } 78 | 79 | // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() 80 | interface ArrayLike { 81 | length: number; 82 | [n: number]: T; 83 | } 84 | 85 | interface ArrayContaining { 86 | new (sample: any[]): any; 87 | 88 | asymmetricMatch(other: any): boolean; 89 | jasmineToString(): string; 90 | } 91 | 92 | interface ObjectContaining { 93 | new (sample: any): any; 94 | 95 | jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; 96 | jasmineToString(): string; 97 | } 98 | 99 | interface Block { 100 | 101 | new (env: Env, func: SpecFunction, spec: Spec): any; 102 | 103 | execute(onComplete: () => void): void; 104 | } 105 | 106 | interface WaitsBlock extends Block { 107 | new (env: Env, timeout: number, spec: Spec): any; 108 | } 109 | 110 | interface WaitsForBlock extends Block { 111 | new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any; 112 | } 113 | 114 | interface Clock { 115 | install(): void; 116 | uninstall(): void; 117 | /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ 118 | tick(ms: number): void; 119 | mockDate(date?: Date): void; 120 | } 121 | 122 | interface CustomEqualityTester { 123 | (first: any, second: any): boolean; 124 | } 125 | 126 | interface CustomMatcher { 127 | compare(actual: T, expected: T): CustomMatcherResult; 128 | compare(actual: any, expected: any): CustomMatcherResult; 129 | } 130 | 131 | interface CustomMatcherFactory { 132 | (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; 133 | } 134 | 135 | interface CustomMatcherFactories { 136 | [index: string]: CustomMatcherFactory; 137 | } 138 | 139 | interface CustomMatcherResult { 140 | pass: boolean; 141 | message?: string; 142 | } 143 | 144 | interface MatchersUtil { 145 | equals(a: any, b: any, customTesters?: Array): boolean; 146 | contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; 147 | buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; 148 | } 149 | 150 | interface Env { 151 | setTimeout: any; 152 | clearTimeout: void; 153 | setInterval: any; 154 | clearInterval: void; 155 | updateInterval: number; 156 | 157 | currentSpec: Spec; 158 | 159 | matchersClass: Matchers; 160 | 161 | version(): any; 162 | versionString(): string; 163 | nextSpecId(): number; 164 | addReporter(reporter: Reporter): void; 165 | execute(): void; 166 | describe(description: string, specDefinitions: () => void): Suite; 167 | // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these 168 | beforeEach(beforeEachFunction: () => void): void; 169 | beforeAll(beforeAllFunction: () => void): void; 170 | currentRunner(): Runner; 171 | afterEach(afterEachFunction: () => void): void; 172 | afterAll(afterAllFunction: () => void): void; 173 | xdescribe(desc: string, specDefinitions: () => void): XSuite; 174 | it(description: string, func: () => void): Spec; 175 | // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these 176 | xit(desc: string, func: () => void): XSpec; 177 | compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean; 178 | compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 179 | equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 180 | contains_(haystack: any, needle: any): boolean; 181 | addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 182 | addMatchers(matchers: CustomMatcherFactories): void; 183 | specFilter(spec: Spec): boolean; 184 | } 185 | 186 | interface FakeTimer { 187 | 188 | new (): any; 189 | 190 | reset(): void; 191 | tick(millis: number): void; 192 | runFunctionsWithinRange(oldMillis: number, nowMillis: number): void; 193 | scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void; 194 | } 195 | 196 | interface HtmlReporter { 197 | new (): any; 198 | } 199 | 200 | interface HtmlSpecFilter { 201 | new (): any; 202 | } 203 | 204 | interface Result { 205 | type: string; 206 | } 207 | 208 | interface NestedResults extends Result { 209 | description: string; 210 | 211 | totalCount: number; 212 | passedCount: number; 213 | failedCount: number; 214 | 215 | skipped: boolean; 216 | 217 | rollupCounts(result: NestedResults): void; 218 | log(values: any): void; 219 | getItems(): Result[]; 220 | addResult(result: Result): void; 221 | passed(): boolean; 222 | } 223 | 224 | interface MessageResult extends Result { 225 | values: any; 226 | trace: Trace; 227 | } 228 | 229 | interface ExpectationResult extends Result { 230 | matcherName: string; 231 | passed(): boolean; 232 | expected: any; 233 | actual: any; 234 | message: string; 235 | trace: Trace; 236 | } 237 | 238 | interface Trace { 239 | name: string; 240 | message: string; 241 | stack: any; 242 | } 243 | 244 | interface PrettyPrinter { 245 | 246 | new (): any; 247 | 248 | format(value: any): void; 249 | iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void; 250 | emitScalar(value: any): void; 251 | emitString(value: string): void; 252 | emitArray(array: any[]): void; 253 | emitObject(obj: any): void; 254 | append(value: any): void; 255 | } 256 | 257 | interface StringPrettyPrinter extends PrettyPrinter { 258 | } 259 | 260 | interface Queue { 261 | 262 | new (env: any): any; 263 | 264 | env: Env; 265 | ensured: boolean[]; 266 | blocks: Block[]; 267 | running: boolean; 268 | index: number; 269 | offset: number; 270 | abort: boolean; 271 | 272 | addBefore(block: Block, ensure?: boolean): void; 273 | add(block: any, ensure?: boolean): void; 274 | insertNext(block: any, ensure?: boolean): void; 275 | start(onComplete?: () => void): void; 276 | isRunning(): boolean; 277 | next_(): void; 278 | results(): NestedResults; 279 | } 280 | 281 | interface Matchers { 282 | 283 | new (env: Env, actual: any, spec: Env, isNot?: boolean): any; 284 | 285 | env: Env; 286 | actual: any; 287 | spec: Env; 288 | isNot?: boolean; 289 | message(): any; 290 | 291 | toBe(expected: any, expectationFailOutput?: any): boolean; 292 | toEqual(expected: any, expectationFailOutput?: any): boolean; 293 | toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; 294 | toBeDefined(expectationFailOutput?: any): boolean; 295 | toBeUndefined(expectationFailOutput?: any): boolean; 296 | toBeNull(expectationFailOutput?: any): boolean; 297 | toBeNaN(): boolean; 298 | toBeTruthy(expectationFailOutput?: any): boolean; 299 | toBeFalsy(expectationFailOutput?: any): boolean; 300 | toHaveBeenCalled(): boolean; 301 | toHaveBeenCalledWith(...params: any[]): boolean; 302 | toHaveBeenCalledTimes(expected: number): boolean; 303 | toContain(expected: any, expectationFailOutput?: any): boolean; 304 | toBeLessThan(expected: number, expectationFailOutput?: any): boolean; 305 | toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; 306 | toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; 307 | toThrow(expected?: any): boolean; 308 | toThrowError(message?: string | RegExp): boolean; 309 | toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; 310 | not: Matchers; 311 | 312 | Any: Any; 313 | } 314 | 315 | interface Reporter { 316 | reportRunnerStarting(runner: Runner): void; 317 | reportRunnerResults(runner: Runner): void; 318 | reportSuiteResults(suite: Suite): void; 319 | reportSpecStarting(spec: Spec): void; 320 | reportSpecResults(spec: Spec): void; 321 | log(str: string): void; 322 | } 323 | 324 | interface MultiReporter extends Reporter { 325 | addReporter(reporter: Reporter): void; 326 | } 327 | 328 | interface Runner { 329 | 330 | new (env: Env): any; 331 | 332 | execute(): void; 333 | beforeEach(beforeEachFunction: SpecFunction): void; 334 | afterEach(afterEachFunction: SpecFunction): void; 335 | beforeAll(beforeAllFunction: SpecFunction): void; 336 | afterAll(afterAllFunction: SpecFunction): void; 337 | finishCallback(): void; 338 | addSuite(suite: Suite): void; 339 | add(block: Block): void; 340 | specs(): Spec[]; 341 | suites(): Suite[]; 342 | topLevelSuites(): Suite[]; 343 | results(): NestedResults; 344 | } 345 | 346 | interface SpecFunction { 347 | (spec?: Spec): void; 348 | } 349 | 350 | interface SuiteOrSpec { 351 | id: number; 352 | env: Env; 353 | description: string; 354 | queue: Queue; 355 | } 356 | 357 | interface Spec extends SuiteOrSpec { 358 | 359 | new (env: Env, suite: Suite, description: string): any; 360 | 361 | suite: Suite; 362 | 363 | afterCallbacks: SpecFunction[]; 364 | spies_: Spy[]; 365 | 366 | results_: NestedResults; 367 | matchersClass: Matchers; 368 | 369 | getFullName(): string; 370 | results(): NestedResults; 371 | log(arguments: any): any; 372 | runs(func: SpecFunction): Spec; 373 | addToQueue(block: Block): void; 374 | addMatcherResult(result: Result): void; 375 | expect(actual: any): any; 376 | waits(timeout: number): Spec; 377 | waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; 378 | fail(e?: any): void; 379 | getMatchersClass_(): Matchers; 380 | addMatchers(matchersPrototype: CustomMatcherFactories): void; 381 | finishCallback(): void; 382 | finish(onComplete?: () => void): void; 383 | after(doAfter: SpecFunction): void; 384 | execute(onComplete?: () => void): any; 385 | addBeforesAndAftersToQueue(): void; 386 | explodes(): void; 387 | spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; 388 | removeAllSpies(): void; 389 | } 390 | 391 | interface XSpec { 392 | id: number; 393 | runs(): void; 394 | } 395 | 396 | interface Suite extends SuiteOrSpec { 397 | 398 | new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any; 399 | 400 | parentSuite: Suite; 401 | 402 | getFullName(): string; 403 | finish(onComplete?: () => void): void; 404 | beforeEach(beforeEachFunction: SpecFunction): void; 405 | afterEach(afterEachFunction: SpecFunction): void; 406 | beforeAll(beforeAllFunction: SpecFunction): void; 407 | afterAll(afterAllFunction: SpecFunction): void; 408 | results(): NestedResults; 409 | add(suiteOrSpec: SuiteOrSpec): void; 410 | specs(): Spec[]; 411 | suites(): Suite[]; 412 | children(): any[]; 413 | execute(onComplete?: () => void): void; 414 | } 415 | 416 | interface XSuite { 417 | execute(): void; 418 | } 419 | 420 | interface Spy { 421 | (...params: any[]): any; 422 | 423 | identity: string; 424 | and: SpyAnd; 425 | calls: Calls; 426 | mostRecentCall: { args: any[]; }; 427 | argsForCall: any[]; 428 | wasCalled: boolean; 429 | } 430 | 431 | interface SpyAnd { 432 | /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ 433 | callThrough(): Spy; 434 | /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ 435 | returnValue(val: any): Spy; 436 | /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ 437 | callFake(fn: Function): Spy; 438 | /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ 439 | throwError(msg: string): Spy; 440 | /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ 441 | stub(): Spy; 442 | } 443 | 444 | interface Calls { 445 | /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/ 446 | any(): boolean; 447 | /** By chaining the spy with calls.count(), will return the number of times the spy was called **/ 448 | count(): number; 449 | /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/ 450 | argsFor(index: number): any[]; 451 | /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/ 452 | allArgs(): any[]; 453 | /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/ 454 | all(): CallInfo[]; 455 | /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/ 456 | mostRecent(): CallInfo; 457 | /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/ 458 | first(): CallInfo; 459 | /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ 460 | reset(): void; 461 | } 462 | 463 | interface CallInfo { 464 | /** The context (the this) for the call */ 465 | object: any; 466 | /** All arguments passed to the call */ 467 | args: any[]; 468 | /** The return value of the call */ 469 | returnValue: any; 470 | } 471 | 472 | interface Util { 473 | inherit(childClass: Function, parentClass: Function): any; 474 | formatException(e: any): any; 475 | htmlEscape(str: string): string; 476 | argsToArray(args: any): any; 477 | extend(destination: any, source: any): any; 478 | } 479 | 480 | interface JsApiReporter extends Reporter { 481 | 482 | started: boolean; 483 | finished: boolean; 484 | result: any; 485 | messages: any; 486 | 487 | new (): any; 488 | 489 | suites(): Suite[]; 490 | summarize_(suiteOrSpec: SuiteOrSpec): any; 491 | results(): any; 492 | resultsForSpec(specId: any): any; 493 | log(str: any): any; 494 | resultsForSpecs(specIds: any): any; 495 | summarizeResult_(result: any): any; 496 | } 497 | 498 | interface Jasmine { 499 | Spec: Spec; 500 | clock: Clock; 501 | util: Util; 502 | } 503 | 504 | export var HtmlReporter: HtmlReporter; 505 | export var HtmlSpecFilter: HtmlSpecFilter; 506 | export var DEFAULT_TIMEOUT_INTERVAL: number; 507 | } -------------------------------------------------------------------------------- /typings/main.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /typings/main/ambient/es6-shim/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/es6-shim/es6-shim.d.ts 3 | // Type definitions for es6-shim v0.31.2 4 | // Project: https://github.com/paulmillr/es6-shim 5 | // Definitions by: Ron Buckton 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | declare type PropertyKey = string | number | symbol; 9 | 10 | interface IteratorResult { 11 | done: boolean; 12 | value?: T; 13 | } 14 | 15 | interface IterableShim { 16 | /** 17 | * Shim for an ES6 iterable. Not intended for direct use by user code. 18 | */ 19 | "_es6-shim iterator_"(): Iterator; 20 | } 21 | 22 | interface Iterator { 23 | next(value?: any): IteratorResult; 24 | return?(value?: any): IteratorResult; 25 | throw?(e?: any): IteratorResult; 26 | } 27 | 28 | interface IterableIteratorShim extends IterableShim, Iterator { 29 | /** 30 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. 31 | */ 32 | "_es6-shim iterator_"(): IterableIteratorShim; 33 | } 34 | 35 | interface StringConstructor { 36 | /** 37 | * Return the String value whose elements are, in order, the elements in the List elements. 38 | * If length is 0, the empty string is returned. 39 | */ 40 | fromCodePoint(...codePoints: number[]): string; 41 | 42 | /** 43 | * String.raw is intended for use as a tag function of a Tagged Template String. When called 44 | * as such the first argument will be a well formed template call site object and the rest 45 | * parameter will contain the substitution values. 46 | * @param template A well-formed template string call site representation. 47 | * @param substitutions A set of substitution values. 48 | */ 49 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; 50 | } 51 | 52 | interface String { 53 | /** 54 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point 55 | * value of the UTF-16 encoded code point starting at the string element at position pos in 56 | * the String resulting from converting this object to a String. 57 | * If there is no element at that position, the result is undefined. 58 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. 59 | */ 60 | codePointAt(pos: number): number; 61 | 62 | /** 63 | * Returns true if searchString appears as a substring of the result of converting this 64 | * object to a String, at one or more positions that are 65 | * greater than or equal to position; otherwise, returns false. 66 | * @param searchString search string 67 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. 68 | */ 69 | includes(searchString: string, position?: number): boolean; 70 | 71 | /** 72 | * Returns true if the sequence of elements of searchString converted to a String is the 73 | * same as the corresponding elements of this object (converted to a String) starting at 74 | * endPosition – length(this). Otherwise returns false. 75 | */ 76 | endsWith(searchString: string, endPosition?: number): boolean; 77 | 78 | /** 79 | * Returns a String value that is made from count copies appended together. If count is 0, 80 | * T is the empty String is returned. 81 | * @param count number of copies to append 82 | */ 83 | repeat(count: number): string; 84 | 85 | /** 86 | * Returns true if the sequence of elements of searchString converted to a String is the 87 | * same as the corresponding elements of this object (converted to a String) starting at 88 | * position. Otherwise returns false. 89 | */ 90 | startsWith(searchString: string, position?: number): boolean; 91 | 92 | /** 93 | * Returns an HTML anchor element and sets the name attribute to the text value 94 | * @param name 95 | */ 96 | anchor(name: string): string; 97 | 98 | /** Returns a HTML element */ 99 | big(): string; 100 | 101 | /** Returns a HTML element */ 102 | blink(): string; 103 | 104 | /** Returns a HTML element */ 105 | bold(): string; 106 | 107 | /** Returns a HTML element */ 108 | fixed(): string 109 | 110 | /** Returns a HTML element and sets the color attribute value */ 111 | fontcolor(color: string): string 112 | 113 | /** Returns a HTML element and sets the size attribute value */ 114 | fontsize(size: number): string; 115 | 116 | /** Returns a HTML element and sets the size attribute value */ 117 | fontsize(size: string): string; 118 | 119 | /** Returns an HTML element */ 120 | italics(): string; 121 | 122 | /** Returns an HTML element and sets the href attribute value */ 123 | link(url: string): string; 124 | 125 | /** Returns a HTML element */ 126 | small(): string; 127 | 128 | /** Returns a HTML element */ 129 | strike(): string; 130 | 131 | /** Returns a HTML element */ 132 | sub(): string; 133 | 134 | /** Returns a HTML element */ 135 | sup(): string; 136 | 137 | /** 138 | * Shim for an ES6 iterable. Not intended for direct use by user code. 139 | */ 140 | "_es6-shim iterator_"(): IterableIteratorShim; 141 | } 142 | 143 | interface ArrayConstructor { 144 | /** 145 | * Creates an array from an array-like object. 146 | * @param arrayLike An array-like object to convert to an array. 147 | * @param mapfn A mapping function to call on every element of the array. 148 | * @param thisArg Value of 'this' used to invoke the mapfn. 149 | */ 150 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 151 | 152 | /** 153 | * Creates an array from an iterable object. 154 | * @param iterable An iterable object to convert to an array. 155 | * @param mapfn A mapping function to call on every element of the array. 156 | * @param thisArg Value of 'this' used to invoke the mapfn. 157 | */ 158 | from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 159 | 160 | /** 161 | * Creates an array from an array-like object. 162 | * @param arrayLike An array-like object to convert to an array. 163 | */ 164 | from(arrayLike: ArrayLike): Array; 165 | 166 | /** 167 | * Creates an array from an iterable object. 168 | * @param iterable An iterable object to convert to an array. 169 | */ 170 | from(iterable: IterableShim): Array; 171 | 172 | /** 173 | * Returns a new array from a set of elements. 174 | * @param items A set of elements to include in the new array object. 175 | */ 176 | of(...items: T[]): Array; 177 | } 178 | 179 | interface Array { 180 | /** 181 | * Returns the value of the first element in the array where predicate is true, and undefined 182 | * otherwise. 183 | * @param predicate find calls predicate once for each element of the array, in ascending 184 | * order, until it finds one where predicate returns true. If such an element is found, find 185 | * immediately returns that element value. Otherwise, find returns undefined. 186 | * @param thisArg If provided, it will be used as the this value for each invocation of 187 | * predicate. If it is not provided, undefined is used instead. 188 | */ 189 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; 190 | 191 | /** 192 | * Returns the index of the first element in the array where predicate is true, and undefined 193 | * otherwise. 194 | * @param predicate find calls predicate once for each element of the array, in ascending 195 | * order, until it finds one where predicate returns true. If such an element is found, find 196 | * immediately returns that element value. Otherwise, find returns undefined. 197 | * @param thisArg If provided, it will be used as the this value for each invocation of 198 | * predicate. If it is not provided, undefined is used instead. 199 | */ 200 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; 201 | 202 | /** 203 | * Returns the this object after filling the section identified by start and end with value 204 | * @param value value to fill array section with 205 | * @param start index to start filling the array at. If start is negative, it is treated as 206 | * length+start where length is the length of the array. 207 | * @param end index to stop filling the array at. If end is negative, it is treated as 208 | * length+end. 209 | */ 210 | fill(value: T, start?: number, end?: number): T[]; 211 | 212 | /** 213 | * Returns the this object after copying a section of the array identified by start and end 214 | * to the same array starting at position target 215 | * @param target If target is negative, it is treated as length+target where length is the 216 | * length of the array. 217 | * @param start If start is negative, it is treated as length+start. If end is negative, it 218 | * is treated as length+end. 219 | * @param end If not specified, length of the this object is used as its default value. 220 | */ 221 | copyWithin(target: number, start: number, end?: number): T[]; 222 | 223 | /** 224 | * Returns an array of key, value pairs for every entry in the array 225 | */ 226 | entries(): IterableIteratorShim<[number, T]>; 227 | 228 | /** 229 | * Returns an list of keys in the array 230 | */ 231 | keys(): IterableIteratorShim; 232 | 233 | /** 234 | * Returns an list of values in the array 235 | */ 236 | values(): IterableIteratorShim; 237 | 238 | /** 239 | * Shim for an ES6 iterable. Not intended for direct use by user code. 240 | */ 241 | "_es6-shim iterator_"(): IterableIteratorShim; 242 | } 243 | 244 | interface NumberConstructor { 245 | /** 246 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 247 | * that is representable as a Number value, which is approximately: 248 | * 2.2204460492503130808472633361816 x 10‍−‍16. 249 | */ 250 | EPSILON: number; 251 | 252 | /** 253 | * Returns true if passed value is finite. 254 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a 255 | * number. Only finite values of the type number, result in true. 256 | * @param number A numeric value. 257 | */ 258 | isFinite(number: number): boolean; 259 | 260 | /** 261 | * Returns true if the value passed is an integer, false otherwise. 262 | * @param number A numeric value. 263 | */ 264 | isInteger(number: number): boolean; 265 | 266 | /** 267 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a 268 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter 269 | * to a number. Only values of the type number, that are also NaN, result in true. 270 | * @param number A numeric value. 271 | */ 272 | isNaN(number: number): boolean; 273 | 274 | /** 275 | * Returns true if the value passed is a safe integer. 276 | * @param number A numeric value. 277 | */ 278 | isSafeInteger(number: number): boolean; 279 | 280 | /** 281 | * The value of the largest integer n such that n and n + 1 are both exactly representable as 282 | * a Number value. 283 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. 284 | */ 285 | MAX_SAFE_INTEGER: number; 286 | 287 | /** 288 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as 289 | * a Number value. 290 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). 291 | */ 292 | MIN_SAFE_INTEGER: number; 293 | 294 | /** 295 | * Converts a string to a floating-point number. 296 | * @param string A string that contains a floating-point number. 297 | */ 298 | parseFloat(string: string): number; 299 | 300 | /** 301 | * Converts A string to an integer. 302 | * @param s A string to convert into a number. 303 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. 304 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 305 | * All other strings are considered decimal. 306 | */ 307 | parseInt(string: string, radix?: number): number; 308 | } 309 | 310 | interface ObjectConstructor { 311 | /** 312 | * Copy the values of all of the enumerable own properties from one or more source objects to a 313 | * target object. Returns the target object. 314 | * @param target The target object to copy to. 315 | * @param sources One or more source objects to copy properties from. 316 | */ 317 | assign(target: any, ...sources: any[]): any; 318 | 319 | /** 320 | * Returns true if the values are the same value, false otherwise. 321 | * @param value1 The first value. 322 | * @param value2 The second value. 323 | */ 324 | is(value1: any, value2: any): boolean; 325 | 326 | /** 327 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. 328 | * @param o The object to change its prototype. 329 | * @param proto The value of the new prototype or null. 330 | * @remarks Requires `__proto__` support. 331 | */ 332 | setPrototypeOf(o: any, proto: any): any; 333 | } 334 | 335 | interface RegExp { 336 | /** 337 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. 338 | * The characters in this string are sequenced and concatenated in the following order: 339 | * 340 | * - "g" for global 341 | * - "i" for ignoreCase 342 | * - "m" for multiline 343 | * - "u" for unicode 344 | * - "y" for sticky 345 | * 346 | * If no flags are set, the value is the empty string. 347 | */ 348 | flags: string; 349 | } 350 | 351 | interface Math { 352 | /** 353 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. 354 | * @param x A numeric expression. 355 | */ 356 | clz32(x: number): number; 357 | 358 | /** 359 | * Returns the result of 32-bit multiplication of two numbers. 360 | * @param x First number 361 | * @param y Second number 362 | */ 363 | imul(x: number, y: number): number; 364 | 365 | /** 366 | * Returns the sign of the x, indicating whether x is positive, negative or zero. 367 | * @param x The numeric expression to test 368 | */ 369 | sign(x: number): number; 370 | 371 | /** 372 | * Returns the base 10 logarithm of a number. 373 | * @param x A numeric expression. 374 | */ 375 | log10(x: number): number; 376 | 377 | /** 378 | * Returns the base 2 logarithm of a number. 379 | * @param x A numeric expression. 380 | */ 381 | log2(x: number): number; 382 | 383 | /** 384 | * Returns the natural logarithm of 1 + x. 385 | * @param x A numeric expression. 386 | */ 387 | log1p(x: number): number; 388 | 389 | /** 390 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of 391 | * the natural logarithms). 392 | * @param x A numeric expression. 393 | */ 394 | expm1(x: number): number; 395 | 396 | /** 397 | * Returns the hyperbolic cosine of a number. 398 | * @param x A numeric expression that contains an angle measured in radians. 399 | */ 400 | cosh(x: number): number; 401 | 402 | /** 403 | * Returns the hyperbolic sine of a number. 404 | * @param x A numeric expression that contains an angle measured in radians. 405 | */ 406 | sinh(x: number): number; 407 | 408 | /** 409 | * Returns the hyperbolic tangent of a number. 410 | * @param x A numeric expression that contains an angle measured in radians. 411 | */ 412 | tanh(x: number): number; 413 | 414 | /** 415 | * Returns the inverse hyperbolic cosine of a number. 416 | * @param x A numeric expression that contains an angle measured in radians. 417 | */ 418 | acosh(x: number): number; 419 | 420 | /** 421 | * Returns the inverse hyperbolic sine of a number. 422 | * @param x A numeric expression that contains an angle measured in radians. 423 | */ 424 | asinh(x: number): number; 425 | 426 | /** 427 | * Returns the inverse hyperbolic tangent of a number. 428 | * @param x A numeric expression that contains an angle measured in radians. 429 | */ 430 | atanh(x: number): number; 431 | 432 | /** 433 | * Returns the square root of the sum of squares of its arguments. 434 | * @param values Values to compute the square root for. 435 | * If no arguments are passed, the result is +0. 436 | * If there is only one argument, the result is the absolute value. 437 | * If any argument is +Infinity or -Infinity, the result is +Infinity. 438 | * If any argument is NaN, the result is NaN. 439 | * If all arguments are either +0 or −0, the result is +0. 440 | */ 441 | hypot(...values: number[]): number; 442 | 443 | /** 444 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. 445 | * If x is already an integer, the result is x. 446 | * @param x A numeric expression. 447 | */ 448 | trunc(x: number): number; 449 | 450 | /** 451 | * Returns the nearest single precision float representation of a number. 452 | * @param x A numeric expression. 453 | */ 454 | fround(x: number): number; 455 | 456 | /** 457 | * Returns an implementation-dependent approximation to the cube root of number. 458 | * @param x A numeric expression. 459 | */ 460 | cbrt(x: number): number; 461 | } 462 | 463 | interface PromiseLike { 464 | /** 465 | * Attaches callbacks for the resolution and/or rejection of the Promise. 466 | * @param onfulfilled The callback to execute when the Promise is resolved. 467 | * @param onrejected The callback to execute when the Promise is rejected. 468 | * @returns A Promise for the completion of which ever callback is executed. 469 | */ 470 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; 471 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; 472 | } 473 | 474 | /** 475 | * Represents the completion of an asynchronous operation 476 | */ 477 | interface Promise { 478 | /** 479 | * Attaches callbacks for the resolution and/or rejection of the Promise. 480 | * @param onfulfilled The callback to execute when the Promise is resolved. 481 | * @param onrejected The callback to execute when the Promise is rejected. 482 | * @returns A Promise for the completion of which ever callback is executed. 483 | */ 484 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; 485 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; 486 | 487 | /** 488 | * Attaches a callback for only the rejection of the Promise. 489 | * @param onrejected The callback to execute when the Promise is rejected. 490 | * @returns A Promise for the completion of the callback. 491 | */ 492 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise; 493 | catch(onrejected?: (reason: any) => void): Promise; 494 | } 495 | 496 | interface PromiseConstructor { 497 | /** 498 | * A reference to the prototype. 499 | */ 500 | prototype: Promise; 501 | 502 | /** 503 | * Creates a new Promise. 504 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 505 | * a resolve callback used resolve the promise with a value or the result of another promise, 506 | * and a reject callback used to reject the promise with a provided reason or error. 507 | */ 508 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; 509 | 510 | /** 511 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 512 | * resolve, or rejected when any Promise is rejected. 513 | * @param values An array of Promises. 514 | * @returns A new Promise. 515 | */ 516 | all(values: IterableShim>): Promise; 517 | 518 | /** 519 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 520 | * or rejected. 521 | * @param values An array of Promises. 522 | * @returns A new Promise. 523 | */ 524 | race(values: IterableShim>): Promise; 525 | 526 | /** 527 | * Creates a new rejected promise for the provided reason. 528 | * @param reason The reason the promise was rejected. 529 | * @returns A new rejected Promise. 530 | */ 531 | reject(reason: any): Promise; 532 | 533 | /** 534 | * Creates a new rejected promise for the provided reason. 535 | * @param reason The reason the promise was rejected. 536 | * @returns A new rejected Promise. 537 | */ 538 | reject(reason: any): Promise; 539 | 540 | /** 541 | * Creates a new resolved promise for the provided value. 542 | * @param value A promise. 543 | * @returns A promise whose internal state matches the provided promise. 544 | */ 545 | resolve(value: T | PromiseLike): Promise; 546 | 547 | /** 548 | * Creates a new resolved promise . 549 | * @returns A resolved promise. 550 | */ 551 | resolve(): Promise; 552 | } 553 | 554 | declare var Promise: PromiseConstructor; 555 | 556 | interface Map { 557 | clear(): void; 558 | delete(key: K): boolean; 559 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 560 | get(key: K): V; 561 | has(key: K): boolean; 562 | set(key: K, value?: V): Map; 563 | size: number; 564 | entries(): IterableIteratorShim<[K, V]>; 565 | keys(): IterableIteratorShim; 566 | values(): IterableIteratorShim; 567 | } 568 | 569 | interface MapConstructor { 570 | new (): Map; 571 | new (iterable: IterableShim<[K, V]>): Map; 572 | prototype: Map; 573 | } 574 | 575 | declare var Map: MapConstructor; 576 | 577 | interface Set { 578 | add(value: T): Set; 579 | clear(): void; 580 | delete(value: T): boolean; 581 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 582 | has(value: T): boolean; 583 | size: number; 584 | entries(): IterableIteratorShim<[T, T]>; 585 | keys(): IterableIteratorShim; 586 | values(): IterableIteratorShim; 587 | } 588 | 589 | interface SetConstructor { 590 | new (): Set; 591 | new (iterable: IterableShim): Set; 592 | prototype: Set; 593 | } 594 | 595 | declare var Set: SetConstructor; 596 | 597 | interface WeakMap { 598 | delete(key: K): boolean; 599 | get(key: K): V; 600 | has(key: K): boolean; 601 | set(key: K, value?: V): WeakMap; 602 | } 603 | 604 | interface WeakMapConstructor { 605 | new (): WeakMap; 606 | new (iterable: IterableShim<[K, V]>): WeakMap; 607 | prototype: WeakMap; 608 | } 609 | 610 | declare var WeakMap: WeakMapConstructor; 611 | 612 | interface WeakSet { 613 | add(value: T): WeakSet; 614 | delete(value: T): boolean; 615 | has(value: T): boolean; 616 | } 617 | 618 | interface WeakSetConstructor { 619 | new (): WeakSet; 620 | new (iterable: IterableShim): WeakSet; 621 | prototype: WeakSet; 622 | } 623 | 624 | declare var WeakSet: WeakSetConstructor; 625 | 626 | declare namespace Reflect { 627 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 628 | function construct(target: Function, argumentsList: ArrayLike): any; 629 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 630 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 631 | function enumerate(target: any): IterableIteratorShim; 632 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 633 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 634 | function getPrototypeOf(target: any): any; 635 | function has(target: any, propertyKey: PropertyKey): boolean; 636 | function isExtensible(target: any): boolean; 637 | function ownKeys(target: any): Array; 638 | function preventExtensions(target: any): boolean; 639 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 640 | function setPrototypeOf(target: any, proto: any): boolean; 641 | } 642 | 643 | declare module "es6-shim" { 644 | var String: StringConstructor; 645 | var Array: ArrayConstructor; 646 | var Number: NumberConstructor; 647 | var Math: Math; 648 | var Object: ObjectConstructor; 649 | var Map: MapConstructor; 650 | var Set: SetConstructor; 651 | var WeakMap: WeakMapConstructor; 652 | var WeakSet: WeakSetConstructor; 653 | var Promise: PromiseConstructor; 654 | namespace Reflect { 655 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 656 | function construct(target: Function, argumentsList: ArrayLike): any; 657 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 658 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 659 | function enumerate(target: any): Iterator; 660 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 661 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 662 | function getPrototypeOf(target: any): any; 663 | function has(target: any, propertyKey: PropertyKey): boolean; 664 | function isExtensible(target: any): boolean; 665 | function ownKeys(target: any): Array; 666 | function preventExtensions(target: any): boolean; 667 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 668 | function setPrototypeOf(target: any, proto: any): boolean; 669 | } 670 | } -------------------------------------------------------------------------------- /typings/main/ambient/jasmine/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5c182b9af717f73146399c2485f70f1e2ac0ff2b/jasmine/jasmine.d.ts 3 | // Type definitions for Jasmine 2.2 4 | // Project: http://jasmine.github.io/ 5 | // Definitions by: Boris Yankov , Theodore Brown , David Pärsson 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts 10 | 11 | declare function describe(description: string, specDefinitions: () => void): void; 12 | declare function fdescribe(description: string, specDefinitions: () => void): void; 13 | declare function xdescribe(description: string, specDefinitions: () => void): void; 14 | 15 | declare function it(expectation: string, assertion?: () => void, timeout?: number): void; 16 | declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 17 | declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; 18 | declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 19 | declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; 20 | declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 21 | 22 | /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ 23 | declare function pending(reason?: string): void; 24 | 25 | declare function beforeEach(action: () => void, timeout?: number): void; 26 | declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; 27 | declare function afterEach(action: () => void, timeout?: number): void; 28 | declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; 29 | 30 | declare function beforeAll(action: () => void, timeout?: number): void; 31 | declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; 32 | declare function afterAll(action: () => void, timeout?: number): void; 33 | declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; 34 | 35 | declare function expect(spy: Function): jasmine.Matchers; 36 | declare function expect(actual: any): jasmine.Matchers; 37 | 38 | declare function fail(e?: any): void; 39 | /** Action method that should be called when the async work is complete */ 40 | interface DoneFn extends Function { 41 | (): void; 42 | 43 | /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ 44 | fail: (message?: Error|string) => void; 45 | } 46 | 47 | declare function spyOn(object: any, method: string): jasmine.Spy; 48 | 49 | declare function runs(asyncMethod: Function): void; 50 | declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; 51 | declare function waits(timeout?: number): void; 52 | 53 | declare namespace jasmine { 54 | 55 | var clock: () => Clock; 56 | 57 | function any(aclass: any): Any; 58 | function anything(): Any; 59 | function arrayContaining(sample: any[]): ArrayContaining; 60 | function objectContaining(sample: any): ObjectContaining; 61 | function createSpy(name: string, originalFn?: Function): Spy; 62 | function createSpyObj(baseName: string, methodNames: any[]): any; 63 | function createSpyObj(baseName: string, methodNames: any[]): T; 64 | function pp(value: any): string; 65 | function getEnv(): Env; 66 | function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 67 | function addMatchers(matchers: CustomMatcherFactories): void; 68 | function stringMatching(str: string): Any; 69 | function stringMatching(str: RegExp): Any; 70 | 71 | interface Any { 72 | 73 | new (expectedClass: any): any; 74 | 75 | jasmineMatches(other: any): boolean; 76 | jasmineToString(): string; 77 | } 78 | 79 | // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() 80 | interface ArrayLike { 81 | length: number; 82 | [n: number]: T; 83 | } 84 | 85 | interface ArrayContaining { 86 | new (sample: any[]): any; 87 | 88 | asymmetricMatch(other: any): boolean; 89 | jasmineToString(): string; 90 | } 91 | 92 | interface ObjectContaining { 93 | new (sample: any): any; 94 | 95 | jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; 96 | jasmineToString(): string; 97 | } 98 | 99 | interface Block { 100 | 101 | new (env: Env, func: SpecFunction, spec: Spec): any; 102 | 103 | execute(onComplete: () => void): void; 104 | } 105 | 106 | interface WaitsBlock extends Block { 107 | new (env: Env, timeout: number, spec: Spec): any; 108 | } 109 | 110 | interface WaitsForBlock extends Block { 111 | new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any; 112 | } 113 | 114 | interface Clock { 115 | install(): void; 116 | uninstall(): void; 117 | /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ 118 | tick(ms: number): void; 119 | mockDate(date?: Date): void; 120 | } 121 | 122 | interface CustomEqualityTester { 123 | (first: any, second: any): boolean; 124 | } 125 | 126 | interface CustomMatcher { 127 | compare(actual: T, expected: T): CustomMatcherResult; 128 | compare(actual: any, expected: any): CustomMatcherResult; 129 | } 130 | 131 | interface CustomMatcherFactory { 132 | (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; 133 | } 134 | 135 | interface CustomMatcherFactories { 136 | [index: string]: CustomMatcherFactory; 137 | } 138 | 139 | interface CustomMatcherResult { 140 | pass: boolean; 141 | message?: string; 142 | } 143 | 144 | interface MatchersUtil { 145 | equals(a: any, b: any, customTesters?: Array): boolean; 146 | contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; 147 | buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; 148 | } 149 | 150 | interface Env { 151 | setTimeout: any; 152 | clearTimeout: void; 153 | setInterval: any; 154 | clearInterval: void; 155 | updateInterval: number; 156 | 157 | currentSpec: Spec; 158 | 159 | matchersClass: Matchers; 160 | 161 | version(): any; 162 | versionString(): string; 163 | nextSpecId(): number; 164 | addReporter(reporter: Reporter): void; 165 | execute(): void; 166 | describe(description: string, specDefinitions: () => void): Suite; 167 | // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these 168 | beforeEach(beforeEachFunction: () => void): void; 169 | beforeAll(beforeAllFunction: () => void): void; 170 | currentRunner(): Runner; 171 | afterEach(afterEachFunction: () => void): void; 172 | afterAll(afterAllFunction: () => void): void; 173 | xdescribe(desc: string, specDefinitions: () => void): XSuite; 174 | it(description: string, func: () => void): Spec; 175 | // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these 176 | xit(desc: string, func: () => void): XSpec; 177 | compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean; 178 | compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 179 | equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 180 | contains_(haystack: any, needle: any): boolean; 181 | addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 182 | addMatchers(matchers: CustomMatcherFactories): void; 183 | specFilter(spec: Spec): boolean; 184 | } 185 | 186 | interface FakeTimer { 187 | 188 | new (): any; 189 | 190 | reset(): void; 191 | tick(millis: number): void; 192 | runFunctionsWithinRange(oldMillis: number, nowMillis: number): void; 193 | scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void; 194 | } 195 | 196 | interface HtmlReporter { 197 | new (): any; 198 | } 199 | 200 | interface HtmlSpecFilter { 201 | new (): any; 202 | } 203 | 204 | interface Result { 205 | type: string; 206 | } 207 | 208 | interface NestedResults extends Result { 209 | description: string; 210 | 211 | totalCount: number; 212 | passedCount: number; 213 | failedCount: number; 214 | 215 | skipped: boolean; 216 | 217 | rollupCounts(result: NestedResults): void; 218 | log(values: any): void; 219 | getItems(): Result[]; 220 | addResult(result: Result): void; 221 | passed(): boolean; 222 | } 223 | 224 | interface MessageResult extends Result { 225 | values: any; 226 | trace: Trace; 227 | } 228 | 229 | interface ExpectationResult extends Result { 230 | matcherName: string; 231 | passed(): boolean; 232 | expected: any; 233 | actual: any; 234 | message: string; 235 | trace: Trace; 236 | } 237 | 238 | interface Trace { 239 | name: string; 240 | message: string; 241 | stack: any; 242 | } 243 | 244 | interface PrettyPrinter { 245 | 246 | new (): any; 247 | 248 | format(value: any): void; 249 | iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void; 250 | emitScalar(value: any): void; 251 | emitString(value: string): void; 252 | emitArray(array: any[]): void; 253 | emitObject(obj: any): void; 254 | append(value: any): void; 255 | } 256 | 257 | interface StringPrettyPrinter extends PrettyPrinter { 258 | } 259 | 260 | interface Queue { 261 | 262 | new (env: any): any; 263 | 264 | env: Env; 265 | ensured: boolean[]; 266 | blocks: Block[]; 267 | running: boolean; 268 | index: number; 269 | offset: number; 270 | abort: boolean; 271 | 272 | addBefore(block: Block, ensure?: boolean): void; 273 | add(block: any, ensure?: boolean): void; 274 | insertNext(block: any, ensure?: boolean): void; 275 | start(onComplete?: () => void): void; 276 | isRunning(): boolean; 277 | next_(): void; 278 | results(): NestedResults; 279 | } 280 | 281 | interface Matchers { 282 | 283 | new (env: Env, actual: any, spec: Env, isNot?: boolean): any; 284 | 285 | env: Env; 286 | actual: any; 287 | spec: Env; 288 | isNot?: boolean; 289 | message(): any; 290 | 291 | toBe(expected: any, expectationFailOutput?: any): boolean; 292 | toEqual(expected: any, expectationFailOutput?: any): boolean; 293 | toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; 294 | toBeDefined(expectationFailOutput?: any): boolean; 295 | toBeUndefined(expectationFailOutput?: any): boolean; 296 | toBeNull(expectationFailOutput?: any): boolean; 297 | toBeNaN(): boolean; 298 | toBeTruthy(expectationFailOutput?: any): boolean; 299 | toBeFalsy(expectationFailOutput?: any): boolean; 300 | toHaveBeenCalled(): boolean; 301 | toHaveBeenCalledWith(...params: any[]): boolean; 302 | toHaveBeenCalledTimes(expected: number): boolean; 303 | toContain(expected: any, expectationFailOutput?: any): boolean; 304 | toBeLessThan(expected: number, expectationFailOutput?: any): boolean; 305 | toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; 306 | toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; 307 | toThrow(expected?: any): boolean; 308 | toThrowError(message?: string | RegExp): boolean; 309 | toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; 310 | not: Matchers; 311 | 312 | Any: Any; 313 | } 314 | 315 | interface Reporter { 316 | reportRunnerStarting(runner: Runner): void; 317 | reportRunnerResults(runner: Runner): void; 318 | reportSuiteResults(suite: Suite): void; 319 | reportSpecStarting(spec: Spec): void; 320 | reportSpecResults(spec: Spec): void; 321 | log(str: string): void; 322 | } 323 | 324 | interface MultiReporter extends Reporter { 325 | addReporter(reporter: Reporter): void; 326 | } 327 | 328 | interface Runner { 329 | 330 | new (env: Env): any; 331 | 332 | execute(): void; 333 | beforeEach(beforeEachFunction: SpecFunction): void; 334 | afterEach(afterEachFunction: SpecFunction): void; 335 | beforeAll(beforeAllFunction: SpecFunction): void; 336 | afterAll(afterAllFunction: SpecFunction): void; 337 | finishCallback(): void; 338 | addSuite(suite: Suite): void; 339 | add(block: Block): void; 340 | specs(): Spec[]; 341 | suites(): Suite[]; 342 | topLevelSuites(): Suite[]; 343 | results(): NestedResults; 344 | } 345 | 346 | interface SpecFunction { 347 | (spec?: Spec): void; 348 | } 349 | 350 | interface SuiteOrSpec { 351 | id: number; 352 | env: Env; 353 | description: string; 354 | queue: Queue; 355 | } 356 | 357 | interface Spec extends SuiteOrSpec { 358 | 359 | new (env: Env, suite: Suite, description: string): any; 360 | 361 | suite: Suite; 362 | 363 | afterCallbacks: SpecFunction[]; 364 | spies_: Spy[]; 365 | 366 | results_: NestedResults; 367 | matchersClass: Matchers; 368 | 369 | getFullName(): string; 370 | results(): NestedResults; 371 | log(arguments: any): any; 372 | runs(func: SpecFunction): Spec; 373 | addToQueue(block: Block): void; 374 | addMatcherResult(result: Result): void; 375 | expect(actual: any): any; 376 | waits(timeout: number): Spec; 377 | waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; 378 | fail(e?: any): void; 379 | getMatchersClass_(): Matchers; 380 | addMatchers(matchersPrototype: CustomMatcherFactories): void; 381 | finishCallback(): void; 382 | finish(onComplete?: () => void): void; 383 | after(doAfter: SpecFunction): void; 384 | execute(onComplete?: () => void): any; 385 | addBeforesAndAftersToQueue(): void; 386 | explodes(): void; 387 | spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; 388 | removeAllSpies(): void; 389 | } 390 | 391 | interface XSpec { 392 | id: number; 393 | runs(): void; 394 | } 395 | 396 | interface Suite extends SuiteOrSpec { 397 | 398 | new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any; 399 | 400 | parentSuite: Suite; 401 | 402 | getFullName(): string; 403 | finish(onComplete?: () => void): void; 404 | beforeEach(beforeEachFunction: SpecFunction): void; 405 | afterEach(afterEachFunction: SpecFunction): void; 406 | beforeAll(beforeAllFunction: SpecFunction): void; 407 | afterAll(afterAllFunction: SpecFunction): void; 408 | results(): NestedResults; 409 | add(suiteOrSpec: SuiteOrSpec): void; 410 | specs(): Spec[]; 411 | suites(): Suite[]; 412 | children(): any[]; 413 | execute(onComplete?: () => void): void; 414 | } 415 | 416 | interface XSuite { 417 | execute(): void; 418 | } 419 | 420 | interface Spy { 421 | (...params: any[]): any; 422 | 423 | identity: string; 424 | and: SpyAnd; 425 | calls: Calls; 426 | mostRecentCall: { args: any[]; }; 427 | argsForCall: any[]; 428 | wasCalled: boolean; 429 | } 430 | 431 | interface SpyAnd { 432 | /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ 433 | callThrough(): Spy; 434 | /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ 435 | returnValue(val: any): Spy; 436 | /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ 437 | callFake(fn: Function): Spy; 438 | /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ 439 | throwError(msg: string): Spy; 440 | /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ 441 | stub(): Spy; 442 | } 443 | 444 | interface Calls { 445 | /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/ 446 | any(): boolean; 447 | /** By chaining the spy with calls.count(), will return the number of times the spy was called **/ 448 | count(): number; 449 | /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/ 450 | argsFor(index: number): any[]; 451 | /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/ 452 | allArgs(): any[]; 453 | /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/ 454 | all(): CallInfo[]; 455 | /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/ 456 | mostRecent(): CallInfo; 457 | /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/ 458 | first(): CallInfo; 459 | /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ 460 | reset(): void; 461 | } 462 | 463 | interface CallInfo { 464 | /** The context (the this) for the call */ 465 | object: any; 466 | /** All arguments passed to the call */ 467 | args: any[]; 468 | /** The return value of the call */ 469 | returnValue: any; 470 | } 471 | 472 | interface Util { 473 | inherit(childClass: Function, parentClass: Function): any; 474 | formatException(e: any): any; 475 | htmlEscape(str: string): string; 476 | argsToArray(args: any): any; 477 | extend(destination: any, source: any): any; 478 | } 479 | 480 | interface JsApiReporter extends Reporter { 481 | 482 | started: boolean; 483 | finished: boolean; 484 | result: any; 485 | messages: any; 486 | 487 | new (): any; 488 | 489 | suites(): Suite[]; 490 | summarize_(suiteOrSpec: SuiteOrSpec): any; 491 | results(): any; 492 | resultsForSpec(specId: any): any; 493 | log(str: any): any; 494 | resultsForSpecs(specIds: any): any; 495 | summarizeResult_(result: any): any; 496 | } 497 | 498 | interface Jasmine { 499 | Spec: Spec; 500 | clock: Clock; 501 | util: Util; 502 | } 503 | 504 | export var HtmlReporter: HtmlReporter; 505 | export var HtmlSpecFilter: HtmlSpecFilter; 506 | export var DEFAULT_TIMEOUT_INTERVAL: number; 507 | } -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hggeorgiev/rails-angular2starter/bc6f69dcf70de666003b35917884df5861771cf3/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------