railz_lite 0.1.8 → 0.1.9
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.
- checksums.yaml +4 -4
 - data/lib/railz_lite/cli.rb +8 -1
 - data/lib/railz_lite/generators/project.rb +7 -3
 - data/lib/railz_lite/generators/templates/server.rb +7 -0
 - data/lib/railz_lite/generators/templates/welcome_view.index.html.erb +12 -0
 - data/lib/railz_lite/generators/templates/winter_fox_large.jpg +0 -0
 - data/lib/railz_lite/models/db_connection.rb +9 -5
 - data/lib/railz_lite/version.rb +1 -1
 - metadata +3 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 81d26ed037ad3c977f1cb81938ae67fe84e5d61bb003b56fc4a42cfefa66c85e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 83094af33c58caab3053c15a6325360d4d865739a127180cb8b601010e3f20ca
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7fc0c8c888e5c2d906c0d3c7be43d240ad13197ce19681547232308eca1dc6fe06f5805d18a52743923445d9916408caddb95c043b8f1b865ae16bca8657c7ad
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 36bef73dd88344e44ad8066f73489fc8bc2e9d709013eff7e16ddb098992d34840fe6230e35f8770e089bbecabc8c35c71e9a301e2b6c60191b46e4987fded59
         
     | 
    
        data/lib/railz_lite/cli.rb
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'thor'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'railz_lite'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'railz_lite/generators/project'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'railz_lite/models/db_connection'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module RailzLite
         
     | 
| 
       6 
7 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
         @@ -9,14 +10,20 @@ module RailzLite 
     | 
|
| 
       9 
10 
     | 
    
         
             
                  RailzLite::Generators::Project.start([project_name])
         
     | 
| 
       10 
11 
     | 
    
         
             
                end
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                desc 'server', 'Starts up a puma server within RailzLite project'
         
     | 
| 
      
 13 
     | 
    
         
            +
                desc 'server', 'Starts up a puma server within RailzLite project. Also initializes '
         
     | 
| 
       13 
14 
     | 
    
         
             
                def server
         
     | 
| 
       14 
15 
     | 
    
         
             
                  file =  File.join(Dir.pwd, 'config', 'server.rb')
         
     | 
| 
       15 
16 
     | 
    
         
             
                  if File.exist?(file)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    DBConnection.start # load our db connection
         
     | 
| 
       16 
18 
     | 
    
         
             
                    system('ruby', file)
         
     | 
| 
       17 
19 
     | 
    
         
             
                  else
         
     | 
| 
       18 
20 
     | 
    
         
             
                    raise "File not found at #{file}"
         
     | 
| 
       19 
21 
     | 
    
         
             
                  end
         
     | 
| 
       20 
22 
     | 
    
         
             
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                desc 'db_reset', 'Restarts the database and reads db/app.sql file'
         
     | 
| 
      
 25 
     | 
    
         
            +
                def db_reset
         
     | 
| 
      
 26 
     | 
    
         
            +
                  DBConnection.reset
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
       21 
28 
     | 
    
         
             
              end
         
     | 
| 
       22 
29 
     | 
    
         
             
            end
         
     | 
| 
         @@ -26,12 +26,16 @@ module RailzLite 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    template('server.rb', "#{project_name}/config/server.rb")
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  def  
     | 
| 
       30 
     | 
    
         
            -
                     
     | 
| 
      
 29 
     | 
    
         
            +
                  def add_welcome_view
         
     | 
| 
      
 30 
     | 
    
         
            +
                    template('welcome_view.index.html.erb', "#{project_name}/views/welcome_controller/welcome_view.index.html.erb")
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                  def add_public
         
     | 
| 
       34 
     | 
    
         
            -
                     
     | 
| 
      
 34 
     | 
    
         
            +
                    copy_file('winter_fox_large.jpg', "#{project_name}/public")
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def create_sql_file
         
     | 
| 
      
 38 
     | 
    
         
            +
                    create_file("#{project_name}/db/app.sql")
         
     | 
| 
       35 
39 
     | 
    
         
             
                  end
         
     | 
| 
       36 
40 
     | 
    
         
             
                end
         
     | 
| 
       37 
41 
     | 
    
         
             
              end
         
     | 
| 
         @@ -2,10 +2,17 @@ require 'rack' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'railz_lite/controllers/static'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'railz_lite/controllers/show_exceptions'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'railz_lite/controllers/router'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'railz_lite'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # example controller config
         
     | 
| 
      
 8 
     | 
    
         
            +
             class WelcomeController < RailzLite::ControllerBase
         
     | 
| 
      
 9 
     | 
    
         
            +
               def index; end
         
     | 
| 
      
 10 
     | 
    
         
            +
             end
         
     | 
| 
       5 
11 
     | 
    
         | 
| 
       6 
12 
     | 
    
         
             
            router = Router.new
         
     | 
| 
       7 
13 
     | 
    
         
             
            router.draw do
         
     | 
| 
       8 
14 
     | 
    
         
             
              # add routes here
         
     | 
| 
      
 15 
     | 
    
         
            +
              get Regexp.new('^/$'), WelcomeController, :index
         
     | 
| 
       9 
16 
     | 
    
         
             
            end
         
     | 
| 
       10 
17 
     | 
    
         | 
| 
       11 
18 
     | 
    
         
             
            app = Proc.new do |env|
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <div style="
         
     | 
| 
      
 2 
     | 
    
         
            +
                width: 50%;
         
     | 
| 
      
 3 
     | 
    
         
            +
                margin: 0 auto;
         
     | 
| 
      
 4 
     | 
    
         
            +
                margin-top: 18px;
         
     | 
| 
      
 5 
     | 
    
         
            +
                text-align: center;
         
     | 
| 
      
 6 
     | 
    
         
            +
                ">
         
     | 
| 
      
 7 
     | 
    
         
            +
              <h1>Welcome To Railz Lite!</h1>
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              <img src="../public/winter_fox_large.jpg" />
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              <h3>For guidelines on how to build an app with this framework see <a href="https://github.com/bryanqb07/railz_lite">here</a>.</h3>
         
     | 
| 
      
 12 
     | 
    
         
            +
            </div>
         
     | 
| 
         Binary file 
     | 
| 
         @@ -1,11 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'sqlite3'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            PRINT_QUERIES = ENV['PRINT_QUERIES'] == 'true'
         
     | 
| 
       4 
     | 
    
         
            -
            ROOT_FOLDER = Dir.pwd
         
     | 
| 
       5 
     | 
    
         
            -
            SQL_FILE = File.join(ROOT_FOLDER, 'app.sql')
         
     | 
| 
       6 
     | 
    
         
            -
            DB_FILE = File.join(ROOT_FOLDER, 'app.db')
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
3 
     | 
    
         
             
            class DBConnection
         
     | 
| 
      
 4 
     | 
    
         
            +
              PRINT_QUERIES = ENV['PRINT_QUERIES'] == 'true'
         
     | 
| 
      
 5 
     | 
    
         
            +
              ROOT_FOLDER = Dir.pwd
         
     | 
| 
      
 6 
     | 
    
         
            +
              SQL_FILE = File.join(ROOT_FOLDER, 'db', 'app.sql')
         
     | 
| 
      
 7 
     | 
    
         
            +
              DB_FILE = File.join(ROOT_FOLDER, 'db', 'app.db')
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.start
         
     | 
| 
      
 10 
     | 
    
         
            +
                DBConnection.open(DB_FILE)
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       9 
13 
     | 
    
         
             
              def self.open(db_file_name)
         
     | 
| 
       10 
14 
     | 
    
         
             
                @db = SQLite3::Database.new(db_file_name)
         
     | 
| 
       11 
15 
     | 
    
         
             
                @db.results_as_hash = true
         
     | 
    
        data/lib/railz_lite/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: railz_lite
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.9
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - bryan lynch
         
     | 
| 
         @@ -168,6 +168,8 @@ files: 
     | 
|
| 
       168 
168 
     | 
    
         
             
            - lib/railz_lite/generators/project.rb~
         
     | 
| 
       169 
169 
     | 
    
         
             
            - lib/railz_lite/generators/templates/application_controller.rb~
         
     | 
| 
       170 
170 
     | 
    
         
             
            - lib/railz_lite/generators/templates/server.rb
         
     | 
| 
      
 171 
     | 
    
         
            +
            - lib/railz_lite/generators/templates/welcome_view.index.html.erb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - lib/railz_lite/generators/templates/winter_fox_large.jpg
         
     | 
| 
       171 
173 
     | 
    
         
             
            - lib/railz_lite/models/associatable.rb
         
     | 
| 
       172 
174 
     | 
    
         
             
            - lib/railz_lite/models/associatable2.rb
         
     | 
| 
       173 
175 
     | 
    
         
             
            - lib/railz_lite/models/attr_accessor_object.rb
         
     |