Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

Commit

Permalink
Changed to Drafter instead of Snowcrash
Browse files Browse the repository at this point in the history
  • Loading branch information
thecopy committed Jul 18, 2015
1 parent 7fb426e commit ecdd3e0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Erik Jonsson Thorén
Copyright (c) 2015 Erik Jonsson Thorén

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tool for generating a Postman collection from the Apiary API, or Blueprint JSON
Supports

* Blueprint API Markup
* Blueprint API JSON from Snowcrash
* Blueprint API JSON from Drafter (Snowcrash)
* Fetching Blueprint API Markup from Apiary API

# Installation
Expand Down Expand Up @@ -47,9 +47,9 @@ It's also possible to specify the output file using the `--output`.

# Prerequisites

[Snowcrash](https://github.com/apiaryio/snowcrash#install) is required if you want to use Blueprint API markup/Apiary API.
[Drafter](https://github.com/apiaryio/drafter) is required if you want to use Blueprint API markup/Apiary API.

To install on OS X:

brew install --HEAD https://raw.github.com/apiaryio/snowcrash/master/tools/homebrew/snowcrash.rb
brew install --HEAD https://raw.github.com/apiaryio/drafter/master/tools/homebrew/drafter.rb

20 changes: 10 additions & 10 deletions apiary2postman/apiary2postman.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ def readInput():

return content

def check_snowcrash():
def check_drafter():
try:
subprocess.check_output(['which', 'snowcrash'])
subprocess.check_output(['which', 'drafter'])
except:
print 'Please install snowcrash:'
print 'Please install drafter:'
print ''
print 'By using brew:'
print '\tbrew install --HEAD https://raw.github.com/apiaryio/snowcrash/master/tools/homebrew/snowcrash.rb'
print '\tbrew install --HEAD https://raw.github.com/apiaryio/drafter/master/tools/homebrew/drafter.rb'
print ''
print 'By source, see:'
print '\thttps://github.com/apiaryio/snowcrash#build'
print '\thttps://github.com/apiaryio/drafter'
exit(3)

def main():
Expand All @@ -38,12 +38,12 @@ def main():
subparsers = parser.add_subparsers(help='',title='subcommands',
description='valid subcommands')

parser_blueprint = subparsers.add_parser('blueprint', description='blueprint: Read Blueprint API markup, then convert it using snowcrash, then generate Postman collection JSON.',
help='Read Blueprint API markup, then convert it using snowcrash, then generate Postman collection JSON. Use "blueprint -h" for more help.')
parser_blueprint = subparsers.add_parser('blueprint', description='blueprint: Read Blueprint API markup, then convert it using drafter, then generate Postman collection JSON.',
help='Read Blueprint API markup, then convert it using drafter, then generate Postman collection JSON. Use "blueprint -h" for more help.')

parser_json = subparsers.add_parser('json', description='json: Use prepared JSON to generate the Postman collection.',help='Use prepared JSON. Use "json -h" for more help.')

parser_api = subparsers.add_parser('api', description='api: Use the Apiary API to fetch the Blueprint markup, then convert it using snowcrash, then generate Postman collection JSON.',
parser_api = subparsers.add_parser('api', description='api: Use the Apiary API to fetch the Blueprint markup, then convert it using drafter, then generate Postman collection JSON.',
help='Use the Apiary API to fetch the JSON. Use "api -h" for more help.')

parser.add_argument('--pretty', dest='pretty', action='store_true', default=False,
Expand All @@ -70,11 +70,11 @@ def main():
input = args.input.read()
elif hasattr(args, 'blueprint_input'):
# blueprint mode
check_snowcrash()
check_drafter()
input = blueprint2json(args.blueprint_input.read())
else:
# API mode
check_snowcrash()
check_drafter()

apikey = None
if args.key != None:
Expand Down
2 changes: 1 addition & 1 deletion apiary2postman/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def fetch_blueprint(name, key):
return response_body['code']

def blueprint2json(blueprint):
p = Popen(['snowcrash', '--format', 'json'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
p = Popen(['drafter', '--format', 'json'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
out, err = p.communicate(blueprint)
return out

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
setup(
name = 'apiary2postman',
packages = ['apiary2postman'], # this must be the same as the name above
version = '0.4.4',
version = '0.4.6',
description = 'A tool for converting Blueman API markup from Apiary.io to Postman collection/dumps',
author = 'Erik Jonsson Thoren',
author_email = '[email protected]',
url = 'https://github.com/thecopy/apiary2postman', # use the URL to the github repo
download_url = 'https://github.com/thecopy/apiary2postman/tarball/0.4.4', # I'll explain this in a second
download_url = 'https://github.com/thecopy/apiary2postman/tarball/0.4.6', # I'll explain this in a second
keywords = ['apiary', 'blueman', 'postman'], # arbitrary keywords
classifiers = [],
entry_points={
Expand Down

0 comments on commit ecdd3e0

Please sign in to comment.