sinatra-rider 0.2.1 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/README.md +20 -0
  4. data/db/migrate/1_create_users.rb +1 -1
  5. data/db/schema.rb +12 -14
  6. data/db/seeds.rb +3 -0
  7. data/example/myapp/Gemfile +1 -1
  8. data/example/myapp/Gemfile.lock +85 -74
  9. data/example/myapp/db/migrate/1_create_users.rb +1 -1
  10. data/example/myapp/db/schema.rb +12 -14
  11. data/lib/sinatra/rider/assets.rb +14 -8
  12. data/lib/sinatra/rider/command.rb +13 -5
  13. data/lib/sinatra/rider/pathing.rb +1 -1
  14. data/lib/sinatra/rider/quiet_assets.rb +1 -1
  15. data/lib/sinatra/rider/templates/console.tt +16 -0
  16. data/lib/sinatra/rider/templates/gemfile.tt +1 -1
  17. data/lib/sinatra/rider/version.rb +1 -1
  18. data/lib/sinatra/{views → rider/views}/login.erb +0 -0
  19. data/lib/sinatra/{views → rider/views}/signup.erb +0 -0
  20. data/lib/sinatra/rider/views/vendor/bootstrap-3.3.7.min.css +6 -0
  21. data/lib/sinatra/rider/views/vendor/bootstrap.css +1 -0
  22. data/lib/sinatra/rider/views/vendor/font-awesome-4.7.0.min.css +4 -0
  23. data/lib/sinatra/rider/views/vendor/font-awesome.css +1 -0
  24. data/lib/sinatra/rider/views/vendor/fonts/FontAwesome.otf +0 -0
  25. data/lib/sinatra/rider/views/vendor/fonts/fontawesome-webfont.eot +0 -0
  26. data/lib/sinatra/rider/views/vendor/fonts/fontawesome-webfont.svg +2671 -0
  27. data/lib/sinatra/rider/views/vendor/fonts/fontawesome-webfont.ttf +0 -0
  28. data/lib/sinatra/rider/views/vendor/fonts/fontawesome-webfont.woff +0 -0
  29. data/lib/sinatra/rider/views/vendor/fonts/fontawesome-webfont.woff2 +0 -0
  30. data/sinatra-rider.gemspec +8 -7
  31. metadata +53 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 25bd32f4686dc1ef70a3bad62a0eb866d97cce03
4
- data.tar.gz: 4a6f26f9354502348088c9079cb1ddea97b82125
2
+ SHA256:
3
+ metadata.gz: bc0800113023930bf9ccb731c659877326256e045d0f7d6a5934f4028dab4510
4
+ data.tar.gz: 223529596bbc50851e6c9ba1ecffb26c09133bed7b9f94050b32af6a2eceaf4c
5
5
  SHA512:
6
- metadata.gz: 2f695ea42619ee6731f07a221aa2f9af9f91953920bc30f94c9a8c16f5df104ec687e18f5a3f13500e13e1579586cef77fff8df4d4c646edeb4f2def20c3909c
7
- data.tar.gz: bb662ac4fa4874749df9b70f529ab00ab6ba389a00ec93db46cf326f099414049766c59f5bdd93980d0114ffeff4182ba6028bb65f6d96136a4e6640ece2cd7b
6
+ metadata.gz: 6bd856e793ef72cb156ac5d281d0f0cb0329d89ad91d04e30654158a56793b5f1c2bd68e323b29801e2cf808943e7e7a51f2387cf18fd4890e8cccff12ebe93b
7
+ data.tar.gz: 1e543b708ccbeaee373a9876348149408bbc60bb69a0f84fee1d1911777456faa771783a8fc0e810f5946a651f9a375608abe23a2e4266cb6dc499e4ff8ac540
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.cache
data/README.md CHANGED
@@ -9,6 +9,7 @@ All the nice extras Sinatra likes to have when he's on the road.
9
9
  - Sass
10
10
  - Dotenv
11
11
  - Better Errors
12
+ - Local copy of bootstrap and font-awesome
12
13
  - Autoloading `app` and `lib` directories
13
14
  - ~~One dozen blue M&Ms~~
14
15
 
@@ -98,6 +99,25 @@ Better Errors are included in the Sinatra configuration when `RACK_ENV` is in de
98
99
 
99
100
  [More Information](https://github.com/charliesome/better_errors)
100
101
 
102
+ ### Locally available copies of bootstrap and font-awesome
103
+
104
+ `Sinatra::Rider` provides a copy of the latest Bootstrap and Font-Awesome libraries for your usage. Just add the `link` tag to your layout and you're styling!
105
+
106
+ ```html
107
+ <head>
108
+ <title>My Sinatra::Rider App</title>
109
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
110
+ <link rel="stylesheet" type="text/css" href="/assets/bootstrap.css">
111
+ <link rel="stylesheet" type="text/css" href="/assets/font-awesome.css">
112
+ </head>
113
+ ```
114
+
115
+ Current Versions:
116
+ - Bootstrap: 3.3.7
117
+ - Font-Awesome: 4.7.0
118
+
119
+ More Information: [Bootstrap](https://getbootstrap.com/) & [Font-Awesome](http://fontawesome.io/)
120
+
101
121
  ### Autoloading `app` and `lib`
102
122
 
103
123
  Any ruby files present in `app` or `lib` as siblings in the root directory of your `config.ru` will be automatically required.
@@ -1,4 +1,4 @@
1
- class CreateUsers < ActiveRecord::Migration
1
+ class CreateUsers < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :users do |t|
4
4
  t.string :name
@@ -1,13 +1,12 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
5
4
  #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
11
10
  #
12
11
  # It's strongly recommended that you check this file into your version control system.
13
12
 
@@ -16,14 +15,13 @@ ActiveRecord::Schema.define(version: 1) do
16
15
  # These are extensions that must be enabled in order to support this database
17
16
  enable_extension "plpgsql"
18
17
 
19
- create_table "users", force: :cascade do |t|
20
- t.string "name"
21
- t.string "username", null: false
22
- t.string "encrypted_password", null: false
23
- t.datetime "created_at", null: false
24
- t.datetime "updated_at", null: false
18
+ create_table "users", id: :serial, force: :cascade do |t|
19
+ t.string "name"
20
+ t.string "username", null: false
21
+ t.string "encrypted_password", null: false
22
+ t.datetime "created_at", null: false
23
+ t.datetime "updated_at", null: false
24
+ t.index ["username"], name: "index_users_on_username"
25
25
  end
26
26
 
27
- add_index "users", ["username"], name: "index_users_on_username", using: :btree
28
-
29
27
  end
@@ -0,0 +1,3 @@
1
+ require_relative '../lib/sinatra/rider/user'
2
+
3
+ Sinatra::Rider::User.signup(name: 'Matt', username: 'admin', password: 'hunter1')
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
- gem 'sinatra-rider'
4
+ gem 'sinatra-rider', '0.2.6', path: '/Users/matthew/src/sinatra-rider'
@@ -1,101 +1,112 @@
1
+ PATH
2
+ remote: /Users/matthew/src/sinatra-rider
3
+ specs:
4
+ sinatra-rider (0.2.6)
5
+ activerecord
6
+ better_errors
7
+ binding_of_caller
8
+ dotenv
9
+ pg
10
+ sass (~> 3.4)
11
+ sinatra (~> 2.1)
12
+ sinatra-activerecord
13
+ sinatra-contrib
14
+ sinatra_warden
15
+ sprockets (~> 3.7)
16
+ thin
17
+ thor
18
+ uglifier
19
+
1
20
  GEM
2
21
  remote: https://rubygems.org/
3
22
  specs:
4
- activemodel (4.2.5)
5
- activesupport (= 4.2.5)
6
- builder (~> 3.1)
7
- activerecord (4.2.5)
8
- activemodel (= 4.2.5)
9
- activesupport (= 4.2.5)
10
- arel (~> 6.0)
11
- activesupport (4.2.5)
12
- i18n (~> 0.7)
13
- json (~> 1.7, >= 1.7.7)
23
+ activemodel (6.0.3.4)
24
+ activesupport (= 6.0.3.4)
25
+ activerecord (6.0.3.4)
26
+ activemodel (= 6.0.3.4)
27
+ activesupport (= 6.0.3.4)
28
+ activesupport (6.0.3.4)
29
+ concurrent-ruby (~> 1.0, >= 1.0.2)
30
+ i18n (>= 0.7, < 2)
14
31
  minitest (~> 5.1)
15
- thread_safe (~> 0.3, >= 0.3.4)
16
32
  tzinfo (~> 1.1)
17
- arel (6.0.4)
18
- backports (3.6.8)
19
- better_errors (2.1.1)
33
+ zeitwerk (~> 2.2, >= 2.2.2)
34
+ better_errors (2.8.3)
20
35
  coderay (>= 1.0.0)
21
- erubis (>= 2.6.6)
36
+ erubi (>= 1.0.0)
22
37
  rack (>= 0.9.0)
23
- binding_of_caller (0.7.2)
38
+ binding_of_caller (0.8.0)
24
39
  debug_inspector (>= 0.0.1)
25
- builder (3.2.3)
26
- coderay (1.1.1)
27
- concurrent-ruby (1.0.4)
28
- daemons (1.2.4)
29
- debug_inspector (0.0.2)
30
- dotenv (2.2.0)
31
- erubis (2.7.0)
32
- eventmachine (1.2.2)
40
+ coderay (1.1.3)
41
+ concurrent-ruby (1.1.7)
42
+ daemons (1.3.1)
43
+ debug_inspector (0.0.3)
44
+ dotenv (2.7.6)
45
+ erubi (1.9.0)
46
+ eventmachine (1.2.7)
33
47
  execjs (2.7.0)
34
- i18n (0.8.0)
35
- json (1.8.6)
36
- minitest (5.10.1)
37
- multi_json (1.12.1)
38
- pg (0.19.0)
39
- rack (1.6.5)
40
- rack-protection (1.5.3)
48
+ ffi (1.13.1)
49
+ i18n (1.8.5)
50
+ concurrent-ruby (~> 1.0)
51
+ minitest (5.14.2)
52
+ multi_json (1.15.0)
53
+ mustermann (1.1.1)
54
+ ruby2_keywords (~> 0.0.1)
55
+ pg (1.2.3)
56
+ rack (2.2.3)
57
+ rack-protection (2.1.0)
41
58
  rack
42
- rack-test (0.6.3)
43
- rack (>= 1.0)
44
- rake (12.0.0)
45
- sass (3.4.23)
46
- sinatra (1.4.8)
47
- rack (~> 1.5)
48
- rack-protection (~> 1.4)
49
- tilt (>= 1.3, < 3)
50
- sinatra-activerecord (2.0.12)
51
- activerecord (>= 3.2)
59
+ rake (13.0.1)
60
+ rb-fsevent (0.10.4)
61
+ rb-inotify (0.10.1)
62
+ ffi (~> 1.0)
63
+ ruby2_keywords (0.0.2)
64
+ sass (3.7.4)
65
+ sass-listen (~> 4.0.0)
66
+ sass-listen (4.0.0)
67
+ rb-fsevent (~> 0.9, >= 0.9.4)
68
+ rb-inotify (~> 0.9, >= 0.9.7)
69
+ sinatra (2.1.0)
70
+ mustermann (~> 1.0)
71
+ rack (~> 2.2)
72
+ rack-protection (= 2.1.0)
73
+ tilt (~> 2.0)
74
+ sinatra-activerecord (2.0.19)
75
+ activerecord (>= 4.1)
52
76
  sinatra (>= 1.0)
53
- sinatra-contrib (1.4.7)
54
- backports (>= 2.0)
77
+ sinatra-contrib (2.1.0)
55
78
  multi_json
56
- rack-protection
57
- rack-test
58
- sinatra (~> 1.4.0)
59
- tilt (>= 1.3, < 3)
60
- sinatra-rider (0.1.0)
61
- activerecord (= 4.2.5)
62
- better_errors
63
- binding_of_caller
64
- dotenv
65
- pg
66
- sass
67
- sinatra
68
- sinatra-activerecord
69
- sinatra-contrib
70
- sinatra_warden
71
- sprockets
72
- thin
73
- uglifier
74
- sinatra_warden (1.0.0)
75
- sinatra (~> 1.4.6)
76
- warden (~> 1.2.3)
77
- sprockets (3.7.1)
79
+ mustermann (~> 1.0)
80
+ rack-protection (= 2.1.0)
81
+ sinatra (= 2.1.0)
82
+ tilt (~> 2.0)
83
+ sinatra_warden (0.3.2)
84
+ sinatra (>= 1.0.0)
85
+ warden (~> 1.0)
86
+ sprockets (3.7.2)
78
87
  concurrent-ruby (~> 1.0)
79
88
  rack (> 1, < 3)
80
- thin (1.7.0)
89
+ thin (1.7.2)
81
90
  daemons (~> 1.0, >= 1.0.9)
82
91
  eventmachine (~> 1.0, >= 1.0.4)
83
92
  rack (>= 1, < 3)
84
- thread_safe (0.3.5)
85
- tilt (2.0.6)
86
- tzinfo (1.2.2)
93
+ thor (1.0.1)
94
+ thread_safe (0.3.6)
95
+ tilt (2.0.10)
96
+ tzinfo (1.2.7)
87
97
  thread_safe (~> 0.1)
88
- uglifier (3.0.4)
98
+ uglifier (4.2.0)
89
99
  execjs (>= 0.3.0, < 3)
90
- warden (1.2.7)
91
- rack (>= 1.0)
100
+ warden (1.2.9)
101
+ rack (>= 2.0.9)
102
+ zeitwerk (2.4.0)
92
103
 
93
104
  PLATFORMS
94
105
  ruby
95
106
 
96
107
  DEPENDENCIES
97
108
  rake
98
- sinatra-rider
109
+ sinatra-rider (= 0.2.6)!
99
110
 
100
111
  BUNDLED WITH
101
- 1.13.7
112
+ 2.1.4
@@ -1,4 +1,4 @@
1
- class CreateUsers < ActiveRecord::Migration
1
+ class CreateUsers < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :users do |t|
4
4
  t.string :name
@@ -1,13 +1,12 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
5
4
  #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
11
10
  #
12
11
  # It's strongly recommended that you check this file into your version control system.
13
12
 
@@ -16,14 +15,13 @@ ActiveRecord::Schema.define(version: 1) do
16
15
  # These are extensions that must be enabled in order to support this database
17
16
  enable_extension "plpgsql"
18
17
 
19
- create_table "users", force: :cascade do |t|
20
- t.string "name"
21
- t.string "username", null: false
22
- t.string "encrypted_password", null: false
23
- t.datetime "created_at", null: false
24
- t.datetime "updated_at", null: false
18
+ create_table "users", id: :serial, force: :cascade do |t|
19
+ t.string "name"
20
+ t.string "username", null: false
21
+ t.string "encrypted_password", null: false
22
+ t.datetime "created_at", null: false
23
+ t.datetime "updated_at", null: false
24
+ t.index ["username"], name: "index_users_on_username"
25
25
  end
26
26
 
27
- add_index "users", ["username"], name: "index_users_on_username", using: :btree
28
-
29
27
  end
@@ -7,16 +7,22 @@ module Sinatra
7
7
  module Rider
8
8
  module Assets
9
9
  def self.registered(app)
10
- app.set :pipeline, Sprockets::Environment.new
10
+ app.set :pipeline, pipeline = Sprockets::Environment.new
11
11
 
12
- app.pipeline.append_path "assets/stylesheets"
13
- app.pipeline.append_path "assets/javascripts"
14
- app.pipeline.js_compressor = :uglify
15
- app.pipeline.css_compressor = :scss
12
+ pipeline.append_path "assets/stylesheets"
13
+ pipeline.append_path "assets/javascripts"
14
+ pipeline.append_path File.join(__dir__, "views/vendor")
16
15
 
17
- app.get "/assets/*" do
18
- env["PATH_INFO"].sub!("/assets", "")
19
- settings.pipeline.call(env)
16
+ pipeline.js_compressor = :uglify
17
+ pipeline.css_compressor = :scss
18
+
19
+ app.get '/assets/*' do
20
+ env['PATH_INFO'].sub!(%r{^/assets}, '')
21
+ pipeline.call(env)
22
+ end
23
+
24
+ app.configure :development do
25
+ pipeline.cache = Sprockets::Cache::FileStore.new(File.join(app.root, 'tmp'))
20
26
  end
21
27
  end
22
28
  end
@@ -16,12 +16,12 @@ module Sinatra
16
16
  end
17
17
 
18
18
  def prepare_ruby_version
19
- create_file("#{path}/.ruby-version") { "2.1.9\n" }
19
+ create_file("#{path}/.ruby-version") { "#{RUBY_VERSION}\n" }
20
20
  end
21
21
 
22
22
  def prepare_dotenv
23
23
  create_file("#{path}/.env") { "SESSION_SECRET=super secret shh\n" }
24
- create_file("#{path}/.gitignore") { ".env\n" }
24
+ create_file("#{path}/.gitignore") { ".env\ntmp/\n" }
25
25
  end
26
26
 
27
27
  def prepare_database
@@ -38,10 +38,14 @@ module Sinatra
38
38
  end
39
39
 
40
40
  def prepare_app
41
+ template('templates/console.tt', "#{path}/bin/console")
42
+ system('chmod', '+x', "#{path}/bin/console")
43
+
41
44
  template('templates/user.tt', "#{path}/app/user.rb")
42
45
  template('templates/layout.erb', "#{path}/views/layout.erb")
43
46
  template('templates/navigation.erb', "#{path}/views/_navigation.erb")
44
47
  template('templates/index.erb', "#{path}/views/index.erb")
48
+ create_file("#{path}/README.md") { "# #{path.capitalize}\n" }
45
49
  end
46
50
 
47
51
  def prepare_assets
@@ -57,10 +61,14 @@ module Sinatra
57
61
  run('bundle install')
58
62
  run('bundle exec rake db:create db:migrate')
59
63
  run('git init')
60
- puts "You're all set up! Start your server like this:"
61
- puts " bundle exec rackup config.ru"
62
- puts "\nYou can get setup with a user at http://localhost:9292/signup"
64
+ run('git add .')
65
+ run('git commit -m "Initial Commit"')
63
66
  end
67
+
68
+ run("cd #{path}")
69
+ puts "You're all set up! Start your server like this:"
70
+ puts " bundle exec rackup config.ru"
71
+ puts "\nYou can get setup with a user at http://localhost:9292/signup"
64
72
  end
65
73
 
66
74
  def self.source_root
@@ -2,7 +2,7 @@ module Sinatra
2
2
  module Rider
3
3
  module Pathing
4
4
  def self.registered(app)
5
- app.set :views, [app.settings.views, File.join(File.dirname(__dir__), 'views')]
5
+ app.set :views, [app.settings.views, File.join(__dir__, 'views')].flatten
6
6
 
7
7
  app.helpers do
8
8
  def find_template(views, name, engine, &block)
@@ -14,7 +14,7 @@ module Sinatra
14
14
 
15
15
  def call(env)
16
16
  ext = env['REQUEST_PATH'].split('.').last
17
- if #{extensions.inspect}.include? ext
17
+ if #{extensions.inspect}.include?(ext)
18
18
  @app.call env
19
19
  else
20
20
  call_with_logging env
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ require 'bundler/setup'
3
+ require 'dotenv'
4
+ Dotenv.load
5
+
6
+ require 'sinatra/rider'
7
+
8
+ # You can add fixtures and/or initialization code here to make experimenting
9
+ # with your gem easier. You can also use a different console, if you like.
10
+
11
+ # (If you use this, don't forget to add pry to your Gemfile!)
12
+ # require "pry"
13
+ # Pry.start
14
+
15
+ require 'irb'
16
+ IRB.start