lucie-lib 0.0.21 → 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/lib/lucie.rb +4 -0
- data/lib/lucie/app.rb +1 -1
- data/lib/lucie/helpers/controller_name.rb +18 -0
- data/lib/lucie/version.rb +3 -1
- data/test/unit/helpers/controller_name_test.rb +16 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a65f6ee5a45b19bd5c771cbb51f29d457cd9d2
|
4
|
+
data.tar.gz: b800eca212e9572e9ef879597fcd1e6b1b233d0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16490b1dabaf91a42fd7c18c666030e85525cfe7d932c36aab09be8bbeb00e777aa9f9f03fd086857b84628308ff6e513c0467999b2410d7b21ee0133574fd99
|
7
|
+
data.tar.gz: 0d81b701679534c0773baf3e2f11467109100b91185e5a5c0a7b032bc7233e31a9efab351c27de3a9a4d4676417585c68e60df14274933dbf82e0a57042a2198
|
data/lib/lucie.rb
CHANGED
data/lib/lucie/app.rb
CHANGED
@@ -156,7 +156,7 @@ private
|
|
156
156
|
filename = File.basename(path)
|
157
157
|
controller_name = filename.split(".rb").first
|
158
158
|
if controller_name.to_s.length > 0
|
159
|
-
const_name =
|
159
|
+
const_name = Helpers::ControllerName.new(controller_name).capitalized
|
160
160
|
|
161
161
|
# place the constant to the root namespace
|
162
162
|
Object.class_eval do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Lucie
|
2
|
+
module Helpers
|
3
|
+
#
|
4
|
+
# Converts controller name from underscore form to capitalized
|
5
|
+
#
|
6
|
+
class ControllerName
|
7
|
+
attr_reader :name
|
8
|
+
|
9
|
+
def initialize(name)
|
10
|
+
@name = name
|
11
|
+
end
|
12
|
+
|
13
|
+
def capitalized
|
14
|
+
@name.split("_").map{|x| x.capitalize}.join
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/lucie/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ControllerNameTest < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
include Helpers
|
6
|
+
|
7
|
+
def test_controller_name_capitalizer
|
8
|
+
assert_equal "Test", ControllerName.new("test").capitalized
|
9
|
+
assert_equal "TestController", ControllerName.new("test_controller").capitalized
|
10
|
+
assert_equal "", ControllerName.new("").capitalized
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_controller_name_name
|
14
|
+
assert_equal "test_controller", ControllerName.new("test_controller").name
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucie-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nucc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/lucie/controller/base.rb
|
97
97
|
- lib/lucie/controller/exit_request.rb
|
98
98
|
- lib/lucie/exceptions.rb
|
99
|
+
- lib/lucie/helpers/controller_name.rb
|
99
100
|
- lib/lucie/snippets/template.rb
|
100
101
|
- lib/lucie/validators/base.rb
|
101
102
|
- lib/lucie/validators/mandatory_option.rb
|
@@ -115,6 +116,7 @@ files:
|
|
115
116
|
- test/unit/command_line_parser_test.rb
|
116
117
|
- test/unit/command_line_slicer_test.rb
|
117
118
|
- test/unit/controller/base_test.rb
|
119
|
+
- test/unit/helpers/controller_name_test.rb
|
118
120
|
homepage: http://my.luc.ie
|
119
121
|
licenses: []
|
120
122
|
metadata: {}
|
@@ -153,3 +155,4 @@ test_files:
|
|
153
155
|
- test/unit/command_line_parser_test.rb
|
154
156
|
- test/unit/command_line_slicer_test.rb
|
155
157
|
- test/unit/controller/base_test.rb
|
158
|
+
- test/unit/helpers/controller_name_test.rb
|