boothby 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a50187c4df9bbd138400be332c4da6063d6c6d5dd636f20b8795859034aa968
4
- data.tar.gz: efb1401d2c069b1871a74db81b990eeeeb0f420d535f2cf2dd7031daf0a3590d
3
+ metadata.gz: ab4d5adf41bd16b9fbefb2091be928bd6f09a4b5bd4d7b886aefb9b84c6fed2a
4
+ data.tar.gz: dbe0aa90902fc3d2864ba681b9071235d4ca0ddb7b1e1b3e675c52af1f1555e1
5
5
  SHA512:
6
- metadata.gz: 6f65e00cc1fdbcb89ac69c6269573c1452588699adcb38b6a3276baca450cdd4fa021491b9acff3b4ba887bf05b9b92dde85550da1c9c1661d7a2677446de590
7
- data.tar.gz: ac9a4a2c967c14f9fdc486e95e9f181f3b4c980f8e5c315edbf6e6c358bfc226242513995d0aaf68dd4bc8a0c3e2f2612a099762f068a33f6d238b877d351cec
6
+ metadata.gz: 8591557fc5b0753e69baee1c73e5a3a915834f7b11c65a578823afdc635e9ddc8ed7c9e2b67fd66405a28a87bcfb6f00660f43438328aec1beff2bfae71ffdf0
7
+ data.tar.gz: 33cf11e463191d02c54dede3dd1aab8e5a114ab7b34fe6c5d7a9d98fd9247bd7b9f1055c7eb762d3ea1b625877b626ce4cf38f2641e9120f1868727ec71df544
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.1
data/Gemfile CHANGED
@@ -5,10 +5,3 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in boothby.gemspec
6
6
  gemspec
7
7
 
8
- gem 'pg'
9
-
10
- gem 'rake'
11
- gem 'rspec'
12
- gem 'rubocop'
13
- gem 'rubocop-performance'
14
- gem 'rubocop-rspec'
data/Gemfile.lock CHANGED
@@ -1,77 +1,78 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boothby (0.1.0)
5
- pastel
4
+ Boothby (0.1.2)
5
+ pastel (~> 0.8)
6
6
  rails (>= 5.2)
7
- thor
8
- tty-command
9
- tty-spinner
7
+ rake (~> 13.0)
8
+ thor (~> 1.2)
9
+ tty-command (~> 0.10)
10
+ tty-spinner (~> 0.9)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
14
- actioncable (7.0.2.4)
15
- actionpack (= 7.0.2.4)
16
- activesupport (= 7.0.2.4)
15
+ actioncable (7.0.3.1)
16
+ actionpack (= 7.0.3.1)
17
+ activesupport (= 7.0.3.1)
17
18
  nio4r (~> 2.0)
18
19
  websocket-driver (>= 0.6.1)
19
- actionmailbox (7.0.2.4)
20
- actionpack (= 7.0.2.4)
21
- activejob (= 7.0.2.4)
22
- activerecord (= 7.0.2.4)
23
- activestorage (= 7.0.2.4)
24
- activesupport (= 7.0.2.4)
20
+ actionmailbox (7.0.3.1)
21
+ actionpack (= 7.0.3.1)
22
+ activejob (= 7.0.3.1)
23
+ activerecord (= 7.0.3.1)
24
+ activestorage (= 7.0.3.1)
25
+ activesupport (= 7.0.3.1)
25
26
  mail (>= 2.7.1)
26
27
  net-imap
27
28
  net-pop
28
29
  net-smtp
29
- actionmailer (7.0.2.4)
30
- actionpack (= 7.0.2.4)
31
- actionview (= 7.0.2.4)
32
- activejob (= 7.0.2.4)
33
- activesupport (= 7.0.2.4)
30
+ actionmailer (7.0.3.1)
31
+ actionpack (= 7.0.3.1)
32
+ actionview (= 7.0.3.1)
33
+ activejob (= 7.0.3.1)
34
+ activesupport (= 7.0.3.1)
34
35
  mail (~> 2.5, >= 2.5.4)
35
36
  net-imap
36
37
  net-pop
37
38
  net-smtp
38
39
  rails-dom-testing (~> 2.0)
39
- actionpack (7.0.2.4)
40
- actionview (= 7.0.2.4)
41
- activesupport (= 7.0.2.4)
40
+ actionpack (7.0.3.1)
41
+ actionview (= 7.0.3.1)
42
+ activesupport (= 7.0.3.1)
42
43
  rack (~> 2.0, >= 2.2.0)
43
44
  rack-test (>= 0.6.3)
44
45
  rails-dom-testing (~> 2.0)
45
46
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
46
- actiontext (7.0.2.4)
47
- actionpack (= 7.0.2.4)
48
- activerecord (= 7.0.2.4)
49
- activestorage (= 7.0.2.4)
50
- activesupport (= 7.0.2.4)
47
+ actiontext (7.0.3.1)
48
+ actionpack (= 7.0.3.1)
49
+ activerecord (= 7.0.3.1)
50
+ activestorage (= 7.0.3.1)
51
+ activesupport (= 7.0.3.1)
51
52
  globalid (>= 0.6.0)
52
53
  nokogiri (>= 1.8.5)
53
- actionview (7.0.2.4)
54
- activesupport (= 7.0.2.4)
54
+ actionview (7.0.3.1)
55
+ activesupport (= 7.0.3.1)
55
56
  builder (~> 3.1)
56
57
  erubi (~> 1.4)
57
58
  rails-dom-testing (~> 2.0)
58
59
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
59
- activejob (7.0.2.4)
60
- activesupport (= 7.0.2.4)
60
+ activejob (7.0.3.1)
61
+ activesupport (= 7.0.3.1)
61
62
  globalid (>= 0.3.6)
62
- activemodel (7.0.2.4)
63
- activesupport (= 7.0.2.4)
64
- activerecord (7.0.2.4)
65
- activemodel (= 7.0.2.4)
66
- activesupport (= 7.0.2.4)
67
- activestorage (7.0.2.4)
68
- actionpack (= 7.0.2.4)
69
- activejob (= 7.0.2.4)
70
- activerecord (= 7.0.2.4)
71
- activesupport (= 7.0.2.4)
63
+ activemodel (7.0.3.1)
64
+ activesupport (= 7.0.3.1)
65
+ activerecord (7.0.3.1)
66
+ activemodel (= 7.0.3.1)
67
+ activesupport (= 7.0.3.1)
68
+ activestorage (7.0.3.1)
69
+ actionpack (= 7.0.3.1)
70
+ activejob (= 7.0.3.1)
71
+ activerecord (= 7.0.3.1)
72
+ activesupport (= 7.0.3.1)
72
73
  marcel (~> 1.0)
73
74
  mini_mime (>= 1.1.0)
74
- activesupport (7.0.2.4)
75
+ activesupport (7.0.3.1)
75
76
  concurrent-ruby (~> 1.0, >= 1.0.2)
76
77
  i18n (>= 1.6, < 2)
77
78
  minitest (>= 5.1)
@@ -86,9 +87,9 @@ GEM
86
87
  erubi (1.10.0)
87
88
  globalid (1.0.0)
88
89
  activesupport (>= 5.0)
89
- i18n (1.10.0)
90
+ i18n (1.12.0)
90
91
  concurrent-ruby (~> 1.0)
91
- loofah (2.17.0)
92
+ loofah (2.18.0)
92
93
  crass (~> 1.0.2)
93
94
  nokogiri (>= 1.5.9)
94
95
  mail (2.7.1)
@@ -96,7 +97,7 @@ GEM
96
97
  marcel (1.0.2)
97
98
  method_source (1.0.0)
98
99
  mini_mime (1.1.2)
99
- minitest (5.15.0)
100
+ minitest (5.16.2)
100
101
  net-imap (0.2.3)
101
102
  digest
102
103
  net-protocol
@@ -112,50 +113,49 @@ GEM
112
113
  net-protocol
113
114
  timeout
114
115
  nio4r (2.5.8)
115
- nokogiri (1.13.4-x86_64-darwin)
116
+ nokogiri (1.13.7-x86_64-darwin)
116
117
  racc (~> 1.4)
117
118
  parallel (1.22.1)
118
- parser (3.1.1.0)
119
+ parser (3.1.2.0)
119
120
  ast (~> 2.4.1)
120
121
  pastel (0.8.0)
121
122
  tty-color (~> 0.5)
122
- pg (1.3.5)
123
123
  pry (0.14.1)
124
124
  coderay (~> 1.1)
125
125
  method_source (~> 1.0)
126
126
  racc (1.6.0)
127
- rack (2.2.3)
128
- rack-test (1.1.0)
129
- rack (>= 1.0, < 3)
130
- rails (7.0.2.4)
131
- actioncable (= 7.0.2.4)
132
- actionmailbox (= 7.0.2.4)
133
- actionmailer (= 7.0.2.4)
134
- actionpack (= 7.0.2.4)
135
- actiontext (= 7.0.2.4)
136
- actionview (= 7.0.2.4)
137
- activejob (= 7.0.2.4)
138
- activemodel (= 7.0.2.4)
139
- activerecord (= 7.0.2.4)
140
- activestorage (= 7.0.2.4)
141
- activesupport (= 7.0.2.4)
127
+ rack (2.2.4)
128
+ rack-test (2.0.2)
129
+ rack (>= 1.3)
130
+ rails (7.0.3.1)
131
+ actioncable (= 7.0.3.1)
132
+ actionmailbox (= 7.0.3.1)
133
+ actionmailer (= 7.0.3.1)
134
+ actionpack (= 7.0.3.1)
135
+ actiontext (= 7.0.3.1)
136
+ actionview (= 7.0.3.1)
137
+ activejob (= 7.0.3.1)
138
+ activemodel (= 7.0.3.1)
139
+ activerecord (= 7.0.3.1)
140
+ activestorage (= 7.0.3.1)
141
+ activesupport (= 7.0.3.1)
142
142
  bundler (>= 1.15.0)
143
- railties (= 7.0.2.4)
143
+ railties (= 7.0.3.1)
144
144
  rails-dom-testing (2.0.3)
145
145
  activesupport (>= 4.2.0)
146
146
  nokogiri (>= 1.6)
147
- rails-html-sanitizer (1.4.2)
147
+ rails-html-sanitizer (1.4.3)
148
148
  loofah (~> 2.3)
149
- railties (7.0.2.4)
150
- actionpack (= 7.0.2.4)
151
- activesupport (= 7.0.2.4)
149
+ railties (7.0.3.1)
150
+ actionpack (= 7.0.3.1)
151
+ activesupport (= 7.0.3.1)
152
152
  method_source
153
153
  rake (>= 12.2)
154
154
  thor (~> 1.0)
155
155
  zeitwerk (~> 2.5)
156
156
  rainbow (3.1.1)
157
157
  rake (13.0.6)
158
- regexp_parser (2.2.1)
158
+ regexp_parser (2.5.0)
159
159
  rexml (3.2.5)
160
160
  rspec (3.11.0)
161
161
  rspec-core (~> 3.11.0)
@@ -170,26 +170,26 @@ GEM
170
170
  diff-lcs (>= 1.2.0, < 2.0)
171
171
  rspec-support (~> 3.11.0)
172
172
  rspec-support (3.11.0)
173
- rubocop (1.26.1)
173
+ rubocop (1.30.0)
174
174
  parallel (~> 1.10)
175
175
  parser (>= 3.1.0.0)
176
176
  rainbow (>= 2.2.2, < 4.0)
177
177
  regexp_parser (>= 1.8, < 3.0)
178
- rexml
179
- rubocop-ast (>= 1.16.0, < 2.0)
178
+ rexml (>= 3.2.5, < 4.0)
179
+ rubocop-ast (>= 1.18.0, < 2.0)
180
180
  ruby-progressbar (~> 1.7)
181
181
  unicode-display_width (>= 1.4.0, < 3.0)
182
- rubocop-ast (1.16.0)
182
+ rubocop-ast (1.18.0)
183
183
  parser (>= 3.1.1.0)
184
- rubocop-performance (1.13.3)
184
+ rubocop-performance (1.14.0)
185
185
  rubocop (>= 1.7.0, < 2.0)
186
186
  rubocop-ast (>= 0.4.0)
187
- rubocop-rspec (2.9.0)
187
+ rubocop-rspec (2.11.1)
188
188
  rubocop (~> 1.19)
189
189
  ruby-progressbar (1.11.0)
190
- strscan (3.0.1)
190
+ strscan (3.0.3)
191
191
  thor (1.2.1)
192
- timeout (0.2.0)
192
+ timeout (0.3.0)
193
193
  tty-color (0.6.0)
194
194
  tty-command (0.10.1)
195
195
  pastel (~> 0.8)
@@ -202,20 +202,18 @@ GEM
202
202
  websocket-driver (0.7.5)
203
203
  websocket-extensions (>= 0.1.0)
204
204
  websocket-extensions (0.1.5)
205
- zeitwerk (2.5.4)
205
+ zeitwerk (2.6.0)
206
206
 
207
207
  PLATFORMS
208
- x86_64-darwin-20
208
+ ruby
209
209
 
210
210
  DEPENDENCIES
211
- boothby!
212
- pg
213
- pry
214
- rake
215
- rspec
216
- rubocop
217
- rubocop-performance
218
- rubocop-rspec
211
+ Boothby!
212
+ pry (~> 0.14)
213
+ rspec (~> 3.11)
214
+ rubocop (~> 1.28)
215
+ rubocop-performance (~> 1.13)
216
+ rubocop-rspec (~> 2.10)
219
217
 
220
218
  BUNDLED WITH
221
- 2.3.9
219
+ 2.3.12
data/README.md CHANGED
@@ -1,37 +1,75 @@
1
1
  # Boothby
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/boothby`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A Rails application lifecycle manager. Boothby provides CLI commands to standardize common development tasks across a team: setting up a fresh clone, updating after pulling new code, and seeding the database.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Named after [Boothby](https://memory-alpha.fandom.com/wiki/Boothby), the groundskeeper of Starfleet Academy.
6
+
7
+ > **Archived.** This gem is no longer maintained.
6
8
 
7
9
  ## Installation
8
10
 
9
- Install the gem and add to the application's Gemfile by executing:
11
+ Add to your application's Gemfile:
10
12
 
11
- $ bundle add boothby
13
+ ```ruby
14
+ gem 'boothby'
15
+ ```
12
16
 
13
- If bundler is not being used to manage dependencies, install the gem by executing:
17
+ ## Usage
14
18
 
15
- $ gem install boothby
19
+ ### `boothby setup`
16
20
 
17
- ## Usage
21
+ Run once after cloning the repo:
22
+
23
+ ```sh
24
+ $ boothby setup
25
+ ```
26
+
27
+ - Copies any `*.example` config files that don't already have a real counterpart
28
+ - Runs `bundle install` and `yarn install` (if `package.json` exists)
29
+ - Runs `rails db:prepare db:test:prepare`
30
+ - Clears logs and tmp files
31
+ - Restarts the application server
32
+
33
+ ### `boothby update`
34
+
35
+ Run after pulling new code:
36
+
37
+ ```sh
38
+ $ boothby update
39
+ ```
40
+
41
+ Same as `setup` but runs `db:migrate` instead of `db:prepare`.
42
+
43
+ ### `boothby seed`
18
44
 
19
- TODO: Write usage instructions here
45
+ Seeds the database using a structured `db/seeds.yml` config:
20
46
 
21
- ## Development
47
+ ```sh
48
+ $ boothby seed
49
+ ```
22
50
 
23
- 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.
51
+ Seeds are organized by environment. A `:base` set runs for all environments; additional sets run only for the matching Rails environment. Progress is shown via animated terminal spinners.
24
52
 
25
- 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).
53
+ ### `Boothby::KeyRing`
26
54
 
27
- ## Contributing
55
+ Auto-loads all YAML files from `config/` and exposes them as methods with environment-aware access and dot notation:
28
56
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/boothby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/boothby/blob/main/CODE_OF_CONDUCT.md).
57
+ ```ruby
58
+ Boothby::KeyRing.database # reads config/database.yml
59
+ Boothby::KeyRing.application # reads config/application.yml
60
+ ```
30
61
 
31
- ## Code of Conduct
62
+ ## Configuration
32
63
 
33
- Everyone interacting in the Boothby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/boothby/blob/main/CODE_OF_CONDUCT.md).
64
+ ```ruby
65
+ # config/initializers/boothby.rb
66
+ Boothby.configure do |config|
67
+ config.root = Rails.root
68
+ config.seeds_configuration = 'db/seeds.yml'
69
+ config.configuration_directory = 'config'
70
+ end
71
+ ```
34
72
 
35
- ## Copyright
73
+ ## License
36
74
 
37
- Copyright (c) 2022 Christopher Hagmann. See [MIT License](LICENSE.txt) for further details.
75
+ Copyright (c) 2022 Christopher Hagmann. See [MIT License](LICENSE.txt) for further details.
data/docs/index.md CHANGED
@@ -1,37 +1,7 @@
1
- ## Welcome to GitHub Pages
1
+ # Boothby
2
2
 
3
- You can use the [editor on GitHub](https://github.com/cdhagmann/boothby/edit/main/docs/index.md) to maintain and preview the content for your website in Markdown files.
3
+ A Rails application lifecycle manager. Named after [Boothby](https://memory-alpha.fandom.com/wiki/Boothby), the groundskeeper of Starfleet Academy.
4
4
 
5
- Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
5
+ > **Archived.** This gem is no longer maintained.
6
6
 
7
- ### Markdown
8
-
9
- Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
10
-
11
- ```markdown
12
- Syntax highlighted code block
13
-
14
- # Header 1
15
- ## Header 2
16
- ### Header 3
17
-
18
- - Bulleted
19
- - List
20
-
21
- 1. Numbered
22
- 2. List
23
-
24
- **Bold** and _Italic_ and `Code` text
25
-
26
- [Link](url) and ![Image](src)
27
- ```
28
-
29
- For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
30
-
31
- ### Jekyll Themes
32
-
33
- Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/cdhagmann/boothby/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
34
-
35
- ### Support or Contact
36
-
37
- Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out.
7
+ See the [README](https://github.com/cdhagmann/Boothby#readme) for full documentation.
data/lib/boothby/base.rb CHANGED
@@ -1,6 +1,12 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  module Boothby
3
- class base
4
+ class Base
5
+ include Boothby::Configuration
4
6
 
7
+ def self.root(*args)
8
+ @root ||= File.expand_path('../..', __dir__)
9
+ File.join(@root, *args)
10
+ end
5
11
  end
6
12
  end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boothby
4
+ # Specialize hash to allow ease of access for configuration values
5
+ class ConfigurationData
6
+ DEFAULT = 'EMPTY' # Default is to raise KeyError if key does not exist
7
+ ENVIRONMENT = Rails.env.freeze
8
+
9
+ def self.from_yaml(filename, **options)
10
+ file_path = Rails.root.join(filename)
11
+ return unless File.file?(file_path)
12
+
13
+ content = File.read(file_path)
14
+ content = ERB.new(content).result
15
+ yml = YAML.safe_load(content, [Time, Date], aliases: true)
16
+ new(yml, **options)
17
+ end
18
+
19
+ def initialize(hash, **options)
20
+ @options = options.reverse_merge(
21
+ environment: ENVIRONMENT,
22
+ default: DEFAULT
23
+ )
24
+
25
+ @hash = add_dot_access(hash.with_indifferent_access)
26
+ end
27
+
28
+ def config(first_key = nil, **options)
29
+ return @hash if first_key.blank?
30
+
31
+ opts = @options.merge(**options)
32
+ @hash.key?(first_key) ? @hash : @hash.fetch(opts[:environment], @hash)
33
+ end
34
+
35
+ def dig(*keys, **options)
36
+ hash = config(keys.first, **options)
37
+
38
+ while hash.respond_to?(:fetch) && (key = keys.shift)
39
+ hash = hash.fetch(key, nil)
40
+ end
41
+
42
+ keys.empty? ? hash : nil
43
+ end
44
+
45
+ def dig!(*keys, **options)
46
+ hash = config(keys.first, **options)
47
+
48
+ while hash.respond_to?(:fetch) && (key = keys.shift)
49
+ hash = hash.fetch(key, nil)
50
+ end
51
+
52
+ keys.empty? ? hash : raise(KeyError)
53
+ end
54
+
55
+ def [](key)
56
+ dig(key)
57
+ end
58
+
59
+ def []=(key, value)
60
+ config_hash = @hash.fetch(@options[:environment], @hash)
61
+ config_hash[key] = value
62
+ define_singleton_method(key) { value }
63
+ config_hash.define_singleton_method(key) { value }
64
+ end
65
+
66
+ def fetch(key, **options)
67
+ opts = @options.merge(**options)
68
+ hash = config(key, **opts)
69
+
70
+ if opts[:default] == DEFAULT
71
+ hash.fetch(key)
72
+ else
73
+ hash.fetch(key, opts[:default])
74
+ end
75
+ end
76
+
77
+ def key?(key, **options)
78
+ opts = @options.merge(**options)
79
+ hash = config(key, **opts)
80
+ hash.key?(key)
81
+ end
82
+
83
+ def add_dot_access(hash)
84
+ allow_dot_access(hash, base_level: true)
85
+ config_hash = hash.fetch(@options[:environment], hash)
86
+ allow_dot_access(config_hash, base_level: true) if config_hash != hash
87
+ hash
88
+ end
89
+
90
+ def allow_dot_access(hash, base_level: true)
91
+ hash.each do |key, value|
92
+ hash.define_singleton_method(key) { value }
93
+ define_singleton_method(key) { value } if base_level
94
+ allow_dot_access(value, base_level: false) if value.is_a?(Hash)
95
+ end
96
+ end
97
+ end
98
+ end
@@ -12,7 +12,7 @@ module Boothby
12
12
  config_files = Dir[Rails.root.join('config/*.y{a,}ml{.erb,}')]
13
13
  @configs = config_files.to_h do |config|
14
14
  config_name = File.basename(config).split('.').first.to_sym
15
- [config_name, Boothby::YAMLReader.new(config)]
15
+ [config_name, Boothby::ConfigurationData.from_yaml(config)]
16
16
  end
17
17
  end
18
18
 
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boothby
4
+ class Root
5
+ include Boothby::Configuration
6
+
7
+ def self.join(*args)
8
+ @root ||= File.expand_path('../..', __dir__)
9
+ File.join(@root, *args)
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boothby
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'root'
4
+
3
5
  module Boothby
4
6
  # Read YAML files
5
- class YAMLReader
7
+ class YAMLReader << Boothby::Base
6
8
  attr_reader :filename
7
9
 
8
10
  def initialize(name)
@@ -14,14 +16,20 @@ module Boothby
14
16
  full_config[environment].dig(*attributes) || full_config.dig(*attributes)
15
17
  end
16
18
 
19
+ def key?(key_name)
20
+ !get(key_name).nil?
21
+ end
22
+
17
23
  def method_missing(method_name, *args, **kwargs, &block)
18
- env = kwargs.delete(:environment) || kwargs.delete(:env)
19
- return get(method_name, environment: env) unless env.nil?
24
+ return super unless key?(method_name)
20
25
 
21
- cfg = full_config.fetch(method_name, nil)
22
- return (args.empty? ? cfg : cfg.dig(*args)) unless cfg.nil?
26
+ environment = kwargs.delete(:environment) || kwargs.delete(:env)
27
+ attributes = [method_name] + args
28
+ get(*attributes, environment: environment)
29
+ end
23
30
 
24
- get(method_name) || super
31
+ def respond_to_missing?(method_name)
32
+ return super unless key?(method_name)
25
33
  end
26
34
 
27
35
  private def full_config
@@ -65,7 +73,7 @@ module Boothby
65
73
  end
66
74
 
67
75
  private def absolute_path?(file)
68
- file.start_with?(Rails.root.to_s)
76
+ file.start_with?(Boothby::Root.root.to_s)
69
77
  end
70
78
 
71
79
  private def find_file(prefix)
metadata CHANGED
@@ -1,114 +1,170 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boothby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Hagmann
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-05-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: thor
13
+ name: pastel
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
18
+ version: '0.8'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ">="
23
+ - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0'
25
+ version: '0.8'
27
26
  - !ruby/object:Gem::Dependency
28
- name: pastel
27
+ name: rails
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: '0'
32
+ version: '5.2'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: '0'
39
+ version: '5.2'
41
40
  - !ruby/object:Gem::Dependency
42
- name: tty-spinner
41
+ name: rake
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - ">="
44
+ - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '0'
46
+ version: '13.0'
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
- - - ">="
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: thor
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.2'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
53
66
  - !ruby/object:Gem::Version
54
- version: '0'
67
+ version: '1.2'
55
68
  - !ruby/object:Gem::Dependency
56
69
  name: tty-command
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
- - - ">="
72
+ - - "~>"
60
73
  - !ruby/object:Gem::Version
61
- version: '0'
74
+ version: '0.10'
62
75
  type: :runtime
63
76
  prerelease: false
64
77
  version_requirements: !ruby/object:Gem::Requirement
65
78
  requirements:
66
- - - ">="
79
+ - - "~>"
67
80
  - !ruby/object:Gem::Version
68
- version: '0'
81
+ version: '0.10'
69
82
  - !ruby/object:Gem::Dependency
70
- name: rails
83
+ name: tty-spinner
71
84
  requirement: !ruby/object:Gem::Requirement
72
85
  requirements:
73
- - - ">="
86
+ - - "~>"
74
87
  - !ruby/object:Gem::Version
75
- version: '5.2'
88
+ version: '0.9'
76
89
  type: :runtime
77
90
  prerelease: false
78
91
  version_requirements: !ruby/object:Gem::Requirement
79
92
  requirements:
80
- - - ">="
93
+ - - "~>"
81
94
  - !ruby/object:Gem::Version
82
- version: '5.2'
95
+ version: '0.9'
83
96
  - !ruby/object:Gem::Dependency
84
97
  name: pry
85
98
  requirement: !ruby/object:Gem::Requirement
86
99
  requirements:
87
- - - ">="
100
+ - - "~>"
88
101
  - !ruby/object:Gem::Version
89
- version: '0'
102
+ version: '0.14'
90
103
  type: :development
91
104
  prerelease: false
92
105
  version_requirements: !ruby/object:Gem::Requirement
93
106
  requirements:
94
- - - ">="
107
+ - - "~>"
95
108
  - !ruby/object:Gem::Version
96
- version: '0'
109
+ version: '0.14'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rspec
99
112
  requirement: !ruby/object:Gem::Requirement
100
113
  requirements:
101
- - - ">="
114
+ - - "~>"
102
115
  - !ruby/object:Gem::Version
103
- version: '0'
116
+ version: '3.11'
104
117
  type: :development
105
118
  prerelease: false
106
119
  version_requirements: !ruby/object:Gem::Requirement
107
120
  requirements:
108
- - - ">="
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '3.11'
124
+ - !ruby/object:Gem::Dependency
125
+ name: rubocop
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.28'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.28'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rubocop-performance
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '1.13'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '1.13'
152
+ - !ruby/object:Gem::Dependency
153
+ name: rubocop-rspec
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '2.10'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
109
164
  - !ruby/object:Gem::Version
110
- version: '0'
111
- description: Groundskeeper to manage your rails application
165
+ version: '2.10'
166
+ description: 'DEPRECATED: This gem is no longer maintained. Groundskeeper to manage
167
+ your rails application.'
112
168
  email:
113
169
  - cdhagmann@gmail.com
114
170
  executables:
@@ -118,13 +174,12 @@ extra_rdoc_files: []
118
174
  files:
119
175
  - ".rspec"
120
176
  - ".rubocop.yml"
177
+ - ".ruby-version"
121
178
  - Gemfile
122
179
  - Gemfile.lock
123
180
  - LICENSE.txt
124
181
  - README.md
125
182
  - Rakefile
126
- - boothby.gemspec
127
- - config/database.yml
128
183
  - config/initializers/boothby.rb
129
184
  - db/seeds.yml
130
185
  - docs/CHANGELOG.md
@@ -140,8 +195,10 @@ files:
140
195
  - lib/boothby/commands/setup.rb
141
196
  - lib/boothby/commands/update.rb
142
197
  - lib/boothby/configuration.rb
198
+ - lib/boothby/configuration_data.rb
143
199
  - lib/boothby/key_ring.rb
144
200
  - lib/boothby/maintenance.rb
201
+ - lib/boothby/root.rb
145
202
  - lib/boothby/seeds.rb
146
203
  - lib/boothby/templates/.gitkeep
147
204
  - lib/boothby/templates/seed/.gitkeep
@@ -149,9 +206,7 @@ files:
149
206
  - lib/boothby/templates/update/.gitkeep
150
207
  - lib/boothby/version.rb
151
208
  - lib/boothby/yaml_reader.rb
152
- - node_modules/.yarn-integrity
153
209
  - sig/boothby.rbs
154
- - yarn.lock
155
210
  homepage: https://cdhagmann.com/Boothby
156
211
  licenses:
157
212
  - MIT
@@ -159,7 +214,7 @@ metadata:
159
214
  homepage_uri: https://cdhagmann.com/Boothby
160
215
  source_code_uri: https://github.com/cdhagmann/Boothby
161
216
  changelog_uri: https://cdhagmann.com/Boothby/CHANGELOG.html
162
- post_install_message:
217
+ rubygems_mfa_required: 'true'
163
218
  rdoc_options: []
164
219
  require_paths:
165
220
  - lib
@@ -174,8 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
229
  - !ruby/object:Gem::Version
175
230
  version: '0'
176
231
  requirements: []
177
- rubygems_version: 3.1.6
178
- signing_key:
232
+ rubygems_version: 4.0.10
179
233
  specification_version: 4
180
- summary: Groundskeeper to manage your rails application
234
+ summary: "[DEPRECATED] Groundskeeper to manage your rails application"
181
235
  test_files: []
data/boothby.gemspec DELETED
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/boothby/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "boothby"
7
- spec.license= "MIT"
8
- spec.version = Boothby::VERSION
9
- spec.authors = ["Christopher Hagmann"]
10
- spec.email = ["cdhagmann@gmail.com"]
11
-
12
- spec.summary = "Groundskeeper to manage your rails application"
13
- spec.description = "Groundskeeper to manage your rails application"
14
- spec.homepage = "https://cdhagmann.com/Boothby"
15
- spec.required_ruby_version = ">= 2.7.0"
16
-
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = "https://github.com/cdhagmann/Boothby"
19
- spec.metadata["changelog_uri"] = "https://cdhagmann.com/Boothby/CHANGELOG.html"
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
- `git ls-files -z`.split("\x0").reject do |f|
25
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
- end
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
31
-
32
- # Uncomment to register a new dependency of your gem
33
- spec.add_dependency "thor"
34
- spec.add_dependency "pastel"
35
- spec.add_dependency "tty-spinner"
36
- spec.add_dependency "tty-command"
37
- spec.add_dependency "rails", ">= 5.2"
38
-
39
- spec.add_development_dependency 'pry'
40
- spec.add_development_dependency "rspec"
41
-
42
- # For more information and examples about making a new gem, check out our
43
- # guide at: https://bundler.io/guides/creating_gem.html
44
- end
data/config/database.yml DELETED
@@ -1,12 +0,0 @@
1
- default: &default
2
- adapter: postgresql
3
- pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
4
- timeout: 5000
5
-
6
- development:
7
- <<: *default
8
- database: boothby_development
9
-
10
- test:
11
- <<: *default
12
- database: boothby_test
@@ -1,10 +0,0 @@
1
- {
2
- "systemParams": "darwin-x64-83",
3
- "modulesFolders": [],
4
- "flags": [],
5
- "linkedModules": [],
6
- "topLevelPatterns": [],
7
- "lockfileEntries": {},
8
- "files": [],
9
- "artifacts": {}
10
- }
data/yarn.lock DELETED
@@ -1,4 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-