├── .buildpacks ├── .gitignore ├── .travis.yml ├── CHAGELOG ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Rakefile ├── app.json ├── app ├── assets │ ├── javascripts │ │ ├── ace │ │ │ ├── ace.js │ │ │ ├── ext-modelist.js │ │ │ ├── mode-abap.js │ │ │ ├── mode-actionscript.js │ │ │ ├── mode-ada.js │ │ │ ├── mode-asciidoc.js │ │ │ ├── mode-assembly_x86.js │ │ │ ├── mode-autohotkey.js │ │ │ ├── mode-batchfile.js │ │ │ ├── mode-c9search.js │ │ │ ├── mode-c_cpp.js │ │ │ ├── mode-clojure.js │ │ │ ├── mode-cobol.js │ │ │ ├── mode-coffee.js │ │ │ ├── mode-coldfusion.js │ │ │ ├── mode-csharp.js │ │ │ ├── mode-css.js │ │ │ ├── mode-curly.js │ │ │ ├── mode-d.js │ │ │ ├── mode-dart.js │ │ │ ├── mode-diff.js │ │ │ ├── mode-django.js │ │ │ ├── mode-dot.js │ │ │ ├── mode-ejs.js │ │ │ ├── mode-erlang.js │ │ │ ├── mode-forth.js │ │ │ ├── mode-ftl.js │ │ │ ├── mode-glsl.js │ │ │ ├── mode-golang.js │ │ │ ├── mode-groovy.js │ │ │ ├── mode-haml.js │ │ │ ├── mode-haskell.js │ │ │ ├── mode-haxe.js │ │ │ ├── mode-html.js │ │ │ ├── mode-html_ruby.js │ │ │ ├── mode-ini.js │ │ │ ├── mode-jade.js │ │ │ ├── mode-java.js │ │ │ ├── mode-javascript.js │ │ │ ├── mode-json.js │ │ │ ├── mode-jsoniq.js │ │ │ ├── mode-jsp.js │ │ │ ├── mode-jsx.js │ │ │ ├── mode-julia.js │ │ │ ├── mode-latex.js │ │ │ ├── mode-less.js │ │ │ ├── mode-liquid.js │ │ │ ├── mode-lisp.js │ │ │ ├── mode-livescript.js │ │ │ ├── mode-logiql.js │ │ │ ├── mode-lsl.js │ │ │ ├── mode-lua.js │ │ │ ├── mode-luapage.js │ │ │ ├── mode-lucene.js │ │ │ ├── mode-makefile.js │ │ │ ├── mode-markdown.js │ │ │ ├── mode-matlab.js │ │ │ ├── mode-mushcode.js │ │ │ ├── mode-mushcode_high_rules.js │ │ │ ├── mode-mysql.js │ │ │ ├── mode-objectivec.js │ │ │ ├── mode-ocaml.js │ │ │ ├── mode-pascal.js │ │ │ ├── mode-perl.js │ │ │ ├── mode-pgsql.js │ │ │ ├── mode-php.js │ │ │ ├── mode-plain_text.js │ │ │ ├── mode-powershell.js │ │ │ ├── mode-prolog.js │ │ │ ├── mode-properties.js │ │ │ ├── mode-python.js │ │ │ ├── mode-r.js │ │ │ ├── mode-rdoc.js │ │ │ ├── mode-rhtml.js │ │ │ ├── mode-ruby.js │ │ │ ├── mode-rust.js │ │ │ ├── mode-sass.js │ │ │ ├── mode-scad.js │ │ │ ├── mode-scala.js │ │ │ ├── mode-scheme.js │ │ │ ├── mode-scss.js │ │ │ ├── mode-sh.js │ │ │ ├── mode-snippets.js │ │ │ ├── mode-sql.js │ │ │ ├── mode-stylus.js │ │ │ ├── mode-svg.js │ │ │ ├── mode-tcl.js │ │ │ ├── mode-tex.js │ │ │ ├── mode-text.js │ │ │ ├── mode-textile.js │ │ │ ├── mode-tmsnippet.js │ │ │ ├── mode-toml.js │ │ │ ├── mode-twig.js │ │ │ ├── mode-typescript.js │ │ │ ├── mode-vbscript.js │ │ │ ├── mode-velocity.js │ │ │ ├── mode-verilog.js │ │ │ ├── mode-xml.js │ │ │ ├── mode-xquery.js │ │ │ ├── mode-yaml.js │ │ │ └── theme-github.js │ │ ├── application.js │ │ ├── code_prettify.js │ │ └── header.js │ └── stylesheets │ │ ├── application.css │ │ ├── bootstrap_and_overrides.css.less │ │ └── code_prettify.css ├── controllers │ ├── application_controller.rb │ ├── comments_controller.rb │ ├── favorites_controller.rb │ ├── gists_controller.rb │ ├── root_controller.rb │ ├── sessions_controller.rb │ └── users_controller.rb ├── helpers │ └── application_helper.rb ├── mailers │ └── .gitkeep ├── models │ ├── comment.rb │ ├── concerns │ │ └── basic_persistence.rb │ ├── favorite.rb │ ├── gist.rb │ ├── gist_file.rb │ ├── gist_fork_creation.rb │ ├── gist_history.rb │ ├── gist_persistence.rb │ └── user.rb └── views │ ├── comments │ ├── _form.html.erb │ └── _list.html.erb │ ├── common │ ├── _favorites.html.erb │ ├── _flash_error.html.erb │ ├── _flash_notice.html.erb │ ├── _mygists.html.erb │ └── _search_form.html.erb │ ├── favorites │ └── just_required_for_rspec │ ├── gists │ ├── _fork_of.html.erb │ ├── _forks.html.erb │ ├── _form.html.erb │ ├── _gist_files_input.html.erb │ ├── _history.html.erb │ ├── _list.html.erb │ ├── _mine_page.html.erb │ ├── _page.html.erb │ ├── _user_fav_page.html.erb │ ├── _user_page.html.erb │ ├── add_gist_files_input.js.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── mine.html.erb │ ├── mine_page.js.erb │ ├── new.html.erb │ ├── page.js.erb │ ├── show.html.erb │ ├── user_fav_page.js.erb │ └── user_page.js.erb │ ├── kaminari │ ├── _first_page.html.erb │ ├── _gap.html.erb │ ├── _last_page.html.erb │ ├── _page.html.erb │ └── _paginator.html.erb │ ├── layouts │ └── application.html.erb │ ├── root │ └── index.html.erb │ ├── sessions │ └── failure.html.erb │ └── users │ ├── _form.html.erb │ ├── edit.html.erb │ └── show.html.erb ├── bin ├── bundle ├── rails └── rake ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── backtrace_silencers.rb │ ├── client_side_validations.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── kaminari_config.rb │ ├── mime_types.rb │ ├── omniauth.rb │ ├── quiet_assets.rb │ ├── secret_token.rb │ ├── session_store.rb │ ├── simple_form.rb │ ├── unlimited_strength_cryptography.rb │ └── wrap_parameters.rb ├── locales │ ├── en.yml │ ├── simple_form.en.yml │ ├── simple_form.zh.yml │ └── zh.yml └── routes.rb ├── db ├── migrate │ ├── 20121003022144_create_users.rb │ ├── 20121003022220_create_gists.rb │ ├── 20121003022313_create_gist_files.rb │ ├── 20121003022400_create_comments.rb │ ├── 20121003054038_create_gist_histories.rb │ ├── 20121008094826_create_favorites.rb │ ├── 20121015023421_change_gist_histories_gist_id_not_null.rb │ └── 20140110041301_add_email_to_users.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .gitkeep ├── tasks │ └── .gitkeep └── templates │ └── erb │ └── scaffold │ └── _form.html.erb ├── log └── .gitkeep ├── public ├── 400.html ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── screenshot1.png ├── screenshot2.png └── spec ├── controllers ├── application_controller_spec.rb ├── comments_controller_spec.rb ├── favorites_controller_spec.rb ├── gists_controller_spec.rb ├── root_controller_spec.rb ├── sessions_controller_spec.rb └── users_controller_spec.rb ├── factories.rb ├── helpers └── application_helper_spec.rb ├── models ├── comment_spec.rb ├── concerns │ └── basic_persistence_spec.rb ├── favorite_spec.rb ├── gist_file_spec.rb ├── gist_fork_creation_spec.rb ├── gist_history_spec.rb ├── gist_persistence_spec.rb ├── gist_spec.rb └── user_spec.rb ├── requests ├── gists_spec.rb └── users_spec.rb ├── routing ├── comments_routing_spec.rb ├── favorites_routing_spec.rb ├── gists_routing_spec.rb ├── root_routing_spec.rb ├── sessions_routing_spec.rb └── users_routing_spec.rb └── spec_helper.rb /.buildpacks: -------------------------------------------------------------------------------- 1 | https://github.com/rcaught/heroku-buildpack-cmake 2 | https://codon-buildpacks.s3.amazonaws.com/buildpacks/frederick/heroku-buildpack-ruby.tgz 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .bundle 3 | .loadpath 4 | .project 5 | .rvmrc 6 | .idea 7 | Thumbs.db 8 | log/*.log 9 | db/*.sqlite3 10 | doc/* 11 | public/cache/**/* 12 | tmp/ 13 | vendor/ 14 | public/assets/ 15 | coverage/ 16 | backup/ 17 | test/reports 18 | out/ 19 | untitled/ 20 | *.iml 21 | 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - jruby-19mode 4 | - 2.1.5 5 | # TODO: tests on Ruby 2.2.0 6 | # - 2.2.0 7 | bundler_args: --without postgresql 8 | env: 9 | - DB=sqlite 10 | script: 11 | - RAILS_ENV=test bundle exec rake --trace db:migrate spec 12 | 13 | -------------------------------------------------------------------------------- /CHAGELOG: -------------------------------------------------------------------------------- 1 | Gistub CHANGELOG 2 | --- 3 | 4 | v 1.3.7 5 | - Rails 4.0.13 6 | 7 | v 1.3.6 8 | - Title improvement by @netmarkjp 9 | - Rails 4.0.5 10 | 11 | v 1.3.5 12 | - Markdown support in comments by @cb372 13 | - Disabled scripts in markdown bodies 14 | - Rails 4.0.3 15 | 16 | v 1.3.4 17 | - Removed email from profile page 18 | - Added GISTUB_APP_NAME environment variable to customize header 19 | 20 | v 1.3.3 21 | - #28 Link to latest raw file when single file (feedback by @rngtng) 22 | - Improved error pages 23 | - Fixed fork error after omniauth callbacks 24 | - Bumped some dependencies 25 | 26 | v 1.3.2 27 | - #26 Show Gravatar icons using email provided by OmniAuth by @shuhei 28 | 29 | v 1.3.1 30 | - #25 Prevented gist timestamp from overlapping with code box by @shuhei 31 | 32 | v 1.3.0 33 | - Bumped Rails from 3.2 to 4.0.2 34 | - Added GISTUB_SECRET_TOKEN, GISTUB_SECRET_KEY_BASE environment variables support 35 | 36 | v 1.2.7 37 | - Added GISTUB_AUTO_LINK, GISTUB_ALLOWS_ANONYMOUS environment variables support 38 | 39 | v 1.2.6 40 | - Fixed the issue that font-awesome icons don't appear 41 | 42 | v 1.2.5 43 | - Introduced GISTUB_OPENID_IDENTIFIER env value to specify auth server instead of Google OpenID 44 | 45 | v 1.2.4 46 | - Changed source, git repo access from git protocol to https protocol 47 | 48 | v 1.2.3 49 | - Enabled using tags in comments 50 | 51 | v 1.2.2 52 | - Fixed the issue ace editor doesn't work for several new files 53 | - Made the ids of gist file inputs and textareas unique by @shuhei 54 | 55 | v 1.2.1 56 | - Removed git submodule and added ace js files to app/assets/javascripts 57 | 58 | v 1.2.0 59 | - Add ace editor for gist file body by @shuhei 60 | 61 | v 1.1.21 62 | - Improved CSS for google-code-prettify 63 | 64 | v 1.1.20 65 | - Changed user page's gist/fav order to desc 66 | - Bumped google-code-prettify to the lastest version 67 | 68 | v 1.0.19 69 | - Added coveralls 70 | 71 | v 1.0.18 72 | - Started using Code Climate 73 | 74 | v 1.0.17 75 | - Fixed #17 Disabling anonymous posts 76 | - deafult filename if absent (refs #15) 77 | 78 | v 1.0.14 79 | - Added client side validation for gist creation thanks to @pellegrino 80 | 81 | v 1.0.13 82 | - Working on Ruby 2.0.0 and JRuby(again) thanks to @pellegrino 83 | 84 | v 1.0.12 85 | - Changed kaminari paging windows size because of broken layout for over 200 gists 86 | 87 | v 1.0.11 88 | - Enabled using rails_autolink 89 | 90 | v 1.0.10 91 | - Bumped Rails version to 3.2.13 92 | - Markdown support 93 | 94 | v 1.0.9 95 | - Bumped Rails version to 3.2.12 96 | 97 | v 1.0.8 98 | - Show the nickname of user who likes the gist by @tototoshi 99 | 100 | v 1.0.7 101 | - Fixed issue #10 Icons are not displayed after updating twitter-bootstrap-rails 102 | 103 | v 1.0.6 104 | - Fixed search paging 105 | 106 | v 1.0.5 107 | - Fixed issue #3 Searching gists 108 | 109 | v 1.0.4 110 | - Added likes, comments for list pages 111 | - Fixed issue #9 Fails to display gist if commented users are dropped 112 | 113 | v 1.0.3 114 | - Fixed appearance 115 | - Fixed an error at user page 116 | 117 | v 1.0.2 118 | - Fixed issue #8 Use not /tmp dir but tmp dir under rails root 119 | 120 | v 1.0.1 121 | - Fixed issue #4 font-resizing 122 | 123 | v 1.0.0 124 | - Initial versioning 125 | - Fixed root path issue #7 thanks to @fujiwara 126 | 127 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # TODO: rails 4.2 4 | gem 'rails', '5.2.6.2' 5 | gem 'jquery-rails', '>= 4.0.1' 6 | gem 'rails_autolink', '>= 1.1.6' 7 | 8 | gem 'qiita-markdown', :platforms => :ruby 9 | gem 'kramdown', :platforms => :jruby 10 | 11 | gem 'omniauth-openid' 12 | gem 'erubis' 13 | gem 'kaminari', '>= 0.16.1' 14 | 15 | gem 'simple_form', '>= 4.0.0' 16 | 17 | gem 'coveralls', require: false 18 | 19 | gem 'pg', group: :postgresql 20 | 21 | group :development do 22 | # better_errors 2.0 requires Ruby 2.0 or higher 23 | gem 'better_errors', '1.1.0' 24 | gem 'magic_encoding' 25 | gem 'binding_of_caller', :platforms => :ruby 26 | end 27 | 28 | group :test, :development do 29 | gem 'bullet' 30 | gem 'pry-rails' 31 | gem 'sqlite3', :platforms => :ruby 32 | gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby 33 | gem 'factory_girl' 34 | gem 'factory_girl_rails', '>= 4.5.0' 35 | # TODO: rspec 3 36 | gem 'rspec-rails', '2.14.2' 37 | gem 'rspec-kickstarter' 38 | end 39 | 40 | group :test do 41 | gem 'simplecov', :require => false 42 | gem 'simplecov-rcov', :require => false 43 | end 44 | 45 | group :assets do 46 | gem 'less-rails', '>= 2.6.0' 47 | gem 'twitter-bootstrap-rails', '>= 2.2.8' 48 | gem 'therubyracer', :platforms => :ruby 49 | gem 'therubyrhino', :platforms => :jruby 50 | gem 'uglifier', '>= 1.0.3' 51 | end 52 | 53 | group :server do 54 | # bin/rails s mizuno 55 | gem 'mizuno', :platforms => :jruby 56 | gem 'thin', :platforms => :ruby 57 | end 58 | 59 | # rails g rspec:install 60 | # rails g simple_form:install --bootstrap 61 | # rails g bootstrap:install 62 | # rails g bootstrap:layout application fluid 63 | # rails g kaminari:config 64 | 65 | # bundle exec rake assets:precompile RAILS_ENV=production RAILS_GROUPS=assets 66 | 67 | # JRuby 68 | # see: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md 69 | # export JRUBY_OPTS=--1.9 70 | 71 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012 Kazuhiro Sera 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 NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gistub : Sharing code snippets in-house 2 | 3 | Gistub is a stand alone application for sharing snippet such as `gist.github.com`. 4 | 5 | If you're familiar with Rails apps, you can set up Gistub in several minutes. 6 | 7 | Many companies and organizations use Gistub for sharing code snippets safely in house. 8 | 9 | [![Build Status](https://travis-ci.org/seratch/gistub.png)](https://travis-ci.org/seratch/gistub) 10 | [![Coverage Status](https://coveralls.io/repos/seratch/gistub/badge.png?branch=develop)](https://coveralls.io/r/seratch/gistub?branch=develop) 11 | [![Code Climate](https://codeclimate.com/github/seratch/gistub.png)](https://codeclimate.com/github/seratch/gistub) 12 | 13 | [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) 14 | 15 | ## How to use 16 | 17 | `master` branch is always the lastest stable version. 18 | 19 | ```sh 20 | git clone git://github.com/seratch/gistub.git -b master 21 | cd gistub 22 | bin/bundle install 23 | bin/rake db:migrate 24 | bin/rails s 25 | ``` 26 | 27 | Access `http://localhost:3000/` through web browser. 28 | 29 | ## Live Demo 30 | 31 | http://gistub.herokuapp.com/ 32 | 33 | Top page: 34 | 35 | ![top](https://raw.github.com/seratch/gistub/master/screenshot1.png) 36 | 37 | Rich Editor with Ace: 38 | 39 | ![input](https://raw.github.com/seratch/gistub/master/screenshot2.png) 40 | 41 | 42 | ## Configuration over environment variables 43 | 44 | Specify settings in `.bashrc` or others. 45 | 46 | ``` 47 | export GISTUB_APP_NAME="MyGistub" 48 | export GISTUB_OPENID_IDENTIFIER=https://your_auth_server/openid/ 49 | export GISTUB_AUTO_LINK=true 50 | export GISTUB_ALLOWS_ANONYMOUS=false 51 | export GISTUB_SECRET_TOKEN=xxx... 52 | export GISTUB_SECRET_KEY_BASE=yyy... 53 | ``` 54 | 55 | ## Gistub Tools 56 | 57 | ### For Emacs users 58 | 59 | https://github.com/tototoshi/gistub-el 60 | 61 | ### For Vimmers 62 | 63 | https://github.com/glidenote/nogistub.vim 64 | 65 | ## License 66 | 67 | (The MIT License) 68 | 69 | Copyright (c) 2012 Kazuhiro Sera 70 | 71 | 72 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | 3 | require File.expand_path('../config/application', __FILE__) 4 | 5 | Gistub::Application.load_tasks 6 | 7 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gistub", 3 | "description": "Sharing code snippets in-house", 4 | "keywords": ["gist"], 5 | "scripts": { 6 | "postdeploy": "bundle exec rake db:create db:migrate" 7 | }, 8 | "env": { 9 | "BUILDPACK_URL": "https://github.com/heroku/heroku-buildpack-multi.git", 10 | "BUNDLE_WITHOUT": { 11 | "description": "bundle install --without ", 12 | "value": "test:development" 13 | }, 14 | "GISTUB_APP_NAME": { 15 | "description": "variable to customize header", 16 | "value": "", 17 | "required": false 18 | }, 19 | "GISTUB_OPENID_IDENTIFIER": { 20 | "description": "specify auth server instead of Google OpenID", 21 | "value": "", 22 | "required": false 23 | }, 24 | "GISTUB_AUTO_LINK": { 25 | "description": "whether enabling rails_autolink", 26 | "value": "true", 27 | "required": false 28 | }, 29 | "GISTUB_ALLOWS_ANONYMOUS": { 30 | "description": "whether enabling anonymous post", 31 | "value": "false", 32 | "required": false 33 | }, 34 | "GISTUB_SECRET_TOKEN": { 35 | "generator": "secret" 36 | }, 37 | "GISTUB_SECRET_KEY_BASE": { 38 | "generator": "secret" 39 | } 40 | }, 41 | "addons": [ 42 | "papertrail" 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /app/assets/javascripts/ace/ext-modelist.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/ext/modelist",["require","exports","module"],function(e,t,n){function i(e){var t=a.text,n=e.split(/[\/\\]/).pop();for(var i=0;i|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.AdaHighlightRules=s}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-batchfile.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/batchfile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/batchfile_highlight_rules","ace/mode/folding/cstyle"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./batchfile_highlight_rules").BatchFileHighlightRules,u=e("./folding/cstyle").FoldMode,a=function(){var e=new o;this.foldingRules=new u,this.$tokenizer=new s(e.getRules())};r.inherits(a,i),function(){this.lineCommentStart="::",this.blockComment=""}.call(a.prototype),t.Mode=a}),ace.define("ace/mode/batchfile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"keyword.command.dosbatch",regex:"\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b",caseInsensitive:!0},{token:"keyword.control.statement.dosbatch",regex:"\\b(?:goto|call|exit)\\b",caseInsensitive:!0},{token:"keyword.control.conditional.if.dosbatch",regex:"\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b",caseInsensitive:!0},{token:"keyword.control.conditional.dosbatch",regex:"\\b(?:if|else)\\b",caseInsensitive:!0},{token:"keyword.control.repeat.dosbatch",regex:"\\bfor\\b",caseInsensitive:!0},{token:"keyword.operator.dosbatch",regex:"\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b"},{token:["doc.comment","comment"],regex:"(?:^|\\b)(rem)($|\\s.*$)",caseInsensitive:!0},{token:"comment.line.colons.dosbatch",regex:"::.*$"},{include:"variable"},{token:"punctuation.definition.string.begin.shell",regex:'"',push:[{token:"punctuation.definition.string.end.shell",regex:'"',next:"pop"},{include:"variable"},{defaultToken:"string.quoted.double.dosbatch"}]},{token:"keyword.operator.pipe.dosbatch",regex:"[|]"},{token:"keyword.operator.redirect.shell",regex:"&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>"}],variable:[{token:"constant.numeric",regex:"%%\\w+"},{token:["markup.list","constant.other","markup.list"],regex:"(%)(\\w+)(%?)"}]},this.normalizeRules()};s.metaData={name:"Batch File",scopeName:"source.dosbatch",fileTypes:["bat"]},r.inherits(s,i),t.BatchFileHighlightRules=s}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i){var s=i.index;return i[1]?this.openingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s+i[0].length,1)}if(t!=="markbeginend")return;var i=r.match(this.foldingStopMarker);if(i){var s=i.index+i[0].length;return i[1]?this.closingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s,-1)}}}.call(o.prototype)}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-c9search.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/c9search",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/c9search_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/c9search"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./c9search_highlight_rules").C9SearchHighlightRules,u=e("./matching_brace_outdent").MatchingBraceOutdent,a=e("./folding/c9search").FoldMode,f=function(){this.$tokenizer=new s((new o).getRules()),this.$outdent=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)}}.call(f.prototype),t.Mode=f}),ace.define("ace/mode/c9search_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:["c9searchresults.constant.numeric","c9searchresults.text","c9searchresults.text"],regex:"(^\\s+[0-9]+)(:\\s*)(.+)"},{token:["string","text"],regex:"(.+)(:$)"}]}};r.inherits(s,i),t.C9SearchHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/c9search",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^(\S.*\:|Searching for.*)$/,this.foldingStopMarker=/^(\s+|Found.*)$/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getAllLines(n),s=r[n],o=/^(Found.*|Searching for.*)$/,u=/^(\S.*\:|\s*)$/,a=o.test(s)?o:u;if(this.foldingStartMarker.test(s)){for(var f=n+1,l=e.getLength();f=0;f--){s=r[f];if(a.test(s))break}return new i(f,s.length,n,0)}}}.call(o.prototype)}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-cobol.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/cobol",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/cobol_highlight_rules","ace/range"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./cobol_highlight_rules").CobolHighlightRules,u=e("../range").Range,a=function(){this.$tokenizer=new s((new o).getRules())};r.inherits(a,i),function(){this.lineCommentStart="*"}.call(a.prototype),t.Mode=a}),ace.define("ace/mode/cobol_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT",t="true|false|null",n="count|min|max|avg|sum|rank|now|coalesce|main",r=this.createKeywordMapper({"support.function":n,keyword:e,"constant.language":t},"identifier",!0);this.$rules={start:[{token:"comment",regex:"\\*.*$"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.CobolHighlightRules=s}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-diff.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/diff",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/diff_highlight_rules","ace/mode/folding/diff"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./diff_highlight_rules").DiffHighlightRules,u=e("./folding/diff").FoldMode,a=function(){this.$tokenizer=new s((new o).getRules()),this.foldingRules=new u(["diff","index","\\+{3}","@@|\\*{5}"],"i")};r.inherits(a,i),function(){}.call(a.prototype),t.Mode=a}),ace.define("ace/mode/diff_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{regex:"^(?:\\*{15}|={67}|-{3}|\\+{3})$",token:"punctuation.definition.separator.diff",name:"keyword"},{regex:"^(@@)(\\s*.+?\\s*)(@@)(.*)$",token:["constant","constant.numeric","constant","comment.doc.tag"]},{regex:"^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",token:["constant.numeric","punctuation.definition.range.diff","constant.function","constant.numeric","punctuation.definition.range.diff","invalid"],name:"meta."},{regex:"^(\\-{3}|\\+{3}|\\*{3})( .+)$",token:["constant.numeric","meta.tag"]},{regex:"^([!+>])(.*?)(\\s*)$",token:["support.constant","text","invalid"]},{regex:"^([<\\-])(.*?)(\\s*)$",token:["support.function","string","invalid"]},{regex:"^(diff)(\\s+--\\w+)?(.+?)( .+)?$",token:["variable","variable","keyword","variable"]},{regex:"^Index.+$",token:"variable"},{regex:"^\\s+$",token:"text"},{regex:"\\s*$",token:"invalid"},{defaultToken:"invisible",caseInsensitive:!0}]}};r.inherits(s,i),t.DiffHighlightRules=s}),ace.define("ace/mode/folding/diff",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(e,t){this.regExpList=e,this.flag=t,this.foldingStartMarker=RegExp("^("+e.join("|")+")",this.flag)};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i={row:n,column:r.length},o=this.regExpList;for(var u=1;u<=o.length;u++){var a=RegExp("^("+o.slice(0,u).join("|")+")",this.flag);if(a.test(r))break}for(var f=e.getLength();++n=2){f||(l=i.getCurrentTokenRow()-1),f+=c==2?1:-1;if(f<0)break}else if(c>=a)break}f||(l=i.getCurrentTokenRow()-1);while(l>t&&!/\S/.test(e.getLine(l)))l--;return new s(t,e.getLine(t).length,l,e.getLine(l).length)}}.call(u.prototype)}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-lisp.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/lisp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/lisp_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./lisp_highlight_rules").LispHighlightRules,u=function(){var e=new o;this.$tokenizer=new s(e.getRules()),this.$keywordList=e.$keywordList};r.inherits(u,i),function(){this.lineCommentStart=";"}.call(u.prototype),t.Mode=u}),ace.define("ace/mode/lisp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="case|do|let|loop|if|else|when",t="eq|neq|and|or",n="null|nil",r="cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn",i=this.createKeywordMapper({"keyword.control":e,"keyword.operator":t,"constant.language":n,"support.function":r},"identifier",!0);this.$rules={start:[{token:"comment",regex:";.*$"},{token:["storage.type.function-type.lisp","text","entity.name.function.lisp"],regex:"(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"},{token:["punctuation.definition.constant.character.lisp","constant.character.lisp"],regex:"(#)((?:\\w|[\\\\+-=<>'\"&#])+)"},{token:["punctuation.definition.variable.lisp","variable.other.global.lisp","punctuation.definition.variable.lisp"],regex:"(\\*)(\\S*)(\\*)"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"},{token:i,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"string",regex:'"(?=.)',next:"qqstring"}],qqstring:[{token:"constant.character.escape.lisp",regex:"\\\\."},{token:"string",regex:'[^"\\\\]+'},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"start"}]}};r.inherits(s,i),t.LispHighlightRules=s}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-livescript.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/livescript",["require","exports","module","ace/tokenizer","ace/mode/matching_brace_outdent","ace/range","ace/mode/text"],function(e,t,n){function u(e,t){function n(){}return n.prototype=(e.superclass=t).prototype,(e.prototype=new n).constructor=e,typeof t.extended=="function"&&t.extended(e),e}function a(e,t){var n={}.hasOwnProperty;for(var r in t)n.call(t,r)&&(e[r]=t[r]);return e}var r,i,s,o;r="(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*",t.Mode=i=function(t){function o(){var t;this.$tokenizer=new(e("../tokenizer").Tokenizer)(o.Rules);if(t=e("../mode/matching_brace_outdent"))this.$outdent=new t.MatchingBraceOutdent}var n,i=u((a(o,t).displayName="LiveScriptMode",o),t).prototype,s=o;return n=RegExp("(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*"+r+")?))\\s*$"),i.getNextLineIndent=function(e,t,r){var i,s;return i=this.$getIndent(t),s=this.$tokenizer.getLineTokens(t,e).tokens,(!s.length||s[s.length-1].type!=="comment")&&e==="start"&&n.test(t)&&(i+=r),i},i.toggleCommentLines=function(t,n,r,i){var s,o,u,a,f,l;s=/^(\s*)#/,o=new(e("../range").Range)(0,0,0,0);for(u=r;u<=i;++u)a=u,(f=s.test(l=n.getLine(a)))?l=l.replace(s,"$1"):l=l.replace(/^\s*/,"$&#"),o.end.row=o.start.row=a,o.end.column=l.length+1,n.replace(o,l);return 1-f*2},i.checkOutdent=function(e,t,n){var r;return(r=this.$outdent)!=null?r.checkOutdent(t,n):void 8},i.autoOutdent=function(e,t,n){var r;return(r=this.$outdent)!=null?r.autoOutdent(t,n):void 8},o}(e("../mode/text").Mode),s="(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))",o={token:"string",regex:".+"},i.Rules={start:[{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)"+s},{token:"constant.language",regex:"(?:true|false|yes|no|on|off|null|void|undefined)"+s},{token:"invalid.illegal",regex:"(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)"+s},{token:"language.support.class",regex:"(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)"+s},{token:"language.support.function",regex:"(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)"+s},{token:"variable.language",regex:"(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)"+s},{token:"identifier",regex:r+"\\s*:(?![:=])"},{token:"variable",regex:r},{token:"keyword.operator",regex:"(?:\\.{3}|\\s+\\?)"},{token:"keyword.variable",regex:"(?:@+|::|\\.\\.)",next:"key"},{token:"keyword.operator",regex:"\\.\\s*",next:"key"},{token:"string",regex:"\\\\\\S[^\\s,;)}\\]]*"},{token:"string.doc",regex:"'''",next:"qdoc"},{token:"string.doc",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string",regex:"<\\[",next:"words"},{token:"string.regex",regex:"//",next:"heregex"},{token:"comment.doc",regex:"/\\*",next:"comment"},{token:"comment",regex:"#.*"},{token:"string.regex",regex:"\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}",next:"key"},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[)}\\]]",next:"key"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],heregex:[{token:"string.regex",regex:".*?//[gimy$?]{0,4}",next:"start"},{token:"string.regex",regex:"\\s*#{"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],key:[{token:"keyword.operator",regex:"[.?@!]+"},{token:"identifier",regex:r,next:"start"},{token:"text",regex:".",next:"start"}],comment:[{token:"comment.doc",regex:".*?\\*/",next:"start"},{token:"comment.doc",regex:".+"}],qdoc:[{token:"string",regex:".*?'''",next:"key"},o],qqdoc:[{token:"string",regex:'.*?"""',next:"key"},o],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"key"},o],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"key"},o],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"key"},o],words:[{token:"string",regex:".*?\\]>",next:"key"},o]}}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-lucene.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/lucene",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/lucene_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./lucene_highlight_rules").LuceneHighlightRules,u=function(){this.$tokenizer=new s((new o).getRules())};r.inherits(u,i),t.Mode=u}),ace.define("ace/mode/lucene_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=function(){this.$rules={start:[{token:"constant.character.negation",regex:"[\\-]"},{token:"constant.character.interro",regex:"[\\?]"},{token:"constant.character.asterisk",regex:"[\\*]"},{token:"constant.character.proximity",regex:"~[0-9]+\\b"},{token:"keyword.operator",regex:"(?:AND|OR|NOT)\\b"},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"keyword",regex:"[\\S]+:"},{token:"string",regex:'".*?"'},{token:"text",regex:"\\s+"}]}};r.inherits(o,s),t.LuceneHighlightRules=o}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-makefile.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/makefile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/makefile_highlight_rules","ace/mode/folding/coffee"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./makefile_highlight_rules").MakefileHighlightRules,u=e("./folding/coffee").FoldMode,a=function(){var e=new o;this.foldingRules=new u,this.$tokenizer=new s(e.getRules()),this.$keywordList=e.$keywordList};r.inherits(a,i),function(){this.lineCommentStart="#",this.$indentWithTabs=!0}.call(a.prototype),t.Mode=a}),ace.define("ace/mode/makefile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/sh_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=e("./sh_highlight_rules"),o=function(){var e=this.createKeywordMapper({keyword:s.reservedKeywords,"support.function.builtin":s.languageConstructs,"invalid.deprecated":"debugger"},"string");this.$rules={start:[{token:"string.interpolated.backtick.makefile",regex:"`",next:"shell-start"},{token:"punctuation.definition.comment.makefile",regex:/#(?=.)/,next:"comment"},{token:["keyword.control.makefile"],regex:"^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)"},{token:["entity.name.function.makefile","text"],regex:"^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)"}],comment:[{token:"punctuation.definition.comment.makefile",regex:/.+\\/},{token:"punctuation.definition.comment.makefile",regex:".+",next:"start"}],"shell-start":[{token:e,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"string",regex:"\\w+"},{token:"string.interpolated.backtick.makefile",regex:"`",next:"start"}]}};r.inherits(o,i),t.MakefileHighlightRules=o}),ace.define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=t.reservedKeywords="!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set",o=t.languageConstructs="[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait",u=function(){var e=this.createKeywordMapper({keyword:s,"support.function.builtin":o,"invalid.deprecated":"debugger"},"identifier"),t="(?:(?:[1-9]\\d*)|(?:0))",n="(?:\\.\\d+)",r="(?:\\d+)",i="(?:(?:"+r+"?"+n+")|(?:"+r+"\\.))",u="(?:(?:"+i+"|"+r+")"+")",a="(?:"+u+"|"+i+")",f="(?:&"+r+")",l="[a-zA-Z][a-zA-Z0-9_]*",c="(?:(?:\\$"+l+")|(?:"+l+"=))",h="(?:\\$(?:SHLVL|\\$|\\!|\\?))",p="(?:"+l+"\\s*\\(\\))";this.$rules={start:[{token:"constant",regex:/\\./},{token:["text","comment"],regex:/(^|\s)(#.*)$/},{token:"string",regex:'"',push:[{token:"constant.language.escape",regex:/\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/},{token:"constant",regex:/\$\w+/},{token:"string",regex:'"',next:"pop"},{defaultToken:"string"}]},{token:"variable.language",regex:h},{token:"variable",regex:c},{token:"support.function",regex:p},{token:"support.function",regex:f},{token:"string",start:"'",end:"'"},{token:"constant.numeric",regex:a},{token:"constant.numeric",regex:t+"\\b"},{token:e,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"}]},this.normalizeRules()};r.inherits(u,i),t.ShHighlightRules=u}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++nl){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.MushCodeRules=s}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-pascal.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/pascal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/pascal_highlight_rules","ace/mode/folding/coffee"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./pascal_highlight_rules").PascalHighlightRules,u=e("./folding/coffee").FoldMode,a=function(){var e=new o;this.foldingRules=new u,this.$tokenizer=new s(e.getRules())};r.inherits(a,i),function(){this.lineCommentStart=["--","//"],this.blockComment=[{start:"(*",end:"*)"},{start:"{",end:"}"}]}.call(a.prototype),t.Mode=a}),ace.define("ace/mode/pascal_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{caseInsensitive:!0,token:"keyword.control.pascal",regex:"\\b(?:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\b"},{caseInsensitive:!0,token:["variable.pascal","text","storage.type.prototype.pascal","entity.name.function.prototype.pascal"],regex:"\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))"},{caseInsensitive:!0,token:["variable.pascal","text","storage.type.function.pascal","entity.name.function.pascal"],regex:"\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?"},{token:"constant.numeric.pascal",regex:"\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"},{token:"punctuation.definition.comment.pascal",regex:"--.*$",push_:[{token:"comment.line.double-dash.pascal.one",regex:"$",next:"pop"},{defaultToken:"comment.line.double-dash.pascal.one"}]},{token:"punctuation.definition.comment.pascal",regex:"//.*$",push_:[{token:"comment.line.double-slash.pascal.two",regex:"$",next:"pop"},{defaultToken:"comment.line.double-slash.pascal.two"}]},{token:"punctuation.definition.comment.pascal",regex:"\\(\\*",push:[{token:"punctuation.definition.comment.pascal",regex:"\\*\\)",next:"pop"},{defaultToken:"comment.block.pascal.one"}]},{token:"punctuation.definition.comment.pascal",regex:"\\{",push:[{token:"punctuation.definition.comment.pascal",regex:"\\}",next:"pop"},{defaultToken:"comment.block.pascal.two"}]},{token:"punctuation.definition.string.begin.pascal",regex:'"',push:[{token:"constant.character.escape.pascal",regex:"\\\\."},{token:"punctuation.definition.string.end.pascal",regex:'"',next:"pop"},{defaultToken:"string.quoted.double.pascal"}]},{token:"punctuation.definition.string.begin.pascal",regex:"'",push:[{token:"constant.character.escape.apostrophe.pascal",regex:"''"},{token:"punctuation.definition.string.end.pascal",regex:"'",next:"pop"},{defaultToken:"string.quoted.single.pascal"}]},{token:"keyword.operator",regex:"[+\\-;,/*%]|:=|="}]},this.normalizeRules()};r.inherits(s,i),t.PascalHighlightRules=s}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++nl){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring3:[{token:"constant.language.escape",regex:m},{token:"string",regex:'"{3}',next:"start"},{defaultToken:"string"}],qstring3:[{token:"constant.language.escape",regex:m},{token:"string",regex:"'{3}",next:"start"},{defaultToken:"string"}],qqstring:[{token:"constant.language.escape",regex:m},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:m},{token:"string",regex:"\\\\$",next:"qstring"},{token:"string",regex:"'|$",next:"start"},{defaultToken:"string"}]}};r.inherits(s,i),t.PythonHighlightRules=s}),ace.define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=t.FoldMode=function(e){this.foldingStartMarker=new RegExp("([\\[{])(?:\\s*)$|("+e+")(?:\\s*)(?:#.*)?$")};r.inherits(s,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i)return i[1]?this.openingBracketBlock(e,i[1],n,i.index):i[2]?this.indentationBlock(e,n,i.index+i[2].length):this.indentationBlock(e,n)}}.call(s.prototype)}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-r.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/r",["require","exports","module","ace/range","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/r_highlight_rules","ace/mode/matching_brace_outdent","ace/unicode"],function(e,t,n){var r=e("../range").Range,i=e("../lib/oop"),s=e("./text").Mode,o=e("../tokenizer").Tokenizer,u=e("./text_highlight_rules").TextHighlightRules,a=e("./r_highlight_rules").RHighlightRules,f=e("./matching_brace_outdent").MatchingBraceOutdent,l=e("../unicode"),c=function(){this.$tokenizer=new o((new a).getRules()),this.$outdent=new f};i.inherits(c,s),function(){this.lineCommentStart="#"}.call(c.prototype),t.Mode=c}),ace.define("ace/mode/r_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=e("./tex_highlight_rules").TexHighlightRules,u=function(){var e=i.arrayToMap("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass".split("|")),t=i.arrayToMap("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|NA_complex_".split("|"));this.$rules={start:[{token:"comment.sectionhead",regex:"#+(?!').*(?:----|====|####)\\s*$"},{token:"comment",regex:"#+'",next:"rd-start"},{token:"comment",regex:"#.*$"},{token:"string",regex:'["]',next:"qqstring"},{token:"string",regex:"[']",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+[Li]?\\b"},{token:"constant.numeric",regex:"\\d+L\\b"},{token:"constant.numeric",regex:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b"},{token:"constant.numeric",regex:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b"},{token:"constant.language.boolean",regex:"(?:TRUE|FALSE|T|F)\\b"},{token:"identifier",regex:"`.*?`"},{onMatch:function(n){return e[n]?"keyword":t[n]?"constant.language":n=="..."||n.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*\\b"},{token:"keyword.operator",regex:"%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:"},{token:"keyword.operator",regex:"%.*?%"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]};var n=(new o("comment")).getRules();for(var r=0;r|<=|=>|=|!="},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"}]},this.normalizeRules()};r.inherits(u,i),t.ShHighlightRules=u}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-snippets.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/snippets",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/folding/coffee"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./text_highlight_rules").TextHighlightRules,u=function(){var e="SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME";this.$rules={start:[{token:"constant.language.escape",regex:/\\[\$}`\\]/},{token:"keyword",regex:"\\$(?:TM_)?(?:"+e+")\\b"},{token:"variable",regex:"\\$\\w+"},{onMatch:function(e,t,n){return n[1]?n[1]++:n.unshift(t,1),this.tokenName},tokenName:"markup.list",regex:"\\${",next:"varDecl"},{onMatch:function(e,t,n){return n[1]?(n[1]--,n[1]||n.splice(0,2),this.tokenName):"text"},tokenName:"markup.list",regex:"}"},{token:"doc.comment",regex:/^\${2}-{5,}$/}],varDecl:[{regex:/\d+\b/,token:"constant.numeric"},{token:"keyword",regex:"(?:TM_)?(?:"+e+")\\b"},{token:"variable",regex:"\\w+"},{regex:/:/,token:"punctuation.operator",next:"start"},{regex:/\//,token:"string.regex",next:"regexp"},{regex:"",next:"start"}],regexp:[{regex:/\\./,token:"escape"},{regex:/\[/,token:"regex.start",next:"charClass"},{regex:"/",token:"string.regex",next:"format"},{token:"string.regex",regex:"."}],charClass:[{regex:"\\.",token:"escape"},{regex:"\\]",token:"regex.end",next:"regexp"},{token:"string.regex",regex:"."}],format:[{regex:/\\[ulULE]/,token:"keyword"},{regex:/\$\d+/,token:"variable"},{regex:"/[gim]*:?",token:"string.regex",next:"start"},{token:"string",regex:"."}]}};r.inherits(u,o),t.SnippetHighlightRules=u;var a=function(){this.$rules={start:[{token:"text",regex:"^\\t",next:"sn-start"},{token:"invalid",regex:/^ \s*/},{token:"comment",regex:/^#.*/},{token:"constant.language.escape",regex:"^regex ",next:"regex"},{token:"constant.language.escape",regex:"^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"}],regex:[{token:"text",regex:"\\."},{token:"keyword",regex:"/"},{token:"empty",regex:"$",next:"start"}]},this.embedRules(u,"sn-",[{token:"text",regex:"^\\t",next:"sn-start"},{onMatch:function(e,t,n){return n.splice(n.length),this.tokenName},tokenName:"text",regex:"^(?! )",next:"start"}])};r.inherits(a,o),t.SnippetGroupHighlightRules=a;var f=e("./folding/coffee").FoldMode,l=function(){var e=new a;this.foldingRules=new f,this.$tokenizer=new s(e.getRules())};r.inherits(l,i),function(){this.$indentWithTabs=!0}.call(l.prototype),t.Mode=l}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++nl){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.SqlHighlightRules=s}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-tcl.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/tcl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/folding/cstyle","ace/mode/tcl_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./folding/cstyle").FoldMode,u=e("./tcl_highlight_rules").TclHighlightRules,a=e("./matching_brace_outdent").MatchingBraceOutdent,f=e("../range").Range,l=function(){this.$tokenizer=new s((new u).getRules()),this.$outdent=new a,this.foldingRules=new o};r.inherits(l,i),function(){this.lineCommentStart="#",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.$tokenizer.getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"){var o=t.match(/^.*[\{\(\[]\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)}}.call(l.prototype),t.Mode=l}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i){var s=i.index;return i[1]?this.openingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s+i[0].length,1)}if(t!=="markbeginend")return;var i=r.match(this.foldingStopMarker);if(i){var s=i.index+i[0].length;return i[1]?this.closingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s,-1)}}}.call(o.prototype)}),ace.define("ace/mode/tcl_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment",regex:"#.*\\\\$",next:"commentfollow"},{token:"comment",regex:"#.*$"},{token:"support.function",regex:"[\\\\]$",next:"splitlineStart"},{token:"text",regex:'[\\\\](?:["]|[{]|[}]|[[]|[]]|[$]|[])'},{token:"text",regex:"^|[^{][;][^}]|[/\r/]",next:"commandItem"},{token:"string",regex:'[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'[ ]*["]',next:"qqstring"},{token:"variable.instance",regex:"[$]",next:"variable"},{token:"support.function",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"},{token:"identifier",regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"paren.lparen",regex:"[[{]",next:"commandItem"},{token:"paren.lparen",regex:"[(]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],commandItem:[{token:"comment",regex:"#.*\\\\$",next:"commentfollow"},{token:"comment",regex:"#.*$",next:"start"},{token:"string",regex:'[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"variable.instance",regex:"[$]",next:"variable"},{token:"support.function",regex:"(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])",next:"commandItem"},{token:"support.function",regex:"[a-zA-Z0-9_/]+(?:[:][:])",next:"commandItem"},{token:"support.function",regex:"(?:[:][:])",next:"commandItem"},{token:"paren.rparen",regex:"[\\])}]"},{token:"support.function",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"},{token:"keyword",regex:"[a-zA-Z0-9_/]+",next:"start"}],commentfollow:[{token:"comment",regex:".*\\\\$",next:"commentfollow"},{token:"comment",regex:".+",next:"start"}],splitlineStart:[{token:"text",regex:"^.",next:"start"}],variable:[{token:"variable.instance",regex:"[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?",next:"start"},{token:"variable.instance",regex:"{?[a-zA-Z_\\d]+}?",next:"start"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?["]',next:"start"},{token:"string",regex:".+"}]}};r.inherits(s,i),t.TclHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-tex.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/tex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules","ace/mode/matching_brace_outdent"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./text_highlight_rules").TextHighlightRules,u=e("./tex_highlight_rules").TexHighlightRules,a=e("./matching_brace_outdent").MatchingBraceOutdent,f=function(e){e?this.$tokenizer=new s((new o).getRules()):this.$tokenizer=new s((new u).getRules()),this.$outdent=new a};r.inherits(f,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.allowAutoInsert=function(){return!1}}.call(f.prototype),t.Mode=f}),ace.define("ace/mode/tex_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=function(e){e||(e="text"),this.$rules={start:[{token:"comment",regex:"%.*$"},{token:e,regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",next:"nospell"},{token:"keyword",regex:"\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])}]"},{token:e,regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell."+e,regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"},{token:"keyword",regex:"\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",next:"start"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])]"},{token:"paren.keyword.operator",regex:"}",next:"start"},{token:"nospell."+e,regex:"\\s+"},{token:"nospell."+e,regex:"\\w+"}]}};r.inherits(o,s),t.TexHighlightRules=o}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-text.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seratch/gistub/bbb69975ab9291f7224b058302ca0a5f1a9e038a/app/assets/javascripts/ace/mode-text.js -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-textile.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/textile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/textile_highlight_rules","ace/mode/matching_brace_outdent"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./textile_highlight_rules").TextileHighlightRules,u=e("./matching_brace_outdent").MatchingBraceOutdent,a=function(){this.$tokenizer=new s((new o).getRules()),this.$outdent=new u};r.inherits(a,i),function(){this.getNextLineIndent=function(e,t,n){return e=="intag"?n:""},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)}}.call(a.prototype),t.Mode=a}),ace.define("ace/mode/textile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:function(e){return e.charAt(0)=="h"?"markup.heading."+e.charAt(1):"markup.heading"},regex:"h1|h2|h3|h4|h5|h6|bq|p|bc|pre",next:"blocktag"},{token:"keyword",regex:"[\\*]+|[#]+"},{token:"text",regex:".+"}],blocktag:[{token:"keyword",regex:"\\. ",next:"start"},{token:"keyword",regex:"\\(",next:"blocktagproperties"}],blocktagproperties:[{token:"keyword",regex:"\\)",next:"blocktag"},{token:"string",regex:"[a-zA-Z0-9\\-_]+"},{token:"keyword",regex:"#"}]}};r.inherits(s,i),t.TextileHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-tmsnippet.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/tmsnippet",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/folding/coffee"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./text_highlight_rules").TextHighlightRules,u=function(){var e="SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME";this.$rules={start:[{token:"constant.language.escape",regex:/\\[\$}`\\]/},{token:"keyword",regex:"\\$(?:TM_)?(?:"+e+")\\b"},{token:"variable",regex:"\\$\\w+"},{onMatch:function(e,t,n){return n[1]?n[1]++:n.unshift(t,1),this.tokenName},tokenName:"markup.list",regex:"\\${",next:"varDecl"},{onMatch:function(e,t,n){return n[1]?(n[1]--,n[1]||n.splice(0,2),this.tokenName):"text"},tokenName:"markup.list",regex:"}"},{token:"doc.comment",regex:/^\${2}-{5,}$/}],varDecl:[{regex:/\d+\b/,token:"constant.numeric"},{token:"keyword",regex:"(?:TM_)?(?:"+e+")\\b"},{token:"variable",regex:"\\w+"},{regex:/:/,token:"punctuation.operator",next:"start"},{regex:/\//,token:"string.regex",next:"regexp"},{regex:"",next:"start"}],regexp:[{regex:/\\./,token:"escape"},{regex:/\[/,token:"regex.start",next:"charClass"},{regex:"/",token:"string.regex",next:"format"},{token:"string.regex",regex:"."}],charClass:[{regex:"\\.",token:"escape"},{regex:"\\]",token:"regex.end",next:"regexp"},{token:"string.regex",regex:"."}],format:[{regex:/\\[ulULE]/,token:"keyword"},{regex:/\$\d+/,token:"variable"},{regex:"/[gim]*:?",token:"string.regex",next:"start"},{token:"string",regex:"."}]}};r.inherits(u,o),t.SnippetHighlightRules=u;var a=function(){this.$rules={start:[{token:"text",regex:"^\\t",next:"sn-start"},{token:"invalid",regex:/^ \s*/},{token:"comment",regex:/^#.*/},{token:"constant.language.escape",regex:"^regex ",next:"regex"},{token:"constant.language.escape",regex:"^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"}],regex:[{token:"text",regex:"\\."},{token:"keyword",regex:"/"},{token:"empty",regex:"$",next:"start"}]},this.embedRules(u,"sn-",[{token:"text",regex:"^\\t",next:"sn-start"},{onMatch:function(e,t,n){return n.splice(n.length),this.tokenName},tokenName:"text",regex:"^(?! )",next:"start"}])};r.inherits(a,o),t.SnippetGroupHighlightRules=a;var f=e("./folding/coffee").FoldMode,l=function(){var e=new a;this.foldingRules=new f,this.$tokenizer=new s(e.getRules())};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)}}.call(l.prototype),t.Mode=l}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++nl){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.VerilogHighlightRules=s}) -------------------------------------------------------------------------------- /app/assets/javascripts/ace/mode-yaml.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./yaml_highlight_rules").YamlHighlightRules,u=e("./matching_brace_outdent").MatchingBraceOutdent,a=e("./folding/coffee").FoldMode,f=function(){this.$tokenizer=new s((new o).getRules()),this.$outdent=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart="#",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)}}.call(f.prototype),t.Mode=f}),ace.define("ace/mode/yaml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"list.markup",regex:/^(?:-{3}|\.{3})\s*(?=#|$)/},{token:"list.markup",regex:/^\s*[\-?](?:$|\s)/},{token:"constant",regex:"!![\\w//]+"},{token:"constant.language",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:["meta.tag","keyword"],regex:/^(\s*\w.*?)(\:(?:\s+|$))/},{token:["meta.tag","keyword"],regex:/(\w+?)(\s*\:(?:\s+|$))/},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"[\\|>]\\w*",next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:/[+\-]?[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?\b/},{token:"constant.numeric",regex:/[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/},{token:"constant.language.boolean",regex:"(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",regex:".+"}]}};r.inherits(s,i),t.YamlHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++nl){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u span {font-weight: normal !important;}.ace-github .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-github .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-github .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-github .ace_gutter-active-line {background-color : rgba(0, 0, 0, 0.07);}.ace-github .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-github .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-github .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}';var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}) -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | //= require twitter/bootstrap 2 | -------------------------------------------------------------------------------- /app/assets/javascripts/header.js: -------------------------------------------------------------------------------- 1 | //= require jquery 2 | //= require jquery_ujs 3 | //= require code_prettify 4 | //= require_tree . 5 | 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | *= require_self 3 | *= require_tree . 4 | */ 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/bootstrap_and_overrides.css.less: -------------------------------------------------------------------------------- 1 | @import "twitter/bootstrap/bootstrap"; 2 | @import "twitter/bootstrap/responsive"; 3 | @import "twitter/bootstrap/sprites.less"; 4 | 5 | // Set the correct sprite paths 6 | @iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings"); 7 | @iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white"); 8 | 9 | // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) 10 | @fontAwesomeEotPath: asset-url("fontawesome-webfont.eot"); 11 | @fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix"); 12 | @fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff"); 13 | @fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf"); 14 | @fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular"); 15 | 16 | // Font Awesome 17 | @import "fontawesome/font-awesome"; 18 | 19 | // Set the correct sprite paths 20 | @iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings.png"); 21 | @iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white.png"); 22 | 23 | // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) 24 | @fontAwesomeEotPath: asset-url("fontawesome-webfont.eot"); 25 | @fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix"); 26 | @fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff"); 27 | @fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf"); 28 | @fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular"); 29 | 30 | // Font Awesome 31 | @import "fontawesome/font-awesome"; 32 | 33 | // Your custom LESS stylesheets goes here 34 | // 35 | // Since bootstrap was imported above you have access to its mixins which 36 | // you may use and inherit here 37 | // 38 | // If you'd like to override bootstrap's own variables, you can do so here as well 39 | // See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation 40 | // 41 | // Example: 42 | // @linkColor: #ff0000; 43 | 44 | body { padding-top: 60px; } 45 | 46 | -------------------------------------------------------------------------------- /app/assets/stylesheets/code_prettify.css: -------------------------------------------------------------------------------- 1 | /* Pretty printing styles. Used with prettify.js. */ 2 | 3 | /* SPAN elements with the classes below are added by prettyprint. */ 4 | .pln { color: #000 } /* plain text */ 5 | 6 | @media screen { 7 | .str { color: #006400 } /* string content */ 8 | .kwd { color: #00008b } /* a keyword */ 9 | .com { color: #d2b48c } /* a comment */ 10 | .typ { color: #b22222 } /* a type name */ 11 | .lit { color: #8b4513 } /* a literal value */ 12 | /* punctuation, lisp open bracket, lisp close bracket */ 13 | .pun, .opn, .clo { color: #660 } 14 | .tag { color: #008 } /* a markup tag name */ 15 | .atn { color: #606 } /* a markup attribute name */ 16 | .atv { color: #080 } /* a markup attribute value */ 17 | .dec, .var { color: #606 } /* a declaration; a variable name */ 18 | .fun { color: red } /* a function name */ 19 | } 20 | 21 | /* Use higher contrast and text-weight for printable form. */ 22 | @media print, projection { 23 | .str { color: #006400 } 24 | .kwd { color: #00008b; font-weight: bold } 25 | .com { color: #d2b48c; font-style: italic } 26 | .typ { color: #b22222; font-weight: bold } 27 | .lit { color: #8b4513 } 28 | .pun, .opn, .clo { color: #440 } 29 | .tag { color: #006; font-weight: bold } 30 | .atn { color: #404 } 31 | .atv { color: #060 } 32 | } 33 | 34 | /* Specify class=linenums on a pre to get line numbering */ 35 | ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE } /* IE indents via margin-left */ 36 | 37 | /* Put a border around prettyprinted code snippets. */ 38 | pre.prettyprint { padding: 10px 10px 10px 30px; border: 1px solid #888 } 39 | 40 | li.L0, 41 | li.L1, 42 | li.L2, 43 | li.L3, 44 | li.L5, 45 | li.L6, 46 | li.L7, 47 | /*li.L8 { list-style-type: none } */ 48 | 49 | /* Alternate shading for lines */ 50 | li.L1, 51 | li.L3, 52 | li.L5, 53 | li.L7, 54 | /* li.L9 { background: #eee } */ 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class ApplicationController < ActionController::Base 3 | 4 | protect_from_forgery 5 | 6 | before_action :load_current_user, :nickname_required 7 | 8 | helper_method [:current_user, :anonymous_allowed] 9 | 10 | private 11 | 12 | def render_404 13 | render file: "#{Rails.root}/public/404", formats: [:html], status: 404 14 | end 15 | 16 | def anonymous_allowed 17 | Gistub::Application.config.gistub_allows_anonymous 18 | end 19 | 20 | def nickname_required 21 | if current_user.present? && current_user.nickname.nil? 22 | redirect_to edit_user_path(current_user) 23 | end 24 | end 25 | 26 | def login_required 27 | redirect_to signin_path(return_to: request.url) if current_user.blank? 28 | end 29 | 30 | def load_current_user 31 | if @cached_current_user.present? 32 | @cached_current_user 33 | else 34 | begin 35 | @cached_current_user = session[:user_id].present? ? User.find(session[:user_id]) : nil 36 | rescue Exception => e 37 | Rails.logger.debug e 38 | reset_session 39 | nil 40 | end 41 | end 42 | end 43 | 44 | def current_user 45 | @cached_current_user 46 | end 47 | 48 | def destroy_and_redirect_to_gist(active_record_model, success_notice, failure_notice) 49 | gist_id = params[:gist_id] 50 | if active_record_model.present? 51 | active_record_model.destroy 52 | redirect_to gist_path(gist_id), notice: success_notice 53 | else 54 | redirect_to gist_path(gist_id), notice: failure_notice 55 | end 56 | end 57 | 58 | def debug_log_back_trace(e) 59 | Rails.logger.debug e.backtrace.join("\n") 60 | end 61 | 62 | end 63 | -------------------------------------------------------------------------------- /app/controllers/comments_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class CommentsController < ApplicationController 3 | 4 | before_action :login_required 5 | 6 | respond_to :html 7 | 8 | def create 9 | @gist = Gist.find_commentable_gist(params[:gist_id], current_user.try(:id)) 10 | @gist_history = @gist.latest_history 11 | comment = Comment.new 12 | comment.gist_id = @gist.id 13 | comment.user_id = current_user.try(:id) 14 | comment.body = params[:body] 15 | if comment.save 16 | redirect_to gist_path(@gist.id), notice: 'Comment is successfully added.' 17 | else 18 | render action: '../gists/show' 19 | end 20 | end 21 | 22 | def destroy 23 | comment = Comment.where(id: params[:id], user_id: current_user.try(:id)).first 24 | destroy_and_redirect_to_gist(comment, 'Comment is successfully removed.', 'Not found.') 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /app/controllers/favorites_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class FavoritesController < ApplicationController 3 | 4 | before_action :login_required 5 | 6 | respond_to :html 7 | 8 | def create 9 | @gist = Gist.find_commentable_gist(params[:gist_id], current_user.try(:id)) 10 | fav = Favorite.new 11 | fav.gist_id = @gist.id 12 | fav.user_id = current_user.id 13 | if fav.save 14 | redirect_to gist_path(@gist.id), notice: 'You liked this gist.' 15 | else 16 | render action: '../gists/show' 17 | end 18 | end 19 | 20 | def destroy 21 | own_fav = Favorite.where(id: params[:id], user_id: current_user.try(:id)).first 22 | destroy_and_redirect_to_gist(own_fav, 'Your love is cancelled.', 'Not found.') 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /app/controllers/root_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class RootController < ApplicationController 3 | 4 | respond_to :html 5 | 6 | def index 7 | @gists = Gist.limit(5).recent 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class SessionsController < ApplicationController 3 | 4 | protect_from_forgery :except => :create 5 | 6 | skip_before_action :login_required 7 | skip_before_action :nickname_required, only: [:destroy] 8 | 9 | def start 10 | return_to = params[:return_to] || root_path 11 | redirect_to url_for("#{root_path}auth/open_id?return_to=#{return_to}") 12 | end 13 | 14 | def failure 15 | respond_to { |format| format.html } 16 | end 17 | 18 | def create 19 | auth = request.env['omniauth.auth'] 20 | if auth.present? 21 | user = User.where( 22 | omniauth_provider: auth['provider'], 23 | omniauth_uid: auth['uid'] 24 | ).first || User.create_with_omniauth(auth) 25 | 26 | user.update!(email: auth['info']['email']) 27 | 28 | session[:user_id] = user.id 29 | return redirect_to params[:return_to] if params[:return_to].present? 30 | end 31 | redirect_to root_path 32 | end 33 | 34 | def destroy 35 | session[:user_id] = nil 36 | reset_session 37 | redirect_to root_path 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class UsersController < ApplicationController 3 | 4 | skip_before_action :nickname_required, only: [:edit, :update, :destroy] 5 | before_action :login_required, only: [:edit, :update, :destroy] 6 | 7 | respond_to :html 8 | 9 | def show 10 | @user = User.find(params[:id]) 11 | @gists = Gist.where(user_id: @user.id).recent.page(1).per(10) 12 | @favorites = Favorite.where(user_id: @user.id).page(1).per(10) 13 | end 14 | 15 | def edit 16 | if current_user.try(:id) == params[:id].to_i 17 | @user = User.find(params[:id]) 18 | render action: 'edit' 19 | else 20 | redirect_to root_path 21 | end 22 | end 23 | 24 | def update 25 | if current_user.try(:id) == params[:id].to_i 26 | @user = User.find(params[:id]) 27 | if params[:user][:nickname].blank? 28 | flash[:notice] = 'Nickname is required.' 29 | return render action: 'edit' 30 | end 31 | if @user.update_attributes(user_params) 32 | redirect_to @user, notice: 'User was successfully updated.' 33 | else 34 | render action: 'edit' 35 | end 36 | else 37 | redirect_to root_path 38 | end 39 | end 40 | 41 | def destroy 42 | if current_user.id == params[:id].to_i 43 | user = User.find(current_user.id) 44 | user.destroy 45 | reset_session 46 | end 47 | redirect_to root_path 48 | end 49 | 50 | private 51 | 52 | def user_params 53 | params.require(:user).permit(:nickname) 54 | end 55 | 56 | end 57 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | begin 3 | require 'kramdown' 4 | rescue LoadError 5 | end 6 | 7 | require 'digest/md5' 8 | require 'cgi' 9 | 10 | module ApplicationHelper 11 | 12 | def is_anonymous_gist_allowed 13 | anonymous_allowed || current_user.present? 14 | end 15 | 16 | def my_gists 17 | if current_user.present? 18 | Gist.limit(5).find_my_recent_gists(current_user.id) 19 | else 20 | nil 21 | end 22 | end 23 | 24 | def my_favorite_gists 25 | if current_user.present? 26 | favorites = Favorite.where(user_id: current_user.id).limit(5).order(:id).reverse_order 27 | favorites.map { |fav| fav.gist }.select(&:present?) 28 | else 29 | nil 30 | end 31 | end 32 | 33 | def recent_gists 34 | Gist.recent.limit(10).find_all 35 | end 36 | 37 | def is_already_favorited(gist) 38 | find_my_favorite(gist).present? 39 | end 40 | 41 | def find_my_favorite(gist) 42 | if current_user.present? 43 | Favorite.where(user_id: current_user.id).where(gist_id: gist.id).first 44 | else 45 | nil 46 | end 47 | end 48 | 49 | def favorite_users(gist) 50 | gist.favorites.map { |f| f.user } 51 | end 52 | 53 | def markdown(md_body) 54 | if defined?(Kramdown) 55 | # JRuby 56 | Kramdown::Document.new(md_body).to_html 57 | else 58 | # MRI 59 | processor = Qiita::Markdown::Processor.new 60 | result = processor.call(md_body) 61 | result[:output].to_s.html_safe 62 | end 63 | rescue Exception 64 | md_body 65 | end 66 | 67 | def gravatar_image(user, options = {}) 68 | return nil if user.nil? || user.email.nil? 69 | 70 | hash = Digest::MD5.hexdigest(user.email.downcase) 71 | opts = options.dup 72 | query = opts.select { |k, v| [:size, :d].include?(k) } 73 | .map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" } 74 | .join('&') 75 | img_options = { 76 | :src => "//www.gravatar.com/avatar/#{hash}?#{query}", 77 | :alt => user.nickname 78 | } 79 | if size = options[:size] 80 | img_options[:width] = size 81 | img_options[:height] = size 82 | end 83 | 84 | tag 'img', img_options, false, false 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seratch/gistub/bbb69975ab9291f7224b058302ca0a5f1a9e038a/app/mailers/.gitkeep -------------------------------------------------------------------------------- /app/models/comment.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class Comment < ActiveRecord::Base 3 | 4 | validates :body, presence: true 5 | validates :gist_id, presence: true 6 | validates :user_id, presence: true 7 | 8 | belongs_to :gist 9 | belongs_to :user 10 | 11 | end 12 | -------------------------------------------------------------------------------- /app/models/concerns/basic_persistence.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | module BasicPersistence 3 | 4 | def transaction 5 | ActiveRecord::Base.transaction do 6 | yield 7 | end 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /app/models/favorite.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class Favorite < ActiveRecord::Base 3 | 4 | validates :gist_id, presence: true 5 | validates :user_id, presence: true 6 | 7 | belongs_to :gist 8 | belongs_to :user 9 | 10 | scope :recent, lambda { order(:created_at).reverse_order } 11 | 12 | end 13 | -------------------------------------------------------------------------------- /app/models/gist.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class Gist < ActiveRecord::Base 3 | 4 | validates :title, :presence => true 5 | 6 | belongs_to :user 7 | belongs_to :source_gist, class_name: Gist 8 | 9 | has_many :gist_histories, -> { order(:updated_at => :desc) } 10 | has_many :comments, -> { order(:updated_at => :asc) } 11 | has_many :favorites, -> { order(:updated_at => :asc) } 12 | 13 | default_scope { 14 | order(:id) 15 | .where(is_public: true) 16 | .includes(:user) 17 | .includes(:gist_histories) 18 | .includes(:comments) 19 | .includes(:favorites) 20 | } 21 | 22 | scope :recent, lambda { order(:created_at).reverse_order } 23 | 24 | def self.search(query, current_user_id, page) 25 | keywords = query.split("\s") 26 | like_parts = keywords.map { |keyword| "%#{keyword}%" } 27 | 28 | gist_ids_from_gists = find_gist_ids_from_gists(like_parts, current_user_id) 29 | gist_ids_from_files = find_gist_ids_from_gist_files(like_parts, current_user_id) 30 | ids = (gist_ids_from_gists + gist_ids_from_files).uniq 31 | 32 | find_visible_gists_in(ids, current_user_id, page) 33 | end 34 | 35 | def latest_history 36 | gist_histories.first 37 | end 38 | 39 | def forks 40 | Gist.recent.where(:source_gist_id => id) 41 | end 42 | 43 | def self.include_private 44 | unscoped 45 | .includes(:user) 46 | .includes(:gist_histories) 47 | .includes(:comments) 48 | .includes(:favorites) 49 | end 50 | 51 | def self.find_already_forked(source_gist_id, user_id) 52 | Gist.where(source_gist_id: source_gist_id, user_id: user_id).first 53 | end 54 | 55 | def self.find_my_recent_gists(user_id) 56 | Gist.include_private.where(user_id: user_id).recent 57 | end 58 | 59 | def self.find_my_gist_even_if_private(id, user_id) 60 | if user_id.nil? 61 | where(id: id).first 62 | else 63 | my_gist = reduce(where(id: id, user_id: user_id)) 64 | public_gist = reduce(where(id: id, is_public: true)) 65 | include_private.where(my_gist.or(public_gist)).first 66 | end 67 | end 68 | 69 | def self.find_commentable_gist(id, user_id) 70 | public_gist = where(id: id).first 71 | if public_gist.present? 72 | public_gist 73 | else 74 | find_my_gist_even_if_private(id, user_id) 75 | end 76 | end 77 | 78 | private 79 | 80 | def self.reduce(where) 81 | where.where_values.reduce(:and) 82 | end 83 | 84 | def self.find_gist_ids_from_gists(like_parts, current_user_id) 85 | g = Gist.arel_table 86 | 87 | query = g[:is_public].eq(true).or(g[:user_id].eq(current_user_id)) 88 | 89 | query = query.and(g[:title].matches(like_parts.first)) 90 | query = like_parts.drop(1).reduce(query) { |q, like_part| 91 | q.and(g[:title].matches(like_part)) 92 | } 93 | 94 | Gist.include_private.where(query).pluck(:id) 95 | end 96 | 97 | def self.find_gist_ids_from_gist_files(like_parts, current_user_id) 98 | gf = GistFile.arel_table 99 | 100 | query = gf[:name].matches(like_parts.first).or(gf[:body].matches(like_parts.first)) 101 | query = like_parts.drop(1).reduce(query) { |q, like_part| 102 | q.and(gf[:name].matches(like_part).or(gf[:body].matches(like_part))) 103 | } 104 | 105 | GistFile.where(query).joins(:gist_history).pluck('gist_histories.gist_id').uniq 106 | end 107 | 108 | def self.find_visible_gists_in(ids, current_user_id, page) 109 | g = Gist.arel_table 110 | Gist.include_private 111 | .where(g[:is_public].eq(true).or(g[:user_id].eq(current_user_id))) 112 | .where(id: ids) 113 | .order(:created_at => :desc) 114 | .page(page).per(10) 115 | end 116 | 117 | end 118 | -------------------------------------------------------------------------------- /app/models/gist_file.rb: -------------------------------------------------------------------------------- 1 | class GistFile < ActiveRecord::Base 2 | 3 | validates :name, :presence => true 4 | validates :body, :presence => true 5 | validates :gist_history_id, :presence => true 6 | 7 | belongs_to :gist_history 8 | 9 | end 10 | -------------------------------------------------------------------------------- /app/models/gist_fork_creation.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class GistForkCreation 3 | include BasicPersistence 4 | 5 | def save!(gist_to_fork, current_user) 6 | transaction do 7 | created_gist = Gist.create!( 8 | title: gist_to_fork.title, 9 | source_gist_id: gist_to_fork.id, 10 | user_id: current_user.try(:id) 11 | ) 12 | created_history = GistHistory.create!(gist_id: created_gist.id) 13 | gist_to_fork.latest_history.gist_files.each do |file| 14 | GistFile.create( 15 | gist_history_id: created_history.id, 16 | name: file.name, 17 | body: file.body 18 | ) 19 | end 20 | created_gist 21 | end 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /app/models/gist_history.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class GistHistory < ActiveRecord::Base 3 | 4 | validates :gist_id, presence: true 5 | 6 | belongs_to :gist 7 | belongs_to :user 8 | 9 | has_many :gist_files 10 | 11 | # Since ActiveRecord 4.0.1, following code doesn't work as expected 12 | #default_scope { order(:id).reverse_order } 13 | default_scope { order(:id => :desc) } 14 | 15 | def gist 16 | Gist.include_private.where(id: gist_id).first 17 | end 18 | 19 | def headline 20 | body = gist_files.first.try(:body) 21 | body.nil? ? '' : body.split("\n").take(3).join("\n") 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /app/models/gist_persistence.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class GistPersistence 3 | include BasicPersistence 4 | 5 | def initialize(flash) 6 | @flash = flash 7 | end 8 | 9 | def save_history!(gist_id, user_id) 10 | GistHistory.create!( 11 | gist_id: gist_id, 12 | user_id: user_id 13 | ) 14 | end 15 | 16 | def save_files!(history, gist_files) 17 | if gist_files.select { |name, body| body.present? }.empty? 18 | @flash[:error] = 'Gist file is required.' 19 | raise 'Gist files are required!' 20 | end 21 | # If file name is absent, add default name such as file1,2,3... instead. 22 | file_count = 1 23 | gist_files.each do |name, body| 24 | GistFile.create( 25 | gist_history_id: history.id, 26 | name: name.present? ? name : "file#{file_count}", 27 | body: body 28 | ) 29 | file_count += 1 30 | end 31 | end 32 | 33 | def save!(gist, gist_files, current_user) 34 | transaction do 35 | if gist.save! 36 | history = save_history!(gist.id, current_user.try(:id)) 37 | save_files!(history, gist_files) 38 | end 39 | end 40 | end 41 | 42 | end 43 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | class User < ActiveRecord::Base 3 | 4 | validates :omniauth_provider, presence: true 5 | validates :omniauth_uid, presence: true 6 | 7 | has_many :gists, -> { order(:updated_at => :desc) } 8 | has_many :comments, -> { order(:updated_at => :desc) } 9 | 10 | def self.create_with_omniauth(auth) 11 | create! do |user| 12 | user.omniauth_provider = auth['provider'] 13 | user.omniauth_uid = auth['uid'] 14 | user.email = auth['info']['email'] 15 | user.nickname = nil 16 | end 17 | end 18 | 19 | 20 | end 21 | -------------------------------------------------------------------------------- /app/views/comments/_form.html.erb: -------------------------------------------------------------------------------- 1 | <% if current_user.present? %> 2 | <% 3 | @comment ||= Comment.new 4 | %> 5 | <%= simple_form_for [@gist, @comment] do |f| %> 6 | 7 | <%= f.error_notification %> 8 | 9 |
10 | <%= text_area_tag :body, nil, :rows => 8, :class => 'span8' %> 11 |
12 | 13 |
14 | <%= f.submit 'Submit', :class => 'btn btn-primary' %> 15 |
16 | 17 | <% end %> 18 | <% else %> 19 | Please <%= link_to 'sign in', signin_path %> to comment. 20 | <% end %> 21 | -------------------------------------------------------------------------------- /app/views/comments/_list.html.erb: -------------------------------------------------------------------------------- 1 | <% @gist.comments.each do |comment| %> 2 |
3 | 4 | 5 | <% if comment.user.present? %> 6 | <%= link_to comment.user.nickname, comment.user %> 7 | commented <%= time_ago_in_words(comment.created_at) + ' ago' %> 8 | <% if comment.user_id == current_user.try(:id) %> 9 |   <%= link_to 'Delete', gist_comment_path(@gist, comment), :method => :delete, :data => {:confirm => 'Are you sure?'} %> 10 | <% end %> 11 | <% else %> 12 | A deleted user commented <%= time_ago_in_words(comment.created_at) + ' ago' %> 13 | <% end %> 14 | 15 | 16 | <% if Gistub::Application.config.gistub_auto_link %> 17 | <%= auto_link raw markdown(sanitize comment.body) %> 18 | <% else %> 19 | <%= raw markdown(sanitize comment.body) %> 20 | <% end %> 21 |
22 | <% end %> 23 | -------------------------------------------------------------------------------- /app/views/common/_favorites.html.erb: -------------------------------------------------------------------------------- 1 | <% if current_user.present? %> 2 | 3 |

Favorite Gists

4 | 5 | <% my_favorite_gists.each do |gist| %> 6 |
7 |   8 | <%= link_to gist.title, gist %> 9 |
10 | 11 | created <%= time_ago_in_words(gist.created_at) + ' ago' %> 12 | 13 |
14 | <% end %> 15 | 16 | <%= link_to "More...", user_path(current_user) %> 17 | 18 |
19 | 20 | <% end %> 21 | -------------------------------------------------------------------------------- /app/views/common/_flash_error.html.erb: -------------------------------------------------------------------------------- 1 | <% if flash[:error] %> 2 |
3 | <%= flash[:error] %> 4 |
5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/views/common/_flash_notice.html.erb: -------------------------------------------------------------------------------- 1 | <% if flash[:notice] %> 2 |
3 | <%= flash[:notice] %> 4 |
5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/views/common/_mygists.html.erb: -------------------------------------------------------------------------------- 1 | <% if current_user.present? %> 2 | 3 |

My Gists

4 | 5 | <% my_gists.each do |gist| %> 6 |
7 | <% if gist.is_public %> 8 |   9 | <% else %> 10 |   11 | <% end %> 12 | <%= link_to gist.title, gist %> 13 |
14 | 15 | created <%= time_ago_in_words(gist.created_at) + ' ago' %> 16 | 17 |
18 | <% end %> 19 | 20 | <%= link_to "More...", user_path(current_user) %> 21 | 22 |
23 | 24 | <% end %> 25 | -------------------------------------------------------------------------------- /app/views/common/_search_form.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_tag search_gists_path, :method => :get do %> 3 | <%= text_field_tag :search_query, @search_query, :placeholder => "Search", :class => "span3" %> 4 | <% end %> 5 |
6 | -------------------------------------------------------------------------------- /app/views/favorites/just_required_for_rspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seratch/gistub/bbb69975ab9291f7224b058302ca0a5f1a9e038a/app/views/favorites/just_required_for_rspec -------------------------------------------------------------------------------- /app/views/gists/_fork_of.html.erb: -------------------------------------------------------------------------------- 1 | <% if @gist.source_gist.present? %> 2 |
3 |

Fork of

4 |
    5 |
  • 6 | 7 |   8 | <%= link_to @gist.source_gist.title, @gist.source_gist %> 9 |
    10 | <%= time_ago_in_words(@gist.source_gist.created_at) + ' ago' %> 11 | by 12 | <% if @gist.source_gist.user.nil? %>Anonymous 13 | <% else %> 14 | <%= link_to @gist.source_gist.user.nickname, user_path(@gist.source_gist.user) %> 15 | <%= gravatar_image(@gist.source_gist.user, :size => 15) %> 16 | <% end %> 17 |
    18 |
  • 19 |
20 | <% end %> 21 | -------------------------------------------------------------------------------- /app/views/gists/_forks.html.erb: -------------------------------------------------------------------------------- 1 | <% if @gist.forks.present? %> 2 |
3 |

Forks

4 |
    5 | <% @gist.forks.each do |gist| %> 6 |
  • 7 | 8 |   9 | <%= link_to gist.title, gist %> 10 |
    11 | <%= time_ago_in_words(gist.created_at) + ' ago' %> 12 | by 13 | <% if gist.user.nil? %>Anonymous 14 | <% else %> 15 | <%= link_to gist.user.nickname, user_path(gist.user) %> 16 | <%= gravatar_image(gist.user, :size => 15) %> 17 | <% end %> 18 |
    19 |
  • 20 | <% end %> 21 |
22 | <% end %> 23 | -------------------------------------------------------------------------------- /app/views/gists/_form.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | model_name = Gist 3 | @gist ||= Gist.new 4 | @gist_history ||= GistHistory.new 5 | %> 6 | <% if is_anonymous_gist_allowed %> 7 | 8 | <%= simple_form_for @gist do |f| %> 9 | 10 | <%= render :partial => 'common/flash_error' %> 11 | 12 |
13 | <%= f.input :title, :label => false, :placeholder => 'Gist description...', :input_html => {:class => 'span8'} %> 14 |
15 | 16 |
17 | 18 | <% @gist_history.gist_files.each do |gist_file| %> 19 | <%= render :partial => 'gists/gist_files_input', :locals => { :gist_file => gist_file } %> 20 | <% end %> 21 | 22 | <%= render :partial => 'gists/gist_files_input', :locals => { :gist_file => nil } %> 23 | 24 |
25 | 26 | 29 | 30 |
31 | <% if current_user.present? and @gist.id.nil? %> 32 | <%= check_box_tag 'is_public', true, @gist.is_public %> 33 | <% else %> 34 | <%= check_box_tag 'is_public', true, @gist.user_id.nil? ? true : @gist.is_public, :disabled => true %> 35 | <% end %> 36 |   Create as a public Gist 37 |
38 | 39 |
40 | <%= f.submit 'Submit', :class => 'btn btn-primary' %> 41 |
42 | <% end %> 43 | 44 | 90 | 91 | <% else %> 92 | 93 | Please <%= link_to 'sign in', signin_path %> to create a gist. 94 | 95 | <% end %> 96 | -------------------------------------------------------------------------------- /app/views/gists/_gist_files_input.html.erb: -------------------------------------------------------------------------------- 1 | <% id = gist_file.try(:id) || "new#{Time.now.to_f.to_s.gsub(/\./, '')}" %> 2 |
3 |
4 | <%= text_field_tag 'gist_file_names[]', gist_file.try(:name), :placeholder => 'name this file...', :class => 'span8 gist_file_name', :id => "gist_file_names_#{id}"%> 5 |
6 |
7 | <%= text_area_tag 'gist_file_bodies[]', gist_file.try(:body), :rows => 15, :class => 'span8 gist_file_body', :id => "gist_file_bodies_#{id}" %> 8 |
9 | Remove this…
10 |
11 | 12 | -------------------------------------------------------------------------------- /app/views/gists/_history.html.erb: -------------------------------------------------------------------------------- 1 |

History

2 |
    3 | <% @gist.gist_histories.each do |history| %> 4 |
  • 5 | 6 |   7 | <% if history.id == @gist_history.id %> 8 | <%= time_ago_in_words(history.created_at) + ' ago' %> 9 | by 10 | <% if history.user.nil? %>Anonymous 11 | <% else %> 12 | <%= link_to history.user.nickname, user_path(history.user) %> 13 | <%= gravatar_image(history.user, :size => 15) %> 14 | <% end %> 15 | <% else %> 16 | <%= link_to time_ago_in_words(history.created_at) + ' ago', show_history_gist_path(@gist, history) %> 17 | by 18 | <% if history.user.nil? %>Anonymous 19 | <% else %> 20 | <%= link_to history.user.nickname, user_path(history.user) %> 21 | <%= gravatar_image(history.user, :size => 15) %> 22 | <% end %> 23 | <% end %> 24 | 25 |
  • 26 | <% end %> 27 |
28 | -------------------------------------------------------------------------------- /app/views/gists/_list.html.erb: -------------------------------------------------------------------------------- 1 | <% if @gists.empty? %> 2 |
No gist found
3 | <% end %> 4 | <% @gists.each do |gist| %> 5 | <% if gist.latest_history %> 6 |

7 | <% if gist.is_public %> 8 |  <%= link_to gist.title, gist %> 9 | <% if gist.favorites.present? %> 10 | <%= gist.favorites.size %> <% if gist.favorites.size == 1 %>like<% else %>likes<% end %><% if gist.comments.present? %>,<% end %> 11 | <% end %> 12 | <% if gist.comments.present? %> 13 | <%= gist.comments.size %> <% if gist.comments.size == 1 %>comment<% else %>comments<% end %> 14 | <% end %> 15 |
16 | 17 | <%= time_ago_in_words(gist.latest_history.created_at) + ' ago' %> 18 | by 19 | <% if gist.user.nil? %> 20 | Anonymous 21 | <% else %> 22 | <%= link_to gist.user.nickname, user_path(gist.user) %> 23 | <%= gravatar_image(gist.user, :size => 20) %> 24 | <% end %> 25 | 26 |
27 | <% else %> 28 |
29 |  <%= link_to gist.title, gist %> 30 | <% if gist.favorites.present? %> 31 | <%= gist.favorites.size %> <% if gist.favorites.size == 1 %>like<% else %>likes<% end %><% if gist.comments.present? %>,<% end %> 32 | <% end %> 33 | <% if gist.comments.present? %> 34 | <%= gist.comments.size %> <% if gist.comments.size == 1 %>comment<% else %>comments<% end %> 35 | <% end %> 36 |
37 | 38 | <%= time_ago_in_words(gist.latest_history.created_at) + ' ago' %> 39 | by 40 | <% if gist.user.nil? %> 41 | Anonymous 42 | <% else %> 43 | <%= link_to gist.user.nickname, user_path(gist.user) %> 44 | <% end %> 45 | 46 |
47 |
48 | <% end %> 49 |

50 |
<%= gist.latest_history.headline %>
51 | <% end %> 52 | <% end %> 53 | -------------------------------------------------------------------------------- /app/views/gists/_mine_page.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= paginate @gists, :remote => true, :window => 6, :params => {:action => 'mine_page'} %> 3 | <%= render :partial => 'gists/list' %> 4 |
5 | -------------------------------------------------------------------------------- /app/views/gists/_page.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= paginate @gists, :remote => true, :window => 6, :params => {:action => 'page'} %> 3 | <%= render :partial => 'gists/list' %> 4 |
5 | -------------------------------------------------------------------------------- /app/views/gists/_user_fav_page.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= paginate @favorites, :remote => true, :window => 6, 3 | :params => {:controller => 'gists', :action => 'user_fav_page', :user_id => @user.id} 4 | %> 5 | <% @favorites.each do |fav| %> 6 | <% gist = fav.gist %> 7 | <% if gist.present? %> 8 |

9 | <%= link_to gist.title, gist %> 10 |
11 | 12 | <%= time_ago_in_words(gist.latest_history.created_at) + ' ago' %> 13 | by 14 | <% if gist.user.nil? %>Anonymous 15 | <% else %><%= link_to gist.user.nickname, user_path(gist.user) %> 16 | <% end %> 17 | 18 |
19 |

20 |
<%= gist.latest_history.headline %>
21 | <% end %> 22 | <% end %> 23 |
24 | -------------------------------------------------------------------------------- /app/views/gists/_user_page.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= paginate @gists, :remote => true, :window => 6, 3 | :params => {:controller => 'gists', :action => 'user_page', :user_id => @user.id} 4 | %> 5 | <%= render :partial => 'gists/list' %> 6 |
7 | -------------------------------------------------------------------------------- /app/views/gists/add_gist_files_input.js.erb: -------------------------------------------------------------------------------- 1 | $('#gist_files_input').append('<%= j(render(:partial => 'gist_files_input', :locals => { :gist_file => GistFile.new }) ) %>'); 2 | -------------------------------------------------------------------------------- /app/views/gists/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @gist %> | 6 | <%= link_to 'Back', gists_path %> 7 | 8 |
9 |
10 | <%= render :partial => 'gists/history' %> 11 |
12 | -------------------------------------------------------------------------------- /app/views/gists/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | <%= render :partial => 'common/flash_notice' %> 4 | 5 | <% @gist_list_title ||= "Gists" %> 6 |

 <%= @gist_list_title %> 7 | <%= render :partial => 'common/search_form' %> 8 |

9 |
10 | 11 |
12 | <%= render :partial => 'gists/page' %> 13 |
14 | 15 | 20 | 21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /app/views/gists/mine.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | <%= render :partial => 'common/flash_notice' %> 4 | 5 |

 My Gists 6 | <%= render :partial => 'common/search_form' %> 7 |

8 |
9 | 10 | <%= render :partial => 'gists/mine_page' %> 11 | 12 | 17 | 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /app/views/gists/mine_page.js.erb: -------------------------------------------------------------------------------- 1 | $('#gists').html('<%= j(render(:partial => 'gists/mine_page')) %>'); 2 | prettyPrint(); 3 | -------------------------------------------------------------------------------- /app/views/gists/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |

 New Gist

4 |
5 | <%= render 'gists/form' %> 6 | 7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /app/views/gists/page.js.erb: -------------------------------------------------------------------------------- 1 | $('#gists').html('<%= j(render(:partial => 'gists/page')) %>'); 2 | prettyPrint(); 3 | -------------------------------------------------------------------------------- /app/views/gists/show.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :title do %><%= @gist.title %><% end %> 2 |
3 | 4 | <%= render :partial => 'common/flash_notice' %> 5 | 6 |

7 | <% if @gist.is_public %> 8 |  <%= @gist.title %> 9 | 10 | <% favorite_users(@gist).each do |user| %> 11 | 12 | <% end %> 13 | 14 | <% else %> 15 |
 <%= @gist.title %>
16 | <% end %> 17 |

18 |
19 |
20 | <% if current_user.present? %> 21 | <% if is_already_favorited(@gist) %> 22 |   23 | <%= link_to 'Dislike', gist_favorite_path(@gist, find_my_favorite(@gist)), :method => :delete %> 24 | <% else %> 25 |   26 | <%= link_to 'Like', gist_favorites_path(@gist), :method => :post %> 27 | <% end %> 28 |    29 | <% end %> 30 | <% if @gist.user_id != current_user.try(:id) %> 31 |  <%= link_to 'Fork', gist_fork_path(@gist), :method => :post %> 32 |    33 | <% end %> 34 | <% if (@gist.user_id.nil? && is_anonymous_gist_allowed) || (@gist.user_id.present? && @gist.user_id == current_user.try(:id)) %> 35 |  <%= link_to 'Edit', edit_gist_path(@gist) %> 36 |    37 | <% end %> 38 | <% if current_user.present? and @gist.user_id == current_user.try(:id) %> 39 |  <%= link_to 'Delete', gist_path(@gist), :method => :delete, :data => {:confirm => 'Are you sure?'} %> 40 | <% elsif (@gist.user_id.nil? && is_anonymous_gist_allowed) %> 41 |  <%= link_to 'Delete', gist_path(@gist), :method => :delete, :data => {:confirm => 'Are you sure?'} %> 42 | <% end %> 43 |
44 |
45 |
46 | 47 | <% @gist_history.gist_files.each do |file| %> 48 |

49 |  <%= file.name %> 50 | 51 | <%= link_to 'Raw', show_raw_file_gist_path(@gist, file) %> 52 | 53 |

54 | <% if file.name =~ /.+((\.md)|(\.markdown))$/ %> 55 | <% if Gistub::Application.config.gistub_auto_link %> 56 |
<%= raw auto_link markdown(sanitize file.body) %>
57 | <% else %> 58 |
<%= raw markdown(sanitize file.body) %>
59 | <% end %> 60 | <% else %> 61 |
<%= file.body %>
62 | <% end %> 63 | <% end %> 64 | 65 |
66 |

Comments

67 |
68 | <%= render :partial => 'comments/list' %> 69 | <%= render :partial => 'comments/form' %> 70 | 71 | 76 | 77 |
78 |
79 | <%= render :partial => 'gists/history' %> 80 | <%= render :partial => 'gists/fork_of' %> 81 | <%= render :partial => 'gists/forks' %> 82 |
83 | -------------------------------------------------------------------------------- /app/views/gists/user_fav_page.js.erb: -------------------------------------------------------------------------------- 1 | $('#favorites').html('<%= j(render(:partial => 'gists/user_fav_page')) %>'); 2 | prettyPrint(); 3 | 4 | -------------------------------------------------------------------------------- /app/views/gists/user_page.js.erb: -------------------------------------------------------------------------------- 1 | $('#user_gists').html('<%= j(render(:partial => 'gists/user_page')) %>'); 2 | prettyPrint(); 3 | -------------------------------------------------------------------------------- /app/views/kaminari/_first_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link to the "First" page 2 | - available local variables 3 | url: url to the first page 4 | current_page: a page object for the currently displayed page 5 | num_pages: total number of pages 6 | per_page: number of items to fetch per page 7 | remote: data-remote 8 | -%> 9 |
  • 10 | <%= link_to raw(t 'views.pagination.first'), url, :remote => remote %> 11 |
  • 12 | -------------------------------------------------------------------------------- /app/views/kaminari/_gap.html.erb: -------------------------------------------------------------------------------- 1 | <%# Non-link tag that stands for skipped pages... 2 | - available local variables 3 | current_page: a page object for the currently displayed page 4 | num_pages: total number of pages 5 | per_page: number of items to fetch per page 6 | remote: data-remote 7 | -%> 8 |
  • <%= raw(t 'views.pagination.truncate') %>
  • 9 | -------------------------------------------------------------------------------- /app/views/kaminari/_last_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link to the "Last" page 2 | - available local variables 3 | url: url to the last page 4 | current_page: a page object for the currently displayed page 5 | num_pages: total number of pages 6 | per_page: number of items to fetch per page 7 | remote: data-remote 8 | -%> 9 | 12 | -------------------------------------------------------------------------------- /app/views/kaminari/_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link showing page number 2 | - available local variables 3 | page: a page object for "this" page 4 | url: url to this page 5 | current_page: a page object for the currently displayed page 6 | num_pages: total number of pages 7 | per_page: number of items to fetch per page 8 | remote: data-remote 9 | -%> 10 |
  • 11 | <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> 12 |
  • 13 | -------------------------------------------------------------------------------- /app/views/kaminari/_paginator.html.erb: -------------------------------------------------------------------------------- 1 | <%# The container tag 2 | - available local variables 3 | current_page: a page object for the currently displayed page 4 | num_pages: total number of pages 5 | per_page: number of items to fetch per page 6 | remote: data-remote 7 | paginator: the paginator that renders the pagination tags inside 8 | -%> 9 | <%= paginator.render do -%> 10 | 23 | <% end -%> 24 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | <% app_name = ENV['GISTUB_APP_NAME'].presence || 'Gistub' %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= content_for?(:title) ? yield(:title) + ' - ' + app_name : app_name %> 9 | <%= csrf_meta_tags %> 10 | 11 | 14 | 15 | <%= stylesheet_link_tag "application", :media => "all" %> 16 | <%= javascript_include_tag "header" %> 17 | 18 | 19 | 20 | 21 | 44 | 45 |
    46 | 47 |
    48 | <%= yield %> 49 |
    50 |
    51 | Gistub : Sharing code snippets in-house - version 1.3.6 52 |
    53 | 54 |
    55 | 56 | <%= javascript_include_tag "application" %> 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /app/views/root/index.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | 3 | <%= render :partial => 'common/flash_notice' %> 4 | 5 | <% unless @gists.to_a.size == 0 %> 6 |

     Latest 5 Public Gists 7 | <%= render :partial => 'common/search_form' %> 8 |

    9 |
    10 | <% @gists.each do |gist| %> 11 | <% if gist.latest_history.present? %> 12 |

    13 |  <%= link_to gist.title, gist %> 14 | <% if gist.favorites.present? %> 15 | <%= gist.favorites.size %> <% if gist.favorites.size == 1 %>like<% else %>likes<% end %><% if gist.comments.present? %>,<% end %> 16 | <% end %> 17 | <% if gist.comments.present? %> 18 | <%= gist.comments.size %> <% if gist.comments.size == 1 %>comment<% else %>comments<% end %> 19 | <% end %> 20 |
    21 | 22 | <%= time_ago_in_words(gist.latest_history.created_at) + ' ago' %> 23 | by 24 | <% if gist.user.nil? %>Anonymous 25 | <% else %> 26 | <%= link_to gist.user.nickname, user_path(gist.user) %> 27 | <%= gravatar_image(gist.user, :size => 20) %> 28 | <% end %> 29 | 30 |
    31 |

    32 |
    <%= gist.latest_history.headline %>
    33 | <% end %> 34 | <% end %> 35 | 36 |
    37 |
    38 | <%= link_to 'Read more...', gists_path %> 39 |
    40 |
    41 |
    42 |
    43 | <% end %> 44 | 45 |

    New Gist

    46 |
    47 | <%= render 'gists/form' %> 48 | 49 | 54 | 55 |
    56 |
    57 | <%= render :partial => 'common/mygists' %> 58 | <%= render :partial => 'common/favorites' %> 59 |
    60 | -------------------------------------------------------------------------------- /app/views/sessions/failure.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | 3 |

    Authentication Cancelled

    4 |
    5 | <%= link_to 'Back to home', root_path %> 6 | 7 |
    8 |
    9 |
    10 | -------------------------------------------------------------------------------- /app/views/users/_form.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing User

    2 |
    3 | <%= simple_form_for @user, :html => {:class => 'form-horizontal'} do |f| %> 4 | 5 | <%= render :partial => 'common/flash_notice' %> 6 | <%= f.error_notification %> 7 | 8 |
    9 | <%= f.input :nickname, :input_html => {:class => 'span6'} %> 10 | <%= f.input :omniauth_provider, :input_html => {:class => 'span6'}, :disabled => true %> 11 | <%= f.input :omniauth_uid, :input_html => {:class => 'span6'}, :disabled => true %> 12 |
    13 | 14 |
    15 | <%= f.submit 'Submit', :class => 'btn btn-info' %> 16 | <%= link_to 'Cancel', root_path, :class => 'btn' %> 17 |
    18 | 19 | <% end %> 20 | -------------------------------------------------------------------------------- /app/views/users/edit.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | 3 | <%= render 'users/form' %> 4 | 5 |
    6 |
    7 |
    8 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | 3 | <%= render :partial => 'common/flash_notice' %> 4 | 5 |

    6 | <%= gravatar_image(@user, :size => 30) %> 7 | <%= @user.nickname %> 8 |

    9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
    <%= @user.omniauth_provider %>
    <%= @user.omniauth_uid %>
    19 | 20 | <% if @user.id == current_user.try(:id) %> 21 |  <%= link_to 'Edit', edit_user_path(@user) %> 22 |    23 |  <%= link_to 'Delete', user_path(@user), :method => :delete, :data => {:confirm => 'Are you sure?'} %> 24 | <% end %> 25 | 26 |
    27 |

    Public Gists

    28 |
    29 | 30 | <%= render :partial => 'gists/user_page' %> 31 | 32 |
    33 |

    Favorite Gists

    34 |
    35 | 36 | <%= render :partial => 'gists/user_fav_page' %> 37 | 38 | 43 | 44 |
    45 |
    46 |
    47 | -------------------------------------------------------------------------------- /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 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require ::File.expand_path('../config/environment', __FILE__) 2 | 3 | map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do 4 | run Gistub::Application 5 | end 6 | 7 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | require File.expand_path('../boot', __FILE__) 3 | 4 | require 'rails/all' 5 | 6 | if defined?(Bundler) 7 | # If you precompile assets before deploying to production, use this line 8 | Bundler.require(*Rails.groups(:assets => %w(development test))) 9 | # If you want your assets lazily compiled in production, use this line 10 | # Bundler.require(:default, :assets, Rails.env) 11 | end 12 | 13 | module Gistub 14 | class Application < Rails::Application 15 | 16 | config.action_view.sanitized_allowed_tags = ['script'] 17 | 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 | # Custom directories with classes and modules you want to be autoloadable. 23 | # config.autoload_paths += %W(#{config.root}/extras) 24 | 25 | # Only load the plugins named here, in the order given (default is alphabetical). 26 | # :all can be used as a placeholder for all plugins not explicitly named. 27 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 28 | 29 | # Activate observers that should always be running. 30 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 31 | 32 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 33 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 34 | # config.time_zone = 'Central Time (US & Canada)' 35 | 36 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 37 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 38 | # config.i18n.default_locale = :de 39 | I18n.enforce_available_locales = false 40 | 41 | # Configure the default encoding used in templates for Ruby 1.9. 42 | config.encoding = "utf-8" 43 | 44 | # Configure sensitive parameters which will be filtered from the log file. 45 | config.filter_parameters += [:password] 46 | 47 | # Enable escaping HTML in JSON. 48 | config.active_support.escape_html_entities_in_json = true 49 | 50 | # Use SQL instead of Active Record's schema dumper when creating the database. 51 | # This is necessary if your schema can't be completely dumped by the schema dumper, 52 | # like if you have constraints or database-specific column types 53 | # config.active_record.schema_format = :sql 54 | 55 | # Enable the asset pipeline 56 | config.assets.enabled = true 57 | 58 | # Version of your assets, change this if you want to expire all your assets 59 | config.assets.version = '1.0' 60 | 61 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 62 | # config.assets.precompile += %w( search.js ) 63 | config.assets.precompile += [ 64 | "header.js", 65 | "fontawesome-webfont.ttf", 66 | "fontawesome-webfont.eot", 67 | "fontawesome-webfont.svg", 68 | "fontawesome-webfont.woff" 69 | ] 70 | 71 | # Enabling rails_autolink 72 | config.gistub_auto_link = ENV['GISTUB_AUTO_LINK'] == 'true' 73 | 74 | # Enabling anonymous post 75 | config.gistub_allows_anonymous = ENV['GISTUB_ALLOWS_ANONYMOUS'] != 'false' 76 | 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | # Set up gems listed in the Gemfile. 3 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 4 | 5 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 6 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | require File.expand_path('../application', __FILE__) 3 | 4 | Gistub::Application.initialize! 5 | 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | Gistub::Application.configure do 3 | # Settings specified here will take precedence over those in config/application.rb 4 | 5 | # In the development environment your application's code is reloaded on 6 | # every request. This slows down response time but is perfect for development 7 | # since you don't have to restart the web server when you make code changes. 8 | config.cache_classes = false 9 | 10 | # Do not eager load code on boot. 11 | config.eager_load = false 12 | 13 | # Show full error reports and disable caching 14 | config.consider_all_requests_local = true 15 | config.action_controller.perform_caching = false 16 | 17 | # Don't care if the mailer can't send 18 | config.action_mailer.raise_delivery_errors = false 19 | 20 | # Print deprecation notices to the Rails logger 21 | config.active_support.deprecation = :log 22 | 23 | # Only use best-standards-support built into browsers 24 | config.action_dispatch.best_standards_support = :builtin 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 | 32 | config.after_initialize do 33 | Bullet.enable = true 34 | #Bullet.raise = true 35 | Bullet.rails_logger = true 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | Gistub::Application.configure do 3 | # Settings specified here will take precedence over those in config/application.rb 4 | 5 | # Code is not reloaded between requests 6 | config.cache_classes = true 7 | 8 | # Eager load code on boot. This eager loads most of Rails and 9 | # your application in memory, allowing both thread web servers 10 | # and those relying on copy on write to perform better. 11 | # Rake tasks automatically ignore this option for performance. 12 | config.eager_load = true 13 | 14 | # Full error reports are disabled and caching is turned on 15 | config.consider_all_requests_local = false 16 | config.action_controller.perform_caching = true 17 | 18 | # Disable Rails's static asset server (Apache or nginx will already do this) 19 | config.serve_static_assets = true 20 | 21 | # Compress JavaScripts and CSS 22 | config.assets.compress = true 23 | 24 | # Don't fallback to assets pipeline if a precompiled asset is missed 25 | config.assets.compile = false 26 | 27 | # Generate digests for assets URLs 28 | config.assets.digest = true 29 | 30 | # Defaults to nil and saved in location specified by config.assets.prefix 31 | # config.assets.manifest = YOUR_PATH 32 | config.assets.version = '1.0' 33 | 34 | # Specifies the header that your server uses for sending files 35 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 36 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 37 | 38 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 39 | # config.force_ssl = true 40 | 41 | # See everything in the log (default is :info) 42 | # config.log_level = :debug 43 | 44 | # Prepend all log lines with the following tags 45 | # config.log_tags = [ :subdomain, :uuid ] 46 | 47 | # Use a different logger for distributed setups 48 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 49 | 50 | # Use a different cache store in production 51 | # config.cache_store = :mem_cache_store 52 | 53 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 54 | # config.action_controller.asset_host = "http://assets.example.com" 55 | 56 | # Disable delivery errors, bad email addresses will be ignored 57 | # config.action_mailer.raise_delivery_errors = false 58 | 59 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 60 | # the I18n.default_locale when a translation can not be found) 61 | config.i18n.fallbacks = true 62 | 63 | # Send deprecation notices to registered listeners 64 | config.active_support.deprecation = :notify 65 | 66 | # Log the query plan for queries taking more than this (works 67 | # with SQLite, MySQL, and PostgreSQL) 68 | # config.active_record.auto_explain_threshold_in_seconds = 0.5 69 | 70 | # Use default logging formatter so that PID and timestamp are not suppressed. 71 | config.log_formatter = ::Logger::Formatter.new 72 | 73 | end 74 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | Gistub::Application.configure do 3 | 4 | # Do not eager load code on boot. This avoids loading your whole application 5 | # just for the purpose of running a single test. If you are using a tool that 6 | # preloads Rails for running tests, you may have to set it to true. 7 | config.eager_load = false 8 | 9 | # Configure static asset server for tests with Cache-Control for performance. 10 | config.serve_static_assets = true 11 | 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Show full error reports and disable caching. 15 | config.consider_all_requests_local = true 16 | config.action_controller.perform_caching = false 17 | 18 | # Raise exceptions instead of rendering exception templates. 19 | config.action_dispatch.show_exceptions = false 20 | 21 | # Disable request forgery protection in test environment. 22 | config.action_controller.allow_forgery_protection = false 23 | 24 | # Tell Action Mailer not to deliver emails to the real world. 25 | # The :test delivery method accumulates sent emails in the 26 | # ActionMailer::Base.deliveries array. 27 | config.action_mailer.delivery_method = :test 28 | 29 | # Print deprecation notices to the stderr. 30 | config.active_support.deprecation = :stderr 31 | 32 | config.after_initialize do 33 | Bullet.enable = true 34 | #Bullet.raise = true 35 | Bullet.rails_logger = true 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 5 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 6 | 7 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 8 | # Rails.backtrace_cleaner.remove_silencers! 9 | -------------------------------------------------------------------------------- /config/initializers/client_side_validations.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding : utf-8 -*- 2 | # ClientSideValidations Initializer 3 | 4 | # Uncomment to disable uniqueness validator, possible security issue 5 | # ClientSideValidations::Config.disabled_validators = [:uniqueness] 6 | 7 | # Uncomment to validate number format with current I18n locale 8 | # ClientSideValidations::Config.number_format_with_locale = true 9 | 10 | # Uncomment the following block if you want each input field to have the validation messages attached. 11 | ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| 12 | unless html_tag =~ /^