devtools-base 2.0.0

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.
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.13.5
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem "simplecov"
5
+ gem "codeclimate-test-reporter", "~> 1.0.0"
6
+ end
7
+
8
+ # Specify your gem's dependencies in devtools-base.gemspec
9
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Donovan Young
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ [![Build Status](https://travis-ci.org/dyoung522/devtools-base.svg?branch=master)](https://travis-ci.org/dyoung522/devtools-base)
2
+ [![Code Climate](https://codeclimate.com/github/dyoung522/devtools-base/badges/gpa.svg)](https://codeclimate.com/github/dyoung522/devtools-base)
3
+ [![Test Coverage](https://codeclimate.com/github/dyoung522/devtools-base/badges/coverage.svg)](https://codeclimate.com/github/dyoung522/devtools-base/coverage)
4
+
5
+ # DevTools (Base)
6
+
7
+ DevTools is a compilation of utilities created to make the development process easier.
8
+
9
+ ## Installation
10
+
11
+ The base class is intended to be required in other tools via
12
+
13
+ require "devtools-base"
14
+
15
+ ## Usage
16
+
17
+ Once installed, this gem provides a base for several, mostly independent, utilities.
18
+
19
+ It gives you command line support, which includes the following options:
20
+
21
+ - `--help | -h` : Command line help
22
+ - `--config | -c <FILE>` : Include tools-specific options from config FILE
23
+ - `--version | -v` : Print version information and exit
24
+
25
+ Additionally, the base will look for and load (if found) tool specific
26
+ configuration items from one of the following files:
27
+
28
+ - `~/.toolname`
29
+ - `./.toolname`
30
+ - `./toolname.rc`
31
+ - `./toolname.conf`
32
+
33
+ Where `toolname` is the name of the executable using this base.
34
+
35
+ ## Development
36
+
37
+ 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.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`.
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on [our GitHub page](https://github.com/dyoung522/devtools-base)
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ Rake::Task[:build].enhance [:spec]
7
+
8
+ task :default => :spec
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "devtools"
5
+ require "pry"
6
+
7
+ Pry.start
8
+
@@ -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
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "devtools/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "devtools-base"
8
+ spec.version = DevTools::VERSION
9
+ spec.authors = ["Donovan Young"]
10
+ spec.email = ["dyoung522@gmail.com"]
11
+
12
+ spec.summary = %q{Miscellaneous utilities to make a developers life easier}
13
+ spec.description = %q{Utilities include:\nRunTest - Runs specs based on local configuration} +
14
+ %q{\nRunEnv - Run the dev environment based on local configuration} +
15
+ %q{\nPRlist - Polls git repos and displays a queue of stories ready for QA}
16
+ spec.homepage = "https://github.com/dyoung522/devtools-base"
17
+ spec.license = "MIT"
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "config", "~> 1.3"
25
+ spec.add_dependency "octokit", "~> 4.0"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.13"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "pry", "~> 0.4"
31
+ end
@@ -0,0 +1,3 @@
1
+ require "devtools/options"
2
+ require "devtools/utils"
3
+ require "devtools/version"
@@ -0,0 +1,79 @@
1
+ require "config"
2
+ require "optparse"
3
+
4
+ module DevTools
5
+ class OptParse
6
+ attr_reader :parser, :version
7
+
8
+ def initialize(opts)
9
+ program_path = DevTools::PROGRAM
10
+ program_files = []
11
+
12
+ %W(~/.#{program_path} ./.#{program_path} ./#{program_path}.conf ./#{program_path}.rc).each do |path|
13
+ program_files.push File.expand_path(path)
14
+ end
15
+
16
+ Config.setup do |config|
17
+ config.const_name = 'Options'
18
+ config.use_env = true
19
+ end
20
+
21
+ Config.load_and_set_settings opts[:testing] ? String.new : program_files
22
+
23
+ default_options(Options, opts[:defaults]) if opts[:defaults]
24
+
25
+ Options.verbose = Options.verbose ? 1 : 0 unless Options.verbose.is_a?(Numeric)
26
+ Options.debug = true if Options.verbose >= 5
27
+
28
+ @parser ||= common_options opts[:testing]
29
+ @version ||= sprintf "%s v%s (%s v%s)\n",
30
+ opts[:name] || DevTools::PROGRAM, opts[:version] || DevTools::VERSION,
31
+ "DevTools", DevTools::VERSION
32
+ end
33
+
34
+ def common_options(unit_testing = false)
35
+ OptionParser.new do |opts|
36
+ opts.on_tail("-h", "--help", "Show this message") do
37
+ unless unit_testing
38
+ puts version + "\n"
39
+ puts opts
40
+ exit
41
+ end
42
+ end
43
+
44
+ # Config file
45
+ opts.on_tail("-c", "--config FILE", "Specify an alternate configuration file") do |file|
46
+ Options.add_source! file
47
+ Options.reload!
48
+ end
49
+
50
+ # dry-run switch
51
+ opts.on_tail("--dry-run", "Don't actually run commands") do
52
+ Options.dryrun = true
53
+ end
54
+
55
+ # Verbose switch
56
+ opts.on_tail("-q", "--quiet", "Run quietly") do
57
+ Options.verbose = 0
58
+ end
59
+
60
+ opts.on_tail("-v", "--verbose", "Run verbosely (may be specified more than once)") do
61
+ Options.verbose += 1
62
+ end
63
+
64
+ opts.on_tail("--version", "Show version") do
65
+ unless unit_testing
66
+ puts version
67
+ exit
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ def default_options(options, opts)
74
+ opts.each do |key, value|
75
+ options[key] = value unless options.keys.include?(key)
76
+ end
77
+ end
78
+ end # class Option
79
+ end # module DevTools
@@ -0,0 +1,8 @@
1
+ module DevTools
2
+ module Utils
3
+ def self.die(message)
4
+ puts message
5
+ exit 1
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ module DevTools
2
+ PROGRAM = File.basename($0, ".rb")
3
+ VERSION = "2.0.0"
4
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devtools-base
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Donovan Young
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: config
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: octokit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.4'
97
+ description: Utilities include:\nRunTest - Runs specs based on local configuration\nRunEnv -
98
+ Run the dev environment based on local configuration\nPRlist - Polls git repos
99
+ and displays a queue of stories ready for QA
100
+ email:
101
+ - dyoung522@gmail.com
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".codeclimate.yml"
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".rubocop.yml"
110
+ - ".travis.yml"
111
+ - Gemfile
112
+ - LICENSE.txt
113
+ - README.md
114
+ - Rakefile
115
+ - bin/console
116
+ - bin/setup
117
+ - devtools-base.gemspec
118
+ - lib/devtools.rb
119
+ - lib/devtools/options.rb
120
+ - lib/devtools/utils.rb
121
+ - lib/devtools/version.rb
122
+ homepage: https://github.com/dyoung522/devtools-base
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.5.2
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Miscellaneous utilities to make a developers life easier
146
+ test_files: []