rbcli 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/README.md +50 -6
- data/exe/rbcli +81 -32
- data/lib/rbcli/configuration/config.rb +6 -6
- data/lib/rbcli/configuration/configurate.rb +1 -1
- data/lib/rbcli/engine/load_project.rb +19 -0
- data/lib/rbcli/engine/parser.rb +2 -2
- data/lib/rbcli/logging/logging.rb +7 -4
- data/lib/rbcli/stateful_systems/state_storage.rb +4 -0
- data/lib/rbcli/version.rb +1 -1
- data/lib/rbcli-tool/erb_renderer.rb +43 -0
- data/lib/rbcli-tool/mdless_fix.rb +386 -0
- data/lib/rbcli-tool/project.rb +87 -0
- data/lib/rbcli-tool.rb +16 -0
- data/lib/rbcli.rb +11 -10
- data/rbcli.gemspec +1 -0
- data/skeletons/micro/executable +123 -0
- data/skeletons/mini/executable +241 -0
- data/skeletons/project/.gitignore +11 -0
- data/skeletons/project/.rbcli +0 -0
- data/skeletons/project/.rspec +3 -0
- data/skeletons/project/CODE_OF_CONDUCT.md +74 -0
- data/skeletons/project/Gemfile +6 -0
- data/skeletons/project/README.md +31 -0
- data/skeletons/project/Rakefile +6 -0
- data/skeletons/project/application/commands/command.rb +31 -0
- data/skeletons/project/application/commands/scripts/script.sh +23 -0
- data/skeletons/project/application/options.rb +30 -0
- data/skeletons/project/config/autoupdate.rb +32 -0
- data/skeletons/project/config/logging.rb +19 -0
- data/skeletons/project/config/storage.rb +34 -0
- data/skeletons/project/config/userspace.rb +28 -0
- data/skeletons/project/config/version.rb +3 -0
- data/skeletons/project/default_user_configs/user_defaults.yml +6 -0
- data/skeletons/project/exe/executable +54 -0
- data/skeletons/project/hooks/default_action.rb +16 -0
- data/skeletons/project/hooks/first_run.rb +16 -0
- data/skeletons/project/hooks/post_execution.rb +14 -0
- data/skeletons/project/hooks/pre_execution.rb +14 -0
- data/skeletons/project/spec/spec_helper.rb +14 -0
- data/skeletons/project/spec/untitled_spec.rb +9 -0
- data/skeletons/project/untitled.gemspec +40 -0
- metadata +47 -2
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            Rbcli::Configurate.me do
         | 
| 2 | 
            +
            	####
         | 
| 3 | 
            +
            	# HOOKS
         | 
| 4 | 
            +
            	###
         | 
| 5 | 
            +
            	# Here you can set hooks that will be run at specified points in the execution chain.
         | 
| 6 | 
            +
            	# Global CLI options are made available to many of the hooks, but command parameters and lineitems are not.
         | 
| 7 | 
            +
            	###
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            	## Default Action -- (Optional) -- The default code to execute when no subcommand is given.
         | 
| 10 | 
            +
            	# If not present, the help is shown (same as -h)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            	default_action do |opts|
         | 
| 13 | 
            +
            		puts "Hello, #{opts[:name]}."
         | 
| 14 | 
            +
            		puts "To see the help, use -h"
         | 
| 15 | 
            +
            	end
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            Rbcli::Configurate.me do
         | 
| 2 | 
            +
            	####
         | 
| 3 | 
            +
            	# HOOKS
         | 
| 4 | 
            +
            	###
         | 
| 5 | 
            +
            	# Here you can set hooks that will be run at specified points in the execution chain.
         | 
| 6 | 
            +
            	# Global CLI options are made available to many of the hooks, but command parameters and lineitems are not.
         | 
| 7 | 
            +
            	###
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            	## First-Run Hook -- (Optional) -- Allows providing a block of code that executes the first time that the application is run on a given system.
         | 
| 10 | 
            +
            	# If `halt_after_running` is set to `true` then parsing will not continue after this code is executed. All subsequent runs will not execute this code.
         | 
| 11 | 
            +
            	# This feature is dependent on the Local State Storage system, and will not run without it.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            	first_run halt_after_running: false do
         | 
| 14 | 
            +
            		puts "This is the first time the mytool command is run! Don't forget to generate a config file with the `-g` option before continuing."
         | 
| 15 | 
            +
            	end
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            Rbcli::Configurate.me do
         | 
| 2 | 
            +
            	####
         | 
| 3 | 
            +
            	# HOOKS
         | 
| 4 | 
            +
            	###
         | 
| 5 | 
            +
            	# Here you can set hooks that will be run at specified points in the execution chain.
         | 
| 6 | 
            +
            	# Global CLI options are made available to many of the hooks, but command parameters and lineitems are not.
         | 
| 7 | 
            +
            	###
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            	## Post-Execution Hook -- (Optional) -- Allows providing a block of code that runs _after_ all commands
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            	post_hook do |opts|
         | 
| 12 | 
            +
            		puts 'This is a post-command hook. It executes after the command.'
         | 
| 13 | 
            +
            	end
         | 
| 14 | 
            +
            end
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            Rbcli::Configurate.me do
         | 
| 2 | 
            +
            	####
         | 
| 3 | 
            +
            	# HOOKS
         | 
| 4 | 
            +
            	###
         | 
| 5 | 
            +
            	# Here you can set hooks that will be run at specified points in the execution chain.
         | 
| 6 | 
            +
            	# Global CLI options are made available to many of the hooks, but command parameters and lineitems are not.
         | 
| 7 | 
            +
            	###
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            	## Pre-Execution Hook -- (Optional) -- Allows providing a block of code that runs _before_ all commands
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            	pre_hook do |opts|
         | 
| 12 | 
            +
            		puts 'This is a pre-command hook. It executes before the command.'
         | 
| 13 | 
            +
            	end
         | 
| 14 | 
            +
            end
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            require "bundler/setup"
         | 
| 2 | 
            +
            require "untitled"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            RSpec.configure do |config|
         | 
| 5 | 
            +
              # Enable flags like --only-failures and --next-failure
         | 
| 6 | 
            +
              config.example_status_persistence_file_path = ".rspec_status"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              # Disable RSpec exposing methods globally on `Module` and `main`
         | 
| 9 | 
            +
              config.disable_monkey_patching!
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              config.expect_with :rspec do |c|
         | 
| 12 | 
            +
                c.syntax = :expect
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            config = File.expand_path("../config", __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(config) unless $LOAD_PATH.include?(config)
         | 
| 4 | 
            +
            require 'config/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "<%= @vars[:cmdname] %>"
         | 
| 8 | 
            +
              spec.version       = Project::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["TODO: Your Name Here"]
         | 
| 10 | 
            +
              spec.email         = ["TODO: Your Email Here"]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              spec.summary       = %q{TODO: Write a short summary, because RubyGems requires one.}
         | 
| 13 | 
            +
              spec.description   = %q{TODO: Write a longer description or delete this line.}
         | 
| 14 | 
            +
              spec.homepage      = "TODO: Put your gem's website or public repo URL here."
         | 
| 15 | 
            +
              spec.license       = nil
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
         | 
| 18 | 
            +
              # to allow pushing to a single host or delete this section to allow pushing to any host.
         | 
| 19 | 
            +
              if spec.respond_to?(:metadata)
         | 
| 20 | 
            +
                spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
         | 
| 21 | 
            +
              else
         | 
| 22 | 
            +
                raise "RubyGems 2.0 or newer is required to protect against " \
         | 
| 23 | 
            +
                  "public gem pushes."
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              # Specify which files should be added to the gem when it is released.
         | 
| 27 | 
            +
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         | 
| 28 | 
            +
              spec.files         = Dir.chdir(File.expand_path('..', __FILE__)) do
         | 
| 29 | 
            +
                `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
              spec.bindir        = "exe"
         | 
| 32 | 
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 33 | 
            +
              spec.require_paths = ["application", "config", "default_user_configs", "hooks"]
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              spec.add_development_dependency "bundler", "~> 1.16"
         | 
| 36 | 
            +
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 37 | 
            +
              spec.add_development_dependency "rspec", "~> 3.0"
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            	spec.add_dependency "rbcli", ">= <%= @vars[:rbcli_version] %>"
         | 
| 40 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rbcli
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andrew Khoury
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-07-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -136,6 +136,20 @@ dependencies: | |
| 136 136 | 
             
                - - "~>"
         | 
| 137 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 138 138 | 
             
                    version: '4.9'
         | 
| 139 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 140 | 
            +
              name: mdless
         | 
| 141 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 142 | 
            +
                requirements:
         | 
| 143 | 
            +
                - - "~>"
         | 
| 144 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 145 | 
            +
                    version: '0.0'
         | 
| 146 | 
            +
              type: :runtime
         | 
| 147 | 
            +
              prerelease: false
         | 
| 148 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 149 | 
            +
                requirements:
         | 
| 150 | 
            +
                - - "~>"
         | 
| 151 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 152 | 
            +
                    version: '0.0'
         | 
| 139 153 | 
             
            description: RBCli is a framework to quickly develop command-line tools.
         | 
| 140 154 | 
             
            email:
         | 
| 141 155 | 
             
            - akhoury@live.com
         | 
| @@ -158,6 +172,10 @@ files: | |
| 158 172 | 
             
            - examples/myscript.sh
         | 
| 159 173 | 
             
            - examples/mytool
         | 
| 160 174 | 
             
            - exe/rbcli
         | 
| 175 | 
            +
            - lib/rbcli-tool.rb
         | 
| 176 | 
            +
            - lib/rbcli-tool/erb_renderer.rb
         | 
| 177 | 
            +
            - lib/rbcli-tool/mdless_fix.rb
         | 
| 178 | 
            +
            - lib/rbcli-tool/project.rb
         | 
| 161 179 | 
             
            - lib/rbcli.rb
         | 
| 162 180 | 
             
            - lib/rbcli/autoupdate/autoupdate.rb
         | 
| 163 181 | 
             
            - lib/rbcli/autoupdate/gem_updater.rb
         | 
| @@ -165,6 +183,7 @@ files: | |
| 165 183 | 
             
            - lib/rbcli/configuration/config.rb
         | 
| 166 184 | 
             
            - lib/rbcli/configuration/configurate.rb
         | 
| 167 185 | 
             
            - lib/rbcli/engine/command.rb
         | 
| 186 | 
            +
            - lib/rbcli/engine/load_project.rb
         | 
| 168 187 | 
             
            - lib/rbcli/engine/parser.rb
         | 
| 169 188 | 
             
            - lib/rbcli/logging/logging.rb
         | 
| 170 189 | 
             
            - lib/rbcli/scriptwrapping/scriptwrapper.rb
         | 
| @@ -178,6 +197,32 @@ files: | |
| 178 197 | 
             
            - lib/rbcli/util/trollop.rb
         | 
| 179 198 | 
             
            - lib/rbcli/version.rb
         | 
| 180 199 | 
             
            - rbcli.gemspec
         | 
| 200 | 
            +
            - skeletons/micro/executable
         | 
| 201 | 
            +
            - skeletons/mini/executable
         | 
| 202 | 
            +
            - skeletons/project/.gitignore
         | 
| 203 | 
            +
            - skeletons/project/.rbcli
         | 
| 204 | 
            +
            - skeletons/project/.rspec
         | 
| 205 | 
            +
            - skeletons/project/CODE_OF_CONDUCT.md
         | 
| 206 | 
            +
            - skeletons/project/Gemfile
         | 
| 207 | 
            +
            - skeletons/project/README.md
         | 
| 208 | 
            +
            - skeletons/project/Rakefile
         | 
| 209 | 
            +
            - skeletons/project/application/commands/command.rb
         | 
| 210 | 
            +
            - skeletons/project/application/commands/scripts/script.sh
         | 
| 211 | 
            +
            - skeletons/project/application/options.rb
         | 
| 212 | 
            +
            - skeletons/project/config/autoupdate.rb
         | 
| 213 | 
            +
            - skeletons/project/config/logging.rb
         | 
| 214 | 
            +
            - skeletons/project/config/storage.rb
         | 
| 215 | 
            +
            - skeletons/project/config/userspace.rb
         | 
| 216 | 
            +
            - skeletons/project/config/version.rb
         | 
| 217 | 
            +
            - skeletons/project/default_user_configs/user_defaults.yml
         | 
| 218 | 
            +
            - skeletons/project/exe/executable
         | 
| 219 | 
            +
            - skeletons/project/hooks/default_action.rb
         | 
| 220 | 
            +
            - skeletons/project/hooks/first_run.rb
         | 
| 221 | 
            +
            - skeletons/project/hooks/post_execution.rb
         | 
| 222 | 
            +
            - skeletons/project/hooks/pre_execution.rb
         | 
| 223 | 
            +
            - skeletons/project/spec/spec_helper.rb
         | 
| 224 | 
            +
            - skeletons/project/spec/untitled_spec.rb
         | 
| 225 | 
            +
            - skeletons/project/untitled.gemspec
         | 
| 181 226 | 
             
            homepage: https://github.com/akhoury6/rbcli
         | 
| 182 227 | 
             
            licenses:
         | 
| 183 228 | 
             
            - MIT
         |