Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .firstdraft_project.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@

# Ignore dotenv files
/.env*

# Ignore dotenv files
/.env*

.rbenv-gemsets
examples.txt
12 changes: 11 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.2'
# Use sqlite3 as the database for Active Record
Expand All @@ -9,7 +15,7 @@ gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

Expand Down Expand Up @@ -37,6 +43,9 @@ group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Expand All @@ -54,6 +63,7 @@ group :development do
gem 'annotate'
gem 'awesome_print'
gem 'better_errors'
gem 'dev_toolbar', git: 'https://github.com/firstdraft/dev_toolbar.git'
gem 'binding_of_caller'
gem 'firstdraft_generators', github: 'firstdraft/firstdraft_generators'
gem 'letter_opener'
Expand Down
60 changes: 37 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
GIT
remote: git://github.com/firstdraft/firstdraft_generators.git
remote: https://github.com/firstdraft/dev_toolbar.git
revision: 6a1ae2e4e1a3dfdfd867e0bcb3f2c465ebacc19a
specs:
dev_toolbar (0.1.0)
better_errors
rails

GIT
remote: https://github.com/firstdraft/firstdraft_generators.git
revision: 9405e70b3d5bf2215917c7d268baa07ab76386fd
specs:
firstdraft_generators (0.0.3)

GIT
remote: git://github.com/firstdraft/grade_runner.git
revision: 1e212e50b3fd46ff5b22783d19e0e1aac7928915
remote: https://github.com/firstdraft/grade_runner.git
revision: fbddabac089f98821b7d07d9ac957c836a05264b
specs:
grade_runner (0.0.1)

GIT
remote: git://github.com/firstdraft/web_git.git
revision: 3c4f4c18d62012ba151e3aef90a495cbf5c66de5
remote: https://github.com/firstdraft/web_git.git
revision: 9ef7a0a888858f45d0bcb49fb990d96d00642884
specs:
web_git (0.0.1)
bootstrap (~> 4.0.0.alpha6)
jquery-rails (= 4.3.1)
git_clone_url
jquery-rails
octicons_helper
tether-rails
turbolinks (~> 5)
tzinfo-data

GIT
remote: https://github.com/raghubetina/starter_generators
revision: 48fa7a4fbe4eb90ecfe05a133a7d7550167308f8
revision: c38d341cecde6ff086d8e7882f781f82c2870ffd
specs:
starter_generators (0.9.6)

Expand Down Expand Up @@ -74,8 +82,6 @@ GEM
activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 13.0)
arel (7.1.4)
autoprefixer-rails (7.1.2.3)
execjs
awesome_print (1.8.0)
bcrypt (3.1.11)
better_errors (2.1.1)
Expand All @@ -85,9 +91,6 @@ GEM
bindex (0.5.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap (4.0.0.alpha6)
autoprefixer-rails (>= 6.0.3)
sass (>= 3.4.19)
builder (3.2.3)
byebug (9.0.6)
callsite (0.0.11)
Expand All @@ -99,17 +102,17 @@ GEM
rack-test (>= 0.5.4)
xpath (~> 2.0)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crack (0.4.3)
safe_yaml (~> 1.0.0)
database_cleaner (1.6.1)
database_cleaner (1.6.2)
debug_inspector (0.0.3)
devise (4.3.0)
bcrypt (~> 3.0)
Expand All @@ -129,11 +132,13 @@ GEM
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
faker (1.8.4)
faker (1.7.3)
i18n (~> 0.5)
ffi (1.9.18)
font-awesome-sass (4.7.0)
sass (>= 3.2)
git_clone_url (2.0.0)
uri-ssh_git (>= 2.0)
globalid (0.4.0)
activesupport (>= 4.2.0)
hashdiff (0.3.4)
Expand Down Expand Up @@ -171,10 +176,10 @@ GEM
nio4r (2.0.0)
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
octicons (3.0.1)
octicons (5.0.5)
nokogiri (>= 1.6.3.1)
octicons_helper (3.0.1)
octicons (~> 3.0)
octicons_helper (4.0.7)
octicons
rails
orm_adapter (0.5.0)
pry (0.10.4)
Expand Down Expand Up @@ -249,6 +254,11 @@ GEM
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
slop (3.6.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -267,10 +277,11 @@ GEM
turbolinks-source (5.0.3)
tzinfo (1.2.3)
thread_safe (~> 0.1)
tzinfo-data (1.2017.2)
tzinfo-data (1.2017.3)
tzinfo (>= 1.0.0)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
uri-ssh_git (2.0.0)
warden (1.2.7)
rack (>= 1.0)
web-console (3.5.1)
Expand Down Expand Up @@ -298,8 +309,9 @@ DEPENDENCIES
binding_of_caller
byebug
capybara
coffee-rails (~> 4.1.0)
coffee-rails (~> 4.2)
database_cleaner
dev_toolbar!
devise
dotenv-rails
factory_girl_rails
Expand All @@ -317,6 +329,8 @@ DEPENDENCIES
rspec-rails
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
starter_generators!
tzinfo-data
Expand All @@ -327,4 +341,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
1.15.2
1.16.0
5 changes: 2 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

<%= yield %>
<%= dev_tools if Rails.env.development? %>
</body>
</html>
5 changes: 5 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
5 changes: 5 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
4 changes: 4 additions & 0 deletions bin/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kill -9 $(lsof -i tcp:8080 -t) >/dev/null 2>/dev/null
rails server -b $IP -p $PORT
4 changes: 1 addition & 3 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ chdir APP_ROOT do

puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'

puts "\n== Restarting application server =="
system! 'bin/rails restart'


puts "\n== Installing diff2html-cli =="
system! "npm install -g diff2html-cli"
Expand Down
8 changes: 5 additions & 3 deletions bin/spring
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ unless defined?(Spring)
require 'rubygems'
require 'bundler'

if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq }
gem 'spring', match[1]
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end
21 changes: 21 additions & 0 deletions bin/whitelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
require 'yaml'
include FileUtils

ip_address = ARGV[0]
path = Pathname.new File.expand_path('../../whitelist.yml', __FILE__)
whitelisted_ips = if File.exist?(path)
YAML.load_file(path)
else
[]
end

whitelisted_ips << ip_address
whitelisted_ips = whitelisted_ips.uniq.compact

File.open(path, 'w') {|f| f.write whitelisted_ips.to_yaml }

puts "Stopping Rails server. Please restart it."
`kill -9 $(lsof -i tcp:8080 -t) >/dev/null 2>/dev/null`
6 changes: 6 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Rails.application.configure do
path = Rails.root.join('whitelist.yml')
if File.exist?(path)
whitelisted_ips = YAML.load_file(path)
config.web_console.whitelisted_ips = whitelisted_ips
end
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/framework_trace.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module ActionDispatch
class ExceptionWrapper
def framework_trace
[]
end
end
end
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
mount WebGit::Engine, at: "/rails/git"
end
4 changes: 4 additions & 0 deletions grades.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
submission_url: https://grades.firstdraft.com
project_token: ''
personal_access_token:
Empty file removed public/favicon.ico
Empty file.
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "factory_girl_rails"
require "#{File.expand_path('../support/json_output_formatter', __FILE__)}"
require "#{File.expand_path('../support/hint_formatter', __FILE__)}"
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand All @@ -20,6 +21,7 @@
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.example_status_persistence_file_path = "examples.txt"

def h(hint_identifiers)
hint_identifiers.split.map { |identifier| I18n.t("hints.#{identifier}") }
Expand Down
11 changes: 11 additions & 0 deletions spec/support/hint_formatter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
RSpec::Support.require_rspec_core "formatters/documentation_formatter"

class HintFormatter < RSpec::Core::Formatters::DocumentationFormatter
RSpec::Core::Formatters.register self, :example_failed

def example_failed(failure)
super
@output.puts "\n\nHint: #{failure.example.metadata[:hint][0]}" if failure.example.metadata[:hint].present?
end

end
4 changes: 4 additions & 0 deletions whitelist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- 127.0.0.1
- 10.240.0.0/16
- "::1"