sinatra_spotlight 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8112a6e183525908e2f28b45efb8e9f7a60d4f3
4
+ data.tar.gz: b01d3c994ca54508706af5d86720d864618fc0f4
5
+ SHA512:
6
+ metadata.gz: b8e545de75dcd35a7311fcf58df35a7d9864bd4cc2b242b0fcf928b560297d5a4fa227f38073ed8bc2ca7b4d04839f873de6eef22f62054081be27a632952dc6
7
+ data.tar.gz: cf4b6fbd2578c06d642e259ae69dd03fbcac4390c31ea05c8a67925e297657bd5df4677a82c084e92238dec803b278bce3145a76008c4c5caa413612a715a57a
data/bin/sinspot ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
3
+
4
+ require 'sinspot'
5
+
6
+ ARGV << '-v' if ARGV.empty?
7
+
8
+ Sinspot::Commands.call(ARGV.shift, ARGV)
@@ -0,0 +1,38 @@
1
+ module Sinspot
2
+ class Application
3
+ attr_reader :app_name, :templates_path
4
+
5
+ def initialize(opts)
6
+ raise "Plase, set a app name to create a new slim app" if opts.empty?
7
+
8
+ @app_name = opts.shift
9
+ @templates_path = "#{File.expand_path(File.dirname(__FILE__))}/templates"
10
+ end
11
+
12
+ def build
13
+ create_app_folder
14
+ copy_templates
15
+ end
16
+
17
+ private
18
+
19
+ def create_app_folder
20
+ puts 'Creating application directories...'
21
+ ['', 'app', 'app/controllers', 'app/views', 'app/assets', 'app/assets/stylesheets', 'config'].each do |dir|
22
+ `mkdir #{app_name}/#{dir}`
23
+ end
24
+ end
25
+
26
+ def copy_templates
27
+ [
28
+ 'gemfile', 'config.ru', 'README.md', 'config/environment.rb',
29
+ 'app/views/index.erb', 'app/controllers/application_controller.rb',
30
+ 'app/controllers/home_controller.rb', 'app/assets/stylesheets/reset.css',
31
+ 'app/assets/stylesheets/home.css'
32
+ ].each do |file_path|
33
+ puts "Copy #{file_path} to application dir"
34
+ FileUtils.cp([templates_path, file_path].join('/'), [app_name, file_path].join('/'))
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ module Sinspot
2
+ class Commands
3
+ DEFINED_ACTIONS = ['version', 'new']
4
+ ALIASES = {
5
+ '-v' => 'version',
6
+ }
7
+
8
+ def self.call(action, opts)
9
+ action = ALIASES[action] || action
10
+ raise "\"#{action}\" not is a Sinatra Spotlight method!" unless DEFINED_ACTIONS.include?(action)
11
+
12
+ new.send(action, opts)
13
+ end
14
+
15
+ def version(opts)
16
+ return puts(Sinspot::VERSION) if opts.include?('--verbose')
17
+ puts "Sinatra Spotlight version #{Sinspot::VERSION}"
18
+ end
19
+
20
+ def new(opts)
21
+ Sinspot::Application.new(opts).build
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ruby '2.3.1'
4
+
5
+ gem 'rack'
6
+ gem 'sinatra'
7
+ gem 'sinatra-assetpack'
8
+ gem 'json'
9
+
10
+ group :test, :development do
11
+ gem 'byebug'
12
+ gem 'rspec'
13
+ gem 'rack-test'
14
+ end
@@ -0,0 +1 @@
1
+ TODO: Write your README.md
@@ -0,0 +1,3 @@
1
+ h1 {
2
+ color: red;
3
+ }
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ * * v2.0 | 20110126
3
+ * * License: none (public domain)
4
+ * * */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
@@ -0,0 +1,21 @@
1
+ class ApplicationController < Sinatra::Base
2
+ set :root, File.dirname(__FILE__)
3
+
4
+ register Sinatra::AssetPack
5
+
6
+ =begin
7
+ assets do
8
+ serve '/css', from: '../assets/stylesheets/'
9
+
10
+ css_compression :simple
11
+ end
12
+ =end
13
+
14
+ # set folder for templates to ../views, but make the path absolute
15
+ set :views, File.expand_path('../../views', __FILE__)
16
+
17
+ # don't enable logging when running tests
18
+ configure :production, :development do
19
+ enable :logging
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ class HomeController < ApplicationController
2
+ # show get '/resource/:id {}'
3
+ # create post '/resource {}'
4
+ # destroy delete '/resource/:id {}'
5
+ # update put/patch 'resource/:id {}'
6
+
7
+ # Index
8
+ get '/' do
9
+ erb :index
10
+ end
11
+ end
@@ -0,0 +1 @@
1
+ <h1>Welcome to your new Sinatra Spotlight App!</h1>
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ Bundler.require(:default) # load all the default gems
5
+ Bundler.require(Sinatra::Base.environment) # load all the environment specific gems
@@ -0,0 +1,6 @@
1
+ require './config/environment'
2
+
3
+ require './app/controllers/application_controller'
4
+ require './app/controllers/home_controller'
5
+
6
+ map('/') { run HomeController }
data/lib/sinspot.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'sinatra'
2
+ require 'byebug'
3
+ require 'rspec'
4
+
5
+ require 'sinspot/application'
6
+ require 'sinspot/commands'
7
+
8
+ module Sinspot
9
+ VERSION = 1.0
10
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra_spotlight
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Dante Santos
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 9.0.6
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 9.0.6
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description: Build simple applications based on the mvc model of rails, in a lean
84
+ way using sinatra as a web service.
85
+ email:
86
+ - dante.alighierimds@gmail.com
87
+ executables:
88
+ - sinspot
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - bin/sinspot
93
+ - lib/sinspot.rb
94
+ - lib/sinspot/application.rb
95
+ - lib/sinspot/commands.rb
96
+ - lib/sinspot/templates/Gemfile
97
+ - lib/sinspot/templates/README.md
98
+ - lib/sinspot/templates/app/assets/stylesheets/home.css
99
+ - lib/sinspot/templates/app/assets/stylesheets/reset.css
100
+ - lib/sinspot/templates/app/controllers/application_controller.rb
101
+ - lib/sinspot/templates/app/controllers/home_controller.rb
102
+ - lib/sinspot/templates/app/views/index.erb
103
+ - lib/sinspot/templates/config.ru
104
+ - lib/sinspot/templates/config/environment.rb
105
+ homepage: https://github.com/DanteAlg/sinatra_spotlight
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 2.1.0
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.5.1
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: A sinatra application generator
129
+ test_files: []