GithubHelp home page GithubHelp logo

gabrielpeart / viper-module-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pepicrft/viper-module-generator

0.0 1.0 0.0 196.27 MB

Gem to generate VIPER modules to use them in your Objective-C/Swift projects

License: MIT License

Ruby 3.07% Objective-C 24.52% C 0.09% Shell 0.80% Swift 71.52%

viper-module-generator's Introduction

Viper Module Generator

Code Climate Build Status Test Coverage Dependency Status

image

Gem to generate VIPER modules to use them in your Objective-C/Swift projects The implementation scheme returned by this generator is hardly inspired in the example and post of Objc.io, http://www.objc.io/issue-13/viper.html .

Features

Changelog 0.1.6

  • Added templates command to know which templates are available
  • YAML file in each template with the information about the template (more scalable)

Changelog 0.1

  • Added default template
  • Fully components tested

Changelog 0.2.3

  • VIPER Example using the Twitter API
  • Default template implemented in Swift

Changelog 0.2.5

  • Add COMPANY parameter to set the company name on the files header
  • Set Swift as the default language

Expected in version 0.3

Viper files structure

.objc
+-- DataManager
|   +-- VIPERDataManager.h
|   +-- VIPERDataManager.m
+-- Interactor
|   +-- VIPERInteractor.h
|   +-- VIPERInteractor.m
+-- Presenter
|   +-- VIPERPresenter.h
|   +-- VIPERPresenter.m
+-- ViewController
|   +-- VIPERViewController.h
|   +-- VIPERViewController.m
+-- WireFrame
|   +-- VIPERWireFrame.h
|   +-- VIPERWireFrame.m
+-- Protocols
|   +-- VIPERProtocols.h
.swift
+-- DataManager
|   +-- VIPERDataManager.swift
+-- Interactor
|   +-- VIPERInteractor.swift
+-- Presenter
|   +-- VIPERPresenter.swift
+-- ViewController
|   +-- VIPERViewController.swift
+-- WireFrame
|   +-- VIPERWireFrame.swift
+-- Protocols
|   +-- VIPERProtocols.swift

How to install vipergen ?

You can install it easily as using the gem. With ruby installed in your OSX execute:

sudo gem install vipergen

If everything were right, you should have now the vipergem command available in your system console

How to generate a VIPER module with a given name?

You have just to execute the following command

vipergen generate MyFirstViperModule --path=~/myproject/shared

Another example:

vipergen generate MySecondViperModule --path=~/myproject/shared --author='My Name' --company='My Company' --template='existing_template' --language=swift

And then the files structure will be automatically created. Don't forget to add this folder to your project dragging it into the XCode/Appcode inspector

How can I try the demo project?

  1. Clone the repo git clone https://github.com/pepibumur/viper-module-generator.git
  2. Move into the repo folder and update the git submodules git sumodule update --init
  3. In the folder VIPERGenDemo install the pods pod install
  4. Open the project from the VIPERGenDemo.xcworkspace file
  5. Enjoy it!

Developer tips

Update the gem

When the gem is updated it has to be reported to the gem repository. I followed this tutorial http://amaras-tech.co.uk/article/43/Creating_executable_gems that basically says that once you have your gem ready execute:

gem build vipergen.gemspec
gem install vipergen-0.1.gem
gem push vipergen-0.1.gem

Then you'll be asked for your credentials in order to make the update in the repo (http://guides.rubygems.org/publishing/)

Add a new template

Are you interested in VIPER and you would like to contribute with this gem adding new templates? Feel free to do it. It's pretty easy. You've just to:

  • Create a folder inside templates with the name of your template
  • You'll have to create inside the templates in both languages, Swift and Objective-C (get inspired from existing templates)
  • Use the word VIPER where you want the name to be replaced in.
  • Remember to add the file viperspec.yml with the description of your template as below:
author: pepi
author_email: [email protected]
template_description: Default template with the simplest structure using VIPER
updated_at: 2014-08-24
  • Report it as a PR in this repo updating the gem version in Gemspec.

Resources

Contact

If you have any doubt about the gem or even if you want to make any suggestion you can do it directly to my email address, [email protected] . You can use the issues Github page too

viper-module-generator's People

Contributors

isaacroldan avatar frowing avatar

Watchers

James Cloos avatar

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.