rbcli 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +13 -8
  5. data/Rakefile +5 -5
  6. data/bin/console +3 -3
  7. data/docs-src/docs/development/contributing.md +24 -0
  8. data/docs-src/docs/imported/changelog.md +23 -0
  9. data/docs-src/docs/imported/quick_reference.md +1 -0
  10. data/docs/development/contributing/index.html +15 -0
  11. data/docs/imported/changelog/index.html +120 -18
  12. data/docs/search/search_index.json +38 -8
  13. data/docs/sitemap.xml +19 -19
  14. data/lib/rbcli.rb +3 -22
  15. data/lib/rbcli/configuration/configurate.rb +49 -98
  16. data/lib/rbcli/{stateful_systems/configuratestorage.rb → configuration/configurate_blocks/hooks.rb} +23 -15
  17. data/lib/rbcli/configuration/configurate_blocks/me.rb +122 -0
  18. data/lib/rbcli/configuration/configurate_blocks/storage.rb +50 -0
  19. data/lib/rbcli/engine/command.rb +59 -60
  20. data/lib/rbcli/engine/parser.rb +17 -10
  21. data/lib/rbcli/{autoupdate → features/autoupdate/common}/autoupdate.rb +2 -20
  22. data/lib/rbcli/{autoupdate → features/autoupdate}/gem_updater.rb +1 -0
  23. data/lib/rbcli/{autoupdate → features/autoupdate}/github_updater.rb +1 -0
  24. data/lib/rbcli/{logging → features}/logging.rb +19 -18
  25. data/lib/rbcli/{remote_exec → features}/remote_exec.rb +0 -0
  26. data/lib/rbcli/{scriptwrapping → features}/scriptwrapper.rb +0 -29
  27. data/lib/rbcli/{configuration/config.rb → features/userconfig.rb} +0 -0
  28. data/lib/rbcli/{stateful_systems → state_storage/common}/state_storage.rb +0 -0
  29. data/lib/rbcli/{stateful_systems/storagetypes → state_storage}/localstate.rb +2 -10
  30. data/lib/rbcli/{stateful_systems/storagetypes → state_storage}/remote_state_connectors/dynamodb.rb +0 -0
  31. data/lib/rbcli/{stateful_systems/storagetypes → state_storage}/remotestate_dynamodb.rb +6 -20
  32. data/lib/rbcli/util/deprecation_warning.rb +43 -0
  33. data/lib/rbcli/version.rb +1 -1
  34. data/rbcli.gemspec +1 -1
  35. data/skeletons/micro/executable +5 -1
  36. data/skeletons/mini/executable +8 -8
  37. data/skeletons/project/Rakefile +2 -2
  38. data/skeletons/project/hooks/default_action.rb +1 -1
  39. data/skeletons/project/hooks/first_run.rb +1 -1
  40. data/skeletons/project/hooks/post_execution.rb +1 -1
  41. data/skeletons/project/hooks/pre_execution.rb +1 -1
  42. data/skeletons/project/spec/spec_helper.rb +2 -2
  43. metadata +17 -14
@@ -462,7 +462,7 @@
462
462
  },
463
463
  {
464
464
  "location": "/development/contributing/",
465
- "text": "Contribution Guide\n\n\nContributing to RBCli is the same as most open source projects:\n\n\n\n\nFork the repository\n\n\nCreate your own branch\n\n\nSubmit a pull request when ready\n\n\n\n\nThat's all there is to it! We've also kept our acceptance criteria pretty simple, as you'll see below. Feel free to submit a pull request even if you don't meet it if you would like your code or feature to be reviewed first; we do want to be mindful of your time and will review submissions before they are polished.\n\n\nCode Acceptance Criteria\n\n\nTabs, Not Spaces\n\n\nPlease, and thanks. We all like to use different indentation levels and styles, and this will keep us consistent between editors.\n\n\nFor filetypes where tabs are not supported (such as YAML), please stick to using two (2) spaces.\n\n\nDocumentation for User Features\n\n\nFor any modification that alters the way RBCli is used -- we're talking additional features, options, keyword changes, major behavioral changes, and the like -- the documentation will need to be updated as well. You'll be happy to know we designed it to make the process relatively painless.\n\n\nRBCli's documentation is essentially a collection of markdown files that have been compiled into a static site using \nMkDocs\n. If you already have python and pip on your system, you can install it by running:\n\n\npip install mkdocs mkdocs-material\n\n\n\n\nYou can find the source markdown files in the \ndocs-src/docs\n folder, and the menu organization in \ndocs-src/mkdocs.yml\n. To preview your changes on a live site, run:\n\n\nmkdocs serve\n\n\n\n\nAlso, don't forget to update the \nQuick Reference Guide\n in the \nREADME.md\n file (the main project one) with information about your changes.\n\n\nOnce you've completed your edits, run the \nmakesite.sh\n command to build the actual HTML pages automatically in the \ndocs\n folder, from where they will be served when live.\n\n\nMaintainer's Notes\n\n\nTo install this gem onto your local machine from source, run \nbundle exec rake install\n.\n\n\nTo release a new version, follow theese steps:\n\n\n\n\nUpdate the version number in \nversion.rb\n\n\nRun \nbundle exec rake install\n, which will update \ngemfile.lock\n with the correct version and all dependency changes\n\n\nRun \ndocs-src/makesite.sh\n, which re-compiles the documentation and pulls in the changelog and quick reference automatically\n\n\nCommit the above changes to master with a commit message of \"vX.X.X\" (where X.X.X is the version number), but do not push\n\n\nRun \nbundle exec rake release\n, which will create a git tag for the version, push git commits and tags, and push the \n.gem\n file to \nrubygems.org\n.",
465
+ "text": "Contribution Guide\n\n\nContributing to RBCli is the same as most open source projects:\n\n\n\n\nFork the repository\n\n\nCreate your own branch\n\n\nSubmit a pull request when ready\n\n\n\n\nThat's all there is to it! We've also kept our acceptance criteria pretty simple, as you'll see below. Feel free to submit a pull request even if you don't meet it if you would like your code or feature to be reviewed first; we do want to be mindful of your time and will review submissions before they are polished.\n\n\nCode Acceptance Criteria\n\n\nTabs, Not Spaces\n\n\nPlease, and thanks. We all like to use different indentation levels and styles, and this will keep us consistent between editors.\n\n\nFor filetypes where tabs are not supported (such as YAML), please stick to using two (2) spaces.\n\n\nDocumentation for User Features\n\n\nFor any modification that alters the way RBCli is used -- we're talking additional features, options, keyword changes, major behavioral changes, and the like -- the documentation will need to be updated as well. You'll be happy to know we designed it to make the process relatively painless.\n\n\nRBCli's documentation is essentially a collection of markdown files that have been compiled into a static site using \nMkDocs\n. If you already have python and pip on your system, you can install it by running:\n\n\npip install mkdocs mkdocs-material\n\n\n\n\nYou can find the source markdown files in the \ndocs-src/docs\n folder, and the menu organization in \ndocs-src/mkdocs.yml\n. To preview your changes on a live site, run:\n\n\nmkdocs serve\n\n\n\n\nAlso, don't forget to update the \nQuick Reference Guide\n in the \nREADME.md\n file (the main project one) with information about your changes.\n\n\nOnce you've completed your edits, run the \nmakesite.sh\n command to build the actual HTML pages automatically in the \ndocs\n folder, from where they will be served when live.\n\n\nDeprecations\n\n\nIf a feature needs to be deprecated, RBCli has a built-in deprecation message feature. You can leverage it by calling the following code when a deprecated command is called:\n\n\nRbcli::DeprecationWarning.new deprecated_command, message, version_when_code_will_be_removed\n\n\n\n\nSo, for example:\n\n\nRbcli::DeprecationWarning.new 'Rbcli::Configurate.me--first_run', 'Please use `RBCli::Configurate.hooks` as the parent block instead.', '0.3.0'\n\n\n\n\nwill display the following message to the user, in red, any any time the application is run:\n\n\nDEPRECATION WRNING: The feature `Rbcli::Configurate.me--post_hook` has been deprecated. Please use `RBCli::Configurate.hooks` as the parent block instead. This feature will be removed in version 0.3.0.\n\n\n\n\nAdditionally, it will place the same line in the logs using \nRbcli.logger.warn\n if logging is enabled.\n\n\nIf a deprecation warning has been added, please remember to mention it in the pull request so that others can update it later.\n\n\nMaintainer's Notes\n\n\nTo install this gem onto your local machine from source, run \nbundle exec rake install\n.\n\n\nTo release a new version, follow theese steps:\n\n\n\n\nUpdate the version number in \nversion.rb\n\n\nRun \nbundle exec rake install\n, which will update \ngemfile.lock\n with the correct version and all dependency changes\n\n\nRun \ndocs-src/makesite.sh\n, which re-compiles the documentation and pulls in the changelog and quick reference automatically\n\n\nCommit the above changes to master with a commit message of \"vX.X.X\" (where X.X.X is the version number), but do not push\n\n\nRun \nbundle exec rake release\n, which will create a git tag for the version, push git commits and tags, and push the \n.gem\n file to \nrubygems.org\n.",
466
466
  "title": "Contribution Guide"
467
467
  },
468
468
  {
@@ -485,6 +485,11 @@
485
485
  "text": "For any modification that alters the way RBCli is used -- we're talking additional features, options, keyword changes, major behavioral changes, and the like -- the documentation will need to be updated as well. You'll be happy to know we designed it to make the process relatively painless. RBCli's documentation is essentially a collection of markdown files that have been compiled into a static site using MkDocs . If you already have python and pip on your system, you can install it by running: pip install mkdocs mkdocs-material You can find the source markdown files in the docs-src/docs folder, and the menu organization in docs-src/mkdocs.yml . To preview your changes on a live site, run: mkdocs serve Also, don't forget to update the Quick Reference Guide in the README.md file (the main project one) with information about your changes. Once you've completed your edits, run the makesite.sh command to build the actual HTML pages automatically in the docs folder, from where they will be served when live.",
486
486
  "title": "Documentation for User Features"
487
487
  },
488
+ {
489
+ "location": "/development/contributing/#deprecations",
490
+ "text": "If a feature needs to be deprecated, RBCli has a built-in deprecation message feature. You can leverage it by calling the following code when a deprecated command is called: Rbcli::DeprecationWarning.new deprecated_command, message, version_when_code_will_be_removed So, for example: Rbcli::DeprecationWarning.new 'Rbcli::Configurate.me--first_run', 'Please use `RBCli::Configurate.hooks` as the parent block instead.', '0.3.0' will display the following message to the user, in red, any any time the application is run: DEPRECATION WRNING: The feature `Rbcli::Configurate.me--post_hook` has been deprecated. Please use `RBCli::Configurate.hooks` as the parent block instead. This feature will be removed in version 0.3.0. Additionally, it will place the same line in the logs using Rbcli.logger.warn if logging is enabled. If a deprecation warning has been added, please remember to mention it in the pull request so that others can update it later.",
491
+ "title": "Deprecations"
492
+ },
488
493
  {
489
494
  "location": "/development/contributing/#maintainers-notes",
490
495
  "text": "To install this gem onto your local machine from source, run bundle exec rake install . To release a new version, follow theese steps: Update the version number in version.rb Run bundle exec rake install , which will update gemfile.lock with the correct version and all dependency changes Run docs-src/makesite.sh , which re-compiles the documentation and pulls in the changelog and quick reference automatically Commit the above changes to master with a commit message of \"vX.X.X\" (where X.X.X is the version number), but do not push Run bundle exec rake release , which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org .",
@@ -547,7 +552,7 @@
547
552
  },
548
553
  {
549
554
  "location": "/imported/changelog/",
550
- "text": "Changelog\n\n\n0.2.1 (Aug 8, 2018)\n\n\nFeatures\n\n\n\n\nRemote Execution added for Script and External commands\n\n\n\n\nBugfixes\n\n\n\n\nFixed a bug that caused RBCli to crash if a direct path mode script's environment variables were declared as symbols\n\n\n\n\n0.2.0 (Aug 5, 2018)\n\n\nFeatures\n\n\n\n\nCLI tool Autoupdate Enabled; when an upgrade to RBCli is detected, the RBCli CLI tool will notify the developer.\n\n\nOfficial documentation created and hosted with Github Pages\n\n\nRBCli released under GPLv3\n\n\nCopyright/License notice displayed via RBCli tool with \nrbcli license\n in accordance with GPLv3 guidelines\n\n\n\n\nBugfixes\n\n\n\n\nFixed version number loading for projects\n\n\nCleaned up command usage help output\n\n\nFixed script and external command generation\n\n\n\n\nImprovements\n\n\n\n\nA quick reference guide can now be found in README.md\n\n\nAutoupdate feature now allows supplying a custom message\n\n\nDirect Path Mode for External Commands now\n\n\nAdded support for a \nlib\n folder in projects, as a place for custom code, which is automatically added to \n$LOAD_PATH\n for developers\n\n\nImproved language regarding external commands: Documentation now differentiates between Standard, Scripted, and External Commands\n\n\nImproved language regarding user config files: Now called Userspace Config\n\n\nOptions and Parameters now allow specifying the letter to be used for the short version, or to disable it altogether\n\n\nUserspace config can now be disabled by setting the path to nil or removing the declaration\n\n\n\n\nDeprecations/Changes\n\n\n\n\nRemoved deprecated and broken examples from the examples folder",
555
+ "text": "Changelog\n\n\n0.2.2 (Aug 22, 2018)\n\n\nFeatures\n\n\nBugfixes\n\n\n\n\nFixed a bug that caused the logger's target and level not to be configured properly via the Configurate block.\n\n\n\n\nImprovements\n\n\n\n\nLazy-loading has been implemented in optional modules such as autoupdates, remote storage, etc. This means that if you do not enable them in the code, they will not be loaded into memory. This significantly improves loding times for applications.\n\n\nAbstraction system created for configuration. This has significantly simplified the existing codebase and makes future development easier.\n\n\nDeprecation warning system added. This allows for RBCli contributors to notify users of breaking changes that may impact their code.\n\n\nFolder structure has been simplified to ease development.\n\n\nMuch of the code has been refactored.\n\n\n\n\nDeprecations/Changes\n\n\n\n\nThe \nRbcli\n module is now \nRBCli\n to better match the branding. The original \nRbcli\n module will still work for this current release, with a warning, but future releases will require code changes. \n\n\nHooks are now defined under the \nRBCli.Configurate.hooks\n block instead of \nRBCli.Configurate.me\n.\n\n\nThe logger is now silent by default. To enable it, it must be configured either via the \nConfigurate\n block or via the user's config file.\n\n\n\n\n0.2.1 (Aug 8, 2018)\n\n\nFeatures\n\n\n\n\nRemote Execution added for Script and External commands\n\n\n\n\nBugfixes\n\n\n\n\nFixed a bug that caused RBCli to crash if a direct path mode script's environment variables were declared as symbols\n\n\n\n\n0.2.0 (Aug 5, 2018)\n\n\nFeatures\n\n\n\n\nCLI tool Autoupdate Enabled; when an upgrade to RBCli is detected, the RBCli CLI tool will notify the developer.\n\n\nOfficial documentation created and hosted with Github Pages\n\n\nRBCli released under GPLv3\n\n\nCopyright/License notice displayed via RBCli tool with \nrbcli license\n in accordance with GPLv3 guidelines\n\n\n\n\nBugfixes\n\n\n\n\nFixed version number loading for projects\n\n\nCleaned up command usage help output\n\n\nFixed script and external command generation\n\n\n\n\nImprovements\n\n\n\n\nA quick reference guide can now be found in README.md\n\n\nAutoupdate feature now allows supplying a custom message\n\n\nDirect Path Mode for External Commands now\n\n\nAdded support for a \nlib\n folder in projects, as a place for custom code, which is automatically added to \n$LOAD_PATH\n for developers\n\n\nImproved language regarding external commands: Documentation now differentiates between Standard, Scripted, and External Commands\n\n\nImproved language regarding user config files: Now called Userspace Config\n\n\nOptions and Parameters now allow specifying the letter to be used for the short version, or to disable it altogether\n\n\nUserspace config can now be disabled by setting the path to nil or removing the declaration\n\n\n\n\nDeprecations/Changes\n\n\n\n\nRemoved deprecated and broken examples from the examples folder",
551
556
  "title": "Changelog"
552
557
  },
553
558
  {
@@ -555,18 +560,43 @@
555
560
  "text": "",
556
561
  "title": "Changelog"
557
562
  },
563
+ {
564
+ "location": "/imported/changelog/#022-aug-22-2018",
565
+ "text": "",
566
+ "title": "0.2.2 (Aug 22, 2018)"
567
+ },
568
+ {
569
+ "location": "/imported/changelog/#features",
570
+ "text": "",
571
+ "title": "Features"
572
+ },
573
+ {
574
+ "location": "/imported/changelog/#bugfixes",
575
+ "text": "Fixed a bug that caused the logger's target and level not to be configured properly via the Configurate block.",
576
+ "title": "Bugfixes"
577
+ },
578
+ {
579
+ "location": "/imported/changelog/#improvements",
580
+ "text": "Lazy-loading has been implemented in optional modules such as autoupdates, remote storage, etc. This means that if you do not enable them in the code, they will not be loaded into memory. This significantly improves loding times for applications. Abstraction system created for configuration. This has significantly simplified the existing codebase and makes future development easier. Deprecation warning system added. This allows for RBCli contributors to notify users of breaking changes that may impact their code. Folder structure has been simplified to ease development. Much of the code has been refactored.",
581
+ "title": "Improvements"
582
+ },
583
+ {
584
+ "location": "/imported/changelog/#deprecationschanges",
585
+ "text": "The Rbcli module is now RBCli to better match the branding. The original Rbcli module will still work for this current release, with a warning, but future releases will require code changes. Hooks are now defined under the RBCli.Configurate.hooks block instead of RBCli.Configurate.me . The logger is now silent by default. To enable it, it must be configured either via the Configurate block or via the user's config file.",
586
+ "title": "Deprecations/Changes"
587
+ },
558
588
  {
559
589
  "location": "/imported/changelog/#021-aug-8-2018",
560
590
  "text": "",
561
591
  "title": "0.2.1 (Aug 8, 2018)"
562
592
  },
563
593
  {
564
- "location": "/imported/changelog/#features",
594
+ "location": "/imported/changelog/#features_1",
565
595
  "text": "Remote Execution added for Script and External commands",
566
596
  "title": "Features"
567
597
  },
568
598
  {
569
- "location": "/imported/changelog/#bugfixes",
599
+ "location": "/imported/changelog/#bugfixes_1",
570
600
  "text": "Fixed a bug that caused RBCli to crash if a direct path mode script's environment variables were declared as symbols",
571
601
  "title": "Bugfixes"
572
602
  },
@@ -576,22 +606,22 @@
576
606
  "title": "0.2.0 (Aug 5, 2018)"
577
607
  },
578
608
  {
579
- "location": "/imported/changelog/#features_1",
609
+ "location": "/imported/changelog/#features_2",
580
610
  "text": "CLI tool Autoupdate Enabled; when an upgrade to RBCli is detected, the RBCli CLI tool will notify the developer. Official documentation created and hosted with Github Pages RBCli released under GPLv3 Copyright/License notice displayed via RBCli tool with rbcli license in accordance with GPLv3 guidelines",
581
611
  "title": "Features"
582
612
  },
583
613
  {
584
- "location": "/imported/changelog/#bugfixes_1",
614
+ "location": "/imported/changelog/#bugfixes_2",
585
615
  "text": "Fixed version number loading for projects Cleaned up command usage help output Fixed script and external command generation",
586
616
  "title": "Bugfixes"
587
617
  },
588
618
  {
589
- "location": "/imported/changelog/#improvements",
619
+ "location": "/imported/changelog/#improvements_1",
590
620
  "text": "A quick reference guide can now be found in README.md Autoupdate feature now allows supplying a custom message Direct Path Mode for External Commands now Added support for a lib folder in projects, as a place for custom code, which is automatically added to $LOAD_PATH for developers Improved language regarding external commands: Documentation now differentiates between Standard, Scripted, and External Commands Improved language regarding user config files: Now called Userspace Config Options and Parameters now allow specifying the letter to be used for the short version, or to disable it altogether Userspace config can now be disabled by setting the path to nil or removing the declaration",
591
621
  "title": "Improvements"
592
622
  },
593
623
  {
594
- "location": "/imported/changelog/#deprecationschanges",
624
+ "location": "/imported/changelog/#deprecationschanges_1",
595
625
  "text": "Removed deprecated and broken examples from the examples folder",
596
626
  "title": "Deprecations/Changes"
597
627
  },
data/docs/sitemap.xml CHANGED
@@ -2,97 +2,97 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <url>
4
4
  <loc>/</loc>
5
- <lastmod>2018-08-08</lastmod>
5
+ <lastmod>2018-08-22</lastmod>
6
6
  <changefreq>daily</changefreq>
7
7
  </url>
8
8
  <url>
9
9
  <loc>/imported/quick_reference/</loc>
10
- <lastmod>2018-08-08</lastmod>
10
+ <lastmod>2018-08-22</lastmod>
11
11
  <changefreq>daily</changefreq>
12
12
  </url>
13
13
  <url>
14
14
  <loc>/tutorial/10-getting_started/</loc>
15
- <lastmod>2018-08-08</lastmod>
15
+ <lastmod>2018-08-22</lastmod>
16
16
  <changefreq>daily</changefreq>
17
17
  </url>
18
18
  <url>
19
19
  <loc>/tutorial/20-project_layout/</loc>
20
- <lastmod>2018-08-08</lastmod>
20
+ <lastmod>2018-08-22</lastmod>
21
21
  <changefreq>daily</changefreq>
22
22
  </url>
23
23
  <url>
24
24
  <loc>/tutorial/30-your_first_command/</loc>
25
- <lastmod>2018-08-08</lastmod>
25
+ <lastmod>2018-08-22</lastmod>
26
26
  <changefreq>daily</changefreq>
27
27
  </url>
28
28
  <url>
29
29
  <loc>/tutorial/40-options_parameters_and_arguments/</loc>
30
- <lastmod>2018-08-08</lastmod>
30
+ <lastmod>2018-08-22</lastmod>
31
31
  <changefreq>daily</changefreq>
32
32
  </url>
33
33
  <url>
34
34
  <loc>/tutorial/50-publishing/</loc>
35
- <lastmod>2018-08-08</lastmod>
35
+ <lastmod>2018-08-22</lastmod>
36
36
  <changefreq>daily</changefreq>
37
37
  </url>
38
38
  <url>
39
39
  <loc>/advanced/command_types/</loc>
40
- <lastmod>2018-08-08</lastmod>
40
+ <lastmod>2018-08-22</lastmod>
41
41
  <changefreq>daily</changefreq>
42
42
  </url>
43
43
  <url>
44
44
  <loc>/advanced/user_config_files/</loc>
45
- <lastmod>2018-08-08</lastmod>
45
+ <lastmod>2018-08-22</lastmod>
46
46
  <changefreq>daily</changefreq>
47
47
  </url>
48
48
  <url>
49
49
  <loc>/advanced/hooks/</loc>
50
- <lastmod>2018-08-08</lastmod>
50
+ <lastmod>2018-08-22</lastmod>
51
51
  <changefreq>daily</changefreq>
52
52
  </url>
53
53
  <url>
54
54
  <loc>/advanced/automatic_updates/</loc>
55
- <lastmod>2018-08-08</lastmod>
55
+ <lastmod>2018-08-22</lastmod>
56
56
  <changefreq>daily</changefreq>
57
57
  </url>
58
58
  <url>
59
59
  <loc>/advanced/state_storage/</loc>
60
- <lastmod>2018-08-08</lastmod>
60
+ <lastmod>2018-08-22</lastmod>
61
61
  <changefreq>daily</changefreq>
62
62
  </url>
63
63
  <url>
64
64
  <loc>/advanced/distributed_state_locking/</loc>
65
- <lastmod>2018-08-08</lastmod>
65
+ <lastmod>2018-08-22</lastmod>
66
66
  <changefreq>daily</changefreq>
67
67
  </url>
68
68
  <url>
69
69
  <loc>/advanced/remote_execution/</loc>
70
- <lastmod>2018-08-08</lastmod>
70
+ <lastmod>2018-08-22</lastmod>
71
71
  <changefreq>daily</changefreq>
72
72
  </url>
73
73
  <url>
74
74
  <loc>/development/contributing/</loc>
75
- <lastmod>2018-08-08</lastmod>
75
+ <lastmod>2018-08-22</lastmod>
76
76
  <changefreq>daily</changefreq>
77
77
  </url>
78
78
  <url>
79
79
  <loc>/development/license/</loc>
80
- <lastmod>2018-08-08</lastmod>
80
+ <lastmod>2018-08-22</lastmod>
81
81
  <changefreq>daily</changefreq>
82
82
  </url>
83
83
  <url>
84
84
  <loc>/development/code_of_conduct/</loc>
85
- <lastmod>2018-08-08</lastmod>
85
+ <lastmod>2018-08-22</lastmod>
86
86
  <changefreq>daily</changefreq>
87
87
  </url>
88
88
  <url>
89
89
  <loc>/imported/changelog/</loc>
90
- <lastmod>2018-08-08</lastmod>
90
+ <lastmod>2018-08-22</lastmod>
91
91
  <changefreq>daily</changefreq>
92
92
  </url>
93
93
  <url>
94
94
  <loc>/whoami/</loc>
95
- <lastmod>2018-08-08</lastmod>
95
+ <lastmod>2018-08-22</lastmod>
96
96
  <changefreq>daily</changefreq>
97
97
  </url>
98
98
  </urlset>
data/lib/rbcli.rb CHANGED
@@ -36,34 +36,15 @@ require 'rbcli/version'
36
36
 
37
37
  # UTILS
38
38
  require 'rbcli/util/hash_deep_symbolize'
39
+ require 'rbcli/util/deprecation_warning'
39
40
  #require 'rbcli/util/string_colorize' # We are using the colorize gem instead. The code is kept here for reference.
40
41
  # END UTILS
41
42
 
42
43
  # BASE PREREQS
43
- require 'rbcli/configuration/config'
44
- require 'rbcli/logging/logging'
44
+ require 'rbcli/features/userconfig'
45
+ require 'rbcli/features/logging'
45
46
  # END BASE PREREQS
46
47
 
47
-
48
- # STATE TOOLS
49
- require 'rbcli/stateful_systems/configuratestorage'
50
- require 'rbcli/stateful_systems/state_storage'
51
- require 'rbcli/stateful_systems/storagetypes/localstate'
52
- require 'rbcli/stateful_systems/storagetypes/remotestate_dynamodb'
53
- # END STATE TOOLS
54
-
55
- # AUTOUPDATE
56
- require 'rbcli/autoupdate/autoupdate'
57
- # END AUTOUPDATE
58
-
59
- # SCRIPT WRAPPER
60
- require 'rbcli/scriptwrapping/scriptwrapper'
61
- # END SCRIPT WRAPPER
62
-
63
- # REMOTE EXEC
64
- require 'rbcli/remote_exec/remote_exec'
65
- # END REMOTE EXEC
66
-
67
48
  # CORE
68
49
  require 'rbcli/configuration/configurate'
69
50
  require 'rbcli/engine/load_project'
@@ -18,117 +18,68 @@
18
18
  # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
-
21
+ #####
22
+ # Configurate
23
+ ###
24
+ # This plugin class allows declaring configuration blocks dynamically
25
+ ##
22
26
  module Rbcli::Configurate
23
-
24
- @data = {
25
- scriptname: nil,
26
- version: nil,
27
- description: nil,
28
- config_userfile: nil,
29
- allow_json: false,
30
- options: {},
31
- default_action: nil,
32
- pre_hook: nil,
33
- post_hook: nil,
34
- first_run: nil,
35
- halt_after_first_run: false,
36
- remote_execution: false
37
- }
38
-
39
- def self.me &block
40
- @self_before_instance_eval = eval "self", block.binding
41
- instance_eval &block
42
- end
43
-
44
- # def self.method_missing(method, *args, &block)
45
- # @self_before_instance_eval.send method, *args, &block
46
- # end
47
-
48
27
  ##
49
- # DSL Functions
28
+ # If a non-existant method is called, we attempt to load the plugin.
29
+ # If the plugin fails to load we display a message to the developer
50
30
  ##
51
- def self.scriptname name
52
- @data[:scriptname] = name
53
- end
54
-
55
- def self.version vsn
56
- @data[:version] = vsn
57
- end
58
-
59
- def self.description desc
60
- @data[:description] = desc
61
- end
62
-
63
- def self.log_level level
64
- Rbcli::Logger::save_defaults level: level
65
- end
66
-
67
- def self.log_target target
68
- Rbcli::Logger::save_defaults target: target
69
- end
70
-
71
- def self.config_userfile *params
72
- Rbcli::Config::set_userfile *params
73
- @data[:config_userfile] = params[0]
74
- end
75
-
76
- def self.config_defaults filename
77
- Rbcli::Config::add_defaults filename
78
- end
79
-
80
- def self.config_default *params
81
- Rbcli::Config::add_default *params
82
- end
83
-
84
- def self.allow_json_output allow_json
85
- @data[:allow_json] = allow_json
86
- end
87
-
88
- def self.option name, description, short: nil, type: :boolean, default: nil, required: false, permitted: nil
89
- default ||= false if (type == :boolean || type == :bool || type == :flag)
90
- @data[:options][name.to_sym] = {
91
- description: description,
92
- type: type,
93
- default: default,
94
- required: required,
95
- permitted: permitted,
96
- short: short
97
- }
98
- end
99
-
100
- def self.default_action &block
101
- @data[:default_action] = block
31
+ def self.method_missing(method, *args, &block)
32
+ filename = "#{File.dirname(__FILE__)}/configurate_blocks/#{method.to_s.downcase}.rb"
33
+ if File.exists? filename
34
+ require filename
35
+ self.send method, *args, &block
36
+ else
37
+ msg = "Invalid Configurate plugin called: `#{method}` in file #{File.expand_path caller[0]}"
38
+ Rbcli::log.fatal {msg}
39
+ raise Exception.new msg
40
+ end
102
41
  end
42
+ end
103
43
 
104
- def self.pre_hook &block
105
- @data[:pre_hook] = block
106
- end
44
+ module Rbcli::Configurable
107
45
 
108
- def self.post_hook &block
109
- @data[:post_hook] = block
110
- end
46
+ def self.included klass
47
+ name = klass.name.split('::')[-1]
111
48
 
112
- def self.first_run halt_after_running: false, &block
113
- @data[:halt_after_first_run] = halt_after_running
114
- @data[:first_run] = block
115
- end
49
+ # We dynamically add two methods to the module: one that runs other methods dynamially, and one that
50
+ # displays a reasonable message if a method is missing
51
+ klass.singleton_class.class_eval do
52
+ define_method :rbcli_private_running_method do |&block|
53
+ @self_before_instance_eval = eval 'self', block.binding
54
+ instance_eval &block
55
+ end
116
56
 
117
- def self.remote_execution permitted: true
118
- @data[:remote_execution] = permitted
119
- end
57
+ define_method :method_missing do |method, *args, &block|
58
+ msg = "Invalid Configurate.#{self.name.split('::')[-1].downcase} method called: `#{method}` in file #{File.expand_path caller[0]}"
59
+ Rbcli::log.fatal {msg}
60
+ raise Exception.new msg
61
+ end
62
+ end
120
63
 
121
- ##
122
- # Data Retrieval
123
- ##
124
- def self.configuration
125
- @data
64
+ # This will dynamically create the configuate block based on the class name.
65
+ # For example, if the class name is 'Me', then the resulting block is `Confiugrate.me`
66
+ Rbcli::Configurate.singleton_class.class_eval do
67
+ define_method name.downcase.to_sym do |&block|
68
+ mod = self.const_get name
69
+ mod.rbcli_private_running_method &block
70
+ end
71
+ end
126
72
  end
127
73
 
128
74
  end
129
75
 
130
76
  module Rbcli
131
- def self.configuration
132
- Rbcli::Configurate::configuration
77
+ def self.configuration mod, key = nil
78
+ begin
79
+ d = Rbcli::Configurate.const_get(mod.to_s.capitalize.to_sym).data
80
+ (key.nil?) ? d : d[key]
81
+ rescue
82
+ nil
83
+ end
133
84
  end
134
85
  end
@@ -18,27 +18,35 @@
18
18
  # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
- module Rbcli::Configurate
22
- def self.storage &block
23
- Rbcli::ConfigurateStorage.configure &block
24
- end
25
- end
26
21
 
22
+ module Rbcli::Configurate::Hooks
23
+ include Rbcli::Configurable
27
24
 
28
- module Rbcli::ConfigurateStorage
29
25
  @data = {
30
- localstate: nil
26
+ default_action: nil,
27
+ pre_hook: nil,
28
+ post_hook: nil,
29
+ first_run: nil,
30
+ halt_after_first_run: false
31
31
  }
32
+ def self.data; @data; end
33
+
34
+
35
+ def self.default_action &block
36
+ @data[:default_action] = block
37
+ end
38
+
39
+ def self.pre_hook &block
40
+ @data[:pre_hook] = block
41
+ end
32
42
 
33
- def self.configure &block
34
- @self_before_instance_eval = eval "self", block.binding
35
- instance_eval &block
43
+ def self.post_hook &block
44
+ @data[:post_hook] = block
36
45
  end
37
46
 
38
- ##
39
- # Data Retrieval
40
- ##
41
- def self.data
42
- @data
47
+ def self.first_run halt_after_running: false, &block
48
+ @data[:halt_after_first_run] = halt_after_running
49
+ @data[:first_run] = block
43
50
  end
51
+
44
52
  end