Giter VIP home page Giter VIP logo

engems's Introduction

engems's People

Contributors

palkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

engems's Issues

Component method in main Gemfile generates error when running 'bundle install'

I am trying to attempt your code into my project. I added component and eval_gemfile_patch scripts the lib folder of my main application. I have an admin_panel engine that is included in the main Gemfile as written in the guide:

component 'admin_panel'

Engine Gemfile looks like:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec
eval_gemfile './Gemfile.runtime'

Engine admin_panel.gemspec looks like:

$LOAD_PATH.push File.expand_path('lib', __dir__)
require 'admin_panel/version'

Gem::Specification.new do |spec|
  spec.name        = 'admin_panel'
  spec.version     = AdminPanel::VERSION
  spec.summary     = 'AdminPanel.'
  spec.description = 'AdminPanel provides functionality to manage project entities'

  spec.add_dependency 'activeadmin'
  spec.add_dependency 'devise'
  spec.add_dependency 'draper'
  spec.add_dependency 'dry-validation', '~> 1.5'
  spec.add_dependency 'omniauth', '~> 1.9.1'
  spec.add_dependency 'omniauth-google-oauth2'
  spec.add_dependency 'omniauth-rails_csrf_protection'
  spec.add_dependency 'rails', '~> 6.0.3', '>= 6.0.3.2'
  spec.add_dependency 'reform', '~> 2.3'
  spec.add_dependency 'sassc-rails'
  spec.add_dependency 'trailblazer', '~> 2.1'

  spec.add_development_dependency 'bundler'
  spec.add_development_dependency 'combustion', '~> 1.3'
  spec.add_development_dependency 'factory_bot'
  spec.add_development_dependency 'ffaker'
  spec.add_development_dependency 'pg'
  spec.add_development_dependency 'pry-byebug'
  spec.add_development_dependency 'rake', '~> 13.0'
  spec.add_development_dependency 'rspec', '~> 3.0'
  spec.add_development_dependency 'rspec-rails'
  spec.add_development_dependency 'strong_migrations'
end

When I run bundle install I had an error:

[!] There was an error parsing `Gemfile`: 
[!] There was an error parsing `Gemfile`: You cannot specify the same gem twice coming from different sources.
You specified that admin_panel (>= 0) should come from source at `engines/admin_panel` and source at `.`
. Bundler cannot continue.

 #  from engines/admin_panel/Gemfile:6
 #  -------------------------------------------
 #  
 >  gemspec
 #  
 #  -------------------------------------------
. Bundler cannot continue.

 #  from /app/Gemfile:171
 #  -------------------------------------------
 #  # Admin panel
 >  component 'admin_panel'
 #  -------------------------------------------

If I remove the gemspec call from the engine Gemfile, everything works fine, but it looks strange because I want to reuse this engine in other applications.
The same will happen if I use your generators and create some kind of test engine or gem. It generates engine with Gemfile with gemspec call inside. And "bundle install" will throw an error again.

Question about runtime dependencies inside engines .gemspec file

Hi,

The first step I'm trying to accomplish for now is just to have runtime dependencies shared by engines to be in one place.
In order to do that, I've created a /gemfiles folder at root with *.gemfiles and then including them with eval_gemfile inside engines.

# gemfiles/http.gemfile

gem 'rest-client', '2.1.0'
# engines/authentication/Gemfile

source 'https://rubygems.org'

eval_gemfile '../../gemfiles/rails.gemfile'
eval_gemfile '../../gemfiles/http.gemfile'
...

The problem is that I need to require the rest-client at engines/authentication/lib/authentication.rb to make it available inside engine runtime:

require "authentication/version"
require "authentication/engine"

require "rest-client"

module Authentication
   ....
end

But, to make this work, I must define rest-client inside engine's .gemspec (spec.add_dependency). But if I do that, it looses the purpose of the eval_gemfile for sharing versions.

Sorry if I'm misunderstanding the concept.

Thanks.

question: root level container app / main app testing

thanks for the sharing in RailsConf and writing this up.
enjoy it and learnt a ton from you.

here a question about the engem cli usage


bin/engem cli currently only run tests in engines and gems.
and I am thinking of adapting the bin/engem and is-dirty to handle my root level end to end testing as well.

do you usually not having root level test case (e.g. feature / system tests) for pure engem rails project ?
wonder if you guys are moving the main_app into engines as well (like the attempt in https://cbra.info/ moving the root app into a folder called web_container)

engine module / namespace and zeitwerk

@palkan Did your team figure out a way to keep the engine namespaced and NOT have to repeat the engine name as a subdirectory everywhere:

  • engines/subsystem1/app/controllers/subsystem1/application_controller.rb
  • engines/subsystem1/app/controllers/subsystem1/foos_controller.rb
  • engines/subsystem1/app/models/subsystem1/foo.rb
  • engines/subsystem1/app/api/subsystem1/foo_service.rb

table_name_prefix

Hi,

I'm trying to use engem-approach, and build upon what you've already learned, in setting up a modular monolith in rails.

I want the table names to be prefixed by the engine/subsystem name... I see table_name_prefix in engines/subystem1/lib/subsystem1.rb, but it doesn't seem to be used anywhere. Can you fill in the details on where you intended to tie that in?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.