madride 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +27 -24
- data/bin/madride +28 -10
- data/example/README.md +5 -1
- data/example/data.yml +1 -0
- data/example/pages/index.html.slim +1 -2
- data/lib/madride/version.rb +1 -1
- metadata +3 -8
    
        data/README.md
    CHANGED
    
    | @@ -1,34 +1,37 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            Madride
         | 
| 2 2 | 
             
            =======
         | 
| 3 3 |  | 
| 4 | 
            -
            Zero-configuration command-line HTTP server with cow super-powers... | 
| 5 | 
            -
            it allows you to serve files from the directory where you call it. But in
         | 
| 6 | 
            -
            comparison to other solutions `madride` allows you to write htmls in slim, js in
         | 
| 7 | 
            -
            coffescript and so on... Consider you have following files:
         | 
| 4 | 
            +
            Zero-configuration command-line HTTP server with cow super-powers...
         | 
| 8 5 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
                    |- app.js.coffee
         | 
| 15 | 
            -
                    `- app.css.sass
         | 
| 6 | 
            +
            It's main purpose is to provide environment for quick prototyping of
         | 
| 7 | 
            +
            pages with *slim* (or any other template engine - feel free to open
         | 
| 8 | 
            +
            feature request issue) without need to run full stack of big boys like
         | 
| 9 | 
            +
            *sinatra* or *rails*. All you need is to simply execute `madride` with
         | 
| 10 | 
            +
            paths to your assets and pages.
         | 
| 16 11 |  | 
| 17 | 
            -
             | 
| 12 | 
            +
            The most simple example is:
         | 
| 18 13 |  | 
| 19 | 
            -
                 | 
| 20 | 
            -
                /app.js
         | 
| 21 | 
            -
                /app.css
         | 
| 14 | 
            +
                madride .
         | 
| 22 15 |  | 
| 23 | 
            -
             | 
| 16 | 
            +
            This will start a server on `0.0.0.0:3000` serving files from `.`
         | 
| 17 | 
            +
            directory. You can provide a dummy data (that will be available in your
         | 
| 18 | 
            +
            templates) with `--data path/to/data.yml` argument. See `example` dir.
         | 
| 24 19 |  | 
| 25 20 |  | 
| 26 | 
            -
             | 
| 21 | 
            +
            Installation
         | 
| 27 22 | 
             
            ------------
         | 
| 28 23 |  | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 24 | 
            +
                gem install madride
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
| 27 | 
            +
            Usage
         | 
| 28 | 
            +
            -----
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            See `example` for details.
         | 
| 31 | 
            +
             | 
| 32 | 
            +
             | 
| 33 | 
            +
            License & Copyrights
         | 
| 34 | 
            +
            --------------------
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            * Copyright (c) 2012 [Aleksey "ixti" Zapparov](https://github.com/ixti)
         | 
| 37 | 
            +
            * Released under the MIT license. See LICENSE for details.
         | 
    
        data/bin/madride
    CHANGED
    
    | @@ -12,7 +12,7 @@ require 'rack' | |
| 12 12 | 
             
            # Options container. Filled in with default values.
         | 
| 13 13 | 
             
            #
         | 
| 14 14 |  | 
| 15 | 
            -
            options = { :host => '0.0.0.0', :port => 3000, :data => {} }
         | 
| 15 | 
            +
            options = { :host => '0.0.0.0', :port => 3000, :data => {}, :paths => [] }
         | 
| 16 16 |  | 
| 17 17 | 
             
            #
         | 
| 18 18 | 
             
            # Parse options
         | 
| @@ -35,22 +35,44 @@ OptionParser.new("", 24, '  ') do |opts| | |
| 35 35 | 
             
              opts.on("-w", "--with PLUGIN", "include PLUGIN") do |plugin|
         | 
| 36 36 | 
             
                begin
         | 
| 37 37 | 
             
                  require "madride-with-#{plugin}"
         | 
| 38 | 
            -
                rescue LoadError
         | 
| 39 | 
            -
                  require plugin
         | 
| 40 38 | 
             
                rescue LoadError
         | 
| 41 39 | 
             
                  puts "Plugin #{plugin} not found"
         | 
| 42 40 | 
             
                end
         | 
| 43 41 | 
             
              end
         | 
| 44 42 |  | 
| 45 43 | 
             
              opts.on("-d", "--data FILE", "read data from yaml FILE") do |file|
         | 
| 46 | 
            -
                options[:data]. | 
| 44 | 
            +
                options[:data].merge! YAML.load_file file
         | 
| 47 45 | 
             
              end
         | 
| 48 46 |  | 
| 47 | 
            +
              #
         | 
| 48 | 
            +
              # No arguments given - show usage help
         | 
| 49 | 
            +
              #
         | 
| 50 | 
            +
             | 
| 49 51 | 
             
              if ARGV.empty?
         | 
| 50 52 | 
             
                puts opts.help
         | 
| 51 53 | 
             
                exit 1
         | 
| 52 54 | 
             
              end
         | 
| 53 | 
            -
             | 
| 55 | 
            +
             | 
| 56 | 
            +
              #
         | 
| 57 | 
            +
              # Parse options
         | 
| 58 | 
            +
              #
         | 
| 59 | 
            +
             | 
| 60 | 
            +
              begin
         | 
| 61 | 
            +
                opts.order(ARGV){ |path| options[:paths] << path }
         | 
| 62 | 
            +
              rescue OptionParser::ParseError => e
         | 
| 63 | 
            +
                opts.warn e.message
         | 
| 64 | 
            +
                exit 1
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
              #
         | 
| 68 | 
            +
              # We need at least one path
         | 
| 69 | 
            +
              #
         | 
| 70 | 
            +
             | 
| 71 | 
            +
              if options[:paths].empty?
         | 
| 72 | 
            +
                opts.warn "No paths given. See `madride --help` for usage info."
         | 
| 73 | 
            +
                exit 1
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
            end
         | 
| 54 76 |  | 
| 55 77 | 
             
            #
         | 
| 56 78 | 
             
            # Create new madride environment
         | 
| @@ -62,11 +84,7 @@ environment = Madride::Environment.new Dir.pwd | |
| 62 84 | 
             
            # Fill in paths
         | 
| 63 85 | 
             
            #
         | 
| 64 86 |  | 
| 65 | 
            -
             | 
| 66 | 
            -
              environment.append_path "."
         | 
| 67 | 
            -
            else
         | 
| 68 | 
            -
              ARGV.each{ |path| environment.append_path path }
         | 
| 69 | 
            -
            end
         | 
| 87 | 
            +
            options[:paths].each{ |path| environment.append_path path }
         | 
| 70 88 |  | 
| 71 89 | 
             
            #
         | 
| 72 90 | 
             
            # Start server
         | 
    
        data/example/README.md
    CHANGED
    
    | @@ -1,4 +1,8 @@ | |
| 1 1 | 
             
            ## How To Start
         | 
| 2 2 |  | 
| 3 | 
            +
            Install dependencies and start server:
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
                bundle install
         | 
| 4 | 
            -
                bundle exec madride --with bootstrap -- assets pages
         | 
| 6 | 
            +
                bundle exec madride --with bootstrap --data data.yml -- assets pages
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            Now you can open http://0.0.0.0:3000/index.html in your browser
         | 
    
        data/example/data.yml
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            bootstrap_demo_url: "http://twitter.github.com/bootstrap/examples/hero.html"
         | 
| @@ -52,7 +52,6 @@ html[lang="en"] | |
| 52 52 | 
             
                  hr
         | 
| 53 53 | 
             
                  footer
         | 
| 54 54 | 
             
                    p
         | 
| 55 | 
            -
                      - url = "http://twitter.github.com/bootstrap/examples/hero.html"
         | 
| 56 55 | 
             
                      ' This is a demo of madride.
         | 
| 57 | 
            -
                      ' Based on a <a href="#{ | 
| 56 | 
            +
                      ' Based on a <a href="#{bootstrap_demo_url}">Basic marketing site</a>
         | 
| 58 57 | 
             
                      ' example of Bootstrap from Twitter.
         | 
    
        data/lib/madride/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: madride
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -142,6 +142,7 @@ files: | |
| 142 142 | 
             
            - example/Gemfile
         | 
| 143 143 | 
             
            - example/README.md
         | 
| 144 144 | 
             
            - example/assets/app.css
         | 
| 145 | 
            +
            - example/data.yml
         | 
| 145 146 | 
             
            - example/pages/index.html.slim
         | 
| 146 147 | 
             
            - lib/madride.rb
         | 
| 147 148 | 
             
            - lib/madride/context_patch.rb
         | 
| @@ -171,24 +172,18 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 171 172 | 
             
              - - ! '>='
         | 
| 172 173 | 
             
                - !ruby/object:Gem::Version
         | 
| 173 174 | 
             
                  version: '0'
         | 
| 174 | 
            -
                  segments:
         | 
| 175 | 
            -
                  - 0
         | 
| 176 | 
            -
                  hash: 828496883
         | 
| 177 175 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 178 176 | 
             
              none: false
         | 
| 179 177 | 
             
              requirements:
         | 
| 180 178 | 
             
              - - ! '>='
         | 
| 181 179 | 
             
                - !ruby/object:Gem::Version
         | 
| 182 180 | 
             
                  version: '0'
         | 
| 183 | 
            -
                  segments:
         | 
| 184 | 
            -
                  - 0
         | 
| 185 | 
            -
                  hash: 828496883
         | 
| 186 181 | 
             
            requirements: []
         | 
| 187 182 | 
             
            rubyforge_project: 
         | 
| 188 183 | 
             
            rubygems_version: 1.8.23
         | 
| 189 184 | 
             
            signing_key: 
         | 
| 190 185 | 
             
            specification_version: 3
         | 
| 191 | 
            -
            summary: madride-1.0. | 
| 186 | 
            +
            summary: madride-1.0.1
         | 
| 192 187 | 
             
            test_files:
         | 
| 193 188 | 
             
            - spec/.gitkeep
         | 
| 194 189 | 
             
            - spec/environment_spec.rb
         |