- 
                Notifications
    You must be signed in to change notification settings 
- Fork 11
Make the change easy #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            stevenharman
  wants to merge
  12
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
make_the_change_easy
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Draft
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    This is pretty darn normalized on *nix systems these days, where this will be installed via Homebrew. Let's rely on that rather than hard-coding to a version of Ruby that can/will likely change over time. Also, use the Regex#match? and avoid extra object; we don't need/use the MatchData, so don't create it.
Whomever calls Hook::init should be responsible for saying where to install. We also simplify things a bit by relying on a tempdir in the tests.
The /o flag tells Ruby to only interpolate the regex once, cache the result of that interpolation, and use it for the rest of the life of the project. Effectively, it in-lines the result of the first time you interpolate. This is a Bad Time™️ for us because that means we cache the first story number we try. In most production usages this is fine b/c we fire up the Ruby process and only check a single time. But that's not true for tests, so depending on the order tests are run, they could start breaking! No more!
Instead we can use features of modern Ruby - the squiggly heredoc (<<~). Which also means we no longer need ActiveSupport 🎉
We can rely on Pathname to do some of the heavy lifting, while also hiding some implementation details (KEYWORD_REGEX), and optimizing some of our regex usage by using #match? when we don't need the MatchData object that would be created by a `#~`. We also remove our dependence on the FakeFile object, trading off that explicit isolation for a more pliable implementation. That is, our test setup doesn't rely on stubbing out Stdlib file access. Instead we set up some fixures via temp dirs and then read/write actual files.
Rather than bespoke and inconsistent "action" methods for these execution objects, rely on a norm.
We don't want to try inlining something from stdlib, for example.
Which is where Gem archives are already being built, so why dirty up our root dir?
i.e., we now use `--help` rather than a `help` sub-command.
1d34272    to
    9c19650      
    Compare
  
    
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Lots of refactoring and/or re-design, before making a change to allow a "template" or strategy-based mechanism for looking up the current "issue number." These changes are largely based on me returning to this code base for the first time, in earnest, in many years, and the experience, understanding, and aesthetics I've developed in that time.