├── .gitignore ├── .rspec ├── Gemfile ├── Gemfile.lock ├── Guardfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── Vagrantfile ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ └── commits.coffee │ └── stylesheets │ │ ├── application.css │ │ ├── commits.scss │ │ └── custom.css.scss ├── controllers │ ├── application_controller.rb │ ├── commits_controller.rb │ └── concerns │ │ └── .keep ├── helpers │ ├── application_helper.rb │ └── commits_helper.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── commit.rb │ └── concerns │ │ ├── .keep │ │ └── commit │ │ └── searchable.rb └── views │ ├── commits │ ├── _search_form.html.erb │ ├── index.html.erb │ └── search.html.erb │ └── layouts │ ├── _footer.html.erb │ ├── _header.html.erb │ └── application.html.erb ├── bin ├── bundle ├── rails ├── rake ├── setup └── spring ├── chef └── moved_to_commit-infra_repo ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── mysqlpls.rb │ ├── session_store.rb │ ├── utf8_enforcer_tag.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── routes.rb └── secrets.yml ├── db ├── migrate │ ├── 20150201100358_create_commits.rb │ ├── 20150206073821_add_fulltext_index_to_commit.rb │ └── 20150815015250_remove_fulltext_index_from_commit.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── robots.txt └── sorry.html └── spec ├── factories.rb ├── models └── commit_spec.rb ├── rails_helper.rb ├── requests └── commits_spec.rb └── spec_helper.rb /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | !/log/.keep 17 | /tmp 18 | 19 | # Ignore Vagrant tempfiles. 20 | /.vagrant/ 21 | 22 | # Ignore bundle tempfiles. 23 | /vendor/ 24 | 25 | # Ignore data file 26 | /db/commits.txt 27 | 28 | # Ignore production environment 29 | config/environments/production.env 30 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '4.2.0' 6 | # Use sqlite3 as the database for Active Record 7 | #gem 'sqlite3' 8 | # Use SCSS for stylesheets 9 | gem 'sass-rails', '~> 5.0' 10 | # Use Uglifier as compressor for JavaScript assets 11 | gem 'uglifier', '>= 1.3.0' 12 | # Use CoffeeScript for .coffee assets and views 13 | gem 'coffee-rails', '~> 4.1.0' 14 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 15 | #gem 'therubyracer', platforms: :ruby 16 | 17 | # Use jquery as the JavaScript library 18 | gem 'jquery-rails' 19 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 20 | gem 'turbolinks' 21 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 22 | gem 'jbuilder', '~> 2.0' 23 | # bundle exec rake doc:rails generates the API under doc/api. 24 | gem 'sdoc', '~> 0.4.0', group: :doc 25 | 26 | # Use ActiveModel has_secure_password 27 | # gem 'bcrypt', '~> 3.1.7' 28 | 29 | # Use Unicorn as the app server 30 | # gem 'unicorn' 31 | 32 | # Use Capistrano for deployment 33 | # gem 'capistrano-rails', group: :development 34 | 35 | # style and font 36 | gem 'sprockets', '~> 2.12.3' 37 | gem 'bootstrap-sass', '~> 3.3.3' 38 | gem 'font-awesome-sass', '~> 4.3.0' 39 | 40 | # paginate 41 | gem 'will_paginate', '~> 3.0.7' 42 | gem 'bootstrap-will_paginate', '~> 0.0.10' 43 | 44 | # search 45 | gem 'elasticsearch-rails', '~> 0.1.7' 46 | gem 'elasticsearch-model', '~> 0.1.7' 47 | 48 | # database 49 | gem 'mysql2', '~> 0.3.17' 50 | 51 | group :development, :test do 52 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 53 | gem 'byebug' 54 | 55 | # Access an IRB console on exception pages or by using <%= console %> in views 56 | gem 'web-console', '~> 2.0' 57 | 58 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 59 | gem 'spring' 60 | 61 | # for test 62 | gem 'rspec-rails', '~> 3.2.0' 63 | gem 'guard', '~> 2.12.1' 64 | gem 'guard-rspec', '~> 4.5.0' 65 | gem 'spork-rails', '~> 4.0.0' 66 | gem 'guard-spork', '~> 2.1.0' 67 | gem 'childprocess', '~> 0.5.5' 68 | gem 'pry-byebug', '~> 3.0.1' 69 | end 70 | 71 | group :test do 72 | gem 'selenium-webdriver', '~> 2.44.0' 73 | gem 'capybara', '~> 2.4.4' 74 | gem 'terminal-notifier-guard', '~> 1.6.4' 75 | gem 'factory_girl_rails', '~> 4.5.0' 76 | gem 'database_cleaner', ' ~> 1.4.0' 77 | gem 'elasticsearch-extensions', '~> 0.0.18' 78 | end 79 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.2.0) 5 | actionpack (= 4.2.0) 6 | actionview (= 4.2.0) 7 | activejob (= 4.2.0) 8 | mail (~> 2.5, >= 2.5.4) 9 | rails-dom-testing (~> 1.0, >= 1.0.5) 10 | actionpack (4.2.0) 11 | actionview (= 4.2.0) 12 | activesupport (= 4.2.0) 13 | rack (~> 1.6.0) 14 | rack-test (~> 0.6.2) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | rails-html-sanitizer (~> 1.0, >= 1.0.1) 17 | actionview (4.2.0) 18 | activesupport (= 4.2.0) 19 | builder (~> 3.1) 20 | erubis (~> 2.7.0) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.1) 23 | activejob (4.2.0) 24 | activesupport (= 4.2.0) 25 | globalid (>= 0.3.0) 26 | activemodel (4.2.0) 27 | activesupport (= 4.2.0) 28 | builder (~> 3.1) 29 | activerecord (4.2.0) 30 | activemodel (= 4.2.0) 31 | activesupport (= 4.2.0) 32 | arel (~> 6.0) 33 | activesupport (4.2.0) 34 | i18n (~> 0.7) 35 | json (~> 1.7, >= 1.7.7) 36 | minitest (~> 5.1) 37 | thread_safe (~> 0.3, >= 0.3.4) 38 | tzinfo (~> 1.1) 39 | ansi (1.5.0) 40 | arel (6.0.0) 41 | autoprefixer-rails (5.1.1) 42 | execjs 43 | json 44 | binding_of_caller (0.7.2) 45 | debug_inspector (>= 0.0.1) 46 | bootstrap-sass (3.3.3) 47 | autoprefixer-rails (>= 5.0.0.1) 48 | sass (>= 3.2.19) 49 | bootstrap-will_paginate (0.0.10) 50 | will_paginate 51 | builder (3.2.2) 52 | byebug (3.5.1) 53 | columnize (~> 0.8) 54 | debugger-linecache (~> 1.2) 55 | slop (~> 3.6) 56 | capybara (2.4.4) 57 | mime-types (>= 1.16) 58 | nokogiri (>= 1.3.3) 59 | rack (>= 1.0.0) 60 | rack-test (>= 0.5.4) 61 | xpath (~> 2.0) 62 | celluloid (0.16.0) 63 | timers (~> 4.0.0) 64 | childprocess (0.5.5) 65 | ffi (~> 1.0, >= 1.0.11) 66 | coderay (1.1.0) 67 | coffee-rails (4.1.0) 68 | coffee-script (>= 2.2.0) 69 | railties (>= 4.0.0, < 5.0) 70 | coffee-script (2.3.0) 71 | coffee-script-source 72 | execjs 73 | coffee-script-source (1.9.0) 74 | columnize (0.9.0) 75 | database_cleaner (1.4.0) 76 | debug_inspector (0.0.2) 77 | debugger-linecache (1.2.0) 78 | diff-lcs (1.2.5) 79 | elasticsearch (1.0.12) 80 | elasticsearch-api (= 1.0.12) 81 | elasticsearch-transport (= 1.0.12) 82 | elasticsearch-api (1.0.12) 83 | multi_json 84 | elasticsearch-extensions (0.0.18) 85 | ansi 86 | ruby-prof 87 | elasticsearch-model (0.1.7) 88 | activesupport (> 3) 89 | elasticsearch (> 0.4) 90 | hashie 91 | elasticsearch-rails (0.1.7) 92 | elasticsearch-transport (1.0.12) 93 | faraday 94 | multi_json 95 | erubis (2.7.0) 96 | execjs (2.2.2) 97 | factory_girl (4.5.0) 98 | activesupport (>= 3.0.0) 99 | factory_girl_rails (4.5.0) 100 | factory_girl (~> 4.5.0) 101 | railties (>= 3.0.0) 102 | faraday (0.9.1) 103 | multipart-post (>= 1.2, < 3) 104 | ffi (1.9.6) 105 | font-awesome-sass (4.3.0) 106 | sass (~> 3.2) 107 | formatador (0.2.5) 108 | globalid (0.3.0) 109 | activesupport (>= 4.1.0) 110 | guard (2.12.1) 111 | formatador (>= 0.2.4) 112 | listen (~> 2.7) 113 | lumberjack (~> 1.0) 114 | nenv (~> 0.1) 115 | notiffany (~> 0.0) 116 | pry (>= 0.9.12) 117 | shellany (~> 0.0) 118 | thor (>= 0.18.1) 119 | guard-compat (1.2.1) 120 | guard-rspec (4.5.0) 121 | guard (~> 2.1) 122 | guard-compat (~> 1.1) 123 | rspec (>= 2.99.0, < 4.0) 124 | guard-spork (2.1.0) 125 | childprocess (>= 0.2.3) 126 | guard (~> 2.0) 127 | guard-compat (~> 1.0) 128 | spork (>= 0.8.4) 129 | hashie (3.4.2) 130 | hike (1.2.3) 131 | hitimes (1.2.2) 132 | i18n (0.7.0) 133 | jbuilder (2.2.6) 134 | activesupport (>= 3.0.0, < 5) 135 | multi_json (~> 1.2) 136 | jquery-rails (4.0.3) 137 | rails-dom-testing (~> 1.0) 138 | railties (>= 4.2.0) 139 | thor (>= 0.14, < 2.0) 140 | json (1.8.2) 141 | listen (2.8.5) 142 | celluloid (>= 0.15.2) 143 | rb-fsevent (>= 0.9.3) 144 | rb-inotify (>= 0.9) 145 | loofah (2.0.1) 146 | nokogiri (>= 1.5.9) 147 | lumberjack (1.0.9) 148 | mail (2.6.3) 149 | mime-types (>= 1.16, < 3) 150 | method_source (0.8.2) 151 | mime-types (2.4.3) 152 | mini_portile (0.6.2) 153 | minitest (5.5.1) 154 | multi_json (1.10.1) 155 | multipart-post (2.0.0) 156 | mysql2 (0.3.17) 157 | nenv (0.2.0) 158 | nokogiri (1.6.6.2) 159 | mini_portile (~> 0.6.0) 160 | notiffany (0.0.5) 161 | nenv (~> 0.1) 162 | shellany (~> 0.0) 163 | pry (0.10.1) 164 | coderay (~> 1.1.0) 165 | method_source (~> 0.8.1) 166 | slop (~> 3.4) 167 | pry-byebug (3.0.1) 168 | byebug (~> 3.4) 169 | pry (~> 0.10) 170 | rack (1.6.0) 171 | rack-test (0.6.3) 172 | rack (>= 1.0) 173 | rails (4.2.0) 174 | actionmailer (= 4.2.0) 175 | actionpack (= 4.2.0) 176 | actionview (= 4.2.0) 177 | activejob (= 4.2.0) 178 | activemodel (= 4.2.0) 179 | activerecord (= 4.2.0) 180 | activesupport (= 4.2.0) 181 | bundler (>= 1.3.0, < 2.0) 182 | railties (= 4.2.0) 183 | sprockets-rails 184 | rails-deprecated_sanitizer (1.0.3) 185 | activesupport (>= 4.2.0.alpha) 186 | rails-dom-testing (1.0.5) 187 | activesupport (>= 4.2.0.beta, < 5.0) 188 | nokogiri (~> 1.6.0) 189 | rails-deprecated_sanitizer (>= 1.0.1) 190 | rails-html-sanitizer (1.0.1) 191 | loofah (~> 2.0) 192 | railties (4.2.0) 193 | actionpack (= 4.2.0) 194 | activesupport (= 4.2.0) 195 | rake (>= 0.8.7) 196 | thor (>= 0.18.1, < 2.0) 197 | rake (10.4.2) 198 | rb-fsevent (0.9.4) 199 | rb-inotify (0.9.5) 200 | ffi (>= 0.5.0) 201 | rdoc (4.2.0) 202 | rspec (3.2.0) 203 | rspec-core (~> 3.2.0) 204 | rspec-expectations (~> 3.2.0) 205 | rspec-mocks (~> 3.2.0) 206 | rspec-core (3.2.0) 207 | rspec-support (~> 3.2.0) 208 | rspec-expectations (3.2.0) 209 | diff-lcs (>= 1.2.0, < 2.0) 210 | rspec-support (~> 3.2.0) 211 | rspec-mocks (3.2.0) 212 | diff-lcs (>= 1.2.0, < 2.0) 213 | rspec-support (~> 3.2.0) 214 | rspec-rails (3.2.0) 215 | actionpack (>= 3.0, <= 4.2) 216 | activesupport (>= 3.0, <= 4.2) 217 | railties (>= 3.0, <= 4.2) 218 | rspec-core (~> 3.2.0) 219 | rspec-expectations (~> 3.2.0) 220 | rspec-mocks (~> 3.2.0) 221 | rspec-support (~> 3.2.0) 222 | rspec-support (3.2.1) 223 | ruby-prof (0.15.8) 224 | rubyzip (1.1.7) 225 | sass (3.4.11) 226 | sass-rails (5.0.1) 227 | railties (>= 4.0.0, < 5.0) 228 | sass (~> 3.1) 229 | sprockets (>= 2.8, < 4.0) 230 | sprockets-rails (>= 2.0, < 4.0) 231 | tilt (~> 1.1) 232 | sdoc (0.4.1) 233 | json (~> 1.7, >= 1.7.7) 234 | rdoc (~> 4.0) 235 | selenium-webdriver (2.44.0) 236 | childprocess (~> 0.5) 237 | multi_json (~> 1.0) 238 | rubyzip (~> 1.0) 239 | websocket (~> 1.0) 240 | shellany (0.0.1) 241 | slop (3.6.0) 242 | spork (1.0.0rc4) 243 | spork-rails (4.0.0) 244 | rails (>= 3.0.0, < 5) 245 | spork (>= 1.0rc0) 246 | spring (1.2.0) 247 | sprockets (2.12.3) 248 | hike (~> 1.2) 249 | multi_json (~> 1.0) 250 | rack (~> 1.0) 251 | tilt (~> 1.1, != 1.3.0) 252 | sprockets-rails (2.2.4) 253 | actionpack (>= 3.0) 254 | activesupport (>= 3.0) 255 | sprockets (>= 2.8, < 4.0) 256 | terminal-notifier-guard (1.6.4) 257 | thor (0.19.1) 258 | thread_safe (0.3.4) 259 | tilt (1.4.1) 260 | timers (4.0.1) 261 | hitimes 262 | turbolinks (2.5.3) 263 | coffee-rails 264 | tzinfo (1.2.2) 265 | thread_safe (~> 0.1) 266 | uglifier (2.7.0) 267 | execjs (>= 0.3.0) 268 | json (>= 1.8.0) 269 | web-console (2.0.0) 270 | activemodel (~> 4.0) 271 | binding_of_caller (>= 0.7.2) 272 | railties (~> 4.0) 273 | sprockets-rails (>= 2.0, < 4.0) 274 | websocket (1.2.1) 275 | will_paginate (3.0.7) 276 | xpath (2.0.0) 277 | nokogiri (~> 1.3) 278 | 279 | PLATFORMS 280 | ruby 281 | 282 | DEPENDENCIES 283 | bootstrap-sass (~> 3.3.3) 284 | bootstrap-will_paginate (~> 0.0.10) 285 | byebug 286 | capybara (~> 2.4.4) 287 | childprocess (~> 0.5.5) 288 | coffee-rails (~> 4.1.0) 289 | database_cleaner (~> 1.4.0) 290 | elasticsearch-extensions (~> 0.0.18) 291 | elasticsearch-model (~> 0.1.7) 292 | elasticsearch-rails (~> 0.1.7) 293 | factory_girl_rails (~> 4.5.0) 294 | font-awesome-sass (~> 4.3.0) 295 | guard (~> 2.12.1) 296 | guard-rspec (~> 4.5.0) 297 | guard-spork (~> 2.1.0) 298 | jbuilder (~> 2.0) 299 | jquery-rails 300 | mysql2 (~> 0.3.17) 301 | pry-byebug (~> 3.0.1) 302 | rails (= 4.2.0) 303 | rspec-rails (~> 3.2.0) 304 | sass-rails (~> 5.0) 305 | sdoc (~> 0.4.0) 306 | selenium-webdriver (~> 2.44.0) 307 | spork-rails (~> 4.0.0) 308 | spring 309 | sprockets (~> 2.12.3) 310 | terminal-notifier-guard (~> 1.6.4) 311 | turbolinks 312 | uglifier (>= 1.3.0) 313 | web-console (~> 2.0) 314 | will_paginate (~> 3.0.7) 315 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # A sample Guardfile 2 | # More info at https://github.com/guard/guard#readme 3 | 4 | ## Uncomment and set this to only include directories you want to watch 5 | # directories %w(app lib config test spec features) 6 | 7 | ## Uncomment to clear the screen before every task 8 | # clearing :on 9 | 10 | ## Guard internally checks for changes in the Guardfile and exits. 11 | ## If you want Guard to automatically start up again, run guard in a 12 | ## shell loop, e.g.: 13 | ## 14 | ## $ while bundle exec guard; do echo "Restarting Guard..."; done 15 | ## 16 | ## Note: if you are using the `directories` clause above and you are not 17 | ## watching the project directory ('.'), then you will want to move 18 | ## the Guardfile to a watched dir and symlink it back, e.g. 19 | # 20 | # $ mkdir config 21 | # $ mv Guardfile config/ 22 | # $ ln -s config/Guardfile . 23 | # 24 | # and, you'll have to watch "config/Guardfile" instead of "Guardfile" 25 | 26 | # Note: The cmd option is now required due to the increasing number of ways 27 | # rspec may be run, below are examples of the most common uses. 28 | # * bundler: 'bundle exec rspec' 29 | # * bundler binstubs: 'bin/rspec' 30 | # * spring: 'bin/rspec' (This will use spring if running and you have 31 | # installed the spring binstubs per the docs) 32 | # * zeus: 'zeus rspec' (requires the server to be started separately) 33 | # * 'just' rspec: 'rspec' 34 | 35 | guard :rspec, cmd: "bundle exec rspec", all_after_pass: false do 36 | require "guard/rspec/dsl" 37 | dsl = Guard::RSpec::Dsl.new(self) 38 | 39 | # Feel free to open issues for suggestions and improvements 40 | 41 | # RSpec files 42 | rspec = dsl.rspec 43 | watch(rspec.spec_helper) { rspec.spec_dir } 44 | watch(rspec.spec_support) { rspec.spec_dir } 45 | watch(rspec.spec_files) 46 | 47 | # Ruby files 48 | ruby = dsl.ruby 49 | dsl.watch_spec_files_for(ruby.lib_files) 50 | 51 | # Rails files 52 | rails = dsl.rails(view_extensions: %w(erb haml slim)) 53 | dsl.watch_spec_files_for(rails.app_files) 54 | dsl.watch_spec_files_for(rails.views) 55 | 56 | watch(rails.controllers) do |m| 57 | [ 58 | rspec.spec.("routing/#{m[1]}_routing"), 59 | rspec.spec.("controllers/#{m[1]}_controller"), 60 | rspec.spec.("acceptance/#{m[1]}") 61 | ] 62 | end 63 | 64 | # Rails config changes 65 | watch(rails.spec_helper) { rspec.spec_dir } 66 | watch(rails.routes) { "#{rspec.spec_dir}/routing" } 67 | watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" } 68 | 69 | # Capybara features specs 70 | watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") } 71 | 72 | # Turnip features and steps 73 | watch(%r{^spec/acceptance/(.+)\.feature$}) 74 | watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m| 75 | Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Masayuki Morita 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # commit-m 2 | 3 | Web service for search commit message examples 4 | 5 | (The web site has been closed): http://commit-m.minamijoyo.com/ 6 | 7 | This repository includes only web application code of commit-m. 8 | Crawler code is available at minamijoyo/commit-crawler repository. 9 | Infra code is available at minamijoyo/commit-infra repository. 10 | 11 | See also: 12 | - https://github.com/minamijoyo/commit-crawler 13 | - https://github.com/minamijoyo/commit-infra 14 | - https://minamijoyo.hatenablog.com/entry/20150220/p1 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = "2" 5 | 6 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 7 | config.vm.box = "opscode-centos-6.5" 8 | config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box" 9 | 10 | config.vm.network :"forwarded_port", guest: 3000, host: 3000 11 | config.vm.network :"forwarded_port", guest: 9200, host: 9200 12 | config.vm.network "private_network", ip: "192.168.33.10" 13 | config.vm.provider "virtualbox" do |vb| 14 | vb.customize ["modifyvm", :id, "--memory", "4096"] 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require_tree . 17 | //= require bootstrap-sprockets 18 | -------------------------------------------------------------------------------- /app/assets/javascripts/commits.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/commits.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the commits controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/custom.css.scss: -------------------------------------------------------------------------------- 1 | @import "bootstrap-sprockets"; 2 | @import "bootstrap"; 3 | @import "font-awesome-sprockets"; 4 | @import "font-awesome"; 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/controllers/commits_controller.rb: -------------------------------------------------------------------------------- 1 | class CommitsController < ApplicationController 2 | def index 3 | @commits = [] 4 | @keyword = "" 5 | end 6 | 7 | def search 8 | @keyword = params[:keyword] 9 | @commits = Commit.search_message(@keyword).paginate(page: params[:page]) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/commits_helper.rb: -------------------------------------------------------------------------------- 1 | module CommitsHelper 2 | def highlight_message(commit) 3 | message = commit.try!(:highlight).try!(:message).try!(:join) || commit.message 4 | sanitize(message, tags: %w[mark]) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/app/mailers/.keep -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/app/models/.keep -------------------------------------------------------------------------------- /app/models/commit.rb: -------------------------------------------------------------------------------- 1 | class Commit < ActiveRecord::Base 2 | include Commit::Searchable 3 | def self.search_message(keyword) 4 | if keyword.present? 5 | query = { 6 | "query": { 7 | "match": { 8 | "message": keyword 9 | } 10 | }, 11 | "highlight": { 12 | "pre_tags": [''], 13 | "post_tags": [''], 14 | "fields": { 15 | "message": {} 16 | } 17 | } 18 | } 19 | Commit.__elasticsearch__.search(query) 20 | else 21 | Commit.none 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/concerns/commit/searchable.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/concern' 2 | module Commit::Searchable 3 | extend ActiveSupport::Concern 4 | 5 | included do 6 | include Elasticsearch::Model 7 | 8 | index_name "commitm" 9 | 10 | settings index: { 11 | number_of_shards: 1, 12 | number_of_replicas: 0, 13 | analysis: { 14 | analyzer: { 15 | commit_analyzer: { 16 | tokenizer: 'standard', 17 | filter: [ 18 | 'lowercase', 19 | 'porter_stem' 20 | ] 21 | } 22 | } 23 | } 24 | } do 25 | mapping _source: { enabled: true } do 26 | indexes :id, type: 'integer', index: 'not_analyzed' 27 | indexes :repo_full_name, type: 'string' 28 | indexes :sha, type: 'string', index: 'not_analyzed' 29 | indexes :message, type: 'string', analyzer: 'commit_analyzer' 30 | end 31 | end 32 | end 33 | 34 | module ClassMethods 35 | def create_index!(options={}) 36 | client = __elasticsearch__.client 37 | client.indices.delete index: "commitm" rescue nil if options[:force] 38 | client.indices.create index: "commitm", 39 | body: { 40 | settings: settings.to_hash, 41 | mappings: mappings.to_hash 42 | } 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /app/views/commits/_search_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag({controller: :commits, action: :search}, {method: "get", class: "form-inline"}) do %> 2 | <%= text_field_tag :keyword, @keyword, size: '50%', class: "form-control", placeholder: "keyword" %> 3 | <%= button_tag(type: "submit", name: nil, class: "btn btn-default") do %> 4 | Search 5 | <% end %> 6 | <% end %> 7 | -------------------------------------------------------------------------------- /app/views/commits/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render 'search_form' %> 2 | -------------------------------------------------------------------------------- /app/views/commits/search.html.erb: -------------------------------------------------------------------------------- 1 | <%= render 'search_form' %> 2 |
3 | <% unless @commits.nil? %> 4 | <%= pluralize(@commits.total_entries, "result") %>. 5 | <% end %> 6 | <% if @commits.any? %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <% @commits.each do |commit| %> 17 | 18 | 19 | 20 | 21 | 22 | <% end %> 23 | 24 |
MessageRepositorySHA
<%= highlight_message(commit) %><%= link_to commit.repo_full_name, "https://github.com/#{commit.repo_full_name}", { :target => "_blank" } %><%= link_to commit.sha[0,7], "https://github.com/#{commit.repo_full_name}/commit/#{commit.sha}", { :target => "_blank" } %>
25 | <%= will_paginate @commits, :params => { :keyword => @keyword} %> 26 | <% end %> 27 | -------------------------------------------------------------------------------- /app/views/layouts/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /app/views/layouts/_header.html.erb: -------------------------------------------------------------------------------- 1 |

commit-m

2 |

GitHubコミットメッセージの文例が検索できるサービス

3 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | commit-m: GitHubコミットメッセージの文例が検索できるサービス 12 | 13 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 14 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 15 | <%= csrf_meta_tags %> 16 | 17 | 18 | 19 | 23 | 24 | 25 | 34 | 35 | 36 | 37 |
38 | <%= render 'layouts/header' %> 39 | <%= yield %> 40 | <%= render 'layouts/footer' %> 41 |
42 | 43 | 44 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | APP_PATH = File.expand_path('../../config/application', __FILE__) 7 | require_relative '../config/boot' 8 | require 'rails/commands' 9 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | require_relative '../config/boot' 7 | require 'rake' 8 | Rake.application.run 9 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast 4 | # It gets overwritten when you run the `spring binstub` command 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) 11 | ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) 12 | ENV["GEM_HOME"] = "" 13 | Gem.paths = ENV 14 | 15 | gem "spring", match[1] 16 | require "spring/binstub" 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /chef/moved_to_commit-infra_repo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/chef/moved_to_commit-infra_repo -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module CommitM 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | 23 | # Do not swallow errors in after_commit/after_rollback callbacks. 24 | config.active_record.raise_in_transactional_callbacks = true 25 | 26 | # for bootstrap-sass 27 | config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) 28 | 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: mysql2 3 | charset: utf8mb4 4 | encoding: utf8mb4 5 | collation: utf8mb4_general_ci 6 | reconnect: false 7 | pool: 5 8 | 9 | development: 10 | <<: *default 11 | socket: /var/lib/mysql/mysql.sock 12 | database: db_development 13 | username: user_development 14 | password: pass_development 15 | 16 | test: 17 | <<: *default 18 | socket: /var/lib/mysql/mysql.sock 19 | database: db_test 20 | username: user_test 21 | password: pass_test 22 | 23 | production: 24 | <<: *default 25 | host: <%= ENV['DB_HOST'] %> 26 | port: <%= ENV['DB_PORT'] %> 27 | database: <%= ENV['DB_DATABASE'] %> 28 | username: <%= ENV['DB_USERNAME'] %> 29 | password: <%= ENV['DB_PASSWORD'] %> 30 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | end 42 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | # config.log_tags = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/mysqlpls.rb: -------------------------------------------------------------------------------- 1 | require 'active_record/connection_adapters/abstract_mysql_adapter' 2 | 3 | module ActiveRecord 4 | module ConnectionAdapters 5 | class AbstractMysqlAdapter 6 | NATIVE_DATABASE_TYPES[:string] = { :name => "varchar", :limit => 191 } 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /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: '_commit_m_session' 4 | -------------------------------------------------------------------------------- /config/initializers/utf8_enforcer_tag.rb: -------------------------------------------------------------------------------- 1 | module ActionView 2 | module Helpers 3 | module FormTagHelper 4 | def utf8_enforcer_tag 5 | "".html_safe 6 | end 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # 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 'commits#index' 7 | match 'commits/search', to: 'commits#search', via: ['post', 'get'] 8 | 9 | # Example of regular route: 10 | # get 'products/:id' => 'catalog#view' 11 | 12 | # Example of named route that can be invoked with purchase_url(id: product.id) 13 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 14 | 15 | # Example resource route (maps HTTP verbs to controller actions automatically): 16 | # resources :products 17 | 18 | # Example resource route with options: 19 | # resources :products do 20 | # member do 21 | # get 'short' 22 | # post 'toggle' 23 | # end 24 | # 25 | # collection do 26 | # get 'sold' 27 | # end 28 | # end 29 | 30 | # Example resource route with sub-resources: 31 | # resources :products do 32 | # resources :comments, :sales 33 | # resource :seller 34 | # end 35 | 36 | # Example resource route with more complex sub-resources: 37 | # resources :products do 38 | # resources :comments 39 | # resources :sales do 40 | # get 'recent', on: :collection 41 | # end 42 | # end 43 | 44 | # Example resource route with concerns: 45 | # concern :toggleable do 46 | # post 'toggle' 47 | # end 48 | # resources :posts, concerns: :toggleable 49 | # resources :photos, concerns: :toggleable 50 | 51 | # Example resource route within a namespace: 52 | # namespace :admin do 53 | # # Directs /admin/products/* to Admin::ProductsController 54 | # # (app/controllers/admin/products_controller.rb) 55 | # resources :products 56 | # end 57 | end 58 | -------------------------------------------------------------------------------- /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: a5e8fba249fa55bf43311a8d6a45384b1152b1b73f310c40b043f51e9d20eb7f854b29818b1f738310c261ba37f2493b5bfecbc997564e859e2861f4010df1b4 15 | 16 | test: 17 | secret_key_base: 7a3aefbdb63be85be18e59a7f6b408aed0a711cc5ff712a40bdd046c1cedd841bf2ffbdcacbb2f0db31a8e78ecbc2545be2d11c302ec36f27ce7351239f1171b 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /db/migrate/20150201100358_create_commits.rb: -------------------------------------------------------------------------------- 1 | class CreateCommits < ActiveRecord::Migration 2 | def change 3 | create_table :commits do |t| 4 | t.string :repo_full_name 5 | t.string :sha 6 | t.text :message 7 | 8 | t.timestamps null: false 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150206073821_add_fulltext_index_to_commit.rb: -------------------------------------------------------------------------------- 1 | class AddFulltextIndexToCommit < ActiveRecord::Migration 2 | def change 3 | add_index :commits, :message, type: :fulltext 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150815015250_remove_fulltext_index_from_commit.rb: -------------------------------------------------------------------------------- 1 | class RemoveFulltextIndexFromCommit < ActiveRecord::Migration 2 | def change 3 | remove_index :commits, :message 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20150815015250) do 15 | 16 | create_table "commits", force: :cascade do |t| 17 | t.string "repo_full_name", limit: 191 18 | t.string "sha", limit: 191 19 | t.text "message", limit: 65535 20 | t.datetime "created_at", null: false 21 | t.datetime "updated_at", null: false 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /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 | 9 | 10 | #CSV.foreach('db/commits.txt') do |row| 11 | # Commit.create(:repo_full_name => row[0], :sha => row[1], :message => row[2]) 12 | #end 13 | 14 | # commit message can contain character , 15 | # so read line and split by myself. 16 | open('db/commits.txt') do |file| 17 | file.each do |line| 18 | repo_full_name, sha, message = line.split(', ', 3) 19 | Commit.create(:repo_full_name => repo_full_name, 20 | :sha => sha, 21 | :message => message[0,1024]) 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

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

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

The change you wanted was rejected.

62 |

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

63 |
64 |

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

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

We're sorry, but something went wrong.

62 |
63 |

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

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minamijoyo/commit-m/1e96590e29495cf24d3e60d07577bb975e3dbe1a/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: /$ 3 | Disallow: /* 4 | -------------------------------------------------------------------------------- /public/sorry.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | sorry 9 | 10 | 11 | Sorry. Site is currently under maintenance. Please try again later. If you have an inquiry, please send your messeage to @minamijoyo . 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/factories.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :commit do 3 | sequence(:repo_full_name) { |n| "Repo#{n}" } 4 | sequence(:sha) { |n| "#{n}"} 5 | sequence(:message) { |n| "Message #{n}"} 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/models/commit_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Commit, type: :model do 4 | before { @commit = Commit.new( 5 | repo_full_name: 'minamijoyo/commit-m', 6 | sha: 'ad029c9d6d79ad6e1b2ca4ff33e998c23c471675', 7 | message: 'Initial commit') } 8 | 9 | subject { @commit } 10 | 11 | it { should respond_to(:repo_full_name) } 12 | it { should respond_to(:sha) } 13 | it { should respond_to(:message) } 14 | 15 | it { should be_valid } 16 | 17 | end 18 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'spork' 3 | #uncomment the following line to use spork with the debugger 4 | #require 'spork/ext/ruby-debug' 5 | 6 | Spork.prefork do 7 | # Loading more in this block will cause your tests to run faster. However, 8 | # if you change any configuration or code from libraries loaded here, you'll 9 | # need to restart spork for it take effect. 10 | 11 | # This file is copied to spec/ when you run 'rails generate rspec:install' 12 | ENV['RAILS_ENV'] ||= 'test' 13 | require 'spec_helper' 14 | require File.expand_path('../../config/environment', __FILE__) 15 | require 'rspec/rails' 16 | require 'database_cleaner' 17 | require 'elasticsearch/extensions/test/cluster' 18 | # Add additional requires below this line. Rails is not loaded until this point! 19 | 20 | # Requires supporting ruby files with custom matchers and macros, etc, in 21 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 22 | # run as spec files by default. This means that files in spec/support that end 23 | # in _spec.rb will both be required and run as specs, causing the specs to be 24 | # run twice. It is recommended that you do not name files matching this glob to 25 | # end with _spec.rb. You can configure this pattern with the --pattern 26 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 27 | # 28 | # The following line is provided for convenience purposes. It has the downside 29 | # of increasing the boot-up time by auto-requiring all files in the support 30 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 31 | # require only the support files necessary. 32 | # 33 | # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } 34 | 35 | # Checks for pending migrations before tests are run. 36 | # If you are not using ActiveRecord, you can remove this line. 37 | ActiveRecord::Migration.maintain_test_schema! 38 | 39 | RSpec.configure do |config| 40 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 41 | # config.fixture_path = "#{::Rails.root}/spec/fixtures" 42 | 43 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 44 | # examples within a transaction, remove the following line or assign false 45 | # instead of true. 46 | # config.use_transactional_fixtures = true 47 | 48 | # RSpec Rails can automatically mix in different behaviours to your tests 49 | # based on their file location, for example enabling you to call `get` and 50 | # `post` in specs under `spec/controllers`. 51 | # 52 | # You can disable this behaviour by removing the line below, and instead 53 | # explicitly tag your specs with their type, e.g.: 54 | # 55 | # RSpec.describe UsersController, :type => :controller do 56 | # # ... 57 | # end 58 | # 59 | # The different available types are documented in the features, such as in 60 | # https://relishapp.com/rspec/rspec-rails/docs 61 | config.infer_spec_type_from_file_location! 62 | 63 | # for test 64 | config.include Capybara::DSL 65 | 66 | config.before(:suite) do 67 | DatabaseCleaner.strategy = :truncation 68 | end 69 | 70 | config.before(:each) do 71 | DatabaseCleaner.start 72 | end 73 | 74 | config.after(:each) do 75 | DatabaseCleaner.clean 76 | end 77 | 78 | # Elasticsearch test setting 79 | config.before(:all, :elasticsearch) do 80 | Elasticsearch::Extensions::Test::Cluster.start(nodes: 1) unless Elasticsearch::Extensions::Test::Cluster.running? 81 | end 82 | 83 | config.after(:all, :elasticsearch) do 84 | Elasticsearch::Extensions::Test::Cluster.stop if Elasticsearch::Extensions::Test::Cluster.running? 85 | end 86 | end 87 | 88 | def elasticsearch_create_index_and_import 89 | Commit.__elasticsearch__.create_index! force: true 90 | Commit.import 91 | sleep 1 92 | end 93 | 94 | def elasticsearch_delete_index 95 | Commit.__elasticsearch__.client.indices.delete index: Commit.index_name 96 | end 97 | end 98 | 99 | Spork.each_run do 100 | # This code will be run each time you run your specs. 101 | 102 | end 103 | -------------------------------------------------------------------------------- /spec/requests/commits_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe "Commits", type: :request do 4 | subject { page } 5 | 6 | describe "Root Page" do 7 | before { visit root_path } 8 | 9 | describe "Site name" do 10 | it { should have_content('commit-m') } 11 | it { should have_title('commit-m') } 12 | end 13 | 14 | describe "Twitter link" do 15 | it { should have_link("@minamijoyo", href: "https://twitter.com/minamijoyo")} 16 | end 17 | 18 | describe "Search form", :elasticsearch do 19 | before do 20 | 3.times { FactoryGirl.create(:commit) } 21 | elasticsearch_create_index_and_import 22 | end 23 | 24 | after do 25 | elasticsearch_delete_index 26 | Commit.delete_all 27 | end 28 | 29 | describe 'Click Search button' do 30 | before do 31 | fill_in "keyword", with:"Message" 32 | click_button "Search" 33 | end 34 | it { should have_content('3 results.') } 35 | end 36 | 37 | end 38 | end 39 | 40 | describe "Search Page", :elasticsearch do 41 | before do 42 | 31.times { FactoryGirl.create(:commit) } 43 | elasticsearch_create_index_and_import 44 | end 45 | 46 | after do 47 | elasticsearch_delete_index 48 | Commit.delete_all 49 | end 50 | 51 | describe "Search" do 52 | before do 53 | visit commits_search_path 54 | fill_in "keyword", with:"Message" 55 | click_button "Search" 56 | end 57 | it { should have_content('31 results.') } 58 | it { should have_selector('table') } 59 | it { should have_content('Message') } 60 | it { should have_selector('div.pagination') } 61 | 62 | describe "Pagination" do 63 | before { all('.pagination')[1].click_link('2') } 64 | it { should have_content('Message') } 65 | end 66 | end 67 | end 68 | 69 | end 70 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # The generated `.rspec` file contains `--require spec_helper` which will cause 4 | # this file to always be loaded, without a need to explicitly require it in any 5 | # files. 6 | # 7 | # Given that it is always loaded, you are encouraged to keep this file as 8 | # light-weight as possible. Requiring heavyweight dependencies from this file 9 | # will add to the boot time of your test suite on EVERY test run, even for an 10 | # individual file that may not need all of that loaded. Instead, consider making 11 | # a separate helper file that requires the additional dependencies and performs 12 | # the additional setup, and require it from the spec files that actually need 13 | # it. 14 | # 15 | # The `.rspec` file also contains a few flags that are not defaults but that 16 | # users commonly want. 17 | # 18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 19 | RSpec.configure do |config| 20 | # rspec-expectations config goes here. You can use an alternate 21 | # assertion/expectation library such as wrong or the stdlib/minitest 22 | # assertions if you prefer. 23 | config.expect_with :rspec do |expectations| 24 | # This option will default to `true` in RSpec 4. It makes the `description` 25 | # and `failure_message` of custom matchers include text for helper methods 26 | # defined using `chain`, e.g.: 27 | # be_bigger_than(2).and_smaller_than(4).description 28 | # # => "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 | --------------------------------------------------------------------------------