carioca 1.3 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/main.yml +18 -0
  3. data/.gitignore +11 -0
  4. data/.rspec +3 -0
  5. data/Gemfile +3 -1
  6. data/Gemfile.lock +44 -40
  7. data/README.md +123 -190
  8. data/Rakefile +5 -59
  9. data/bin/console +15 -0
  10. data/bin/setup +8 -0
  11. data/carioca.gemspec +45 -32
  12. data/config/locales/en.yml +19 -0
  13. data/config/locales/fr.yml +19 -0
  14. data/lib/carioca/configuration.rb +60 -0
  15. data/lib/carioca/constants.rb +60 -0
  16. data/lib/carioca/container.rb +16 -0
  17. data/lib/carioca/dependencies.rb +20 -0
  18. data/lib/carioca/helpers.rb +44 -31
  19. data/lib/carioca/mixin.rb +32 -0
  20. data/lib/carioca/{tasks/rake.rb → rake/manage.rb} +4 -6
  21. data/lib/carioca/rake/tasks/registry.tasks +57 -0
  22. data/lib/carioca/registry.rb +94 -0
  23. data/lib/carioca/registry_file.rb +62 -0
  24. data/lib/carioca/services/config.rb +140 -0
  25. data/lib/carioca/services/i18n.rb +20 -0
  26. data/lib/carioca/services/init.rb +2 -0
  27. data/lib/carioca/services/output.rb +175 -0
  28. data/lib/carioca/validator.rb +49 -0
  29. data/lib/carioca.rb +2 -319
  30. data/samples/Rakefile +2 -0
  31. data/samples/config/carioca.registry +22 -0
  32. data/samples/config/locales/en.yml +2 -0
  33. data/samples/config/locales/es.yml +2 -0
  34. data/samples/config/locales/fr.yml +2 -0
  35. data/samples/config/settings.yml +24 -0
  36. data/samples/test.rb +98 -0
  37. metadata +76 -168
  38. data/AUTHORS +0 -8
  39. data/COPYRIGHT +0 -24
  40. data/ChangeLog +0 -7
  41. data/INSTALL +0 -7
  42. data/doc/manual.rdoc +0 -225
  43. data/lib/carioca/exceptions.rb +0 -9
  44. data/lib/carioca/private.rb +0 -170
  45. data/lib/carioca/services/configuration.rb +0 -201
  46. data/lib/carioca/services/debug.rb +0 -73
  47. data/lib/carioca/services/logger.rb +0 -58
  48. data/lib/carioca/services.rb +0 -143
  49. data/lib/carioca/tasks/registry_init.rake +0 -11
  50. data/spec/carioca_spec.rb +0 -474
  51. data/spec/config/services.registry +0 -55
  52. data/spec/init_spec.rb +0 -1
  53. data/spec/samples/dummy.rb +0 -10
  54. data/spec/samples/otherdummy.rb +0 -10
  55. data/spec/samples/requireddummy.rb +0 -10
  56. data/spec/spec_helper.rb +0 -18
  57. data/test.rb +0 -12
  58. data/ultragreen_roodi_coding_convention.yml +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7452e3def3859f67723245f65eaca57325c02df7
4
- data.tar.gz: e62a5e8df75b45796408e2b23b8ffa3f7272b9dc
2
+ SHA256:
3
+ metadata.gz: 23b95a753d4b358bde71f7d1e9f59ba9456b40302ef9a028a5e791a00c2c7d07
4
+ data.tar.gz: cb29906d32001f5eecf0b7f78e161cf86436b11cec67377a9efacd2ecf63a469
5
5
  SHA512:
6
- metadata.gz: da22b8fb540c74436f8a594500a8be39a6f40c5fa449b4354a2499da95b9e67a4557a117a544f11645a67a68178eeb3c3b1c54c52eedea4767a43a78f60ce924
7
- data.tar.gz: 226b261c12350b1b31729bc42631c7e4ba4f62d6d69de13da218e4daa11c81fdf362082eeb3ab2f7d795f19013609a7fd17dfc21d6cc44cd329c37db04542a45
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
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
+
6
+
data/Gemfile.lock CHANGED
@@ -1,54 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- carioca (1.0)
5
- dorsal
6
- methodic
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: http://rubygems.org/
12
+ remote: https://rubygems.org/
10
13
  specs:
11
- code_statistics (0.2.13)
12
- daemons (1.1.9)
13
- diff-lcs (1.2.1)
14
- dorsal (1.0)
15
- daemons
16
- macaddr (1.6.1)
17
- systemu (~> 2.5.0)
18
- methodic (1.2)
19
- rdoc (4.0.0)
20
- roodi (2.2.0)
21
- ruby_parser (~> 2.3.0)
22
- rspec (2.13.0)
23
- rspec-core (~> 2.13.0)
24
- rspec-expectations (~> 2.13.0)
25
- rspec-mocks (~> 2.13.0)
26
- rspec-core (2.13.1)
27
- rspec-expectations (2.13.0)
28
- diff-lcs (>= 1.1.3, < 2.0)
29
- rspec-mocks (2.13.0)
30
- ruby_parser (2.3.1)
31
- sexp_processor (~> 3.0)
32
- sexp_processor (3.2.0)
33
- systemu (2.5.2)
34
- uuid (2.3.7)
35
- macaddr (~> 1.0)
36
- yard (0.8.5.2)
37
- yard-rspec (0.1)
38
- yard
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
- code_statistics
46
- rdoc
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
- 1.10.3
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
- [![Build Status](https://travis-ci.org/lecid/carioca.png?branch=master)](https://travis-ci.org/lecid/carioca)
18
-
19
-
20
3
  ## Installation
21
4
 
22
- In a valid Ruby environment :
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
- Edit your myapp.gemspec, add this line in Gem::Specification bloc :
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
- so, execute bundle :
12
+ ### Basic usage
65
13
 
66
- ```
67
- $ bundle
68
- ```
14
+ Create you own gem :
69
15
 
70
- Your environment, is ready to create your app
16
+ $ bundle gem yourgem
17
+ $ cd yourgem
18
+ $ vi yourgem.gemspec
71
19
 
72
- #### Prepare Carioca
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
- require 'rubygems'
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
- $ ruby -e 'require "rubygems"; require "carioca"; reg = Carioca::Services::Registry.init :file => "config/myservices.registry"; reg.discover_builtins; reg.save!'
94
- ```
95
-
25
+ and after :
96
26
 
97
- this create you, a New Registry config, with all builtins registered.
98
- Default path :
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
- Now you could continue coding your bin/myapp
104
-
105
- #### Using Configuration Service
30
+ Edit the Rakefil, and add the following line :
106
31
 
107
32
  ```ruby
108
- require 'rubygems'
109
- require 'carioca'
110
-
111
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
112
- config = registry.start_service :name => 'configuration'
113
- config.setings.db = { :name => 'mydb' }
114
- config.settings.db.host = "myhost"
115
- config.settings.db.port = "4545"
116
- config.settings.email = "my@email.com"
117
- config.save!
118
- ```
119
-
120
- #### Using Logger Service
121
-
122
- logger is automatically loaded with Carioca, loading registry with :debug => true, let you see the Carioca traces.
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
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
129
- log = registry.get_service :name => 'logger'
130
- log.info('myapp') {'my message' }
131
- ```
89
+ # frozen_string_literal: true
132
90
 
133
- #### Creating and using your own service
91
+ require_relative "yourgem/version"
92
+ require 'carioca'
134
93
 
135
- before create your own service :
136
94
 
137
- ```
138
- $ mkdir services
139
- ```
95
+ Carioca::Registry.configure do |spec|
96
+ spec.debug = true
97
+ end
140
98
 
141
- Services, must be a class, if not do a wrapper
142
- edit services/myservice.rb
99
+ module Yourgem
100
+ class Error < StandardError; end
143
101
 
144
- ```ruby
145
- class MyService
146
- def initialize
147
- end
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
- You could use the #service_register API (See spec for all details)
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
- ```yaml
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
- So in your app :
112
+ end
170
113
 
171
- ```ruby
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
- #### Using Debug in multiple service instance
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
- require 'rubygems'
188
- require 'carioca'
123
+ require 'yourgem'
189
124
 
190
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
191
- proxy1 = registry.get_service :name => 'debug_myservice', :params => {:service => 'myservice'}
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
- see the log /tmp/log.file :
197
-
198
- ```
199
- D, [2013-03-23T18:20:39.839826 #76641] DEBUG -- ProxyDebug: BEGIN CALL for mapped service myservice
200
- D, [2013-03-23T18:20:39.839875 #76641] DEBUG -- ProxyDebug: called: test
201
- D, [2013-03-23T18:20:39.839920 #76641] DEBUG -- ProxyDebug: args : titi
202
- D, [2013-03-23T18:20:39.839970 #76641] DEBUG -- ProxyDebug: => returned: OK
203
- D, [2013-03-23T18:20:39.840014 #76641] DEBUG -- ProxyDebug: END CALL
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
- #### Using Gem for a service
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
- add to your YAML config config/myservices.registry :
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
- == Copyright
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
- <pre>carioca (c) 2012-2013 Romain GEORGES <romain@ultragreen.net> for Ultragreen Software </pre>
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
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
- require 'rspec'
4
- require 'rake'
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
- CLEAN.include('*.tmp','*.old')
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__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here