carioca 1.3 → 2.0.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 +5 -5
- data/.github/workflows/main.yml +18 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +44 -40
- data/README.md +123 -190
- data/Rakefile +5 -59
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/carioca.gemspec +45 -32
- data/config/locales/en.yml +19 -0
- data/config/locales/fr.yml +19 -0
- data/lib/carioca/configuration.rb +60 -0
- data/lib/carioca/constants.rb +60 -0
- data/lib/carioca/container.rb +16 -0
- data/lib/carioca/dependencies.rb +20 -0
- data/lib/carioca/helpers.rb +44 -31
- data/lib/carioca/mixin.rb +32 -0
- data/lib/carioca/{tasks/rake.rb → rake/manage.rb} +4 -6
- data/lib/carioca/rake/tasks/registry.tasks +57 -0
- data/lib/carioca/registry.rb +94 -0
- data/lib/carioca/registry_file.rb +62 -0
- data/lib/carioca/services/config.rb +140 -0
- data/lib/carioca/services/i18n.rb +20 -0
- data/lib/carioca/services/init.rb +2 -0
- data/lib/carioca/services/output.rb +175 -0
- data/lib/carioca/validator.rb +49 -0
- data/lib/carioca.rb +2 -319
- data/samples/Rakefile +2 -0
- data/samples/config/carioca.registry +22 -0
- data/samples/config/locales/en.yml +2 -0
- data/samples/config/locales/es.yml +2 -0
- data/samples/config/locales/fr.yml +2 -0
- data/samples/config/settings.yml +24 -0
- data/samples/test.rb +98 -0
- metadata +76 -168
- data/AUTHORS +0 -8
- data/COPYRIGHT +0 -24
- data/ChangeLog +0 -7
- data/INSTALL +0 -7
- data/doc/manual.rdoc +0 -225
- data/lib/carioca/exceptions.rb +0 -9
- data/lib/carioca/private.rb +0 -170
- data/lib/carioca/services/configuration.rb +0 -201
- data/lib/carioca/services/debug.rb +0 -73
- data/lib/carioca/services/logger.rb +0 -58
- data/lib/carioca/services.rb +0 -143
- data/lib/carioca/tasks/registry_init.rake +0 -11
- data/spec/carioca_spec.rb +0 -474
- data/spec/config/services.registry +0 -55
- data/spec/init_spec.rb +0 -1
- data/spec/samples/dummy.rb +0 -10
- data/spec/samples/otherdummy.rb +0 -10
- data/spec/samples/requireddummy.rb +0 -10
- data/spec/spec_helper.rb +0 -18
- data/test.rb +0 -12
- data/ultragreen_roodi_coding_convention.yml +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 23b95a753d4b358bde71f7d1e9f59ba9456b40302ef9a028a5e791a00c2c7d07
|
4
|
+
data.tar.gz: cb29906d32001f5eecf0b7f78e161cf86436b11cec67377a9efacd2ecf63a469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b105358ef95e063ffdeea22f81eff91dc0a9044b6dcc941fb0449b0d5f6a9b8106d2cdead2d6fd81223b5863d3a2e8ec902d0ce339c24b6c350f84dbcbd4fb4c
|
7
|
+
data.tar.gz: ccd2744676d47b0dd3e6e25acf29194441c2217018d7b1ca1266b55ad598a942b23ae219c26277b6b2986c67c1dcce1b1dc74ee041e4b32f1fab1ec4ed21c567
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.0.0
|
14
|
+
- name: Run the default task
|
15
|
+
run: |
|
16
|
+
gem install bundler -v 2.2.3
|
17
|
+
bundle install
|
18
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,54 +1,58 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
carioca (
|
5
|
-
|
6
|
-
|
4
|
+
carioca (2.0.2)
|
5
|
+
deep_merge (~> 1.2)
|
6
|
+
i18n (~> 1.10)
|
7
|
+
locale (~> 2.1)
|
8
|
+
pastel (~> 0.8.0)
|
9
|
+
tty-prompt (~> 0.23.1)
|
7
10
|
|
8
11
|
GEM
|
9
|
-
remote:
|
12
|
+
remote: https://rubygems.org/
|
10
13
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
diff-lcs (1.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rspec-
|
24
|
-
|
25
|
-
rspec-
|
26
|
-
rspec-
|
27
|
-
|
28
|
-
|
29
|
-
rspec-mocks (
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
14
|
+
concurrent-ruby (1.1.9)
|
15
|
+
deep_merge (1.2.2)
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
i18n (1.10.0)
|
18
|
+
concurrent-ruby (~> 1.0)
|
19
|
+
locale (2.1.3)
|
20
|
+
pastel (0.8.0)
|
21
|
+
tty-color (~> 0.5)
|
22
|
+
rake (13.0.6)
|
23
|
+
rspec (3.9.0)
|
24
|
+
rspec-core (~> 3.9.0)
|
25
|
+
rspec-expectations (~> 3.9.0)
|
26
|
+
rspec-mocks (~> 3.9.0)
|
27
|
+
rspec-core (3.9.3)
|
28
|
+
rspec-support (~> 3.9.3)
|
29
|
+
rspec-expectations (3.9.4)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-mocks (3.9.1)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-support (3.9.4)
|
36
|
+
tty-color (0.6.0)
|
37
|
+
tty-cursor (0.7.1)
|
38
|
+
tty-prompt (0.23.1)
|
39
|
+
pastel (~> 0.8)
|
40
|
+
tty-reader (~> 0.8)
|
41
|
+
tty-reader (0.9.0)
|
42
|
+
tty-cursor (~> 0.7)
|
43
|
+
tty-screen (~> 0.8)
|
44
|
+
wisper (~> 2.0)
|
45
|
+
tty-screen (0.8.1)
|
46
|
+
wisper (2.0.1)
|
39
47
|
|
40
48
|
PLATFORMS
|
49
|
+
arm64-darwin-20
|
41
50
|
ruby
|
42
51
|
|
43
52
|
DEPENDENCIES
|
44
53
|
carioca!
|
45
|
-
|
46
|
-
|
47
|
-
roodi
|
48
|
-
rspec
|
49
|
-
uuid
|
50
|
-
yard
|
51
|
-
yard-rspec
|
54
|
+
rake (~> 13.0)
|
55
|
+
rspec (~> 3.0)
|
52
56
|
|
53
57
|
BUNDLED WITH
|
54
|
-
|
58
|
+
2.2.3
|
data/README.md
CHANGED
@@ -1,239 +1,172 @@
|
|
1
1
|
# Carioca
|
2
2
|
|
3
|
-
## Content
|
4
|
-
|
5
|
-
Author:: Romain GEORGES <romain@ultragreen.net>
|
6
|
-
Version:: 1.0
|
7
|
-
WWW:: http://www.ultragreen.net/projects/carioca
|
8
|
-
|
9
|
-
## Description
|
10
|
-
|
11
|
-
CARIOCA is Configuration Agent and Registry with Inversion Of Control for your Applications
|
12
|
-
Carioca provide a full IoC light Container for designing your applications
|
13
|
-
Carioca provide :
|
14
|
-
- a complete Configuration Agent
|
15
|
-
- A service Registry (base on IOC/DI pattern)
|
16
|
-
|
17
|
-
[](https://travis-ci.org/lecid/carioca)
|
18
|
-
|
19
|
-
|
20
3
|
## Installation
|
21
4
|
|
22
|
-
|
23
|
-
|
24
|
-
```
|
25
|
-
$ sudo zsh
|
26
|
-
# gem ins carioca
|
27
|
-
```
|
28
|
-
## Implementation
|
29
|
-
|
30
|
-
* [Carioca]
|
31
|
-
* [Carioca::Services]
|
32
|
-
* [Carioca:Services::Registry]
|
33
|
-
|
34
|
-
## Utilisation
|
35
|
-
|
36
|
-
Carioca may be used to create Ruby applications, based on a service registry
|
37
|
-
Carioca come with somes builtin services :
|
38
|
-
* logger : an Internal logger based on the logger gem.
|
39
|
-
* Configuration : a Configuration Service, with Yaml percistance, and pretty accessors.
|
40
|
-
* Debug : a Class Debugger, based on Proxy Design pattern and meta-programation like method_missing
|
41
|
-
|
42
|
-
### Getting start
|
43
|
-
|
44
|
-
#### Preparing Gem
|
45
|
-
|
46
|
-
Just after Installation, Carioca :
|
5
|
+
Install it yourself as:
|
47
6
|
|
48
|
-
|
49
|
-
$ gem ins bundler # if needed
|
50
|
-
$ bunlde gem myapp
|
51
|
-
$ cd myapp
|
52
|
-
```
|
7
|
+
$ gem install carioca
|
53
8
|
|
54
|
-
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
gem.add_dependency 'carioca'
|
58
|
-
gem.add_development_dependency 'rake'
|
59
|
-
gem.add_development_dependency 'carioca'
|
60
|
-
```
|
9
|
+
## Usage
|
61
10
|
|
62
|
-
Description and summary need to be changed to be correctly displayed on Rubygems.
|
63
11
|
|
64
|
-
|
12
|
+
### Basic usage
|
65
13
|
|
66
|
-
|
67
|
-
$ bundle
|
68
|
-
```
|
14
|
+
Create you own gem :
|
69
15
|
|
70
|
-
|
16
|
+
$ bundle gem yourgem
|
17
|
+
$ cd yourgem
|
18
|
+
$ vi yourgem.gemspec
|
71
19
|
|
72
|
-
|
73
|
-
|
74
|
-
```
|
75
|
-
$ mkdir config
|
76
|
-
$ mkdir bin
|
77
|
-
```
|
78
|
-
|
79
|
-
edit bin/myapp :
|
20
|
+
check all the TODO in your gemspec, specify concretly you Gem specification, add the following line :
|
80
21
|
|
81
22
|
```ruby
|
82
|
-
|
83
|
-
require 'carioca'
|
84
|
-
|
85
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
86
|
-
```
|
87
|
-
|
88
|
-
|
89
|
-
After, you could Run Carioca and discover Builtins Services, you need the write access to config path
|
90
|
-
|
91
|
-
|
23
|
+
spec.add_dependency "carioca", "~> 2.0"
|
92
24
|
```
|
93
|
-
|
94
|
-
```
|
95
|
-
|
25
|
+
and after :
|
96
26
|
|
97
|
-
|
98
|
-
|
99
|
-
* config file : ./.config
|
100
|
-
* log file : /tmp/log.file
|
101
|
-
Carioca Registry is a Singleton, and services also be unique instance.
|
27
|
+
$ bundle add carioca
|
28
|
+
$ mkdir -p config/locales
|
102
29
|
|
103
|
-
|
104
|
-
|
105
|
-
#### Using Configuration Service
|
30
|
+
Edit the Rakefil, and add the following line :
|
106
31
|
|
107
32
|
```ruby
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
33
|
+
require "carioca/rake/manage"
|
34
|
+
```
|
35
|
+
Verify, all is right with :
|
36
|
+
|
37
|
+
$ rake -T
|
38
|
+
rake build # Build yourgem-0.1.0.gem into the pkg directory
|
39
|
+
rake carioca:registry:add_service # Adding service to Carioca Registry file
|
40
|
+
rake clean # Remove any temporary products
|
41
|
+
rake clobber # Remove any generated files
|
42
|
+
rake install # Build and install yourgem-0.1.0.gem into system gems
|
43
|
+
rake install:local # Build and install yourgem-0.1.0.gem into system gems without network access
|
44
|
+
rake release[remote] # Create tag v0.1.0 and build and push yourgem-0.1.0.gem to Set to 'http://mygemserver.com'
|
45
|
+
rake spec # Run RSpec code examples
|
46
|
+
|
47
|
+
You could now initialize the Carioca registry following the wizard, with (sample with a simple UUID generator gem):
|
48
|
+
|
49
|
+
$ rake carioca:registry:add_service
|
50
|
+
Carioca : registering service :
|
51
|
+
Registry File path ? ./config/carioca.registry
|
52
|
+
Service name ? uuid
|
53
|
+
Choose the service type ? gem
|
54
|
+
Description ? The uuid service
|
55
|
+
Service [uuid] inline Proc Ruby code ? UUID
|
56
|
+
Give the Rubygem name ? uuid
|
57
|
+
Did this service have dependencies ? no
|
58
|
+
|
59
|
+
=> Service : uuid
|
60
|
+
Definition
|
61
|
+
* type: gem
|
62
|
+
* description: The uuid service
|
63
|
+
* service: UUID
|
64
|
+
* resource: uuid
|
65
|
+
Is it correct ? Yes
|
66
|
+
Carioca : Registry saved
|
67
|
+
|
68
|
+
This will initiate a Carioca Registry (YAML file, the format will be describe after, the wizard support all type of services, managed by Carioca, all keys are Symbols):
|
69
|
+
|
70
|
+
$ cat config/carioca.registry
|
71
|
+
---
|
72
|
+
:uuid:
|
73
|
+
:type: :gem
|
74
|
+
:description: The uuid service
|
75
|
+
:service: UUID
|
76
|
+
:resource: uuid
|
77
|
+
|
78
|
+
Now your are ready to use Carioca :
|
79
|
+
|
80
|
+
In this sample, we are going th create a demo command.
|
81
|
+
Firstly, we have to configure a basic usage of Carioca, this could be made in the lib path, in the root gem library.
|
82
|
+
|
83
|
+
$ emacs lib/yourgem.rb
|
84
|
+
|
85
|
+
content of the destination file
|
123
86
|
|
124
87
|
```ruby
|
125
|
-
require 'rubygems'
|
126
|
-
require 'carioca'
|
127
88
|
|
128
|
-
|
129
|
-
log = registry.get_service :name => 'logger'
|
130
|
-
log.info('myapp') {'my message' }
|
131
|
-
```
|
89
|
+
# frozen_string_literal: true
|
132
90
|
|
133
|
-
|
91
|
+
require_relative "yourgem/version"
|
92
|
+
require 'carioca'
|
134
93
|
|
135
|
-
before create your own service :
|
136
94
|
|
137
|
-
|
138
|
-
|
139
|
-
|
95
|
+
Carioca::Registry.configure do |spec|
|
96
|
+
spec.debug = true
|
97
|
+
end
|
140
98
|
|
141
|
-
|
142
|
-
|
99
|
+
module Yourgem
|
100
|
+
class Error < StandardError; end
|
143
101
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
def test(arg = nil)
|
150
|
-
return 'OK'
|
151
|
-
end
|
102
|
+
class YourgemCMD < Carioca::Container
|
103
|
+
def test
|
104
|
+
logger.info(self.to_s) { "Log me as an instance method" }
|
105
|
+
logger.warn(self.class.to_s) {"Give me an UUID : " + uuid.generate}
|
152
106
|
end
|
153
|
-
end
|
154
|
-
```
|
155
107
|
|
156
|
-
|
157
|
-
but, you could write it directly in YAML in your config/myservices.registry :
|
158
|
-
add the following lines :
|
108
|
+
inject service: :uuid
|
159
109
|
|
160
|
-
|
161
|
-
...
|
162
|
-
myservice:
|
163
|
-
:type: :file
|
164
|
-
:resource: services/myservice.rb
|
165
|
-
:description: a test service
|
166
|
-
:service: MyServices
|
167
|
-
...
|
110
|
+
logger.info(self.to_s) { "Log me as class method" }
|
168
111
|
|
169
|
-
|
112
|
+
end
|
170
113
|
|
171
|
-
|
172
|
-
require 'rubygems'
|
173
|
-
require 'carioca'
|
114
|
+
end
|
174
115
|
|
175
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
176
|
-
service = registry.start_service :name => 'myservice'
|
177
|
-
service.test('titi')
|
178
116
|
```
|
179
117
|
|
180
|
-
|
118
|
+
$ emacs exe/yourgem_cmd
|
181
119
|
|
182
|
-
|
183
|
-
in your app, for debug you could use the Proxy Debug (you need to run Carioca Registry in debug mode ) :
|
184
|
-
(Using "debug_", you create an instance of service debug, so with this syntaxe you could create multiple services instances, with different parameters calling.)
|
120
|
+
content of the file
|
185
121
|
|
186
122
|
```ruby
|
187
|
-
|
188
|
-
require 'carioca'
|
123
|
+
require 'yourgem'
|
189
124
|
|
190
|
-
|
191
|
-
|
192
|
-
proxy1.test('titi')
|
125
|
+
yourgem_cmd = Yourgem::YourgemCMD::new
|
126
|
+
yourgem_cmd.test
|
193
127
|
```
|
194
128
|
|
129
|
+
After this, don't forget to stage new files, and you could build & install the gem before running your new command for the first time :
|
195
130
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
D, [
|
201
|
-
D, [
|
202
|
-
D, [
|
203
|
-
D, [
|
204
|
-
|
131
|
+
$ git add config/ exe/
|
132
|
+
$ rake install && yourgem_cmd
|
133
|
+
yourgem 0.1.0 built to pkg/yourgem-0.1.0.gem.
|
134
|
+
yourgem (0.1.0) installed.
|
135
|
+
D, [2022-03-04T23:11:52.663459 #88808] DEBUG -- Carioca: Preloaded service :i18n on locale : en
|
136
|
+
D, [2022-03-04T23:11:52.663519 #88808] DEBUG -- Carioca: Preloaded service :logger ready on STDOUT
|
137
|
+
D, [2022-03-04T23:11:52.663537 #88808] DEBUG -- Carioca: Initializing Carioca registry
|
138
|
+
D, [2022-03-04T23:11:52.663550 #88808] DEBUG -- Carioca: Preparing builtins services
|
139
|
+
D, [2022-03-04T23:11:52.663580 #88808] DEBUG -- Carioca: Adding service configuration
|
140
|
+
D, [2022-03-04T23:11:52.663609 #88808] DEBUG -- Carioca: Adding service i18n
|
141
|
+
D, [2022-03-04T23:11:52.663649 #88808] DEBUG -- Carioca: Initializing registry from file : ./config/carioca.registry
|
142
|
+
D, [2022-03-04T23:11:52.663773 #88808] DEBUG -- Carioca: Adding service uuid
|
143
|
+
D, [2022-03-04T23:11:52.663794 #88808] DEBUG -- Carioca: Registry initialized successfully
|
144
|
+
I, [2022-03-04T23:11:52.663802 #88808] INFO -- Sample::YourGemCMD: Log me as class method
|
145
|
+
I, [2022-03-04T23:11:52.663813 #88808] INFO -- #<Sample::YourGemCMD:0x00000001312c0bf0>: Log me as an instance method
|
146
|
+
D, [2022-03-04T23:11:52.663844 #88808] DEBUG -- Carioca: Starting service uuid
|
147
|
+
W, [2022-03-04T23:11:52.682812 #88808] WARN -- Sample::YourGemCMD: Give me an UUID : 0505f3f0-7e36-013a-22c7-1e00870a7189
|
205
148
|
|
206
|
-
|
149
|
+
You could see, somme interesting things :
|
150
|
+
* Carioca have an internationalisation service (this service will be explain in detail after):
|
151
|
+
* default configured on :en locale
|
152
|
+
* must be in French (:fr) or English (:en), other traductions are welcome
|
153
|
+
* Carioca have a builtin logger service using regular Logger from Stdlib (also explain in detail in this document)
|
154
|
+
* default logging on STDOUT, but could be redirect in the configure bloc
|
155
|
+
* Carioca give us some usefull traces in debug
|
156
|
+
* Carioca come with a Container Class Template
|
157
|
+
* the Container automatically inject :logger, :i18n and a :configuration service (explain in detail after)
|
158
|
+
* the Container provide a class method macro :inject
|
159
|
+
* this macro give a way to use other services defined in the registry file (service could be register inline, presented after)
|
207
160
|
|
161
|
+
## A step further
|
208
162
|
|
209
|
-
For exemple install uuid gem :
|
210
163
|
|
211
|
-
|
212
|
-
$ gem ins uuid
|
213
|
-
```
|
164
|
+
## Development
|
214
165
|
|
215
|
-
|
216
|
-
|
217
|
-
```yaml
|
218
|
-
uuid:
|
219
|
-
:type: :gem
|
220
|
-
:resource: uuid
|
221
|
-
:description: a Rubygems called uuid to build UUID ids.
|
222
|
-
:service: UUID
|
223
|
-
```
|
224
|
-
|
225
|
-
in your app :
|
226
|
-
|
227
|
-
```ruby
|
228
|
-
require 'rubygems'
|
229
|
-
require 'carioca'
|
230
|
-
|
231
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
|
232
|
-
uuid = registry.get_service :name => 'uuid'
|
233
|
-
uuid.generate
|
234
|
-
```
|
166
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
235
167
|
|
236
|
-
|
168
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
237
169
|
|
238
|
-
|
170
|
+
## Contributing
|
239
171
|
|
172
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Ultragreen/carioca.
|
data/Rakefile
CHANGED
@@ -1,62 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require "rake/clean"
|
6
|
-
require "rubygems/package_task"
|
7
|
-
require "rdoc/task"
|
8
|
-
require 'rspec/core/rake_task'
|
9
|
-
require 'yard'
|
10
|
-
require 'yard/rake/yardoc_task.rb'
|
11
|
-
require "rake/tasklib"
|
12
|
-
require "roodi"
|
13
|
-
require "roodi_task"
|
14
|
-
|
15
|
-
|
16
|
-
RoodiTask.new() do | t |
|
17
|
-
t.patterns = %w(lib/**/*.rb)
|
18
|
-
t.config = "ultragreen_roodi_coding_convention.yml"
|
19
|
-
end
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
20
5
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
21
7
|
|
22
|
-
|
23
|
-
CLOBBER.include('*.tmp', 'build/*','#*#')
|
24
|
-
|
25
|
-
|
26
|
-
content = File::readlines(File.join(File.dirname(__FILE__), 'carioca.gemspec')).join
|
27
|
-
spec = eval(content)
|
28
|
-
|
29
|
-
RSpec::Core::RakeTask.new('spec')
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
YARD::Rake::YardocTask.new do |t|
|
34
|
-
t.files = [ 'lib/**/*.rb', '-', 'doc/**/*','spec/**/*_spec.rb']
|
35
|
-
t.options += ['--title', "Gem Documentation"]
|
36
|
-
t.options += ['-o', "yardoc"]
|
37
|
-
t.options += ['-r', "doc/manual.rdoc"]
|
38
|
-
end
|
39
|
-
YARD::Config.load_plugin('yard-rspec')
|
40
|
-
|
41
|
-
namespace :yardoc do
|
42
|
-
task :clobber do
|
43
|
-
rm_r "yardoc" rescue nil
|
44
|
-
rm_r ".yardoc" rescue nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
task :clobber => "yardoc:clobber"
|
48
|
-
|
49
|
-
|
50
|
-
Gem::PackageTask.new(spec) do |pkg|
|
51
|
-
pkg.need_tar = true
|
52
|
-
pkg.need_zip = true
|
53
|
-
end
|
54
|
-
|
55
|
-
Rake::RDocTask.new('rdoc') do |d|
|
56
|
-
d.rdoc_files.include('doc/**/*','bin/*')
|
57
|
-
d.main = 'doc/manual.rdoc'
|
58
|
-
d.title = 'Uglibs : Ultragreen libraries'
|
59
|
-
d.options << '--line-numbers' << '--diagram' << '-SHN'
|
60
|
-
end
|
61
|
-
|
62
|
-
task :default => [:gem]
|
8
|
+
task default: :spec
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "carioca"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|