Skip to content

Commit 5574bf6

Browse files
Merge pull request #23 from mudbugmedia/add-docker-test-env
Add docker test/dev env
2 parents 6ffb030 + 0239a1c commit 5574bf6

34 files changed

+169
-117
lines changed

.rubocop.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ AllCops:
66
- 'spec/*_helper.rb'
77
- 'Gemfile'
88
- 'Rakefile'
9-
- 'Vagrantfile'
109

1110
Documentation:
1211
Enabled: false

.rubocop_todo.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2015-10-29 13:19:55 -0500 using RuboCop version 0.34.1.
3+
# on 2017-12-29 15:04:25 +0000 using RuboCop version 0.52.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 3
10-
# Configuration parameters: AllowURI, URISchemes.
11-
Metrics/LineLength:
12-
Max: 91
9+
# Offense count: 1
10+
Metrics/AbcSize:
11+
Max: 19
1312

1413
# Offense count: 1
15-
# Configuration parameters: Exclude.
16-
Style/FileName:
14+
# Configuration parameters: CountComments.
15+
Metrics/MethodLength:
16+
Max: 31
17+
18+
# Offense count: 1
19+
Naming/AccessorMethodName:
20+
Exclude:
21+
- 'spec/support/static_file_server.rb'
22+
23+
# Offense count: 1
24+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
25+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
26+
Naming/FileName:
1727
Exclude:
1828
- 'lib/critical-path-css-rails.rb'
29+
30+
# Offense count: 4
31+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
32+
# URISchemes: http, https
33+
Metrics/LineLength:
34+
Max: 96

BACKLOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Backlog
22

3-
## Tests
4-
- Add a testing suite (preferably rspec)
5-
63
## Features
74
- Allow the user to give a single route for a Controller#Show route, instead of hard coding every unique Resource#Show URL
85
* Implementation should account for any route that allows variables/parameters in the URL
96
- Error reporting during CSS generation (404, 500 errors, etc.)
10-
- Allow the user to pass arguments to Penthouse.js, i.e. Viewport size, etc. For a list of the configurable options, please see [Penthouse](https://github.com/pocketjoso/penthouse)
117
- Improve installation process, if possible
128
- Improve implementation. Is their a better solution then using Rails.cache?

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ source 'https://rubygems.org'
33
gemspec
44

55
group :development, :test do
6+
gem 'actionpack'
67
gem 'byebug', platform: [:ruby], require: false
78
gem 'rubocop', require: false
9+
gem 'rspec-rails', '~> 3.6'
10+
gem 'capybara', '~> 2.16'
11+
gem 'pry-rails'
812
end
913

1014
# HACK: npm install on bundle

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ rails generate critical_path_css:install
126126

127127
Answer 'Y' when prompted to overwrite `critical_path_css.rake`. However, overwriting `critical_path_css.yml` is not necessary and not recommended.
128128

129+
130+
## Testing
131+
132+
This gem is to be tested inside of docker/docker-compose. [Combustion](https://github.com/pat/combustion), alongside rspec-rails and capybara, are the primary components for testing. To run the test, you'll need to have [Docker](https://docs.docker.com/engine/installation) installed. Once installed, run the following commands in the gem's root to build, run, and shell into the docker container.
133+
134+
```Bash
135+
docker-compose build
136+
docker-compose up -d
137+
docker exec -it $(cat app_container_name) /bin/bash
138+
```
139+
140+
Once shell'd in, run `bundle exec rspec spec` to run the test. The test rails app lives in `spec/internal`, and it can be viewed locally at `http://localhost:9292/`
141+
142+
129143
## Versions
130144

131145
The critical-path-css-rails gem follows these version guidelines:

app_container_name

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
criticalpathcss_ruby

config.ru

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require 'rubygems'
2+
require 'bundler'
3+
require 'combustion'
4+
5+
Combustion.initialize! :action_controller, :action_view
6+
run Combustion::Application

critical-path-css-rails.gemspec

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
require File.expand_path('../lib/critical_path_css/rails/version', __FILE__)
22

3-
Gem::Specification.new do |s|
4-
s.name = 'critical-path-css-rails'
5-
s.version = CriticalPathCSS::Rails::VERSION
6-
s.platform = Gem::Platform::RUBY
7-
s.authors = ['Michael Misshore']
8-
s.email = 'mmisshore@gmail.com'
9-
s.summary = 'Critical Path CSS for Rails!'
10-
s.description = 'Only load the CSS you need for the initial viewport in Rails!'
11-
s.license = 'MIT'
3+
Gem::Specification.new do |gem|
4+
gem.name = 'critical-path-css-rails'
5+
gem.version = CriticalPathCSS::Rails::VERSION
6+
gem.platform = Gem::Platform::RUBY
7+
gem.authors = ['Michael Misshore']
8+
gem.email = 'mmisshore@gmail.com'
9+
gem.summary = 'Critical Path CSS for Rails!'
10+
gem.description = 'Only load the CSS you need for the initial viewport in Rails!'
11+
gem.license = 'MIT'
1212

13-
s.files = `git ls-files`.split("\n")
14-
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
15-
s.require_path = 'lib'
13+
gem.files = `git ls-files`.split("\n")
14+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
15+
gem.require_path = 'lib'
1616

17-
s.add_development_dependency 'rspec', '~> 3.6'
17+
gem.add_development_dependency 'combustion', '~> 0.7.0'
1818

19-
s.extensions = ['ext/npm/extconf.rb']
19+
gem.extensions = ['ext/npm/extconf.rb']
2020
end

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '2'
2+
services:
3+
ruby:
4+
build:
5+
context: .
6+
dockerfile: docker/ruby/Dockerfile
7+
ports:
8+
- 9292:9292
9+
volumes:
10+
- .:/app:rw
11+
volumes_from:
12+
- data
13+
env_file: docker/ruby/.env
14+
container_name: criticalpathcss_ruby
15+
data:
16+
build:
17+
context: .
18+
dockerfile: docker/ruby/Dockerfile
19+
volumes:
20+
- /gems
21+
command: "true"

docker/ruby/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RAILS_ENV=development

0 commit comments

Comments
 (0)