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.
- checksums.yaml +4 -4
- data/.idea/mvc_one.iml +5 -33
- data/.rubocop.yml +9 -32
- data/CHANGELOG.md +0 -1
- data/Gemfile +6 -7
- data/Gemfile.lock +3 -89
- data/Rakefile +3 -3
- data/exe/mvc_one +7 -86
- data/lib/mvc_one/version.rb +1 -1
- data/lib/mvc_one.rb +3 -3
- data/mvc_one.gemspec +15 -25
- metadata +8 -156
- data/lib/mvc_one/application.rb +0 -56
- data/lib/mvc_one/contracts/application_contract.rb +0 -9
- data/lib/mvc_one/controllers/application_controller.rb +0 -75
- data/lib/mvc_one/models/application_model.rb +0 -13
- data/lib/mvc_one/regexp_router.rb +0 -131
- data/lib/mvc_one/repositories/application_relation.rb +0 -37
- data/lib/mvc_one/repositories/application_repository.rb +0 -20
- data/lib/mvc_one/serializers/application_serializer.rb +0 -143
- data/lib/mvc_one/views/404.slim +0 -12
- data/templates/app/application_layout.slim +0 -9
- data/templates/app/controller_template.erb +0 -50
- data/templates/app/model_template.erb +0 -5
- data/templates/app/welcome_controller_rb.erb +0 -7
- data/templates/app/welcome_index.slim +0 -2
- data/templates/config/routes_rb.erb +0 -12
- data/templates/general/application_rb.erb +0 -7
- data/templates/general/config_ru.erb +0 -11
- data/templates/general/database_yml.erb +0 -12
- data/templates/general/gemfile.erb +0 -7
- data/templates/general/rakefile.erb +0 -75
- data/templates/general/secrets_yml.erb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b72f8b60f99699ee68774cca5d953ec0efa7dd5f96e7c4724215749499e0b8a5
|
4
|
+
data.tar.gz: 712e55f66a83d3052fa6b3ea0fcf2a389c7813b558006ba55acfe24e3ec7ede1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e94be96f58fca694259c0d0323fa6afa5429653218837eb068ccceb2836f384ff45a6f1fdad015414497de0bafbd35d6c4729e7798c086f23abe81fdf05a95d5
|
7
|
+
data.tar.gz: 5913dd96ace60a0065affc235d8fa231971ecc932107926a49979e29fd20303259eceac915a04ab6c41fc44699243898e2e07cc1f48815a30a93e97ad46372a0
|
data/.idea/mvc_one.iml
CHANGED
@@ -12,29 +12,11 @@
|
|
12
12
|
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.4 [global]" jdkType="RUBY_SDK" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
14
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="bcrypt (v3.1.18, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
16
15
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.7, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.2.2, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
18
16
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-configurable (v1.0.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-core (v1.0.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-events (v1.0.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-inflector (v1.0.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-initializer (v3.1.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-logic (v1.5.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-matcher (v0.10.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-monads (v1.6.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
27
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-schema (v1.13.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
28
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-struct (v1.6.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-transaction (v0.15.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-types (v1.7.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="dry-validation (v1.10.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.2, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
33
17
|
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.3, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
34
18
|
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
35
19
|
<orderEntry type="library" scope="PROVIDED" name="parser (v3.2.1.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
36
|
-
<orderEntry type="library" scope="PROVIDED" name="rack (v3.0.4.2, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
37
|
-
<orderEntry type="library" scope="PROVIDED" name="rack-session (v2.0.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
38
20
|
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
39
21
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
40
22
|
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.7.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
@@ -46,39 +28,29 @@
|
|
46
28
|
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.12.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
47
29
|
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.46.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
48
30
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.26.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
49
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-capybara (v2.17.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
50
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
51
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.18.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
52
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-sequel (v0.3.4, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
53
31
|
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
54
|
-
<orderEntry type="library" scope="PROVIDED" name="sequel (v5.66.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
55
|
-
<orderEntry type="library" scope="PROVIDED" name="slim (v5.0.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
56
|
-
<orderEntry type="library" scope="PROVIDED" name="sqlite3 (v1.6.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
57
|
-
<orderEntry type="library" scope="PROVIDED" name="temple (v0.10.0, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
58
32
|
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
59
|
-
<orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.11, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
60
33
|
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.4.2, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
61
|
-
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.6.7, RVM: ruby-2.7.4 [global]) [gem]" level="application" />
|
62
34
|
</component>
|
63
35
|
<component name="RakeTasksCache">
|
64
36
|
<option name="myRootTask">
|
65
37
|
<RakeTaskImpl id="rake">
|
66
38
|
<subtasks>
|
67
|
-
<RakeTaskImpl description="Build mvc_one-0.1.0.
|
39
|
+
<RakeTaskImpl description="Build mvc_one-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
|
68
40
|
<RakeTaskImpl id="build">
|
69
41
|
<subtasks>
|
70
|
-
<RakeTaskImpl description="Generate SHA512 checksum if mvc_one-0.1.0.
|
42
|
+
<RakeTaskImpl description="Generate SHA512 checksum if mvc_one-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
71
43
|
</subtasks>
|
72
44
|
</RakeTaskImpl>
|
73
45
|
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
74
46
|
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
75
|
-
<RakeTaskImpl description="Build and install mvc_one-0.1.0.
|
47
|
+
<RakeTaskImpl description="Build and install mvc_one-0.1.0.gem into system gems" fullCommand="install" id="install" />
|
76
48
|
<RakeTaskImpl id="install">
|
77
49
|
<subtasks>
|
78
|
-
<RakeTaskImpl description="Build and install mvc_one-0.1.0.
|
50
|
+
<RakeTaskImpl description="Build and install mvc_one-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
79
51
|
</subtasks>
|
80
52
|
</RakeTaskImpl>
|
81
|
-
<RakeTaskImpl description="Create tag v0.1.0
|
53
|
+
<RakeTaskImpl description="Create tag v0.1.0 and build and push mvc_one-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
82
54
|
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
83
55
|
<RakeTaskImpl id="rubocop">
|
84
56
|
<subtasks>
|
data/.rubocop.yml
CHANGED
@@ -1,36 +1,13 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-rake
|
3
|
-
- rubocop-sequel
|
4
|
-
- rubocop-rspec
|
5
|
-
|
6
1
|
AllCops:
|
7
|
-
|
8
|
-
|
9
|
-
Metrics/BlockLength:
|
10
|
-
Enabled: false
|
11
|
-
|
12
|
-
RSpec/MultipleExpectations:
|
13
|
-
Enabled: false
|
14
|
-
|
15
|
-
RSpec/ExampleLength:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
RSpec/MultipleMemoizedHelpers:
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
Metrics/AbcSize:
|
22
|
-
Max: 100
|
23
|
-
|
24
|
-
Metrics/ClassLength:
|
25
|
-
Max: 150
|
2
|
+
TargetRubyVersion: 2.6
|
26
3
|
|
27
|
-
|
28
|
-
Enabled:
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
29
7
|
|
30
|
-
Style/
|
31
|
-
Enabled:
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
32
11
|
|
33
|
-
|
34
|
-
|
35
|
-
- 'has_many'
|
36
|
-
- 'has_one'
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 120
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in mvc_one.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
9
|
-
|
10
|
-
gem
|
11
|
-
|
12
|
-
gem
|
13
|
-
gem 'rubocop-sequel', require: false
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "rspec", "~> 3.0"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 1.21"
|
data/Gemfile.lock
CHANGED
@@ -1,84 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mvc_one (0.1.0
|
5
|
-
|
6
|
-
dry-struct (~> 1.5)
|
7
|
-
dry-transaction (~> 0.14)
|
8
|
-
dry-validation (~> 1.9)
|
9
|
-
rack (~> 3)
|
10
|
-
rack-session (~> 2)
|
11
|
-
sequel (~> 5.60)
|
12
|
-
slim (~> 5)
|
13
|
-
sqlite3 (~> 1.5)
|
14
|
-
thor (~> 1.2)
|
4
|
+
mvc_one (0.1.0)
|
5
|
+
thor
|
15
6
|
|
16
7
|
GEM
|
17
8
|
remote: https://rubygems.org/
|
18
9
|
specs:
|
19
10
|
ast (2.4.2)
|
20
|
-
bcrypt (3.1.18)
|
21
|
-
concurrent-ruby (1.2.2)
|
22
11
|
diff-lcs (1.5.0)
|
23
|
-
dry-configurable (1.0.1)
|
24
|
-
dry-core (~> 1.0, < 2)
|
25
|
-
zeitwerk (~> 2.6)
|
26
|
-
dry-core (1.0.0)
|
27
|
-
concurrent-ruby (~> 1.0)
|
28
|
-
zeitwerk (~> 2.6)
|
29
|
-
dry-events (1.0.1)
|
30
|
-
concurrent-ruby (~> 1.0)
|
31
|
-
dry-core (~> 1.0, < 2)
|
32
|
-
dry-inflector (1.0.0)
|
33
|
-
dry-initializer (3.1.1)
|
34
|
-
dry-logic (1.5.0)
|
35
|
-
concurrent-ruby (~> 1.0)
|
36
|
-
dry-core (~> 1.0, < 2)
|
37
|
-
zeitwerk (~> 2.6)
|
38
|
-
dry-matcher (0.10.0)
|
39
|
-
dry-core (~> 1.0)
|
40
|
-
dry-monads (1.6.0)
|
41
|
-
concurrent-ruby (~> 1.0)
|
42
|
-
dry-core (~> 1.0, < 2)
|
43
|
-
zeitwerk (~> 2.6)
|
44
|
-
dry-schema (1.13.0)
|
45
|
-
concurrent-ruby (~> 1.0)
|
46
|
-
dry-configurable (~> 1.0, >= 1.0.1)
|
47
|
-
dry-core (~> 1.0, < 2)
|
48
|
-
dry-initializer (~> 3.0)
|
49
|
-
dry-logic (>= 1.5, < 2)
|
50
|
-
dry-types (>= 1.7, < 2)
|
51
|
-
zeitwerk (~> 2.6)
|
52
|
-
dry-struct (1.6.0)
|
53
|
-
dry-core (~> 1.0, < 2)
|
54
|
-
dry-types (>= 1.7, < 2)
|
55
|
-
ice_nine (~> 0.11)
|
56
|
-
zeitwerk (~> 2.6)
|
57
|
-
dry-transaction (0.15.0)
|
58
|
-
dry-core (~> 1.0)
|
59
|
-
dry-events (~> 1.0)
|
60
|
-
dry-matcher (~> 0.10)
|
61
|
-
dry-monads (~> 1.6)
|
62
|
-
dry-types (1.7.1)
|
63
|
-
concurrent-ruby (~> 1.0)
|
64
|
-
dry-core (~> 1.0)
|
65
|
-
dry-inflector (~> 1.0)
|
66
|
-
dry-logic (~> 1.4)
|
67
|
-
zeitwerk (~> 2.6)
|
68
|
-
dry-validation (1.10.0)
|
69
|
-
concurrent-ruby (~> 1.0)
|
70
|
-
dry-core (~> 1.0, < 2)
|
71
|
-
dry-initializer (~> 3.0)
|
72
|
-
dry-schema (>= 1.12, < 2)
|
73
|
-
zeitwerk (~> 2.6)
|
74
|
-
ice_nine (0.11.2)
|
75
12
|
json (2.6.3)
|
76
13
|
parallel (1.22.1)
|
77
14
|
parser (3.2.1.0)
|
78
15
|
ast (~> 2.4.1)
|
79
|
-
rack (3.0.4.2)
|
80
|
-
rack-session (2.0.0)
|
81
|
-
rack (>= 3.0.0)
|
82
16
|
rainbow (3.1.1)
|
83
17
|
rake (13.0.6)
|
84
18
|
regexp_parser (2.7.0)
|
@@ -108,26 +42,9 @@ GEM
|
|
108
42
|
unicode-display_width (>= 2.4.0, < 3.0)
|
109
43
|
rubocop-ast (1.26.0)
|
110
44
|
parser (>= 3.2.1.0)
|
111
|
-
rubocop-capybara (2.17.1)
|
112
|
-
rubocop (~> 1.41)
|
113
|
-
rubocop-rake (0.6.0)
|
114
|
-
rubocop (~> 1.0)
|
115
|
-
rubocop-rspec (2.18.1)
|
116
|
-
rubocop (~> 1.33)
|
117
|
-
rubocop-capybara (~> 2.17)
|
118
|
-
rubocop-sequel (0.3.4)
|
119
|
-
rubocop (~> 1.0)
|
120
45
|
ruby-progressbar (1.11.0)
|
121
|
-
sequel (5.66.0)
|
122
|
-
slim (5.0.0)
|
123
|
-
temple (~> 0.10.0)
|
124
|
-
tilt (>= 2.0.6, < 2.1)
|
125
|
-
sqlite3 (1.6.1-x86_64-darwin)
|
126
|
-
temple (0.10.0)
|
127
46
|
thor (1.2.1)
|
128
|
-
tilt (2.0.11)
|
129
47
|
unicode-display_width (2.4.2)
|
130
|
-
zeitwerk (2.6.7)
|
131
48
|
|
132
49
|
PLATFORMS
|
133
50
|
x86_64-darwin-20
|
@@ -136,10 +53,7 @@ DEPENDENCIES
|
|
136
53
|
mvc_one!
|
137
54
|
rake (~> 13.0)
|
138
55
|
rspec (~> 3.0)
|
139
|
-
rubocop
|
140
|
-
rubocop-rake
|
141
|
-
rubocop-rspec
|
142
|
-
rubocop-sequel
|
56
|
+
rubocop (~> 1.21)
|
143
57
|
|
144
58
|
BUNDLED WITH
|
145
59
|
2.4.7
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require "rubocop/rake_task"
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
data/exe/mvc_one
CHANGED
@@ -1,27 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
2
|
require 'thor'
|
5
3
|
require 'erb'
|
6
|
-
require 'pry'
|
7
4
|
|
8
5
|
module MvcOne
|
9
6
|
class MyCLI < Thor
|
10
|
-
desc
|
7
|
+
desc "new PROJECT_NAME", "Generate new application"
|
11
8
|
def new(name)
|
12
9
|
puts "Generating #{name}"
|
13
|
-
project_template(name)
|
14
10
|
end
|
15
11
|
|
16
|
-
desc
|
12
|
+
desc "generate controller/model/view/contract name", "Generate new controller/model/view."
|
17
13
|
def generate(layer, layer_name)
|
18
14
|
case layer
|
19
|
-
when 'controller'
|
20
|
-
|
21
|
-
generate_controller layer_name
|
22
|
-
when 'model'
|
23
|
-
puts "Generating model #{layer_name}"
|
24
|
-
generate_model layer_name
|
15
|
+
when 'controller' then puts "Generating controller #{layer_name}"
|
16
|
+
when 'model' then puts "Generating model #{layer_name}"
|
25
17
|
when 'view' then puts "Generating view #{layer_name}"
|
26
18
|
when 'contract' then puts "Generating contract #{layer_name}"
|
27
19
|
else
|
@@ -31,88 +23,17 @@ module MvcOne
|
|
31
23
|
|
32
24
|
private
|
33
25
|
|
34
|
-
def generate_controller(name)
|
35
|
-
raise Error, 'cd into your project repository' unless Dir.exist? 'app/controllers'
|
36
|
-
|
37
|
-
file_name = "app/controllers/#{name}_controller.rb"
|
38
|
-
template = ERB.new(File.read(File.join(gem_path, 'templates/app/controller_template.erb')))
|
39
|
-
File.write(file_name, template.result(binding))
|
40
|
-
end
|
41
|
-
|
42
|
-
def generate_model(name)
|
43
|
-
raise Error, 'cd into your project repository' unless Dir.exist? 'app/models'
|
44
|
-
|
45
|
-
file_name = "app/models/#{name}.rb"
|
46
|
-
template = ERB.new(File.read(File.join(gem_path, 'templates/app/model_template.erb')))
|
47
|
-
File.write(file_name, template.result(binding))
|
48
|
-
end
|
49
|
-
|
50
26
|
def project_template(name)
|
51
|
-
|
52
|
-
make_default_dirs(name_normalized)
|
53
|
-
make_default_files(name_normalized)
|
54
|
-
template = ERB.new <<-ERBTEMPLATE
|
27
|
+
template = ERB.new <<-EOF
|
55
28
|
class ApplicationController
|
56
29
|
def name
|
57
30
|
<%= name %>
|
58
31
|
end
|
59
32
|
end
|
60
|
-
|
33
|
+
EOF
|
61
34
|
template.result(binding)
|
62
35
|
end
|
63
|
-
|
64
|
-
def make_default_files(name_normalized)
|
65
|
-
config_ru = ERB.new(File.read(File.join(gem_path, 'templates/general/config_ru.erb')))
|
66
|
-
File.write "#{name_normalized}/config.ru", config_ru.result(binding)
|
67
|
-
|
68
|
-
rakefile = ERB.new(File.read(File.join(gem_path, 'templates/general/rakefile.erb')))
|
69
|
-
File.write "#{name_normalized}/Rakefile", rakefile.result(binding)
|
70
|
-
|
71
|
-
application_rb = ERB.new(File.read(File.join(gem_path, 'templates/general/application_rb.erb')))
|
72
|
-
File.write "#{name_normalized}/application.rb", application_rb.result(binding)
|
73
|
-
|
74
|
-
routes_rb = ERB.new(File.read(File.join(gem_path, 'templates/config/routes_rb.erb')))
|
75
|
-
File.write "#{name_normalized}/app/config/routes.rb", routes_rb.result(binding)
|
76
|
-
|
77
|
-
database_yml = ERB.new(File.read(File.join(gem_path, 'templates/general/database_yml.erb')))
|
78
|
-
File.write "#{name_normalized}/config/database.yml", database_yml.result(binding)
|
79
|
-
|
80
|
-
secrets_yml = ERB.new(File.read(File.join(gem_path, 'templates/general/secrets_yml.erb')))
|
81
|
-
File.write "#{name_normalized}/config/secrets.yml", secrets_yml.result(binding)
|
82
|
-
|
83
|
-
gemfile = ERB.new(File.read(File.join(gem_path, 'templates/general/gemfile.erb')))
|
84
|
-
File.write "#{name_normalized}/Gemfile", gemfile.result(binding)
|
85
|
-
|
86
|
-
app_layout = File.read(File.join(gem_path, 'templates/app/application_layout.slim'))
|
87
|
-
File.write "#{name_normalized}/app/views/application_layout.slim", app_layout
|
88
|
-
|
89
|
-
welcome_controller = ERB.new(File.read(File.join(gem_path, 'templates/app/welcome_controller_rb.erb')))
|
90
|
-
File.write "#{name_normalized}/app/controllers/welcome_controller.rb", welcome_controller.result(binding)
|
91
|
-
|
92
|
-
Dir.mkdir("#{name_normalized}/app/views/welcome")
|
93
|
-
welcome_index = File.read(File.join(gem_path, 'templates/app/welcome_index.slim'))
|
94
|
-
File.write "#{name_normalized}/app/views/welcome/index.slim", welcome_index
|
95
|
-
end
|
96
|
-
|
97
|
-
def make_default_dirs(root_dir_name)
|
98
|
-
raise Error, "Project directory already exists: #{root_dir_name}" if Dir.exist? root_dir_name
|
99
|
-
|
100
|
-
Dir.mkdir(root_dir_name)
|
101
|
-
|
102
|
-
%w[app config db].each do |dir_name|
|
103
|
-
Dir.mkdir("#{root_dir_name}/#{dir_name}")
|
104
|
-
end
|
105
|
-
Dir.mkdir("#{root_dir_name}/db/migrations")
|
106
|
-
|
107
|
-
%w[controllers models views contracts config].each do |dir_name|
|
108
|
-
Dir.mkdir("#{root_dir_name}/app/#{dir_name}")
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def gem_path
|
113
|
-
File.expand_path("#{File.dirname(__FILE__)}/..")
|
114
|
-
end
|
115
36
|
end
|
116
37
|
end
|
117
38
|
|
118
|
-
MvcOne::MyCLI.start(ARGV)
|
39
|
+
MvcOne::MyCLI.start(ARGV)
|
data/lib/mvc_one/version.rb
CHANGED
data/lib/mvc_one.rb
CHANGED
data/mvc_one.gemspec
CHANGED
@@ -1,46 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "lib/mvc_one/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = "mvc_one"
|
7
7
|
spec.version = MvcOne::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ["Evgenii Sendziuk"]
|
9
|
+
spec.email = ["evgeniisendziuk@taxdome.com"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.license =
|
14
|
-
spec.required_ruby_version =
|
11
|
+
spec.summary = "Simple mvc framework, not for production purposes"
|
12
|
+
spec.description = "Simple mvc framework, not for production purposes"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
16
|
-
|
17
|
-
spec.metadata[
|
16
|
+
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/senzpo/mvc_one.git"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/senzpo/mvc_one.git"
|
18
19
|
|
19
20
|
# Specify which files should be added to the gem when it is released.
|
20
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
22
|
spec.files = Dir.chdir(__dir__) do
|
22
23
|
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
-
(File.expand_path(f) == __FILE__) ||
|
24
|
-
f.match(%r{\A(?:(?:bin|test|spec|features|config)/|\.(?:git|circleci)|appveyor)})
|
24
|
+
(File.expand_path(f) == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
25
25
|
end
|
26
26
|
end
|
27
|
-
spec.bindir =
|
27
|
+
spec.bindir = "exe"
|
28
28
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
-
spec.require_paths = [
|
29
|
+
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
# Uncomment to register a new dependency of your gem
|
32
|
-
spec.add_dependency
|
33
|
-
spec.add_dependency 'dry-struct', '~> 1.5'
|
34
|
-
spec.add_dependency 'dry-transaction', '~> 0.14'
|
35
|
-
spec.add_dependency 'dry-validation', '~> 1.9'
|
36
|
-
spec.add_dependency 'rack', '~> 3'
|
37
|
-
spec.add_dependency 'rack-session', '~> 2'
|
38
|
-
spec.add_dependency 'sequel', '~> 5.60'
|
39
|
-
spec.add_dependency 'slim', '~> 5'
|
40
|
-
spec.add_dependency 'sqlite3', '~> 1.5'
|
41
|
-
spec.add_dependency 'thor', '~> 1.2'
|
32
|
+
spec.add_dependency "thor"
|
42
33
|
|
43
34
|
# For more information and examples about making a new gem, check out our
|
44
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
45
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
46
36
|
end
|