├── .gitignore ├── .ruby-gemset ├── .ruby-version ├── .travis.yml ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── lib ├── ngannotate-rails.rb ├── ngannotate.rb └── ngannotate │ ├── processor.rb │ ├── processor3.rb │ ├── processor_common.rb │ ├── rails.rb │ └── rails │ ├── railtie.rb │ └── version.rb ├── ngannotate-rails.gemspec ├── test ├── example │ ├── .gitignore │ ├── .rspec │ ├── Gemfile │ ├── README.md │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── images │ │ │ │ └── rails.png │ │ │ ├── javascripts │ │ │ │ ├── angular-app-coffee.coffee │ │ │ │ ├── angular-app-js.js │ │ │ │ ├── angular-app.coffee │ │ │ │ └── application.js │ │ │ └── stylesheets │ │ │ │ └── application.css │ │ ├── controllers │ │ │ └── application_controller.rb │ │ ├── helpers │ │ │ └── application_helper.rb │ │ └── views │ │ │ └── layouts │ │ │ └── application.html.erb │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── backtrace_silencers.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── secret_token.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ └── routes.rb │ ├── db │ │ └── seeds.rb │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── favicon.ico │ │ ├── index.html │ │ └── robots.txt │ ├── script │ │ └── rails │ └── spec │ │ ├── rails_helper.rb │ │ ├── requests │ │ ├── annotate_coffee_spec.rb │ │ └── annotate_js_spec.rb │ │ └── spec_helper.rb ├── rails_4.2.x │ ├── .gitignore │ ├── .rspec │ ├── Gemfile │ ├── README.md │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── images │ │ │ │ └── .keep │ │ │ ├── javascripts │ │ │ │ ├── angular-app-coffee.coffee │ │ │ │ ├── angular-app-js.js │ │ │ │ ├── angular-app.coffee │ │ │ │ └── application.js │ │ │ └── stylesheets │ │ │ │ └── application.css │ │ ├── controllers │ │ │ └── application_controller.rb │ │ ├── helpers │ │ │ └── application_helper.rb │ │ └── views │ │ │ └── layouts │ │ │ └── application.html.erb │ ├── bin │ │ ├── bundle │ │ ├── rails │ │ └── rake │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── 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 │ ├── log │ │ └── .keep │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── favicon.ico │ │ ├── index.html │ │ └── robots.txt │ └── spec │ │ ├── rails_helper.rb │ │ ├── requests │ │ ├── annotate_coffee_spec.rb │ │ └── annotate_js_spec.rb │ │ └── spec_helper.rb └── rails_5.1.x │ ├── .gitignore │ ├── .rspec │ ├── Gemfile │ ├── README.md │ ├── Rakefile │ ├── app │ ├── assets │ │ ├── images │ │ │ └── .keep │ │ ├── javascripts │ │ │ ├── angular-app-coffee.coffee │ │ │ ├── angular-app-js.js │ │ │ ├── angular-app.coffee │ │ │ └── application.js │ │ └── stylesheets │ │ │ └── application.css │ ├── controllers │ │ └── application_controller.rb │ ├── helpers │ │ └── application_helper.rb │ └── views │ │ └── layouts │ │ └── application.html.erb │ ├── bin │ ├── bundle │ ├── rails │ └── rake │ ├── config.ru │ ├── config │ ├── application.rb │ ├── boot.rb │ ├── 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 │ ├── public │ ├── 404.html │ ├── 422.html │ ├── 500.html │ ├── favicon.ico │ ├── index.html │ └── robots.txt │ └── spec │ ├── rails_helper.rb │ ├── requests │ ├── annotate_coffee_spec.rb │ └── annotate_js_spec.rb │ └── spec_helper.rb ├── travis └── run.sh └── vendor └── ngannotate.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | .yardoc 6 | Gemfile.lock 7 | !example/Gemfile.lock 8 | InstalledFiles 9 | _yardoc 10 | coverage 11 | doc/ 12 | lib/bundler/man 13 | pkg 14 | rdoc 15 | spec/reports 16 | test/tmp 17 | test/version_tmp 18 | tmp 19 | node_modules 20 | *.log 21 | **/public/assets 22 | -------------------------------------------------------------------------------- /.ruby-gemset: -------------------------------------------------------------------------------- 1 | ngannotate 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.4.1 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.1.5 4 | - 2.4.1 5 | sudo: false 6 | cache: bundler 7 | gemfile: 8 | - test/rails_5.1.x/Gemfile 9 | - test/rails_4.2.x/Gemfile 10 | - test/example/Gemfile 11 | branches: 12 | only: 13 | - master 14 | env: 15 | - VER=3_2 16 | - VER=4_2 17 | - VER=5_1 18 | matrix: 19 | exclude: 20 | - rvm: 2.4.1 21 | - rvm: 2.1.5 22 | include: 23 | - rvm: 2.1.5 24 | gemfile: test/example/Gemfile 25 | env: VER=3_2 26 | - rvm: 2.4.1 27 | gemfile: test/rails_4.2.x/Gemfile 28 | env: VER=4_2 29 | - rvm: 2.4.1 30 | gemfile: test/rails_5.1.x/Gemfile 31 | env: VER=5_1 32 | 33 | script: travis/run.sh 34 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in ngannotate-rails.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Jason Morrison 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ngannotate-rails 2 | =========== 3 | 4 | Use in the Rails asset pipeline. 5 | 6 | Installation 7 | ------------ 8 | 9 | Add this line to your application's Gemfile: 10 | 11 | gem 'ngannotate-rails' 12 | 13 | And then execute: 14 | 15 | $ bundle 16 | 17 | That's it! ngannotate-rails integrates seamlessly into the Rails asset pipeline; your JavaScript or CoffeeScript assets will automatically be run through the ng-annotate pre-minifier. 18 | 19 | Usage 20 | ----- 21 | 22 | By default ng-annotate processing is disabled in development and test environments. Processing, however, can be enforced by specifying NG_FORCE=true option. 23 | 24 | 25 | ### NOTES 26 | 27 | #### Javascript runtime 28 | 29 | [Issue with OSX javascript runtime](https://github.com/kikonen/ngannotate-rails/issues/20) 30 | 31 | Use "therubyracer" as javascript runtime 32 | 33 | Gemfile 34 | ```ruby 35 | gem 'therubyracer', platforms: :ruby 36 | ``` 37 | 38 | For faster transpiling, can try to utilize miniracer 39 | 40 | Gemfile 41 | ```ruby 42 | #gem 'therubyracer', platforms: :ruby 43 | gem 'libv8', '~> 5.0' 44 | gem 'mini_racer', '~> 0.1.4' 45 | 46 | # HACK KI due to "mini_racer" 47 | gem 'sprockets-babel', git: 'https://github.com/kikonen/sprockets-babel.git', tag: '0.0.6.2' 48 | ``` 49 | 50 | #### ES2015+/coffeescript support 51 | 52 | If using ES2015+ or coffeescript, it's recommended to use explicit "ngInject;" for classes. 53 | 54 | test_controller.es6 55 | ```javascript 56 | "use strict"; 57 | export class TestController { 58 | constructor($q) { 59 | "ngInject"; 60 | 61 | this.$q = $q; 62 | } 63 | } 64 | ``` 65 | 66 | #### Heroku 67 | [Issue with Heroku](https://github.com/kikonen/ngannotate-rails/issues/10) 68 | 69 | When pushing to heroku its important to invalidate all of your assets. 70 | 71 | 72 | ```ruby 73 | Rails.application.config.assets.version = '1.0' 74 | Rails.application.config.assets.version = '1.1' 75 | ``` 76 | 77 | ### Environment options 78 | 79 | - NG_REGEXP 80 | * regexp passed to ng-annotate 81 | * see ng-annotate documentation 82 | - NG_OPT 83 | * comma separate list of "opt=value" key pairs passed as options to ng-annotate 84 | * see ng-annotate documentation 85 | - NG_FORCE 86 | * force ng-annotate processing in development/test environment 87 | 88 | For example, 89 | 90 | # Test assets compile in rails development environment 91 | # (assuming config/environments/development.rb is adjusted approriately) 92 | 93 | # with rails 3.2 94 | NG_FORCE=true RAILS_ENV=development bundle exec rake assets:clean assets:precompile 95 | 96 | # with rails 4.1 97 | NG_FORCE=true RAILS_ENV=development bundle exec rake assets:clobber assets:precompile 98 | 99 | ### Rails configuration options 100 | 101 | Defined in "config.ng_annotate" 102 | 103 | - process 104 | * Is annotation processing done for current environment (NG_FORCE=true takes precedence over this) 105 | * default: true for production, false for development and test 106 | - options 107 | * Options for ngannotate (NG_OPT and NG_REGEXP env variables take precedence over this) 108 | * default: {} 109 | - paths 110 | * Asset paths, which are handled. Paths in ignore_paths override this setting 111 | Values can be [String | Regexp | Proc] instances 112 | * default: [/.*/] 113 | - ignore_paths 114 | * List of asset paths, which are ignored from ngannotate processing. 115 | Values can be [String | Regexp | Proc] instances 116 | * default: ['/vendor/'] 117 | 118 | For example, 119 | 120 | config/environments/development.rb 121 | 122 | Rails.application.configure do 123 | ... 124 | config.ng_annotate.process = true 125 | config.ng_annotate.options = { 126 | key1: 'value', 127 | regexp: '...', 128 | } 129 | config.ng_annotate.paths = [ 130 | Rails.root.to_s, 131 | ] 132 | config.ng_annotate.ignore_paths = [ 133 | '/vendor/', 134 | '/some/path/' 135 | ] 136 | ... 137 | end 138 | 139 | 140 | Testing assets locally 141 | ---------------------- 142 | 143 | To allow testing precompiled assets locally in development environment. 144 | 145 | config/environments/development.rb 146 | 147 | # 148 | # to allow testing assets:precompile in development environment 149 | # Usage: 150 | # time NG_FORCE=true RAILS_ENV=development bundle exec rake assets:clean assets:precompile:primary 151 | # NG_FORCE=true rails s -p 3001 152 | # 153 | if ENV['NG_FORCE'] == 'true' 154 | config.assets.compress = true 155 | config.assets.compile = false 156 | config.assets.digest = true 157 | config.assets.debug = false 158 | end 159 | 160 | precompile & start server 161 | 162 | time NG_FORCE=true RAILS_ENV=development bundle exec rake assets:clean assets:precompile:primary 163 | NG_FORCE=true rails s -p 3001 164 | 165 | 166 | Versioning 167 | ---------- 168 | 169 | Originally version numbering of this gem followed ng-annotate. However, in order to improve 170 | handling of possibly compatibility breaking fixes and improvements, version schema is now 171 | separated from ng-annotate. Instead of matching versions, changelog in 172 | [wiki](https://github.com/kikonen/ngannotate-rails/wiki) will indicate which is currently matching 173 | ng-annotate version. 174 | 175 | Every released version is tagged with tag "vX.Y.Z". 176 | 177 | Release Process 178 | --------------- 179 | 180 | For ngannotate update (or any other improvements/fixes): 181 | 182 | ```bash 183 | git checkout master 184 | git pull 185 | # if ngannotate update 186 | rake ngannotate:build 187 | git citool 188 | # check that result makes sense and if so, 189 | # use comment: ngannotate: vX.Y.Z 190 | git tag vX.Y.Z 191 | git push 192 | git push --tags 193 | gem build ngannotate-rails.gemspec 194 | gem push ngannotate-rails-X.Y.Z.gems 195 | ``` 196 | 197 | Help 198 | ---- 199 | 200 | * **Q**: I installed ngannotate-rails, but my assets aren't getting processed with ng-annotate. 201 | 202 | **A:** Remember to delete `tmp/cache/assets` or `touch` all the related asset files so that the cached versions get regenerated. If you've precompiled your assets into `public/assets`, you'll need to re-precompile them. 203 | 204 | Hacking 205 | ------- 206 | 207 | ### Upgrading ng-annotate 208 | 209 | The actual ngannotate project is bundled into this gem via [Browserify](https://github.com/substack/node-browserify). You can update to the latest version of ng-annotate via Rake: 210 | 211 | rake ngannotate:build 212 | 213 | ### Test Application 214 | 215 | There is a Rails 3 application bundled in `example/` that you can use to test the asset pipeline integration. Don't forget to remove `tmp/cache/assets` after upgrading to the latest version of ng-annotate. 216 | 217 | Credits 218 | ------- 219 | 220 | This gem is based into https://github.com/jasonm/ngmin-rails 221 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require 'json' 3 | 4 | def clean_ngannotate 5 | `rm -rf node_modules` 6 | end 7 | 8 | def install_ngannotate 9 | `npm install ng-annotate browserify` 10 | end 11 | 12 | def generate_ngannotate 13 | `./node_modules/.bin/browserify ./node_modules/ng-annotate/build/es5/ng-annotate-main.js | sed -e's/module.exports = function ngAnnotate/window.annotate = function ngAnnotate/' > vendor/ngannotate.js` 14 | end 15 | 16 | def update_version 17 | package = JSON.parse(File.open('./node_modules/ng-annotate/package.json').read) 18 | write_version(package["version"]) 19 | end 20 | 21 | def write_version(version) 22 | text = <<-FILE 23 | module Ngannotate 24 | module Rails 25 | VERSION = "#{version}" 26 | end 27 | end 28 | FILE 29 | 30 | File.open('lib/ngannotate/rails/version.rb', 'w') { |f| f.write text } 31 | end 32 | 33 | namespace :ngannotate do 34 | desc "Build a new version of ngannotate-browserified.js" 35 | task :build do 36 | clean_ngannotate && install_ngannotate && generate_ngannotate && update_version 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/ngannotate-rails.rb: -------------------------------------------------------------------------------- 1 | require_relative 'ngannotate' 2 | -------------------------------------------------------------------------------- /lib/ngannotate.rb: -------------------------------------------------------------------------------- 1 | module Ngannotate 2 | def self.sprockets_v2? 3 | gem = Gem.loaded_specs['sprockets'] 4 | !(gem.version.to_s =~ /\A2\..*\z/).nil? 5 | end 6 | end 7 | 8 | require 'ngannotate/rails' 9 | -------------------------------------------------------------------------------- /lib/ngannotate/processor.rb: -------------------------------------------------------------------------------- 1 | require 'execjs' 2 | require 'sprockets/processor' 3 | require_relative 'processor_common' 4 | 5 | module Ngannotate 6 | class Processor < Sprockets::Processor 7 | include ProcessorCommon 8 | 9 | def evaluate(context, locals) 10 | input = { 11 | filename: @file, 12 | data: data, 13 | } 14 | process_data(input) 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/ngannotate/processor3.rb: -------------------------------------------------------------------------------- 1 | require 'execjs' 2 | require_relative 'processor_common' 3 | 4 | module Ngannotate 5 | class Processor 6 | include ProcessorCommon 7 | 8 | def self.instance 9 | @instance ||= new 10 | end 11 | 12 | def self.call(input) 13 | instance.call(input) 14 | end 15 | 16 | def call(input) 17 | process_data(input) 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/ngannotate/processor_common.rb: -------------------------------------------------------------------------------- 1 | module Ngannotate 2 | module ProcessorCommon 3 | def self.included(base) 4 | base.extend ClassMethods 5 | end 6 | 7 | module ClassMethods 8 | def name 9 | 'Ngannotate::Processor' 10 | end 11 | 12 | def shared_exec_context 13 | @shared_exec_context ||= 14 | begin 15 | ::Rails.logger.info "ng-prepare" 16 | ngannotate_source = File.open(File.expand_path('../../../vendor/ngannotate.js', __FILE__)).read 17 | ExecJS.compile "window = {};" + ngannotate_source 18 | end 19 | end 20 | end 21 | 22 | def logger 23 | ::Rails.logger 24 | end 25 | 26 | def process_data(input) 27 | data = input[:data] 28 | file = input[:filename] 29 | 30 | handle = need_process?(input) 31 | state = handle ? :process : (ignore_file?(input) ? :ignore : :skip) 32 | logger.info "ng-#{state}: #{file}" 33 | return data unless handle 34 | 35 | opt = { add: true }.merge!(parse_ngannotate_options) 36 | r = exec_context.call 'window.annotate', data, opt 37 | r['src'] 38 | end 39 | 40 | def exec_context 41 | @exec_context ||= self.class.shared_exec_context 42 | end 43 | 44 | def config 45 | ::Rails.configuration.ng_annotate 46 | end 47 | 48 | # 49 | # Is processing done for current file. This is determined by 4 checks 50 | # 51 | # - config.paths 52 | # - config.ignore_paths 53 | # - config.process 54 | # - NG_FORCE=true env option 55 | # 56 | def need_process?(input) 57 | force_process = ENV['NG_FORCE'] == 'true' 58 | process_file?(input) && (force_process || config.process) 59 | end 60 | 61 | # 62 | # @return true if current file should be processed 63 | # 64 | def process_file?(input) 65 | !ignore_file?(input) && match_input(config.paths, input) 66 | end 67 | 68 | # 69 | # @return true if current file is ignored 70 | # 71 | def ignore_file?(input) 72 | match_input(config.ignore_paths, input) 73 | end 74 | 75 | # 76 | # @return truthy value if input matches any of paths 77 | # 78 | def match_input(paths, input) 79 | file = input[:filename] 80 | paths.any? do |p| 81 | if p.is_a? Proc 82 | p.call(file) 83 | elsif p.is_a? Regexp 84 | p.match(file) 85 | else 86 | file.index(p) 87 | end 88 | end 89 | end 90 | 91 | # 92 | # Parse extra options for ngannotate 93 | # 94 | def parse_ngannotate_options 95 | opt = config.options.clone 96 | 97 | if ENV['NG_OPT'] 98 | opt_str = ENV['NG_OPT'] 99 | if opt_str 100 | opt = Hash[opt_str.split(',').map { |e| e.split('=') }] 101 | opt.symbolize_keys! 102 | end 103 | end 104 | 105 | regexp = ENV['NG_REGEXP'] 106 | if regexp 107 | opt[:regexp] = regexp 108 | end 109 | 110 | opt 111 | end 112 | end 113 | end 114 | -------------------------------------------------------------------------------- /lib/ngannotate/rails.rb: -------------------------------------------------------------------------------- 1 | require "ngannotate/rails/version" 2 | require 'ngannotate/rails/railtie' if defined?(Rails) 3 | 4 | module Ngannotate 5 | module Rails 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/ngannotate/rails/railtie.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/class/attribute' 2 | if Ngannotate.sprockets_v2? 3 | require 'ngannotate/processor' 4 | else 5 | require 'ngannotate/processor3' 6 | end 7 | 8 | module Ngannotate 9 | module Rails 10 | class Railtie < ::Rails::Railtie 11 | config.before_configuration do |app| 12 | config.ng_annotate = ActiveSupport::OrderedOptions.new 13 | ng = config.ng_annotate 14 | 15 | # Establish static configuration defaults 16 | 17 | # @see ngannotate 18 | ng.options = {} 19 | 20 | # Disabled by default in development and test environments 21 | ng.process = !::Rails.env.development? && !::Rails.env.test? 22 | 23 | # comma separate list of paths to only handle for annotation 24 | # - ignore_paths entries are filtered out from this 25 | ng.paths = [/.*/] 26 | 27 | # comma separate list of paths to ignore from annotation 28 | ng.ignore_paths = [ 29 | '/vendor/', 30 | ] 31 | end 32 | 33 | if config.respond_to?(:assets) 34 | config.assets.configure do |env| 35 | env.register_postprocessor 'application/javascript', Ngannotate::Processor 36 | end 37 | else 38 | initializer "ngannotate-rails.add_ngannotate_postprocessor", :group => :all do |app| 39 | app.assets.register_postprocessor 'application/javascript', Ngannotate::Processor 40 | end 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/ngannotate/rails/version.rb: -------------------------------------------------------------------------------- 1 | module Ngannotate 2 | module Rails 3 | VERSION = "1.2.2" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /ngannotate-rails.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'ngannotate/rails/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "ngannotate-rails" 8 | spec.version = Ngannotate::Rails::VERSION 9 | spec.authors = ["Kari Ikonen"] 10 | spec.email = ["mr.kari.ikonen@gmail.com"] 11 | spec.description = %q{Use ngannotate in the Rails asset pipeline.} 12 | spec.summary = %q{Summary: Use ngannotate in the Rails asset pipeline.} 13 | spec.homepage = "https://github.com/kikonen/ngannotate-rails" 14 | spec.license = "MIT" 15 | 16 | spec.files = `git ls-files`.split($/).reject {|f| f =~ /example/ || f =~ /test/} 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ["lib"] 20 | 21 | spec.add_dependency "rails", ">= 3.1" 22 | spec.add_runtime_dependency "execjs" 23 | spec.add_development_dependency "bundler", "~> 1.3" 24 | spec.add_development_dependency "rake" 25 | end 26 | -------------------------------------------------------------------------------- /test/example/.gitignore: -------------------------------------------------------------------------------- 1 | log/* 2 | public/assets 3 | -------------------------------------------------------------------------------- /test/example/.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /test/example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rails', '3.2.18' 4 | 5 | # Gems used only for assets and not required 6 | # in production environments by default. 7 | group :assets do 8 | gem 'sass-rails', '~> 3.2.3' 9 | gem 'coffee-rails', '~> 3.2.1' 10 | 11 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 12 | # gem 'therubyracer', :platforms => :ruby 13 | 14 | gem 'uglifier', '>= 1.0.3' 15 | 16 | gem 'ngannotate-rails', path: '../..' 17 | end 18 | 19 | gem 'rspec-rails' 20 | gem 'rack-test' 21 | 22 | # various misc useful utilities 23 | gem 'pry-rails' 24 | gem 'awesome_print' 25 | gem 'oj' 26 | gem 'hashie' 27 | gem 'pry-byebug' 28 | -------------------------------------------------------------------------------- /test/example/README.md: -------------------------------------------------------------------------------- 1 | Example Application 2 | ------------------- 3 | 4 | 1. `bundle install` 5 | 2. `rails server` 6 | 3. Visit `http://localhost:3000` and click on the links; the scripts should be automatically annotated. 7 | -------------------------------------------------------------------------------- /test/example/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | App::Application.load_tasks 8 | -------------------------------------------------------------------------------- /test/example/app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/example/app/assets/images/rails.png -------------------------------------------------------------------------------- /test/example/app/assets/javascripts/angular-app-coffee.coffee: -------------------------------------------------------------------------------- 1 | app = angular.module 'myApp', [] 2 | 3 | app.config ($locationProvider) -> 4 | $locationProvider.setHtml5Mode(true) 5 | 6 | app.controller 'MainController', ($scope) -> 7 | 8 | app.directive 'myDirective', ($location) -> 9 | restrict: 'EA' 10 | controller: ($scope, $element) -> 11 | 12 | app.provider 'Service', ($location) -> 13 | @$get = ($window) -> 14 | null 15 | 16 | app.provider 'OtherService', 17 | $get: ($window) -> 18 | 19 | app.run ($window) -> 20 | $window.alert 'test!' 21 | -------------------------------------------------------------------------------- /test/example/app/assets/javascripts/angular-app-js.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('myApp', []); 2 | 3 | app.config(function($locationProvider) { 4 | $locationProvider.setHtml5Mode(true); 5 | }); 6 | 7 | app.controller('MainController', function($scope) {}); 8 | 9 | app.directive('myDirective', function($location) { 10 | return { 11 | restrict: 'EA', 12 | controller: function($scope) {} 13 | }; 14 | }); 15 | 16 | app.provider('Service', function($location) { 17 | this.$get = function($window) {}; 18 | }); 19 | 20 | app.provider('OtherService', { 21 | $get: function($window) {} 22 | }); 23 | 24 | app.run(function($window) { 25 | $window.alert('test!'); 26 | }); 27 | -------------------------------------------------------------------------------- /test/example/app/assets/javascripts/angular-app.coffee: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/example/app/assets/javascripts/angular-app.coffee -------------------------------------------------------------------------------- /test/example/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 vendor/assets/javascripts of plugins, if any, 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 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require_tree . 14 | -------------------------------------------------------------------------------- /test/example/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 vendor/assets/stylesheets of plugins, if any, 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 top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /test/example/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /test/example/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/example/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | App 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/example/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 App::Application 5 | -------------------------------------------------------------------------------- /test/example/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | # require "active_record/railtie" 5 | require "action_controller/railtie" 6 | require "action_mailer/railtie" 7 | require "active_resource/railtie" 8 | require "sprockets/railtie" 9 | # require "rails/test_unit/railtie" 10 | 11 | if defined?(Bundler) 12 | # If you precompile assets before deploying to production, use this line 13 | Bundler.require(*Rails.groups(:assets => %w(development test))) 14 | # If you want your assets lazily compiled in production, use this line 15 | # Bundler.require(:default, :assets, Rails.env) 16 | end 17 | 18 | module App 19 | class Application < Rails::Application 20 | # Settings in config/environments/* take precedence over those specified here. 21 | # Application configuration should go into files in config/initializers 22 | # -- all .rb files in that directory are automatically loaded. 23 | 24 | # Custom directories with classes and modules you want to be autoloadable. 25 | # config.autoload_paths += %W(#{config.root}/extras) 26 | 27 | # Only load the plugins named here, in the order given (default is alphabetical). 28 | # :all can be used as a placeholder for all plugins not explicitly named. 29 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 30 | 31 | # Activate observers that should always be running. 32 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 33 | 34 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 35 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 36 | # config.time_zone = 'Central Time (US & Canada)' 37 | 38 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 39 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 40 | # config.i18n.default_locale = :de 41 | 42 | # Configure the default encoding used in templates for Ruby 1.9. 43 | config.encoding = "utf-8" 44 | 45 | # Configure sensitive parameters which will be filtered from the log file. 46 | config.filter_parameters += [:password] 47 | 48 | # Enable escaping HTML in JSON. 49 | config.active_support.escape_html_entities_in_json = true 50 | 51 | # Use SQL instead of Active Record's schema dumper when creating the database. 52 | # This is necessary if your schema can't be completely dumped by the schema dumper, 53 | # like if you have constraints or database-specific column types 54 | # config.active_record.schema_format = :sql 55 | 56 | # Enforce whitelist mode for mass assignment. 57 | # This will create an empty whitelist of attributes available for mass-assignment for all models 58 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 59 | # parameters by using an attr_accessible or attr_protected declaration. 60 | # config.active_record.whitelist_attributes = true 61 | 62 | # Enable the asset pipeline 63 | config.assets.enabled = true 64 | 65 | # Version of your assets, change this if you want to expire all your assets 66 | config.assets.version = '1.0' 67 | 68 | config.ng_annotate.process = true 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /test/example/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /test/example/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | App::Application.initialize! 6 | -------------------------------------------------------------------------------- /test/example/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | App::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 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 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 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | 25 | 26 | # Do not compress assets 27 | config.assets.compress = false 28 | 29 | # Expands the lines which load the assets 30 | config.assets.debug = true 31 | end 32 | -------------------------------------------------------------------------------- /test/example/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | App::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 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress JavaScripts and CSS 15 | config.assets.compress = true 16 | 17 | # Don't fallback to assets pipeline if a precompiled asset is missed 18 | config.assets.compile = false 19 | 20 | # Generate digests for assets URLs 21 | config.assets.digest = true 22 | 23 | # Defaults to nil and saved in location specified by config.assets.prefix 24 | # config.assets.manifest = YOUR_PATH 25 | 26 | # Specifies the header that your server uses for sending files 27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 29 | 30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 31 | # config.force_ssl = true 32 | 33 | # See everything in the log (default is :info) 34 | # config.log_level = :debug 35 | 36 | # Prepend all log lines with the following tags 37 | # config.log_tags = [ :subdomain, :uuid ] 38 | 39 | # Use a different logger for distributed setups 40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 41 | 42 | # Use a different cache store in production 43 | # config.cache_store = :mem_cache_store 44 | 45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 46 | # config.action_controller.asset_host = "http://assets.example.com" 47 | 48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 49 | # config.assets.precompile += %w( search.js ) 50 | 51 | # Disable delivery errors, bad email addresses will be ignored 52 | # config.action_mailer.raise_delivery_errors = false 53 | 54 | # Enable threaded mode 55 | # config.threadsafe! 56 | 57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 58 | # the I18n.default_locale when a translation can not be found) 59 | config.i18n.fallbacks = true 60 | 61 | # Send deprecation notices to registered listeners 62 | config.active_support.deprecation = :notify 63 | 64 | end 65 | -------------------------------------------------------------------------------- /test/example/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | App::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 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | 33 | # Print deprecation notices to the stderr 34 | config.active_support.deprecation = :stderr 35 | end 36 | -------------------------------------------------------------------------------- /test/example/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 | -------------------------------------------------------------------------------- /test/example/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 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /test/example/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 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /test/example/config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | App::Application.config.secret_token = '8941ca03bcd110c7db257d12ba9f21c251daf389f4ae26bf6c1934a84beffb0d84006491b853f0beb4eae44610bf2468cc6c62cb31248701403fdd25ff130c22' 8 | -------------------------------------------------------------------------------- /test/example/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | App::Application.config.session_store :cookie_store, key: '_app_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # App::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /test/example/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] 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/example/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /test/example/config/routes.rb: -------------------------------------------------------------------------------- 1 | App::Application.routes.draw do 2 | # The priority is based upon order of creation: 3 | # first created -> highest priority. 4 | 5 | # Sample of regular route: 6 | # match 'products/:id' => 'catalog#view' 7 | # Keep in mind you can assign values other than :controller and :action 8 | 9 | # Sample of named route: 10 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 11 | # This route can be invoked with purchase_url(:id => product.id) 12 | 13 | # Sample resource route (maps HTTP verbs to controller actions automatically): 14 | # resources :products 15 | 16 | # Sample resource route with options: 17 | # resources :products do 18 | # member do 19 | # get 'short' 20 | # post 'toggle' 21 | # end 22 | # 23 | # collection do 24 | # get 'sold' 25 | # end 26 | # end 27 | 28 | # Sample resource route with sub-resources: 29 | # resources :products do 30 | # resources :comments, :sales 31 | # resource :seller 32 | # end 33 | 34 | # Sample resource route with more complex sub-resources 35 | # resources :products do 36 | # resources :comments 37 | # resources :sales do 38 | # get 'recent', :on => :collection 39 | # end 40 | # end 41 | 42 | # Sample resource route within a namespace: 43 | # namespace :admin do 44 | # # Directs /admin/products/* to Admin::ProductsController 45 | # # (app/controllers/admin/products_controller.rb) 46 | # resources :products 47 | # end 48 | 49 | # You can have the root of your site routed with "root" 50 | # just remember to delete public/index.html. 51 | # root :to => 'welcome#index' 52 | 53 | # See how all your routes lay out with "rake routes" 54 | 55 | # This is a legacy wild controller route that's not recommended for RESTful applications. 56 | # Note: This route will make all actions in every controller accessible via GET requests. 57 | # match ':controller(/:action(/:id))(.:format)' 58 | end 59 | -------------------------------------------------------------------------------- /test/example/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 | -------------------------------------------------------------------------------- /test/example/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/example/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/example/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /test/example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/example/public/favicon.ico -------------------------------------------------------------------------------- /test/example/public/index.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/example/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.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/example/script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /test/example/spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV['RAILS_ENV'] ||= 'test' 3 | require 'spec_helper' 4 | require File.expand_path('../../config/environment', __FILE__) 5 | require 'rspec/rails' 6 | # Add additional requires below this line. Rails is not loaded until this point! 7 | require 'rack/test' 8 | require 'awesome_print' 9 | 10 | # Requires supporting ruby files with custom matchers and macros, etc, in 11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 12 | # run as spec files by default. This means that files in spec/support that end 13 | # in _spec.rb will both be required and run as specs, causing the specs to be 14 | # run twice. It is recommended that you do not name files matching this glob to 15 | # end with _spec.rb. You can configure this pattern with the --pattern 16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 17 | # 18 | # The following line is provided for convenience purposes. It has the downside 19 | # of increasing the boot-up time by auto-requiring all files in the support 20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 21 | # require only the support files necessary. 22 | # 23 | Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } 24 | 25 | class RSpec::Core::ExampleGroup 26 | # this include really screws up ActionMailer so we put it only in the scope 27 | # where it's needed. 28 | include Rack::Test::Methods 29 | end 30 | 31 | RSpec.configure do |config| 32 | # RSpec Rails can automatically mix in different behaviours to your tests 33 | # based on their file location, for example enabling you to call `get` and 34 | # `post` in specs under `spec/controllers`. 35 | # 36 | # You can disable this behaviour by removing the line below, and instead 37 | # explicitly tag your specs with their type, e.g.: 38 | # 39 | # RSpec.describe UsersController, :type => :controller do 40 | # # ... 41 | # end 42 | # 43 | # The different available types are documented in the features, such as in 44 | # https://relishapp.com/rspec/rspec-rails/docs 45 | config.infer_spec_type_from_file_location! 46 | 47 | config.before :each do 48 | FileUtils.rm_rf File.join(Rails.root, 'tmp/cache') 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/example/spec/requests/annotate_coffee_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe 'annotate js' do 4 | let(:expected_content) { 5 | < "be bigger than 2 and smaller than 4" 29 | # ...rather than: 30 | # # => "be bigger than 2" 31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 32 | end 33 | 34 | # rspec-mocks config goes here. You can use an alternate test double 35 | # library (such as bogus or mocha) by changing the `mock_with` option here. 36 | config.mock_with :rspec do |mocks| 37 | # Prevents you from mocking or stubbing a method that does not exist on 38 | # a real object. This is generally recommended, and will default to 39 | # `true` in RSpec 4. 40 | mocks.verify_partial_doubles = true 41 | end 42 | 43 | # The settings below are suggested to provide a good initial experience 44 | # with RSpec, but feel free to customize to your heart's content. 45 | =begin 46 | # These two settings work together to allow you to limit a spec run 47 | # to individual examples or groups you care about by tagging them with 48 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples 49 | # get run. 50 | config.filter_run :focus 51 | config.run_all_when_everything_filtered = true 52 | 53 | # Limits the available syntax to the non-monkey patched syntax that is 54 | # recommended. For more details, see: 55 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax 56 | # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 57 | # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching 58 | config.disable_monkey_patching! 59 | 60 | # Many RSpec users commonly either run the entire suite or an individual 61 | # file, and it's useful to allow more verbose output when running an 62 | # individual spec file. 63 | if config.files_to_run.one? 64 | # Use the documentation formatter for detailed output, 65 | # unless a formatter has already been configured 66 | # (e.g. via a command-line flag). 67 | config.default_formatter = 'doc' 68 | end 69 | 70 | # Print the 10 slowest examples and example groups at the 71 | # end of the spec run, to help surface which specs are running 72 | # particularly slow. 73 | config.profile_examples = 10 74 | 75 | # Run specs in random order to surface order dependencies. If you find an 76 | # order dependency and want to debug it, you can fix the order by providing 77 | # the seed, which is printed after each run. 78 | # --seed 1234 79 | config.order = :random 80 | 81 | # Seed global randomization in this process using the `--seed` CLI option. 82 | # Setting this allows you to use `--seed` to deterministically reproduce 83 | # test failures related to randomization by passing the same `--seed` value 84 | # as the one that triggered the failure. 85 | Kernel.srand config.seed 86 | =end 87 | end 88 | -------------------------------------------------------------------------------- /test/rails_4.2.x/.gitignore: -------------------------------------------------------------------------------- 1 | log/* 2 | public/assets 3 | -------------------------------------------------------------------------------- /test/rails_4.2.x/.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /test/rails_4.2.x/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rails', '~> 4.2.0' 4 | 5 | gem 'uglifier', '>= 1.3.0' 6 | gem 'coffee-rails', '~> 4.0.0' 7 | gem 'therubyracer', platforms: :ruby 8 | 9 | gem 'sprockets', '>= 3.0.0' 10 | gem 'ngannotate-rails', path: File.expand_path('../../..', __FILE__), require: true 11 | 12 | gem 'rspec-rails' 13 | gem 'rack-test' 14 | 15 | # various misc useful utilities 16 | gem 'pry-rails' 17 | gem 'awesome_print' 18 | gem 'oj' 19 | gem 'hashie' 20 | gem 'pry-byebug' 21 | -------------------------------------------------------------------------------- /test/rails_4.2.x/README.md: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | 26 | 27 | Please feel free to use a different markup language if you do not plan to run 28 | rake doc:app. 29 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_4.2.x/app/assets/images/.keep -------------------------------------------------------------------------------- /test/rails_4.2.x/app/assets/javascripts/angular-app-coffee.coffee: -------------------------------------------------------------------------------- 1 | app = angular.module 'myApp', [] 2 | 3 | app.config ($locationProvider) -> 4 | $locationProvider.setHtml5Mode(true) 5 | 6 | app.controller 'MainController', ($scope) -> 7 | 8 | app.directive 'myDirective', ($location) -> 9 | restrict: 'EA' 10 | controller: ($scope, $element) -> 11 | 12 | app.provider 'Service', ($location) -> 13 | @$get = ($window) -> 14 | null 15 | 16 | app.provider 'OtherService', 17 | $get: ($window) -> 18 | 19 | app.run ($window) -> 20 | $window.alert 'test!' 21 | -------------------------------------------------------------------------------- /test/rails_4.2.x/app/assets/javascripts/angular-app-js.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('myApp', []); 2 | 3 | app.config(function($locationProvider) { 4 | $locationProvider.setHtml5Mode(true); 5 | }); 6 | 7 | app.controller('MainController', function($scope) {}); 8 | 9 | app.directive('myDirective', function($location) { 10 | return { 11 | restrict: 'EA', 12 | controller: function($scope) {} 13 | }; 14 | }); 15 | 16 | app.provider('Service', function($location) { 17 | this.$get = function($window) {}; 18 | }); 19 | 20 | app.provider('OtherService', { 21 | $get: function($window) {} 22 | }); 23 | 24 | app.run(function($window) { 25 | $window.alert('test!'); 26 | }); 27 | -------------------------------------------------------------------------------- /test/rails_4.2.x/app/assets/javascripts/angular-app.coffee: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_4.2.x/app/assets/javascripts/angular-app.coffee -------------------------------------------------------------------------------- /test/rails_4.2.x/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 vendor/assets/javascripts of plugins, if any, 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 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require_tree . 14 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 vendor/assets/stylesheets of plugins, if any, 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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /test/rails_4.2.x/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/rails_4.2.x/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | App 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/rails_4.2.x/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /test/rails_4.2.x/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /test/rails_4.2.x/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "action_controller/railtie" 7 | require "action_view/railtie" 8 | require "sprockets/railtie" 9 | # require "rails/test_unit/railtie" 10 | 11 | # Require the gems listed in Gemfile, including any gems 12 | # you've limited to :test, :development, or :production. 13 | Bundler.require(*Rails.groups) 14 | 15 | 16 | module Example 17 | class Application < Rails::Application 18 | # Settings in config/environments/* take precedence over those specified here. 19 | # Application configuration should go into files in config/initializers 20 | # -- all .rb files in that directory are automatically loaded. 21 | 22 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 23 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 24 | # config.time_zone = 'Central Time (US & Canada)' 25 | 26 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 27 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 28 | # config.i18n.default_locale = :de 29 | 30 | config.ng_annotate.process = true 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /test/rails_4.2.x/config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | # Print deprecation notices to the Rails logger. 17 | config.active_support.deprecation = :log 18 | 19 | # Debug mode disables concatenation and preprocessing of assets. 20 | # This option may cause significant delays in view rendering with a large 21 | # number of complex assets. 22 | config.assets.debug = true 23 | 24 | # Adds additional error checking when serving assets at runtime. 25 | # Checks for improperly declared sprockets dependencies. 26 | # Raises helpful error messages. 27 | config.assets.raise_runtime_errors = true 28 | 29 | # Raises error for missing translations 30 | # config.action_view.raise_on_missing_translations = true 31 | end 32 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 nginx, varnish or squid. 20 | # config.action_dispatch.rack_cache = true 21 | 22 | # Disable Rails's static asset server (Apache or nginx will already do this). 23 | config.serve_static_files = false 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # Generate digests for assets URLs. 33 | config.assets.digest = true 34 | 35 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 36 | 37 | # Specifies the header that your server uses for sending files. 38 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 40 | 41 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 42 | # config.force_ssl = true 43 | 44 | # Set to :debug to see everything in the log. 45 | config.log_level = :info 46 | 47 | # Prepend all log lines with the following tags. 48 | # config.log_tags = [ :subdomain, :uuid ] 49 | 50 | # Use a different logger for distributed setups. 51 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 52 | 53 | # Use a different cache store in production. 54 | # config.cache_store = :mem_cache_store 55 | 56 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 57 | # config.action_controller.asset_host = "http://assets.example.com" 58 | 59 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 60 | # the I18n.default_locale when a translation cannot be found). 61 | config.i18n.fallbacks = true 62 | 63 | # Send deprecation notices to registered listeners. 64 | config.active_support.deprecation = :notify 65 | 66 | # Disable automatic flushing of the log to improve performance. 67 | # config.autoflush_log = false 68 | 69 | # Use default logging formatter so that PID and timestamp are not suppressed. 70 | config.log_formatter = ::Logger::Formatter.new 71 | end 72 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 asset 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 | # Print deprecation notices to the stderr. 30 | config.active_support.deprecation = :stderr 31 | 32 | # Raises error for missing translations 33 | # config.action_view.raise_on_missing_translations = true 34 | end 35 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | # Precompile additional assets. 7 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 8 | # Rails.application.config.assets.precompile += %w( search.js ) 9 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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: '_example_session' 4 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # The priority is based upon order of creation: first created -> highest priority. 3 | # See how all your routes lay out with "rake routes". 4 | 5 | # You can have the root of your site routed with "root" 6 | # root 'welcome#index' 7 | 8 | # Example of regular route: 9 | # get 'products/:id' => 'catalog#view' 10 | 11 | # Example of named route that can be invoked with purchase_url(id: product.id) 12 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 13 | 14 | # Example resource route (maps HTTP verbs to controller actions automatically): 15 | # resources :products 16 | 17 | # Example resource route with options: 18 | # resources :products do 19 | # member do 20 | # get 'short' 21 | # post 'toggle' 22 | # end 23 | # 24 | # collection do 25 | # get 'sold' 26 | # end 27 | # end 28 | 29 | # Example resource route with sub-resources: 30 | # resources :products do 31 | # resources :comments, :sales 32 | # resource :seller 33 | # end 34 | 35 | # Example resource route with more complex sub-resources: 36 | # resources :products do 37 | # resources :comments 38 | # resources :sales do 39 | # get 'recent', on: :collection 40 | # end 41 | # end 42 | 43 | # Example resource route with concerns: 44 | # concern :toggleable do 45 | # post 'toggle' 46 | # end 47 | # resources :posts, concerns: :toggleable 48 | # resources :photos, concerns: :toggleable 49 | 50 | # Example resource route within a namespace: 51 | # namespace :admin do 52 | # # Directs /admin/products/* to Admin::ProductsController 53 | # # (app/controllers/admin/products_controller.rb) 54 | # resources :products 55 | # end 56 | end 57 | -------------------------------------------------------------------------------- /test/rails_4.2.x/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: e05fdbc710442d8f3fe14b6d9155a85e34c247c541e1c4ecf6228010cddbcbfd96f7779c08cc3953789cf67196e913657343b9ec197eb644a4dc7243c6b29d89 15 | 16 | test: 17 | secret_key_base: d63e0dd6d9dbf22deba6369955389ea1509ae94c8aebf7533d7cfa7a68d4e5b7757c40df7ea056b2f838428cb9cf5d70d71c623783c5eef093ed25743b105176 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 | -------------------------------------------------------------------------------- /test/rails_4.2.x/log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_4.2.x/log/.keep -------------------------------------------------------------------------------- /test/rails_4.2.x/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/rails_4.2.x/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/rails_4.2.x/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /test/rails_4.2.x/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_4.2.x/public/favicon.ico -------------------------------------------------------------------------------- /test/rails_4.2.x/public/index.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/rails_4.2.x/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.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/rails_4.2.x/spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV['RAILS_ENV'] ||= 'test' 3 | require 'spec_helper' 4 | require File.expand_path('../../config/environment', __FILE__) 5 | require 'rspec/rails' 6 | # Add additional requires below this line. Rails is not loaded until this point! 7 | require 'rack/test' 8 | require 'awesome_print' 9 | 10 | # Requires supporting ruby files with custom matchers and macros, etc, in 11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 12 | # run as spec files by default. This means that files in spec/support that end 13 | # in _spec.rb will both be required and run as specs, causing the specs to be 14 | # run twice. It is recommended that you do not name files matching this glob to 15 | # end with _spec.rb. You can configure this pattern with the --pattern 16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 17 | # 18 | # The following line is provided for convenience purposes. It has the downside 19 | # of increasing the boot-up time by auto-requiring all files in the support 20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 21 | # require only the support files necessary. 22 | # 23 | Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } 24 | 25 | class RSpec::Core::ExampleGroup 26 | # this include really screws up ActionMailer so we put it only in the scope 27 | # where it's needed. 28 | include Rack::Test::Methods 29 | end 30 | 31 | RSpec.configure do |config| 32 | # RSpec Rails can automatically mix in different behaviours to your tests 33 | # based on their file location, for example enabling you to call `get` and 34 | # `post` in specs under `spec/controllers`. 35 | # 36 | # You can disable this behaviour by removing the line below, and instead 37 | # explicitly tag your specs with their type, e.g.: 38 | # 39 | # RSpec.describe UsersController, :type => :controller do 40 | # # ... 41 | # end 42 | # 43 | # The different available types are documented in the features, such as in 44 | # https://relishapp.com/rspec/rspec-rails/docs 45 | config.infer_spec_type_from_file_location! 46 | 47 | config.before :each do 48 | FileUtils.rm_rf File.join(Rails.root, 'tmp/cache') 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/rails_4.2.x/spec/requests/annotate_coffee_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe 'annotate js' do 4 | let(:expected_content) { 5 | < "be bigger than 2 and smaller than 4" 29 | # ...rather than: 30 | # # => "be bigger than 2" 31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 32 | end 33 | 34 | # rspec-mocks config goes here. You can use an alternate test double 35 | # library (such as bogus or mocha) by changing the `mock_with` option here. 36 | config.mock_with :rspec do |mocks| 37 | # Prevents you from mocking or stubbing a method that does not exist on 38 | # a real object. This is generally recommended, and will default to 39 | # `true` in RSpec 4. 40 | mocks.verify_partial_doubles = true 41 | end 42 | 43 | # The settings below are suggested to provide a good initial experience 44 | # with RSpec, but feel free to customize to your heart's content. 45 | =begin 46 | # These two settings work together to allow you to limit a spec run 47 | # to individual examples or groups you care about by tagging them with 48 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples 49 | # get run. 50 | config.filter_run :focus 51 | config.run_all_when_everything_filtered = true 52 | 53 | # Limits the available syntax to the non-monkey patched syntax that is 54 | # recommended. For more details, see: 55 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax 56 | # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 57 | # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching 58 | config.disable_monkey_patching! 59 | 60 | # Many RSpec users commonly either run the entire suite or an individual 61 | # file, and it's useful to allow more verbose output when running an 62 | # individual spec file. 63 | if config.files_to_run.one? 64 | # Use the documentation formatter for detailed output, 65 | # unless a formatter has already been configured 66 | # (e.g. via a command-line flag). 67 | config.default_formatter = 'doc' 68 | end 69 | 70 | # Print the 10 slowest examples and example groups at the 71 | # end of the spec run, to help surface which specs are running 72 | # particularly slow. 73 | config.profile_examples = 10 74 | 75 | # Run specs in random order to surface order dependencies. If you find an 76 | # order dependency and want to debug it, you can fix the order by providing 77 | # the seed, which is printed after each run. 78 | # --seed 1234 79 | config.order = :random 80 | 81 | # Seed global randomization in this process using the `--seed` CLI option. 82 | # Setting this allows you to use `--seed` to deterministically reproduce 83 | # test failures related to randomization by passing the same `--seed` value 84 | # as the one that triggered the failure. 85 | Kernel.srand config.seed 86 | =end 87 | end 88 | -------------------------------------------------------------------------------- /test/rails_5.1.x/.gitignore: -------------------------------------------------------------------------------- 1 | log/* 2 | public/assets 3 | -------------------------------------------------------------------------------- /test/rails_5.1.x/.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /test/rails_5.1.x/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rails', '5.1.3' 4 | 5 | gem 'uglifier', '>= 1.3.0' 6 | gem 'coffee-rails', '>= 4.0.0' 7 | gem 'therubyracer', platforms: :ruby 8 | 9 | gem 'sprockets', '>= 3.0.0' 10 | gem 'ngannotate-rails', path: File.expand_path('../../..', __FILE__), require: true 11 | 12 | gem 'rspec-rails' 13 | gem 'rack-test' 14 | 15 | # various misc useful utilities 16 | gem 'pry-rails' 17 | gem 'awesome_print' 18 | gem 'oj' 19 | gem 'hashie' 20 | gem 'pry-byebug' 21 | -------------------------------------------------------------------------------- /test/rails_5.1.x/README.md: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | 26 | 27 | Please feel free to use a different markup language if you do not plan to run 28 | rake doc:app. 29 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_5.1.x/app/assets/images/.keep -------------------------------------------------------------------------------- /test/rails_5.1.x/app/assets/javascripts/angular-app-coffee.coffee: -------------------------------------------------------------------------------- 1 | app = angular.module 'myApp', [] 2 | 3 | app.config ($locationProvider) -> 4 | $locationProvider.setHtml5Mode(true) 5 | 6 | app.controller 'MainController', ($scope) -> 7 | 8 | app.directive 'myDirective', ($location) -> 9 | restrict: 'EA' 10 | controller: ($scope, $element) -> 11 | 12 | app.provider 'Service', ($location) -> 13 | @$get = ($window) -> 14 | null 15 | 16 | app.provider 'OtherService', 17 | $get: ($window) -> 18 | 19 | app.run ($window) -> 20 | $window.alert 'test!' 21 | -------------------------------------------------------------------------------- /test/rails_5.1.x/app/assets/javascripts/angular-app-js.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('myApp', []); 2 | 3 | app.config(function($locationProvider) { 4 | $locationProvider.setHtml5Mode(true); 5 | }); 6 | 7 | app.controller('MainController', function($scope) {}); 8 | 9 | app.directive('myDirective', function($location) { 10 | return { 11 | restrict: 'EA', 12 | controller: function($scope) {} 13 | }; 14 | }); 15 | 16 | app.provider('Service', function($location) { 17 | this.$get = function($window) {}; 18 | }); 19 | 20 | app.provider('OtherService', { 21 | $get: function($window) {} 22 | }); 23 | 24 | app.run(function($window) { 25 | $window.alert('test!'); 26 | }); 27 | -------------------------------------------------------------------------------- /test/rails_5.1.x/app/assets/javascripts/angular-app.coffee: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_5.1.x/app/assets/javascripts/angular-app.coffee -------------------------------------------------------------------------------- /test/rails_5.1.x/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 vendor/assets/javascripts of plugins, if any, 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 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require_tree . 14 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 vendor/assets/stylesheets of plugins, if any, 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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /test/rails_5.1.x/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/rails_5.1.x/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | App 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/rails_5.1.x/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /test/rails_5.1.x/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /test/rails_5.1.x/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "action_controller/railtie" 7 | require "action_view/railtie" 8 | require "sprockets/railtie" 9 | # require "rails/test_unit/railtie" 10 | 11 | # Require the gems listed in Gemfile, including any gems 12 | # you've limited to :test, :development, or :production. 13 | Bundler.require(*Rails.groups) 14 | 15 | 16 | module Example 17 | class Application < Rails::Application 18 | # Settings in config/environments/* take precedence over those specified here. 19 | # Application configuration should go into files in config/initializers 20 | # -- all .rb files in that directory are automatically loaded. 21 | 22 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 23 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 24 | # config.time_zone = 'Central Time (US & Canada)' 25 | 26 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 27 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 28 | # config.i18n.default_locale = :de 29 | 30 | config.ng_annotate.process = true 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /test/rails_5.1.x/config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | # Print deprecation notices to the Rails logger. 17 | config.active_support.deprecation = :log 18 | 19 | # Debug mode disables concatenation and preprocessing of assets. 20 | # This option may cause significant delays in view rendering with a large 21 | # number of complex assets. 22 | config.assets.debug = true 23 | 24 | # Adds additional error checking when serving assets at runtime. 25 | # Checks for improperly declared sprockets dependencies. 26 | # Raises helpful error messages. 27 | config.assets.raise_runtime_errors = true 28 | 29 | # Raises error for missing translations 30 | # config.action_view.raise_on_missing_translations = true 31 | end 32 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 nginx, varnish or squid. 20 | # config.action_dispatch.rack_cache = true 21 | 22 | # Disable Rails's static asset server (Apache or nginx will already do this). 23 | config.serve_static_files = false 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # Generate digests for assets URLs. 33 | config.assets.digest = true 34 | 35 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 36 | 37 | # Specifies the header that your server uses for sending files. 38 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 40 | 41 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 42 | # config.force_ssl = true 43 | 44 | # Set to :debug to see everything in the log. 45 | config.log_level = :info 46 | 47 | # Prepend all log lines with the following tags. 48 | # config.log_tags = [ :subdomain, :uuid ] 49 | 50 | # Use a different logger for distributed setups. 51 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 52 | 53 | # Use a different cache store in production. 54 | # config.cache_store = :mem_cache_store 55 | 56 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 57 | # config.action_controller.asset_host = "http://assets.example.com" 58 | 59 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 60 | # the I18n.default_locale when a translation cannot be found). 61 | config.i18n.fallbacks = true 62 | 63 | # Send deprecation notices to registered listeners. 64 | config.active_support.deprecation = :notify 65 | 66 | # Disable automatic flushing of the log to improve performance. 67 | # config.autoflush_log = false 68 | 69 | # Use default logging formatter so that PID and timestamp are not suppressed. 70 | config.log_formatter = ::Logger::Formatter.new 71 | end 72 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 asset 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 | # Print deprecation notices to the stderr. 30 | config.active_support.deprecation = :stderr 31 | 32 | # Raises error for missing translations 33 | # config.action_view.raise_on_missing_translations = true 34 | end 35 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | # Precompile additional assets. 7 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 8 | # Rails.application.config.assets.precompile += %w( search.js ) 9 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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: '_example_session' 4 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # The priority is based upon order of creation: first created -> highest priority. 3 | # See how all your routes lay out with "rake routes". 4 | 5 | # You can have the root of your site routed with "root" 6 | # root 'welcome#index' 7 | 8 | # Example of regular route: 9 | # get 'products/:id' => 'catalog#view' 10 | 11 | # Example of named route that can be invoked with purchase_url(id: product.id) 12 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 13 | 14 | # Example resource route (maps HTTP verbs to controller actions automatically): 15 | # resources :products 16 | 17 | # Example resource route with options: 18 | # resources :products do 19 | # member do 20 | # get 'short' 21 | # post 'toggle' 22 | # end 23 | # 24 | # collection do 25 | # get 'sold' 26 | # end 27 | # end 28 | 29 | # Example resource route with sub-resources: 30 | # resources :products do 31 | # resources :comments, :sales 32 | # resource :seller 33 | # end 34 | 35 | # Example resource route with more complex sub-resources: 36 | # resources :products do 37 | # resources :comments 38 | # resources :sales do 39 | # get 'recent', on: :collection 40 | # end 41 | # end 42 | 43 | # Example resource route with concerns: 44 | # concern :toggleable do 45 | # post 'toggle' 46 | # end 47 | # resources :posts, concerns: :toggleable 48 | # resources :photos, concerns: :toggleable 49 | 50 | # Example resource route within a namespace: 51 | # namespace :admin do 52 | # # Directs /admin/products/* to Admin::ProductsController 53 | # # (app/controllers/admin/products_controller.rb) 54 | # resources :products 55 | # end 56 | end 57 | -------------------------------------------------------------------------------- /test/rails_5.1.x/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: e05fdbc710442d8f3fe14b6d9155a85e34c247c541e1c4ecf6228010cddbcbfd96f7779c08cc3953789cf67196e913657343b9ec197eb644a4dc7243c6b29d89 15 | 16 | test: 17 | secret_key_base: d63e0dd6d9dbf22deba6369955389ea1509ae94c8aebf7533d7cfa7a68d4e5b7757c40df7ea056b2f838428cb9cf5d70d71c623783c5eef093ed25743b105176 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 | -------------------------------------------------------------------------------- /test/rails_5.1.x/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/rails_5.1.x/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/rails_5.1.x/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /test/rails_5.1.x/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kikonen/ngannotate-rails/5297556590b73be868e7e30fcb866a681067b80d/test/rails_5.1.x/public/favicon.ico -------------------------------------------------------------------------------- /test/rails_5.1.x/public/index.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/rails_5.1.x/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.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/rails_5.1.x/spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV['RAILS_ENV'] ||= 'test' 3 | require 'spec_helper' 4 | require File.expand_path('../../config/environment', __FILE__) 5 | require 'rspec/rails' 6 | # Add additional requires below this line. Rails is not loaded until this point! 7 | require 'rack/test' 8 | require 'awesome_print' 9 | 10 | # Requires supporting ruby files with custom matchers and macros, etc, in 11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 12 | # run as spec files by default. This means that files in spec/support that end 13 | # in _spec.rb will both be required and run as specs, causing the specs to be 14 | # run twice. It is recommended that you do not name files matching this glob to 15 | # end with _spec.rb. You can configure this pattern with the --pattern 16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 17 | # 18 | # The following line is provided for convenience purposes. It has the downside 19 | # of increasing the boot-up time by auto-requiring all files in the support 20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 21 | # require only the support files necessary. 22 | # 23 | Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } 24 | 25 | class RSpec::Core::ExampleGroup 26 | # this include really screws up ActionMailer so we put it only in the scope 27 | # where it's needed. 28 | include Rack::Test::Methods 29 | end 30 | 31 | RSpec.configure do |config| 32 | # RSpec Rails can automatically mix in different behaviours to your tests 33 | # based on their file location, for example enabling you to call `get` and 34 | # `post` in specs under `spec/controllers`. 35 | # 36 | # You can disable this behaviour by removing the line below, and instead 37 | # explicitly tag your specs with their type, e.g.: 38 | # 39 | # RSpec.describe UsersController, :type => :controller do 40 | # # ... 41 | # end 42 | # 43 | # The different available types are documented in the features, such as in 44 | # https://relishapp.com/rspec/rspec-rails/docs 45 | config.infer_spec_type_from_file_location! 46 | 47 | config.before :each do 48 | FileUtils.rm_rf File.join(Rails.root, 'tmp/cache') 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/rails_5.1.x/spec/requests/annotate_coffee_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe 'annotate js' do 4 | let(:expected_content) { 5 | < "be bigger than 2 and smaller than 4" 29 | # ...rather than: 30 | # # => "be bigger than 2" 31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 32 | end 33 | 34 | # rspec-mocks config goes here. You can use an alternate test double 35 | # library (such as bogus or mocha) by changing the `mock_with` option here. 36 | config.mock_with :rspec do |mocks| 37 | # Prevents you from mocking or stubbing a method that does not exist on 38 | # a real object. This is generally recommended, and will default to 39 | # `true` in RSpec 4. 40 | mocks.verify_partial_doubles = true 41 | end 42 | 43 | # The settings below are suggested to provide a good initial experience 44 | # with RSpec, but feel free to customize to your heart's content. 45 | =begin 46 | # These two settings work together to allow you to limit a spec run 47 | # to individual examples or groups you care about by tagging them with 48 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples 49 | # get run. 50 | config.filter_run :focus 51 | config.run_all_when_everything_filtered = true 52 | 53 | # Limits the available syntax to the non-monkey patched syntax that is 54 | # recommended. For more details, see: 55 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax 56 | # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 57 | # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching 58 | config.disable_monkey_patching! 59 | 60 | # Many RSpec users commonly either run the entire suite or an individual 61 | # file, and it's useful to allow more verbose output when running an 62 | # individual spec file. 63 | if config.files_to_run.one? 64 | # Use the documentation formatter for detailed output, 65 | # unless a formatter has already been configured 66 | # (e.g. via a command-line flag). 67 | config.default_formatter = 'doc' 68 | end 69 | 70 | # Print the 10 slowest examples and example groups at the 71 | # end of the spec run, to help surface which specs are running 72 | # particularly slow. 73 | config.profile_examples = 10 74 | 75 | # Run specs in random order to surface order dependencies. If you find an 76 | # order dependency and want to debug it, you can fix the order by providing 77 | # the seed, which is printed after each run. 78 | # --seed 1234 79 | config.order = :random 80 | 81 | # Seed global randomization in this process using the `--seed` CLI option. 82 | # Setting this allows you to use `--seed` to deterministically reproduce 83 | # test failures related to randomization by passing the same `--seed` value 84 | # as the one that triggered the failure. 85 | Kernel.srand config.seed 86 | =end 87 | end 88 | -------------------------------------------------------------------------------- /travis/run.sh: -------------------------------------------------------------------------------- 1 | echo "VER = ${VER}" 2 | if [[ ${VER} == '5_1' ]]; then 3 | cd test/rails_5.1.x 4 | elif [[ ${VER} == '4_2' ]]; then 5 | cd test/rails_4.2.x 6 | elif [[ ${VER} == '3_2' ]]; then 7 | cd test/example 8 | fi 9 | echo $PWD 10 | 11 | bundle exec rspec 12 | --------------------------------------------------------------------------------