mvc_one 0.1.0.pre.rc7 → 0.1.0

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.
@@ -1,12 +0,0 @@
1
- doctype html
2
- html
3
- head
4
- title Show page
5
- meta name="keywords" content="template language"
6
- meta name="author"
7
- link rel="icon" type="image/png"
8
- / javascript:
9
- // alert('Slim supports embedded javascript!')
10
-
11
- body
12
- h1 404
@@ -1,9 +0,0 @@
1
- | <!doctype html>
2
- html[lang="en"]
3
- head
4
- meta[charset="utf-8"]
5
- meta[name="viewport" content="width=device-width, initial-scale=1"]
6
- title
7
- | Application
8
- body
9
- == yield
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Controller for <%= name.capitalize%>
4
- class <%= name.capitalize%>Controller < ApplicationController
5
- def index
6
- projects = <%= name.capitalize%>Repository.all
7
- # serialize here
8
- end
9
-
10
- def create
11
- contract = <%= name.capitalize%>Contract.new.call(request_params)
12
- if contract.failure?
13
- return render(
14
- code: 422, body: contract.errors.to_h.to_json,
15
- headers: { 'content-type' => 'application/json' }
16
- )
17
- end
18
-
19
- <%= name%> = <%= name.capitalize%>Repository.create(contract.to_h)
20
- render code: 201, body: <%= name%>.to_h.to_json, headers: { 'content-type' => 'application/json' }
21
- end
22
-
23
- def update
24
- contract = <%= name.capitalize%>Contract.new.call(request_params)
25
- if contract.success?
26
- <%= name.capitalize%>Repository.update(params[:id], contract.to_h)
27
-
28
- head 204
29
- else
30
- render code: 422, body: contract.errors
31
- end
32
- rescue ApplicationRepository::NotFoundRecord
33
- head 404
34
- end
35
-
36
- def delete
37
- <%= name.capitalize%>Repository.delete(params[:id])
38
-
39
- head 204
40
- rescue ApplicationRepository::NotFoundRecord
41
- head 404
42
- end
43
-
44
- def show
45
- <%= name%> = <%= name%>Repository.find(id: params[:id])
46
- #serialize here
47
- rescue ApplicationRepository::NotFoundRecord
48
- head 404
49
- end
50
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class <%= name.capitalize%> < ApplicationModel
4
- attribute? :id, Types::Coercible::Integer.optional.meta(info: 'Uniq ID')
5
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class WelcomeController < MvcOne::ApplicationController
4
- def index
5
- render
6
- end
7
- end
@@ -1,2 +0,0 @@
1
- h1
2
- | Welcome to welcome controller
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lambda do
4
- any to: 'welcome#index'
5
-
6
- # Example
7
- # get '/api/v1/users', to: 'api#v1#users#index'
8
- # get '/api/v1/users/:id', to: 'api#v1#users#show'
9
- # patch '/api/v1/users/:id', to: 'api#v1#users#update'
10
- # delete '/api/v1/users/:id', to: 'api#v1#users#delete'
11
- # post '/api/v1/users', to: 'api#v1#users#create'
12
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Rack friendly launcher for project
4
- class Application < MvcOne::Application
5
- end
6
-
7
- Dir[File.join(File.dirname(__FILE__), 'app', '**', '*.rb')].each { |file| require file }
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
-
6
- Bundler.require
7
-
8
- require './application'
9
-
10
- use Rack::Reloader, 0
11
- run Application.launch
@@ -1,12 +0,0 @@
1
- development:
2
- db:
3
- name: '<%= name_normalized%>.db'
4
- adapter: 'sqlite'
5
- connection_line: 'sqlite://db/<%= name_normalized%>.db'
6
- path: './db/<%= name_normalized%>.db'
7
- test:
8
- db:
9
- name: '<%= name_normalized%>.db'
10
- adapter: 'sqlite'
11
- connection_line: 'sqlite://db/test_<%= name_normalized%>.db'
12
- path: './db/test_<%= name_normalized%>.db'
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'mvc_one', '0.1.0.pre.rc7'
6
- gem 'puma'
7
- gem 'rake', '~> 13.0'
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler'
4
-
5
- Bundler.require
6
-
7
- require './application'
8
-
9
- task :default do
10
- puts 'Hello from default task!'
11
- end
12
-
13
- namespace :db do
14
- # http://sequel.jeremyevans.net/documentation.html
15
- desc 'Create database'
16
- task :create do
17
- SQLite3::Database.open(ApplicationRepository.db_config['db']['path'])
18
- end
19
-
20
- desc 'Drop database'
21
- task :drop do
22
- File.delete(ApplicationRepository.db_config['db']['path'])
23
- end
24
-
25
- desc 'Migrate database'
26
- task :migrate do
27
- Sequel.extension :migration
28
- Sequel::Migrator.run(ApplicationRepository::DB, 'db/migrations')
29
- end
30
-
31
- desc 'Rollback database'
32
- task :rollback do
33
- Sequel.extension :migration
34
- steps = ENV['STEPS'].nil? ? 1 : ENV['STEPS'].to_i
35
- Sequel::Migrator.run(ApplicationRepository::DB, 'db/migrations', relative: steps * -1)
36
- end
37
- end
38
-
39
- namespace :app do
40
- desc 'Run controllers test'
41
- task :console do
42
- require 'rubygems'
43
- require 'bundler'
44
- require 'securerandom'
45
- require 'irb'
46
-
47
- Bundler.require
48
-
49
- require './application'
50
-
51
- ARGV.clear
52
- IRB.start
53
- end
54
- end
55
-
56
- namespace :test do
57
- require 'rake'
58
- require 'rspec/core/rake_task'
59
-
60
- desc 'Run all test'
61
- task :all do
62
- RSpec::Core::RakeTask.new(:spec) do |t|
63
- t.pattern = 'spec/**/*_spec.rb'
64
- end
65
- Rake::Task['spec'].execute
66
- end
67
-
68
- desc 'Run controllers test'
69
- task :controllers do
70
- RSpec::Core::RakeTask.new(:spec) do |t|
71
- t.pattern = 'spec/controllers/**/*_spec.rb'
72
- end
73
- Rake::Task['spec'].execute
74
- end
75
- end
@@ -1,4 +0,0 @@
1
- development:
2
- session_cookie: "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
3
- test:
4
- session_cookie: "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"