jun 0.3.0 → 0.3.2
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/lib/jun/action_dispatch/routing/welcome.html.erb +42 -2
- data/lib/jun/active_support/core_ext/array/access.rb +6 -0
- data/lib/jun/active_support/core_ext/array/conversion.rb +8 -0
- data/lib/jun/active_support/core_ext/hash/transformation.rb +10 -0
- data/lib/jun/active_support/core_ext/string/access.rb +24 -0
- data/lib/jun/active_support/core_ext/string/inflector.rb +18 -0
- data/lib/jun/active_support/dependencies.rb +2 -0
- data/lib/jun/application.rb +4 -0
- data/lib/jun/version.rb +1 -1
- metadata +3 -10
- data/.rubocop.yml +0 -13
- data/Gemfile +0 -5
- data/Rakefile +0 -16
- data/bin/console +0 -8
- data/bin/setup +0 -8
- data/jun.gemspec +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b6cc6a15d5af338fd4de1afc935b39f43dd28967b636fc5bb652d014232d139
|
4
|
+
data.tar.gz: 0755de2dc72eb2c0879fcb42af4230073c5b0e15c31e393bf7f4db3238f1dc1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79d60c6c07d2f0680c454c620b6c4d32938cc14de180fedef634fb47b3ff56b53a490eeefbabc67371af9e1116ffa19362d554828373da19775ff9b3a8660777
|
7
|
+
data.tar.gz: 034d8cebfd5e1e371564c33017dfdcaed4cefdd71a920d8e0a38a06a15d0fbe22ec924a5dfe44ecc3bc0923e169df0f8a488b732cb85ce07f71a20b8a8cd842a
|
@@ -6,9 +6,14 @@
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
7
|
|
8
8
|
<style>
|
9
|
+
:root {
|
10
|
+
--background-color: #fff3f3;
|
11
|
+
--primary-color: #fc7e70;
|
12
|
+
}
|
13
|
+
|
9
14
|
body {
|
10
15
|
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
|
11
|
-
background-color:
|
16
|
+
background-color: var(--background-color);
|
12
17
|
color: #7d3737;
|
13
18
|
}
|
14
19
|
|
@@ -21,12 +26,42 @@
|
|
21
26
|
text-align: center;
|
22
27
|
}
|
23
28
|
|
29
|
+
.button {
|
30
|
+
background-color: var(--primary-color);
|
31
|
+
color: #fff;
|
32
|
+
margin: 0 0.2rem;
|
33
|
+
padding: 0.5rem 0.75rem;
|
34
|
+
border-radius: 3px;
|
35
|
+
text-decoration: none;
|
36
|
+
user-select: none;
|
37
|
+
}
|
38
|
+
|
39
|
+
.button:hover {
|
40
|
+
background-color: #ef7769;
|
41
|
+
}
|
42
|
+
|
43
|
+
.docs-links {
|
44
|
+
margin: 1.5rem 0;
|
45
|
+
}
|
46
|
+
|
24
47
|
.sunspot {
|
25
48
|
width: 100px;
|
26
49
|
height: 100px;
|
27
50
|
border-radius: 50%;
|
28
|
-
background-color:
|
51
|
+
background-color: var(--primary-color);
|
29
52
|
margin: 2rem auto;
|
53
|
+
position: relative;
|
54
|
+
}
|
55
|
+
|
56
|
+
.sunspot::before {
|
57
|
+
content: "";
|
58
|
+
width: 50px;
|
59
|
+
height: 50px;
|
60
|
+
position: absolute;
|
61
|
+
background-color: var(--background-color);
|
62
|
+
border-radius: 50%;
|
63
|
+
top: 25px;
|
64
|
+
left: 25px;
|
30
65
|
}
|
31
66
|
</style>
|
32
67
|
</head>
|
@@ -35,6 +70,11 @@
|
|
35
70
|
<div class="root">
|
36
71
|
<div class="sunspot"></div>
|
37
72
|
<h1>Welcome to Jun!</h1>
|
73
|
+
<p>Get started by checking out the guide or reading up on the docs.</p>
|
74
|
+
<div class="docs-links">
|
75
|
+
<a class="button" href="https://www.rubydoc.info/gems/jun/<%= Jun::VERSION %>#getting-started">Getting Started</a>
|
76
|
+
<a class="button" href="https://www.rubydoc.info/gems/jun/<%= Jun::VERSION %>">Documentation</a>
|
77
|
+
</div>
|
38
78
|
<small>Jun v<%= Jun::VERSION %> | Ruby v<%= RUBY_VERSION %> (<%= RUBY_PLATFORM %>)</small>
|
39
79
|
</div>
|
40
80
|
</body>
|
@@ -1,26 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Array
|
4
|
+
# Returns the second element in the array.
|
4
5
|
def second
|
5
6
|
self[1]
|
6
7
|
end
|
7
8
|
|
9
|
+
# Returns the third element in the array.
|
8
10
|
def third
|
9
11
|
self[2]
|
10
12
|
end
|
11
13
|
|
14
|
+
# Returns the fourth element in the array.
|
12
15
|
def fourth
|
13
16
|
self[3]
|
14
17
|
end
|
15
18
|
|
19
|
+
# Returns the fifth element in the array.
|
16
20
|
def fifth
|
17
21
|
self[4]
|
18
22
|
end
|
19
23
|
|
24
|
+
# Returns the third-to-last element in the array.
|
20
25
|
def third_to_last
|
21
26
|
self[-3]
|
22
27
|
end
|
23
28
|
|
29
|
+
# Returns the second-to-last element in the array.
|
24
30
|
def second_to_last
|
25
31
|
self[-2]
|
26
32
|
end
|
@@ -1,6 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Array
|
4
|
+
# Converts the array to a comma-separated sentence.
|
5
|
+
#
|
6
|
+
# ["one", "two", "three"].to_sentence #=> "one, two and three"
|
7
|
+
# ["left", "right"].to_sentence(last_delimiter: "or") #=> "left or right"
|
8
|
+
# [].to_sentence #=> ""
|
9
|
+
#
|
10
|
+
# @param delimiter [String] the delimiter value for connecting array elements.
|
11
|
+
# @param last_delimiter [String] the connecting word for the last array element.
|
4
12
|
def to_sentence(delimiter: ", ", last_delimiter: "and")
|
5
13
|
return "" if none?
|
6
14
|
return self.first if one?
|
@@ -1,18 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Hash
|
4
|
+
# Returns a new hash with all keys converted to strings.
|
5
|
+
#
|
6
|
+
# { name: "Tom", age: 50 }.stringify_keys #=> {"name"=>"Tom", "age"=>50}
|
4
7
|
def stringify_keys
|
5
8
|
transform_keys(&:to_s)
|
6
9
|
end
|
7
10
|
|
11
|
+
# Modifies the hash in place to convert all keys to strings.
|
12
|
+
# Same as +stringify_keys+ but modifies +self+.
|
8
13
|
def stringify_keys!
|
9
14
|
transform_keys!(&:to_s)
|
10
15
|
end
|
11
16
|
|
17
|
+
# Returns a new hash with all keys converted to symbols.
|
18
|
+
#
|
19
|
+
# { "name" => "Tom", "age" => 50 }.symbolize_keys #=> {:name=>"Tom", :age=>50 }
|
12
20
|
def symbolize_keys
|
13
21
|
transform_keys { |key| key.to_sym rescue key }
|
14
22
|
end
|
15
23
|
|
24
|
+
# Modifies the hash in place to convert all keys to symbols.
|
25
|
+
# Same as +symbolize_keys+ but modifies +self+.
|
16
26
|
def symbolize_keys!
|
17
27
|
transform_keys! { |key| key.to_sym rescue key }
|
18
28
|
end
|
@@ -1,14 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class String
|
4
|
+
# Returns a character at the given integer of the string. The first character
|
5
|
+
# would be returned for index 0, the second at index 1, and onward. If a range
|
6
|
+
# is given, a substring conaining the characters within the range of the given
|
7
|
+
# indicies is returned. If a Regex is provided, the matching substring is returned.
|
8
|
+
#
|
9
|
+
# string = "smoki"
|
10
|
+
# string.at(0) # => "s"
|
11
|
+
# string.at(1..3) # => "mok"
|
12
|
+
# string.at(-2) # => "k"
|
13
|
+
# string.at(/oki/) # => "oki"
|
4
14
|
def at(position)
|
5
15
|
self[position]
|
6
16
|
end
|
7
17
|
|
18
|
+
# Returns a substring from the given position (index) to the end of the string.
|
19
|
+
# If the position is negative, the starting point is counted from the end of the string.
|
20
|
+
#
|
21
|
+
# string = "smoki"
|
22
|
+
# string.from(0) # => "smoki"
|
23
|
+
# string.from(3) # => "ki"
|
24
|
+
# string.from(-2) # => "ki"
|
8
25
|
def from(position)
|
9
26
|
self[position, length]
|
10
27
|
end
|
11
28
|
|
29
|
+
# Returns a substring from the beginning of the string to the given position (index).
|
30
|
+
# If the position is negative, the ending point is counted from the end of the string.
|
31
|
+
#
|
32
|
+
# string = "smoki"
|
33
|
+
# string.to(0) # => "s"
|
34
|
+
# string.to(3) # => "smok"
|
35
|
+
# string.to(-2) # => "smok"
|
12
36
|
def to(position)
|
13
37
|
position += size if position.negative?
|
14
38
|
position = -1 if position.negative?
|
@@ -68,6 +68,11 @@ module Inflector
|
|
68
68
|
'equipment'
|
69
69
|
]
|
70
70
|
|
71
|
+
# Returns the plural form of the string.
|
72
|
+
#
|
73
|
+
# "task".pluralize #=> "tasks"
|
74
|
+
# "octopus".pluralize #=> "octopi"
|
75
|
+
# "fish".singularize #=> "fish"
|
71
76
|
def pluralize
|
72
77
|
return self if UNCHANGEABLE.include? self
|
73
78
|
|
@@ -82,6 +87,11 @@ module Inflector
|
|
82
87
|
self.sub(pattern, replacement)
|
83
88
|
end
|
84
89
|
|
90
|
+
# Returns the singular form of the string.
|
91
|
+
#
|
92
|
+
# "tasks".singularize #=> "task"
|
93
|
+
# "octopi".singularize #=> "octopus"
|
94
|
+
# "fish".singularize #=> "fish"
|
85
95
|
def singularize
|
86
96
|
return self if UNCHANGEABLE.include? self
|
87
97
|
|
@@ -96,6 +106,10 @@ module Inflector
|
|
96
106
|
self.sub(pattern, replacement)
|
97
107
|
end
|
98
108
|
|
109
|
+
# Converts a string to under_score format.
|
110
|
+
#
|
111
|
+
# "HelloThere".underscore #=> "hello_there"
|
112
|
+
# "Foo::BarBaz".underscore #=> "foo/bar_baz"
|
99
113
|
def underscore
|
100
114
|
gsub(/::/, '/').
|
101
115
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
@@ -104,6 +118,10 @@ module Inflector
|
|
104
118
|
downcase
|
105
119
|
end
|
106
120
|
|
121
|
+
# Converts a string to CamelCase format.
|
122
|
+
#
|
123
|
+
# "hello_there".camelize #=> "HelloThere"
|
124
|
+
# "foo/bar_baz".camelize #=> "Foo::BarBaz"
|
107
125
|
def camelize
|
108
126
|
sub(/^[a-z\d]*/) { |match| match.capitalize }.
|
109
127
|
gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.
|
@@ -8,6 +8,8 @@ module Jun
|
|
8
8
|
attr_accessor :autoload_paths
|
9
9
|
self.autoload_paths = []
|
10
10
|
|
11
|
+
# Returns the filepath for a given filename if the file exists
|
12
|
+
# in one of the directories specified in +autoload_paths+.
|
11
13
|
def find_file(filename)
|
12
14
|
autoload_paths.each do |path|
|
13
15
|
filepath = File.join(path, "#{filename}.rb")
|
data/lib/jun/application.rb
CHANGED
@@ -15,6 +15,8 @@ module Jun
|
|
15
15
|
@routes ||= Jun::ActionDispatch::Routing::RouteSet.new
|
16
16
|
end
|
17
17
|
|
18
|
+
# Initializes the Jun application.
|
19
|
+
# @return [Boolean] +true+ if successful, +false+ if already initialized.
|
18
20
|
def initialize!
|
19
21
|
return false if initialized? || Jun.application.nil?
|
20
22
|
|
@@ -38,6 +40,8 @@ module Jun
|
|
38
40
|
@initialized = true
|
39
41
|
end
|
40
42
|
|
43
|
+
# Checks whether the Jun application has been initialized.
|
44
|
+
# @return [Boolean] +true+ if initialized, +false+ if not initialized.
|
41
45
|
def initialized?
|
42
46
|
!!@initialized
|
43
47
|
end
|
data/lib/jun/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zoran
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -110,21 +110,14 @@ dependencies:
|
|
110
110
|
version: '0.14'
|
111
111
|
description: A simple web framework inspired by Rails. Not meant for production use.
|
112
112
|
email:
|
113
|
-
- zspesic@gmail.com
|
114
113
|
executables:
|
115
114
|
- jun
|
116
115
|
extensions: []
|
117
116
|
extra_rdoc_files: []
|
118
117
|
files:
|
119
|
-
- ".rubocop.yml"
|
120
|
-
- Gemfile
|
121
118
|
- LICENSE.txt
|
122
119
|
- README.md
|
123
|
-
- Rakefile
|
124
|
-
- bin/console
|
125
|
-
- bin/setup
|
126
120
|
- exe/jun
|
127
|
-
- jun.gemspec
|
128
121
|
- lib/jun.rb
|
129
122
|
- lib/jun/action_controller/base.rb
|
130
123
|
- lib/jun/action_controller/callbacks.rb
|
@@ -197,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
190
|
- !ruby/object:Gem::Version
|
198
191
|
version: '0'
|
199
192
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.4.3
|
201
194
|
signing_key:
|
202
195
|
specification_version: 4
|
203
196
|
summary: A simple Ruby web framework.
|
data/.rubocop.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
require "rake/testtask"
|
5
|
-
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs << "test"
|
8
|
-
t.libs << "lib"
|
9
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
-
end
|
11
|
-
|
12
|
-
require "rubocop/rake_task"
|
13
|
-
|
14
|
-
RuboCop::RakeTask.new
|
15
|
-
|
16
|
-
task default: %i[test rubocop]
|
data/bin/console
DELETED
data/bin/setup
DELETED
data/jun.gemspec
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/jun/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "jun"
|
7
|
-
spec.version = Jun::VERSION
|
8
|
-
spec.authors = ["Zoran"]
|
9
|
-
spec.email = ["zspesic@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary = "A simple Ruby web framework."
|
12
|
-
spec.description = "A simple web framework inspired by Rails. Not meant for production use."
|
13
|
-
spec.homepage = "https://github.com/zokioki/jun"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
16
|
-
|
17
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
19
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
spec.bindir = "exe"
|
24
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = ["lib"]
|
26
|
-
|
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
|
-
|
31
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
32
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
33
|
-
spec.add_development_dependency "rubocop", "~> 1.21"
|
34
|
-
spec.add_development_dependency "pry", "~> 0.14"
|
35
|
-
end
|