jun 0.2.0 → 0.3.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/jun.gemspec +3 -3
- data/lib/jun/action_dispatch/routing/route_set.rb +1 -1
- data/lib/jun/action_dispatch/routing/welcome.html.erb +11 -2
- data/lib/jun/active_record/persistence.rb +16 -2
- data/lib/jun/active_support/core_ext/array/access.rb +27 -0
- data/lib/jun/active_support/core_ext/hash/transformation.rb +19 -0
- data/lib/jun/active_support/core_ext/string/access.rb +18 -0
- data/lib/jun/version.rb +1 -1
- metadata +17 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70a404db6997b3aa8f1a682cfaac1d401e5a78aa2c6344645aed5819f9a7c617
|
4
|
+
data.tar.gz: 6ef4729b48e1f780a2004515c00a2ee6efbea77cade3522d942d05f602b509b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa512bde19df4fb617e5d49f6336433cff2ed31ba3dcfba942ed4473b8136a943ff92afcf0fb0a9dcf3f9ebc795f796393e0340a23bbfec183f7987cab90b841
|
7
|
+
data.tar.gz: 5bf62a8d2e2cfaedfce5435b44bc54388f2792b48459b028436c4baf40c8971a9bb6a53c3e63eda0126087142da5742cee470cb69890c50c2d23af228f883cad
|
data/jun.gemspec
CHANGED
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_runtime_dependency "rack"
|
28
|
-
spec.add_runtime_dependency "tilt"
|
29
|
-
spec.add_runtime_dependency "sqlite3"
|
27
|
+
spec.add_runtime_dependency "rack", "~> 2.2"
|
28
|
+
spec.add_runtime_dependency "tilt", "~> 2.0"
|
29
|
+
spec.add_runtime_dependency "sqlite3", "~> 1.4"
|
30
30
|
|
31
31
|
spec.add_development_dependency "rake", "~> 13.0"
|
32
32
|
spec.add_development_dependency "minitest", "~> 5.0"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
|
-
<title>Welcome to Jun
|
4
|
+
<title>Welcome to Jun!</title>
|
5
5
|
<meta charset="utf-8">
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
7
|
|
@@ -20,12 +20,21 @@
|
|
20
20
|
margin-top: 4rem;
|
21
21
|
text-align: center;
|
22
22
|
}
|
23
|
+
|
24
|
+
.sunspot {
|
25
|
+
width: 100px;
|
26
|
+
height: 100px;
|
27
|
+
border-radius: 50%;
|
28
|
+
background-color: #fc7e70;
|
29
|
+
margin: 2rem auto;
|
30
|
+
}
|
23
31
|
</style>
|
24
32
|
</head>
|
25
33
|
|
26
34
|
<body>
|
27
35
|
<div class="root">
|
28
|
-
<
|
36
|
+
<div class="sunspot"></div>
|
37
|
+
<h1>Welcome to Jun!</h1>
|
29
38
|
<small>Jun v<%= Jun::VERSION %> | Ruby v<%= RUBY_VERSION %> (<%= RUBY_PLATFORM %>)</small>
|
30
39
|
</div>
|
31
40
|
</body>
|
@@ -25,11 +25,25 @@ module ActiveRecord
|
|
25
25
|
|
26
26
|
def save
|
27
27
|
if new_record?
|
28
|
-
result = self.class.connection.execute(
|
28
|
+
result = self.class.connection.execute(
|
29
|
+
<<~SQL
|
30
|
+
INSERT INTO #{self.class.table_name}
|
31
|
+
(#{@attributes.keys.join(",")})
|
32
|
+
VALUES (#{@attributes.values.map { |v| "'#{v}'" }.join(",")})
|
33
|
+
RETURNING *;
|
34
|
+
SQL
|
35
|
+
)
|
36
|
+
|
29
37
|
@attributes[self.class.primary_key] = result.first[self.class.primary_key]
|
30
38
|
@new_record = false
|
31
39
|
else
|
32
|
-
self.class.connection.execute(
|
40
|
+
self.class.connection.execute(
|
41
|
+
<<~SQL
|
42
|
+
UPDATE #{self.class.table_name}
|
43
|
+
SET #{@attributes.map { |k, v| "#{k} = #{v.nil? ? 'NULL' : "'#{v}'"}" }.join(",")}
|
44
|
+
WHERE id = #{id};
|
45
|
+
SQL
|
46
|
+
)
|
33
47
|
end
|
34
48
|
|
35
49
|
true
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Array
|
4
|
+
def second
|
5
|
+
self[1]
|
6
|
+
end
|
7
|
+
|
8
|
+
def third
|
9
|
+
self[2]
|
10
|
+
end
|
11
|
+
|
12
|
+
def fourth
|
13
|
+
self[3]
|
14
|
+
end
|
15
|
+
|
16
|
+
def fifth
|
17
|
+
self[4]
|
18
|
+
end
|
19
|
+
|
20
|
+
def third_to_last
|
21
|
+
self[-3]
|
22
|
+
end
|
23
|
+
|
24
|
+
def second_to_last
|
25
|
+
self[-2]
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Hash
|
4
|
+
def stringify_keys
|
5
|
+
transform_keys(&:to_s)
|
6
|
+
end
|
7
|
+
|
8
|
+
def stringify_keys!
|
9
|
+
transform_keys!(&:to_s)
|
10
|
+
end
|
11
|
+
|
12
|
+
def symbolize_keys
|
13
|
+
transform_keys { |key| key.to_sym rescue key }
|
14
|
+
end
|
15
|
+
|
16
|
+
def symbolize_keys!
|
17
|
+
transform_keys! { |key| key.to_sym rescue key }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class String
|
4
|
+
def at(position)
|
5
|
+
self[position]
|
6
|
+
end
|
7
|
+
|
8
|
+
def from(position)
|
9
|
+
self[position, length]
|
10
|
+
end
|
11
|
+
|
12
|
+
def to(position)
|
13
|
+
position += size if position.negative?
|
14
|
+
position = -1 if position.negative?
|
15
|
+
|
16
|
+
self[0, position + 1]
|
17
|
+
end
|
18
|
+
end
|
data/lib/jun/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zoran
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
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: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tilt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
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: '0'
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,7 +143,10 @@ files:
|
|
143
143
|
- lib/jun/active_record/persistence.rb
|
144
144
|
- lib/jun/active_record/relation.rb
|
145
145
|
- lib/jun/active_support/core_ext.rb
|
146
|
+
- lib/jun/active_support/core_ext/array/access.rb
|
146
147
|
- lib/jun/active_support/core_ext/array/conversion.rb
|
148
|
+
- lib/jun/active_support/core_ext/hash/transformation.rb
|
149
|
+
- lib/jun/active_support/core_ext/string/access.rb
|
147
150
|
- lib/jun/active_support/core_ext/string/inflector.rb
|
148
151
|
- lib/jun/active_support/dependencies.rb
|
149
152
|
- lib/jun/application.rb
|