README.md in melodiest-0.1.1 vs README.md in melodiest-0.2.0
- old
+ new
@@ -14,43 +14,61 @@
```ruby
gem 'melodiest'
```
### How to Use
+#### Command
+generate app in current directory
+```
+melodiest -n my_app
+```
+generate app in target directory
+```
+melodiest -n my_app -d target/dir
+```
+#### Example Code
Because Melodiest is already required Sinatra, you don't have to require 'sinatra' anymore, just require 'melodiest'.
`Melodiest::Application` is subclass from `Sinatra::Application` and by default is using configuration from `Melodiest::Setting.setup` method.
```ruby
-# mysinatraapp.rb
+# my_app.rb
-require 'melodiest'
-require 'melodiest/auth'
+require 'melodiest/auth/http'
-class App < Melodiest::Application
+class App < Melodiest::Application'
+ configure do
+ # Load up database and such
+ end
+
helpers Melodiest::Auth::Http
+end
- get "/" do
- "hello world!"
- end
+# app/routes/my_routes.rb
- get "/protected" do
- authorized! "myhttpauthusername", "myhttpauthpassword"
- end
+get "/" do
+ "hello world!"
+end
+get "/protected" do
+ authorized! "myhttpauthusername", "myhttpauthpassword"
+ "welcome!"
end
```
+#### Run the server
+```
+bundle exec rackup
+```
-#### Configuration
-Configuration
+### Configuration
- * `set :server, 'thin'`
+See [melodiest/config.yml](https://github.com/kuntoaji/melodiest/blob/master/lib/melodiest/config.yml)
-#### Helpers
+### Helpers
Helper methods
* `Melodiest::Auth::Http`