Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ycv

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ycv

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Ycv

The Ycv Gem (YAML to CSV and vice versa) is a simple yet powerful command-line tool designed specifically for converting Rails fixtures between YAML and CSV formats. This makes Ycv an ideal tool for developers working with Rails applications, allowing for easy manipulation and conversion of data fixtures and configurations.

Installation

To install the Ycv gem, add the following line to your application's Gemfile:

gem 'ycv'

Then execute:

bundle install

Alternatively, you can install it yourself from the command line:

gem install ycv

Usage

Command-Line Interface (CLI)

The ycv command-line tool is straightforward to use and supports output to both files and standard output (STDOUT), making it versatile for scripting and piping to other commands.

Converting Files

To convert a YAML file to CSV:

ycv path/to/input.yml path/to/output.csv

To convert a CSV file to YAML:

ycv path/to/input.csv path/to/output.yml

Using Standard Output If you prefer to output the conversion result to STDOUT (for example, for further processing with other command-line tools), simply omit the output file path:

Convert YAML to CSV and output to STDOUT:

ycv path/to/input.yml > output.csv

Convert CSV to YAML and output to STDOUT:

ycv path/to/input.csv > output.yml

This feature allows you to easily integrate ycv into your command-line workflows and use it in conjunction with other tools like grep, awk, or redirections.

As a Ruby Library

In addition to the CLI, Ycv can be used as a library within Ruby applications.

Sample Conversion

This section provides a simple example of converting between CSV and YAML formats using the ycv tool.

YAML to CSV Conversion

Given a YAML file sample.yml with the following content:

sample_1:
  id: 1
  name: Alice
  age: 30
  
sample_2:
  id: 2
  name: Bob
  age: 25

Running ycv sample.yml sample.csv will produce a CSV file sample.csv with the following content:

id,name,age
1,Alice,30
2,Bob,25

CSV to YAML Conversion

Conversely, given a CSV file sample.csv with the following content:

id,name,age
1,Alice,30
2,Bob,25

Running ycv sample.csv sample.yml will produce a YAML file sample.yml with the following content:

sample_1:
  id: 1
  name: Alice
  age: 30
  
sample_2:
  id: 2
  name: Bob
  age: 25

These examples demonstrate the straightforward conversion process between CSV and YAML formats, making it easy to integrate ycv into your data handling workflows.

Contributing

Contributions to Ycv are always welcome, whether it's through bug reports, pull requests, or feature requests.

Feel free to contribute GitHub at https://github.com/Nozomi-Hijikata/ycv.

FAQs

Package last updated on 01 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc