Coder Social home page Coder Social logo

annotate_gemfile's Introduction

Annotate Gemfile

Adds Github name, description, URL above each gem declaration in your Gemfile.

Under Development

This tool is still currently under development.

Installation

Add this line to your application's Gemfile:

gem 'annotate_gemfile'

And then execute:

$ bundle

Or install it yourself as:

$ gem install annotate_gemfile

Usage

Run the rake task

	$ rake annotate:gemfile

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

annotate_gemfile's People

Contributors

redconfetti avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

annotate_gemfile's Issues

Parser spec

Special thanks to @edwlook for the simple yet effective idea of backing up the current Gemfile before creating an annotate Gemfile.

Add functionality to AnnotateGemfile::Parser which generates a date/time based string for the backed up Gemfile. Use this string to create a copy of the Gemfile like "Gemfile.11-22-2013-22_25_0700.backup"

Next add functionality to create a string representation of the Gemfile with all comments removed. This should only require a regex that detects lines that begin with the pound symbol, and any characters to the end of the line.

Optionally create an array structure with each element representing a line of the Gemfile, and remove elements matching the regex.

Next you'll need another array to store meta data about certain lines which specify a gem definition. Part of this data should include the line of the string in which the definition exists. The idea here is that the annotator will insert the comments above this line for each definition.

More research will be needed to identify what functionality Bundler already provides in parsing or gathering meta data about the gems from the gemfile. Some sort of method needs to be devised to associate the loaded Gem definitions with the line they correspond to. If Bundler doesn't provide this information, another regex based method for matching the gem name and version (and perhaps other attributes) will be needed.

You may be able to generate a new Gemfile from the metadata with the annotations inserted above each line. This might allow one to choose the order of gems that are output. I'm not totally sure about this though because one would need to worry about outputting all definitions to spec. Bundler likely only reads and loads the gemfile specifications from the file... it's not designed to modify the file at all.

That's why the most likely approach is to only focus on well tested logic for inserting annotations above each line. This will certainly minimize any possible bugs arising from conventions that haven't been considered in Gemfiles out in the wild.

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.