{"id":13394933,"url":"https://github.com/thebrianemory/corneal","last_synced_at":"2025-03-13T20:31:48.490Z","repository":{"id":8777535,"uuid":"59708950","full_name":"thebrianemory/corneal","owner":"thebrianemory","description":"A Ruby gem that is a Sinatra app generator with Rails-like simplicity. I built this to help fellow Flatiron School students with their Sinatra assessments.","archived":false,"fork":false,"pushed_at":"2023-01-20T05:13:20.000Z","size":632,"stargazers_count":255,"open_issues_count":17,"forks_count":88,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-05-13T21:46:12.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://thebrianemory.github.io/corneal/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thebrianemory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-26T01:11:04.000Z","updated_at":"2023-09-26T14:00:56.000Z","dependencies_parsed_at":"2023-02-11T23:50:26.906Z","dependency_job_id":null,"html_url":"https://github.com/thebrianemory/corneal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebrianemory%2Fcorneal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebrianemory%2Fcorneal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebrianemory%2Fcorneal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebrianemory%2Fcorneal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thebrianemory","download_url":"https://codeload.github.com/thebrianemory/corneal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243478248,"owners_count":20297218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:36.594Z","updated_at":"2025-03-13T20:31:48.195Z","avatar_url":"https://github.com/thebrianemory.png","language":"Ruby","funding_links":[],"categories":["Generators","Ruby"],"sub_categories":[],"readme":"![Corneal](http://thebrianemory.github.io/corneal/images/corneal-small.png)\n\n## Why this exists\n\nWhen I was creating my first major Sinatra project, [Cook This Way](https://github.com/thebrianemory/cook-this-way), while doing [Learn Verified](https://learn.co/with/thebrianemory), I was looking for a way to build a Sinatra skeleton similar to running\n\n    rails new APP-NAME\n\n[Hazel](https://github.com/c7/hazel) was the closest thing I could find and this gem is based largely off of it. While it did provide a pretty good initial setup, I still had to tweak some things. The views were sitting in the root directory while I wanted them to reside in an app folder along with my models and controllers. There was also no environment.rb in the config folder as I had become accustom to having.\n\nI also wanted to create a gem for future Learn students so they could easily get started building their projects. Although built with them in mind, this can get you off and running with any Sinatra app.\n\nInstall the gem, run `corneal new APP-NAME`, run `bundle install`, and you're all set! You can start up your server with `shotgun` and verify everything is working. It is as simple as that.\n\nIt uses a file structure similar to what you would see with Rails.\n\nDirectory structure:\n```\n├── config.ru\n├── Gemfile\n├── Gemfile.lock\n├── Rakefile\n├── README\n├── app\n│   ├── controllers\n│   │   └── application_controller.rb\n│   ├── models\n│   └── views\n│       ├── layout.erb\n│       └── welcome.erb\n├── config\n│   ├── initializers\n│   └── environment.rb\n├── db\n│   └── migrate\n├── lib\n│   └── .gitkeep\n└── public\n|   ├── images\n|   ├── javascripts\n|   └── stylesheets\n|       └── main.css\n└── spec\n    ├── application_controller_spec.rb\n    └── spec_helper.rb\n```\n\n\n## Installation\n\n    gem install corneal\n\n## Commands\n```\ncorneal -v              # Show Corneal version number\ncorneal help [COMMAND]  # Describe available commands or one specific command\ncorneal new APP-NAME    # Creates a new Sinatra application\ncorneal model NAME      # Generate a model\ncorneal controller NAME # Generate a controller\ncorneal scaffold NAME   # Generate a model with its associated views and controllers\n```\nThe controller generator also have an optional views flag `--no-views` to create controllers without views.\n\n## Using Corneal\n\nTo generate your app:\n\n    corneal new APP-NAME\n\nAfter Corneal is done generating your app, run `bundle install` from your app's directory:\n\n    cd APP-NAME\n    bundle install\n\nYou can then start your server with `shotgun`:\n\n    shotgun\n\nYou can generate a model and migration file:\n\n    corneal model NAME\n\nYou can also generate an entire MVC structure complete with a migration file:\n\n    corneal scaffold NAME\n\nThe resulting structure will look like this:\n\n```\n└─app\n  ├── controllers\n  │   ├──application_controller.rb\n  │   └──new_model_controller.rb\n  ├── models\n  │   └──new_model.rb\n  └── views\n      ├──new_models\n      │  ├──index.html.rb.erb\n      │  ├──show.html.rb.erb\n      │  ├──new.html.rb.erb\n      │  └──edit.html.rb.erb\n      ├── layout.erb\n      └── welcome.erb\n```\n\nYou can also add your model attributes when you generate the scaffold structure and have them added to your migration file:\n\n    corneal [model/scaffold] NAME name:string age:integer\n\n```\nclass CreateUsers \u003c ActiveRecord::Migration\n  def change\n    create_table :users do |t|\n      t.string :name\n      t.age :integer\n\n      t.timestamps null: false\n    end\n  end\nend\n```\n\nVisit [http://localhost:9393/](http://localhost:9393/) to verify your app is running.\n\nYou can also verify it is working by running `rspec` to see the passing test:\n\n    1 example, 0 failures\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/thebrianemory/corneal This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\n    Copyright (c) 2016 Brian Emory\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    \"Software\"), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebrianemory%2Fcorneal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebrianemory%2Fcorneal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebrianemory%2Fcorneal/lists"}