Skip to content

Commit

Permalink
Merge pull request #404 from primer/dont-depend-on-rails
Browse files Browse the repository at this point in the history
Remove full rails as a runtime dependency
  • Loading branch information
manuelpuyol authored Apr 6, 2021
2 parents d900a45 + a614d74 commit 3a9ba7d
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 191 deletions.
37 changes: 17 additions & 20 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@ rails_version = (ENV["RAILS_VERSION"] || "6.1.1").to_s
gem "rack-cors"
gem "rake", "~> 12.0"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", rails_version == "main" ? { git: "https://github.com/rails/rails", ref: "main" } : rails_version
if rails_version != "main"
gem "actionview", rails_version
gem "activemodel", rails_version
gem "activesupport", rails_version
gem "railties", rails_version
else
git "https://github.com/rails/rails", ref: "main" do
# rubocop:disable Bundler/DuplicatedGem
gem "actionview"
gem "activemodel"
gem "activerecord"
gem "activesupport"
gem "railties"
# rubocop:enable Bundler/DuplicatedGem
end
end

# Use Puma as the app server
gem "puma", "~> 4.3.6"
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
Expand All @@ -19,22 +35,3 @@ gem "bootsnap", ">= 1.4.2", require: false

gem "view_component", path: ENV["VIEW_COMPONENT_PATH"] if ENV["VIEW_COMPONENT_PATH"]
gem "view_component_storybook", "~> 0.8.0"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem "minitest", "~> 5.0"
gem "pry-rails"
end

group :development do
# 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

group :test do
# Adds support for Capybara system testing and selenium driver
gem "capybara", "~> 3"

gem "cuprite", "0.11"
end
101 changes: 19 additions & 82 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,29 @@ PATH
remote: .
specs:
primer_view_components (0.0.34)
octicons_helper (>= 9.0.0, < 13.0.0)
rails (>= 5.0.0, < 7.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
octicons_helper (>= 13.0.0)
view_component (>= 2.0.0, < 3.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
mail (>= 2.7.1)
actionmailer (6.1.1)
actionpack (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activesupport (= 6.1.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.1)
actionview (= 6.1.1)
activesupport (= 6.1.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.1)
actionpack (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
nokogiri (>= 1.8.5)
actionview (6.1.1)
activesupport (= 6.1.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.1)
activesupport (= 6.1.1)
globalid (>= 0.3.6)
activemodel (6.1.1)
activesupport (= 6.1.1)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activestorage (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activesupport (= 6.1.1)
marcel (~> 0.3.1)
mimemagic (~> 0.3.2)
activesupport (6.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
Expand Down Expand Up @@ -100,9 +63,7 @@ GEM
concurrent-ruby (~> 1.1)
websocket-driver (>= 0.6, < 0.8)
ffi (1.14.2)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.9)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.4)
listen (3.4.0)
Expand All @@ -111,37 +72,30 @@ GEM
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.8)
nokogiri (~> 1)
mini_mime (1.0.2)
mini_mime (1.1.0)
mini_portile2 (2.5.0)
minitest (5.14.4)
mocha (1.12.0)
msgpack (1.3.3)
nio4r (2.5.4)
nokogiri (1.11.1)
nio4r (2.5.7)
nokogiri (1.11.2)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogiri (1.11.1-x86_64-darwin)
nokogiri (1.11.2-x86_64-darwin)
racc (~> 1.4)
octicons (12.1.0)
octicons (13.0.0)
nokogiri (>= 1.6.3.1)
octicons_helper (12.1.0)
octicons (= 12.1.0)
rails
octicons_helper (13.0.0)
actionview
octicons (= 13.0.0)
railties
parallel (1.20.1)
parser (3.0.0.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.6)
puma (4.3.7)
nio4r (~> 2.0)
Expand All @@ -153,21 +107,6 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.1)
actioncable (= 6.1.1)
actionmailbox (= 6.1.1)
actionmailer (= 6.1.1)
actionpack (= 6.1.1)
actiontext (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activemodel (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
bundler (>= 1.15.0)
railties (= 6.1.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -214,10 +153,6 @@ GEM
simplecov
terminal-table
simplecov-html (0.12.3)
spring (2.1.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand Down Expand Up @@ -253,6 +188,9 @@ PLATFORMS
x86_64-darwin-19

DEPENDENCIES
actionview (= 6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
allocation_tracer (~> 0.6.3)
benchmark-ips (~> 2.8.4)
bootsnap (>= 1.4.2)
Expand All @@ -263,18 +201,17 @@ DEPENDENCIES
mocha
primer_view_components!
pry
pry-rails
puma (~> 4.3.6)
rack-cors
rails (= 6.1.1)
railties (= 6.1.1)
rake (~> 12.0)
rubocop (= 0.82)
rubocop-github (~> 0.16.0)
rubocop-performance (~> 1.7)
simplecov (~> 0.18.0)
simplecov-console (~> 0.7.2)
spring
spring-watcher-listen (~> 2.0.0)
sprockets
sprockets-rails
view_component_storybook (~> 0.8.0)
webpacker (~> 5.0)
yard (~> 0.9.25)
Expand Down
2 changes: 0 additions & 2 deletions app/components/primer/base_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ module Primer
class BaseComponent < Primer::Component
status :beta

include TestSelectorHelper

# ## HTML attributes
#
# System arguments include most HTML attributes. For example:
Expand Down
1 change: 1 addition & 0 deletions app/components/primer/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Component < ViewComponent::Base
include ClassNameHelper
include FetchOrFallbackHelper
include OcticonsHelper
include TestSelectorHelper
include JoinStyleArgumentsHelper
include ViewHelper
include Status::Dsl
Expand Down
4 changes: 0 additions & 4 deletions app/components/primer/octicon_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ module Primer
class OcticonComponent < Primer::Component
status :beta

include ClassNameHelper
include TestSelectorHelper
include OcticonsHelper

SIZE_DEFAULT = :small
SIZE_MAPPINGS = {
SIZE_DEFAULT => 16,
Expand Down
27 changes: 19 additions & 8 deletions demo/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@ rails_version = (ENV["RAILS_VERSION"] || "6.1.1").to_s
gem "rake", "~> 12.0"
gem "rack-cors"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", rails_version == "master" ? { github: "rails/rails" } : rails_version
if rails_version != "main"
gem "actionview", rails_version
gem "activemodel", rails_version
gem "activesupport", rails_version
gem "railties", rails_version
else
git "https://github.com/rails/rails", ref: "main" do
# rubocop:disable Bundler/DuplicatedGem
gem "actionview"
gem "activemodel"
gem "activerecord"
gem "activesupport"
gem "railties"
# rubocop:enable Bundler/DuplicatedGem
end
end

# Use Puma as the app server
gem "puma", "~> 4.3.6"

Expand All @@ -19,17 +35,12 @@ gem "view_component_storybook", "~> 0.8.0"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem "minitest", "~> 5.0"
gem "pry-rails"
gem "sprockets"
gem "sprockets-rails"
end

group :development do
# 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

group :test do
# Adds support for Capybara system testing and selenium driver
gem "capybara", "~> 3"
end
Loading

1 comment on commit 3a9ba7d

@vercel
Copy link

@vercel vercel bot commented on 3a9ba7d Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.