Skip to content

Commit

Permalink
don't requre pry or rb-readline
Browse files Browse the repository at this point in the history
  • Loading branch information
gemfarmer committed Feb 16, 2017
1 parent e7c9609 commit 2869e31
Show file tree
Hide file tree
Showing 23 changed files with 514 additions and 116 deletions.
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -83,6 +83,16 @@ This site does not use any heavy JavaScript frameworks, and should always work w
- jQuery is included in the WDS
- Ruby gems is used for front end dependency management

## Accessibility

To test the site locally for accessibility errors, we use [pa11y-ci](https://github.com/pa11y/ci) to periodically test the site for accessibility concerns.

To set up, do the following:

1. `npm install`
2. `npm install -g pa11y-ci`
3. `npm run pa11y-ci local`

## Standards and benchmarks

### Device and browser support
Expand Down
2 changes: 1 addition & 1 deletion PULL_REQUEST_TEMPLATE.md
Expand Up @@ -2,7 +2,7 @@ Fixes issue(s) # .

[![CircleCI](https://circleci.com/gh/18F/18f.gsa.gov/tree/BRANCH_NAME.svg?style=svg)](https://circleci.com/gh/18F/18f.gsa.gov/tree/BRANCH_NAME)

[:sunglasses: PREVIEW](https://federalist.18f.gov/preview/18F/18f.gsa.gov/BRANCH_NAME/)
[:sunglasses: PREVIEW](https://federalist.fr.cloud.gov/preview/18f/18f.gsa.gov/BRANCH_NAME/)

Changes proposed in this pull request:
-
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -2,11 +2,11 @@

# 18F’s flagship website

This repo houses the 18F website. We use the [Draft U.S. Web Design standards](https://standards.usa.gov/) as a front end framework. The site is built and served through [the Federalist platform](https://federalist.18f.gov).
This repo houses the 18F website. We use the [Draft U.S. Web Design standards](https://standards.usa.gov/) as a front end framework. The site is built and served through [the Federalist platform](https://federalist.fr.cloud.gov/).

### History

A detailed history of the work that went into developing this redesign can be found at [18F/beta.18f.gov](https://github.com/18F/beta.18f.gov). An archived copy of the original website can be found [on a Federalist preview](https://federalist.18f.gov/preview/18F/18f.gsa.gov/staging).
A detailed history of the work that went into developing this redesign can be found at [18F/beta.18f.gov](https://github.com/18F/beta.18f.gov). An archived copy of the original website can be found [on a Federalist preview](https://federalist.fr.cloud.gov/staging).

## Installation

Expand Down Expand Up @@ -42,7 +42,7 @@ Using Docker can make dependencies management easier, but can also slow down you
The site is a static website with HTML, CSS, and Javascript. Deployments are done through the Federalist platform.

1. Federalist runs in its own organization and space in CloudFoundry
1. Federalist Admin: https://federalist.18f.gov/
1. Federalist Admin: https://federalist.fr.cloud.gov/
1. Using the Federalist editor that requires GitHub Oauth and writes commits as auth'd GitHub user, changes are then passed through a webhook back to Federalist
1. Federalist uses a CloudFoundry S3 service to write to the bucket, the Federalist instance only derives S3 credentials from the CloudFoundry S3 service and can only read/write to federalist.18f.gov/*
1. Federalist responds to a webhook on GitHub and runs Jekyll to generate static web files and puts them in an S3 bucket
Expand Down
373 changes: 373 additions & 0 deletions _config-accesslint.yml

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions _config-blog.yml
@@ -1,19 +1,19 @@
env: "development"

---
env: development
exclude:
- .about.yml
- .cfignore
- .codeclimate.yml
- .gitignore
- .gitmodules
- .hound.yml
- _pages
- ".about.yml"
- ".cfignore"
- ".codeclimate.yml"
- ".gitignore"
- ".gitmodules"
- ".hound.yml"
- api-endpoints
- bin
- build
- circle.yml
- config_blog.rb
- CONTRIBUTING.md
- docker-compse.yml
- docker-compose.yml
- docker_entrypoint.rb
- Dockerfile
- examples/
Expand All @@ -22,6 +22,7 @@ exclude:
- Gemfile*
- humans.txt
- ISSUE_TEMPLATE.md
- killport
- LICENSE.md
- node_modules
- package.json
Expand All @@ -34,7 +35,7 @@ exclude:
- serve-blog
- serve-fast
- serve-accesslint
- sitemap.xml
- spec/
- system-security-plan.yml
- tests/
- tests/schema/tags.yml
Expand Down Expand Up @@ -316,7 +317,7 @@ exclude:
- _posts/2016-07-18-cloud-gov-full-steam-ahead-fedramp-assessment-process.md
- _posts/2016-07-19-strategies-for-starting-your-own-writing-lab.md
- _posts/2016-07-21-buying-better-digital-products-part-1-proto-personas-and-understanding-the-problem.md
- _posts/2016-07-22-building-emphathy-with-stakeholder-interviews-part-2-conversation.md
- _posts/2016-07-22-building-empathy-with-stakeholder-interviews-part-2-conversation.md
- _posts/2016-07-26-buying-better-digital-products-part-2-setting-the-product-vision-and-strategy.md
- _posts/2016-07-26-new-pilot-aims-to-streamline-notice-and-comment-process.md
- _posts/2016-07-28-bret-mogilefsky-finding-big-good-cloud-gov.md
Expand Down Expand Up @@ -347,7 +348,6 @@ exclude:
- _posts/2016-10-14-iterative-workplace-design-denver-federal-center.md
- _posts/2016-10-24-embracing-opportunities-to-improve-and-innovate.md
- _posts/2016-10-25-three-small-steps-you-can-take-to-reboot-agile-in-your-organization.md
- _posts/2016-07-22-building-empathy-with-stakeholder-interviews-part-2-conversation.md
- _posts/2016-10-26-writing-for-web-easy-writing-for-users-not.md
- _posts/2016-10-28-california-takes-new-approach-procurement.md
- _posts/2016-11-04-code-gov-the-next-milestone-federal-open-source-code.md
Expand All @@ -366,3 +366,6 @@ exclude:
- _posts/2017-01-05-building-effective-agile-partnership-between-government-industry.md
- _posts/2017-01-06-open-source-collaboration-across-agencies-to-improve-https-deployment.md
- _posts/2017-01-10-mark-hopson-negotiating-on-americas-behalf.md
- _posts/2017-01-11-the-best-way-to-build-big-is-to-start-small.md
---

7 changes: 4 additions & 3 deletions _config-fast-builds.yml
Expand Up @@ -7,21 +7,20 @@ jekyll_pages_api_search:
skip_index: true

env: "development"

exclude:
- .about.yml
- .cfignore
- .codeclimate.yml
- .gitignore
- .gitmodules
- .hound.yml
- _pages
- api-endpoints
- bin
- build
- circle.yml
- config_blog.rb
- CONTRIBUTING.md
- docker-compse.yml
- docker-compose.yml
- docker_entrypoint.rb
- Dockerfile
- examples/
Expand All @@ -30,6 +29,7 @@ exclude:
- Gemfile*
- humans.txt
- ISSUE_TEMPLATE.md
- killport
- LICENSE.md
- node_modules
- package.json
Expand All @@ -43,6 +43,7 @@ exclude:
- serve-fast
- serve-accesslint
- sitemap.xml
- spec/
- system-security-plan.yml
- tests/
- tests/schema/tags.yml
Expand Down
11 changes: 5 additions & 6 deletions _config.yml
Expand Up @@ -123,28 +123,27 @@ exclude:
- bin
- build
- circle.yml
- config_blog.rb
- CONTRIBUTING.md
- docker-compse.yml
- docker-compose.yml
- docker_entrypoint.rb
- Dockerfile
- examples/
- favicon.ico
- feed*
- Gemfile*
- humans.txt
- ISSUE_TEMPLATE.md
- killport
- LICENSE.md
- node_modules
- package.json
- pages/our-work.html
- PULL_REQUEST_TEMPLATE.md
- README.md
- robots.txt
- search-index*
- serve
- serve-blog
- serve-fast
- serve-accesslint
- sitemap.xml
- spec/
- system-security-plan.yml
- tests/
- tests/schema/tags.yml
Expand Down
5 changes: 2 additions & 3 deletions _includes/navigation.html
Expand Up @@ -21,16 +21,15 @@


{% if include.subnav %}
{% assign subnav_page_url = include.subnav_anchor | default: page.url %}
{% assign page_data = subnav_page_url | find_page: nav_items %}

{% if page.nav_items %}
{% include navigation/subnav.html
page_data=page
nav_items=nav_items
children=true
%}
{% else %}
{% assign subnav_page_url = include.subnav_anchor | default: page.url %}
{% assign page_data = subnav_page_url | find_page: nav_items %}
{% include navigation/subnav.html
page_data=page_data
children=true
Expand Down
10 changes: 3 additions & 7 deletions _plugins/author.rb
@@ -1,6 +1,3 @@
require 'pry'
require 'rb-readline'

module Jekyll
class AuthorTag < Liquid::Tag
def initialize(tag_name, author, tokens)
Expand All @@ -24,11 +21,11 @@ def render(_context)
end

def finder(group, name)
data = Jekyll.sites[0].data[group]
if results.respond_to?('find')
return results.find { |member| member['name'] == name }
else
require 'pry'; end
raise Exception, "No teammate found by that name: #{name}"
end
end
end

Expand All @@ -45,7 +42,6 @@ def initialize(tag_name, heading, tokens)
def render(context)
authored = []
author = context.environments[0]['page']['name']
full_name = context.environments[0]['page']['full_name']
first_name = context.environments[0]['page']['first_name']
posts = context.environments[0]['site']['posts']
site_url = context.environments[0]['site']['baseurl']
Expand Down Expand Up @@ -145,7 +141,7 @@ def team_link(input)
name = authors[index].data['name'].downcase
url = "#{site_url}/author/#{name}"
full_name = authors[index].data['full_name']
string = "<a class='post-author' itemprop='name' href='#{url}'>#{full_name}</a>"
"<a class='post-author' itemprop='name' href='#{url}'>#{full_name}</a>"
end
end
end
Expand Down
9 changes: 5 additions & 4 deletions _plugins/author_data.rb
@@ -1,6 +1,4 @@
require 'yaml'
require 'rb-readline'
require 'pry'

module SiteData
class AuthorData
Expand All @@ -9,13 +7,16 @@ class AuthorData
def initialize(test_path = nil)
@test_path = test_path
@basepath = @test_path ? @test_path : Dir.pwd

@path = File.join(@basepath, '_authors')
cwd = File.dirname(__FILE__)
pwd = cwd.split('/')[0...-1].join('/')

@site_post_paths = Dir.entries(File.join(Dir.pwd, '_posts')).select do |f|
@site_post_paths = Dir.entries(File.join(pwd, '_posts')).select do |f|
!File.directory? f and f != '.DS_Store'
end

@all_authors = Dir.entries(File.join(Dir.pwd, '_authors')).select do |f|
@all_authors = Dir.entries(File.join(pwd, '_authors')).select do |f|
!File.directory? f and f != '.DS_Store'
end.flatten.uniq

Expand Down
26 changes: 16 additions & 10 deletions _plugins/related_posts.rb
@@ -1,5 +1,3 @@
require 'pry'
require 'rb-readline'
module Jekyll
class RelGenerator < Liquid::Tag
def initialize(related_posts, text, tokens)
Expand All @@ -10,11 +8,11 @@ def initialize(related_posts, text, tokens)

# Gets all posts from the site by tag and adds those that match the tags on
# the current page. Returns a flattened, deduped, array of post objects
def get_posts_by_tag(page, siteTags)
def get_posts_by_tag(page, site_tags)
tags = page['tags']
other_posts = []
for tag in tags
other_posts.push(siteTags[tag])
other_posts.push(site_tags[tag])
other_posts = other_posts.flatten.uniq
other_posts.delete_if { |post| page['title'] == post['title'] }
end
Expand All @@ -25,10 +23,15 @@ def get_posts_by_tag(page, siteTags)
# to other posts authored on the site. This may take a long time for large
# sites. Returns an array of posts
def get_posts_by_author(other_posts, page, site)
posts = site['posts']
if page['authors']
authors = page['authors']
authors.map { |author| posts.map { |post| if post.data['authors'] && post.data['authors'].index(author) then other_posts.push(post) end } }
authors.map do |author|
site['posts'].map do |post|
if post.data['authors'] && post.data['authors'].index(author)
then other_posts.push(post)
end
end
end
end
other_posts.delete_if { |post| page['title'] == post['title'] }
other_posts
Expand All @@ -40,7 +43,10 @@ def list_posts(other_posts)
internal = @params[1] || 'li'
if other_posts
related_posts = "<#{external}>"
other_posts.flatten.map { |post| related_posts << "<#{internal}><a href='#{@baseurl}#{post.url}' class='related_posts'>&ldquo;#{post.data['title']}&rdquo;</a></#{internal}>" }
other_posts.flatten.map do |post|
related_posts << "<#{internal}><a href='#{@baseurl}#{post.url}' \
class='related_posts'>&ldquo;#{post.data['title']}&rdquo;</a></#{internal}>"
end
related_posts << "</#{external}"
else
related_posts = '<p>No related posts</p>'
Expand All @@ -53,10 +59,10 @@ def list_posts(other_posts)
def render(context)
page = context['page']
site = context['site']
siteTags = site['tags']
other_posts = get_posts_by_tag(page, siteTags)
site_tags = site['tags']
other_posts = get_posts_by_tag(page, site_tags)
other_posts = get_posts_by_author(other_posts, page, site) if other_posts.flatten.length < 3
related_posts = list_posts(other_posts.uniq.take(3))
list_posts(other_posts.uniq.take(3))
end
end
end
Expand Down
3 changes: 0 additions & 3 deletions _plugins/utility.rb
@@ -1,6 +1,3 @@
require 'pry'
require 'rb-readline'

module Jekyll
module Utility
attr_reader :match
Expand Down
6 changes: 3 additions & 3 deletions circle.yml
Expand Up @@ -14,13 +14,13 @@ machine:
dependencies:
pre:
- npm install -g accesslint-cli
- bundle install --binstubs
- bundle install

test:
override:
- npm run test
- npm run htmlproofer
- bundle exec rspec
- CODECLIMATE_REPO_TOKEN=${CODECLIMATE_REPO_TOKEN} bundle exec codeclimate-test-reporter
post:
- ./serve-accesslint && bundle exec accesslint-ci scan http://localhost:4000
# post:
# - ./serve-accesslint && bundle exec accesslint-ci scan http://localhost:4000/site

0 comments on commit 2869e31

Please sign in to comment.