sinator 3.1.1 → 4.0.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/CHANGELOG.md +3 -0
- data/Gemfile.lock +22 -22
- data/lib/sinator/generator.rb +6 -6
- data/lib/sinator/version.rb +1 -1
- data/sinator.gemspec +3 -3
- data/spec/helpers/generator.rb +15 -15
- data/spec/sinator/command_spec.rb +7 -7
- data/spec/sinator/generator_spec.rb +8 -8
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f34ecbbb94d95a5d18092e7dbc30f56f6632aae85e4ade0ac61631aa0a60d2dc
|
4
|
+
data.tar.gz: 6b5f6611754632defcd5e1b1067f4a926c31993a5df12fc212f9ca357f12bea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee06d661c2a157dbf45de4aac82103d428c908fba751cbf7a24f3ef4cc374ea9a3f995a622ca67c01bbba8f66462eedca2b3d6685f17628649facc5f5ed91158
|
7
|
+
data.tar.gz: dce8a9f162b42745f6e02ff0d2e4cc71d89ce9d215fec6c8a57f1756a69ba840893f326ba2d1fe2d5a01879aeca6e8704a7f39aacb7736eb9abee056ee8e3cac
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sinator (3.1.
|
4
|
+
sinator (3.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
diff-lcs (1.
|
10
|
-
docile (1.
|
11
|
-
|
12
|
-
|
13
|
-
rspec-
|
14
|
-
rspec-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
rspec-expectations (3.2.1)
|
9
|
+
diff-lcs (1.5.1)
|
10
|
+
docile (1.4.1)
|
11
|
+
rspec (3.13.0)
|
12
|
+
rspec-core (~> 3.13.0)
|
13
|
+
rspec-expectations (~> 3.13.0)
|
14
|
+
rspec-mocks (~> 3.13.0)
|
15
|
+
rspec-core (3.13.2)
|
16
|
+
rspec-support (~> 3.13.0)
|
17
|
+
rspec-expectations (3.13.3)
|
19
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-mocks (3.2
|
19
|
+
rspec-support (~> 3.13.0)
|
20
|
+
rspec-mocks (3.13.2)
|
22
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
-
rspec-support (~> 3.
|
24
|
-
rspec-support (3.
|
25
|
-
simplecov (0.
|
22
|
+
rspec-support (~> 3.13.0)
|
23
|
+
rspec-support (3.13.2)
|
24
|
+
simplecov (0.22.0)
|
26
25
|
docile (~> 1.1)
|
27
|
-
|
28
|
-
|
29
|
-
simplecov-html (0.
|
26
|
+
simplecov-html (~> 0.11)
|
27
|
+
simplecov_json_formatter (~> 0.1)
|
28
|
+
simplecov-html (0.13.1)
|
29
|
+
simplecov_json_formatter (0.1.4)
|
30
30
|
|
31
31
|
PLATFORMS
|
32
32
|
ruby
|
33
33
|
|
34
34
|
DEPENDENCIES
|
35
|
-
bundler
|
36
|
-
rspec
|
35
|
+
bundler
|
36
|
+
rspec
|
37
37
|
simplecov
|
38
38
|
sinator!
|
39
39
|
|
40
40
|
BUNDLED WITH
|
41
|
-
|
41
|
+
2.5.23
|
data/lib/sinator/generator.rb
CHANGED
@@ -24,7 +24,7 @@ module Sinator
|
|
24
24
|
|
25
25
|
def generate_rakefile
|
26
26
|
gemfile = File.read File.expand_path("../templates/Rakefile.erb", __FILE__)
|
27
|
-
erb = ERB.new gemfile,
|
27
|
+
erb = ERB.new gemfile, trim_mode: '-'
|
28
28
|
|
29
29
|
File.open "#{@destination}/Rakefile", "w" do |f|
|
30
30
|
f.write erb.result(binding)
|
@@ -33,7 +33,7 @@ module Sinator
|
|
33
33
|
|
34
34
|
def generate_gemfile
|
35
35
|
gemfile = File.read File.expand_path("../templates/Gemfile.erb", __FILE__)
|
36
|
-
erb = ERB.new gemfile,
|
36
|
+
erb = ERB.new gemfile, trim_mode: '-'
|
37
37
|
|
38
38
|
File.open "#{@destination}/Gemfile", "w" do |f|
|
39
39
|
f.write erb.result(binding)
|
@@ -53,12 +53,12 @@ module Sinator
|
|
53
53
|
puma_development = File.read File.expand_path("../templates/config/puma/development.erb", __FILE__)
|
54
54
|
puma_production = File.read File.expand_path("../templates/config/puma/production.erb", __FILE__)
|
55
55
|
|
56
|
-
erb = ERB.new puma_development,
|
56
|
+
erb = ERB.new puma_development, trim_mode: '-'
|
57
57
|
File.open "#{@destination}/config/puma/development.rb", "w" do |f|
|
58
58
|
f.write erb.result(binding)
|
59
59
|
end
|
60
60
|
|
61
|
-
erb = ERB.new puma_production,
|
61
|
+
erb = ERB.new puma_production, trim_mode: '-'
|
62
62
|
File.open "#{@destination}/config/puma/production.rb", "w" do |f|
|
63
63
|
f.write erb.result(binding)
|
64
64
|
end
|
@@ -68,14 +68,14 @@ module Sinator
|
|
68
68
|
def generate_app
|
69
69
|
copy_templates
|
70
70
|
app = File.read File.expand_path("../templates/app.erb", __FILE__)
|
71
|
-
erb = ERB.new app,
|
71
|
+
erb = ERB.new app, trim_mode: '-'
|
72
72
|
|
73
73
|
File.open "#{@destination}/#{@app_name}.rb", "w" do |f|
|
74
74
|
f.write erb.result(binding)
|
75
75
|
end
|
76
76
|
|
77
77
|
route = File.read File.expand_path("../templates/app/routes/home.erb", __FILE__)
|
78
|
-
erb = ERB.new route,
|
78
|
+
erb = ERB.new route, trim_mode: '-'
|
79
79
|
|
80
80
|
File.open "#{@destination}/app/routes/home.rb", "w" do |f|
|
81
81
|
f.write erb.result(binding)
|
data/lib/sinator/version.rb
CHANGED
data/sinator.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = 'http://github.com/kuntoaji/sinator'
|
15
15
|
s.license = 'MIT'
|
16
16
|
|
17
|
-
s.required_ruby_version = '>=
|
18
|
-
s.add_development_dependency 'bundler'
|
19
|
-
s.add_development_dependency 'rspec'
|
17
|
+
s.required_ruby_version = '>= 3.3.1'
|
18
|
+
s.add_development_dependency 'bundler'
|
19
|
+
s.add_development_dependency 'rspec'
|
20
20
|
s.add_development_dependency 'simplecov'
|
21
21
|
end
|
data/spec/helpers/generator.rb
CHANGED
@@ -4,7 +4,7 @@ module Helper
|
|
4
4
|
file_content = File.read(file)
|
5
5
|
expected_file_content = File.read(expected_file)
|
6
6
|
|
7
|
-
expect(File.
|
7
|
+
expect(File.exist?(file)).to be_truthy
|
8
8
|
expect(file_content).to eq(expected_file_content)
|
9
9
|
end
|
10
10
|
|
@@ -21,25 +21,25 @@ module Helper
|
|
21
21
|
layout = "#{target_dir}/app/views/layout.erb"
|
22
22
|
home_index = "#{target_dir}/app/views/home/index.erb"
|
23
23
|
|
24
|
-
expect(File.
|
25
|
-
expect(File.
|
26
|
-
expect(File.
|
27
|
-
expect(File.
|
28
|
-
expect(File.
|
29
|
-
|
30
|
-
expect(Dir.
|
31
|
-
expect(Dir.
|
32
|
-
expect(Dir.
|
33
|
-
expect(File.
|
34
|
-
expect(File.
|
24
|
+
expect(File.exist?(config_dir)).to eq(expected_value)
|
25
|
+
expect(File.exist?("#{config_dir}/boot.rb")).to eq(expected_value)
|
26
|
+
expect(File.exist?("#{config_dir}/application.rb")).to eq(expected_value)
|
27
|
+
expect(File.exist?(assets_dir)).to eq(expected_value)
|
28
|
+
expect(File.exist?(public_dir)).to eq(expected_value)
|
29
|
+
|
30
|
+
expect(Dir.exist?(app_dir)).to eq(expected_value)
|
31
|
+
expect(Dir.exist?(routes_dir)).to eq(expected_value)
|
32
|
+
expect(Dir.exist?(views_dir)).to eq(expected_value)
|
33
|
+
expect(File.exist?(layout)).to eq(expected_value)
|
34
|
+
expect(File.exist?(home_index)).to eq(expected_value)
|
35
35
|
end
|
36
36
|
|
37
37
|
def expected_generated_files_with_db(target_dir, expected_value)
|
38
38
|
sample_migration = "#{target_dir}/db/migrations/000_example.rb"
|
39
39
|
|
40
|
-
expect(Dir.
|
41
|
-
expect(File.
|
42
|
-
expect(File.
|
40
|
+
expect(Dir.exist?("#{target_dir}/app/models")).to eq(expected_value)
|
41
|
+
expect(File.exist?("#{target_dir}/config/database.yml")).to eq(expected_value)
|
42
|
+
expect(File.exist?(sample_migration)).to eq(expected_value)
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
@@ -3,17 +3,17 @@ require_relative '../../lib/sinator/command'
|
|
3
3
|
describe Sinator::Command do
|
4
4
|
|
5
5
|
describe "parse" do
|
6
|
-
def
|
7
|
-
FileUtils.rm_r "my_app" if Dir.
|
8
|
-
FileUtils.rm_r "/tmp/my_app" if Dir.
|
6
|
+
def remove_existing_app_if_exist
|
7
|
+
FileUtils.rm_r "my_app" if Dir.exist?("my_app")
|
8
|
+
FileUtils.rm_r "/tmp/my_app" if Dir.exist?("/tmp/my_app")
|
9
9
|
end
|
10
10
|
|
11
11
|
before do
|
12
|
-
|
12
|
+
remove_existing_app_if_exist
|
13
13
|
end
|
14
14
|
|
15
15
|
after :all do
|
16
|
-
|
16
|
+
remove_existing_app_if_exist
|
17
17
|
end
|
18
18
|
|
19
19
|
it "has --help option" do
|
@@ -39,14 +39,14 @@ describe Sinator::Command do
|
|
39
39
|
app = Sinator::Command.parse %w(-n my_app --target /tmp)
|
40
40
|
|
41
41
|
expect(app).to include "my_app is successfully generated in /tmp"
|
42
|
-
expect(Dir.
|
42
|
+
expect(Dir.exist?("/tmp/my_app")).to be_truthy
|
43
43
|
end
|
44
44
|
|
45
45
|
it "has --database option" do
|
46
46
|
app = Sinator::Command.parse %w(-n my_app --target /tmp -d)
|
47
47
|
|
48
48
|
expect(app).to include "my_app is successfully generated in /tmp"
|
49
|
-
expect(Dir.
|
49
|
+
expect(Dir.exist?("/tmp/my_app/db")).to be_truthy
|
50
50
|
end
|
51
51
|
|
52
52
|
context "when has no --name option and only --target option" do
|
@@ -14,13 +14,13 @@ describe Sinator::Generator do
|
|
14
14
|
@dest_with_db = "#{@dest}_with_db"
|
15
15
|
@app = "my_app"
|
16
16
|
|
17
|
-
FileUtils.rm_r @dest if Dir.
|
18
|
-
FileUtils.rm_r @dest_with_db if Dir.
|
17
|
+
FileUtils.rm_r @dest if Dir.exist?(@dest)
|
18
|
+
FileUtils.rm_r @dest_with_db if Dir.exist?(@dest_with_db)
|
19
19
|
end
|
20
20
|
|
21
21
|
after do
|
22
|
-
FileUtils.rm_r @dest if Dir.
|
23
|
-
FileUtils.rm_r @dest_with_db if Dir.
|
22
|
+
FileUtils.rm_r @dest if Dir.exist?(@dest)
|
23
|
+
FileUtils.rm_r @dest_with_db if Dir.exist?(@dest_with_db)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "sets app_name" do
|
@@ -32,9 +32,9 @@ describe Sinator::Generator do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "has default destination path app_name" do
|
35
|
-
FileUtils.rm_r @app if Dir.
|
35
|
+
FileUtils.rm_r @app if Dir.exist?(@app)
|
36
36
|
expect(Sinator::Generator.new(@app).destination).to eq File.expand_path(@app)
|
37
|
-
FileUtils.rm_r @app if Dir.
|
37
|
+
FileUtils.rm_r @app if Dir.exist?(@app)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "sets new destination path even if it's not exist yet" do
|
@@ -97,8 +97,8 @@ describe Sinator::Generator do
|
|
97
97
|
generated_file = "#{target_dir}/app/routes/home.rb"
|
98
98
|
expected_file = File.expand_path("../../fixtures/app_routes_home.txt", __FILE__)
|
99
99
|
|
100
|
-
expect(File.
|
101
|
-
expect(File.
|
100
|
+
expect(File.exist?(erb_file)).to be_falsey
|
101
|
+
expect(File.exist?(generated_file)).to be_truthy
|
102
102
|
expect_file_eq(generated_file, expected_file)
|
103
103
|
end
|
104
104
|
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kunto Aji Kristianto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ homepage: http://github.com/kuntoaji/sinator
|
|
119
119
|
licenses:
|
120
120
|
- MIT
|
121
121
|
metadata: {}
|
122
|
-
post_install_message:
|
122
|
+
post_install_message:
|
123
123
|
rdoc_options: []
|
124
124
|
require_paths:
|
125
125
|
- lib
|
@@ -127,15 +127,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
130
|
+
version: 3.3.1
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
137
|
+
rubygems_version: 3.5.16
|
138
|
+
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Sinatra application generator
|
141
141
|
test_files: []
|