Code Monkey home page Code Monkey logo

Comments (6)

piotrmurach avatar piotrmurach commented on June 7, 2024 1

Hey @quirinux I've changed gemspec to read a manifest file in order to figure out which files to include which heavily relies on your findings.

Thanks for bringing this to my attention and coming up with a solution! ❤️ I will release shortly.

from tty.

quirinux avatar quirinux commented on June 7, 2024

btw, same here with ruby 2.4.1

from tty.

quirinux avatar quirinux commented on June 7, 2024

Found the issue, it only happens when requiring tty package and do not happen when requiring a sub-package like tty-table for example, checking the tty.gemspec file at line 17:

spec.files = `git ls-files`.split($/)

Looks like the issue is right there, checking on this conversation on bundler package: rubygems/bundler#2039 (comment)
They found a better way to sort out those files like:

spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
spec.files.reject! { |fn| fn.include? "CVS" }

so I simple did on my local gemspec:

  #spec.files         = `git ls-files`.split($/)
  spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
  spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
  spec.files.reject! { |fn| fn.include? "CVS" }

and dan-dah, it worked like a charm, I'm gonna open a PR for that

from tty.

piotrmurach avatar piotrmurach commented on June 7, 2024

Hi,

Thanks for trying out tty gem!

First of all, as a general point you shouldn't be really using require 'tty'. This library is a meta gem for scaffolding terminal apps. It is not meant to be used as a direct requirement. In future, I'm planning on having a manifest file that pulls in latest tty packages and injects them into scaffolded application without actually requiring them directly in gemspec. I would encourage you to directly specify and use the tty gems you need, mix and match! Similar to coinpare

When you require the tty file it loads all the plugins by reading them from the tty.gemspec and I can only assume evaluating the spec.files= assignment in the process. On the other hand, the tty-table uses exactly the same code as hundreds of Ruby gems generated with bundler see tty-table gemspec with a difference that it doesn't evalute gemspec when required, only on installation.

Having read rubygems/bundler#2023 & rubygems/bundler#1043 I can see both sides of the issue. There is certainly a good case for dropping reliance on external utility such as git to ensure that things with tty can be packaged easily. It would be prudent to ensure that no necessary files are skipped in the process such as dotfiles etc...

I do appreciate you bringing this to my attention and working on the fix. I'm not saying this is not the solution that I will end up using, but I need a little bit of time to investigate and make my mind up. In the meantime let's continue the dialogue and work on the solution.

from tty.

quirinux avatar quirinux commented on June 7, 2024

perfect @piotrmurach totally agreed, one of my solutions I use a good bunch of tty libs, so it's easier require tty straight forward, but have replaced by each gem I meant to use, indeed got ruby vm bootup time reduced, so the best option is really requiring only needed gems, haven't checked memory footprint yet

About the fix, I submitted a PR, I know it's a minor issue and the changes I made can impact in the whole solution ans user experience, so feel free to reject it or, even better, add your comments here or on the PR and I make the needed changes

from tty.

quirinux avatar quirinux commented on June 7, 2024

it is a such good idea, better than mine, cheers

from tty.

Related Issues (20)

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.