colorconfig 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f73cef0b9d476c6dab04f261fdfd324132ad735a
4
+ data.tar.gz: 261883209d324d4b7206411a9b5668422e44bd26
5
+ SHA512:
6
+ metadata.gz: 4d2c59bbd6d3b4b3381c5e25556e4de89d04ff8ea5c8cdb068c1d56cd45aba5b4a8f537d477c0165325477f077981844d102866fb024ae1cf66269375e4cc6a6
7
+ data.tar.gz: bf456327d6e4774673ca68457e87b63244ebfe0aa91ff4a97be23a5e4faf46e8caa4301d2d555f2fdd90edbd96b7f1afff9f54dff01b1979f44c49af6bdccb1f
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+
19
+ /.idea/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in colorconfig.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Eric Henderson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # colorconfig
2
+
3
+ create/edit a color configuration file for `mvn2` and `mvr`
4
+
5
+ ## Installation
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install colorconfig
10
+
11
+ ## Usage
12
+
13
+ ###action:
14
+ goes through a series of command line option prompts (where you enter the number of the option you want), looping until you exit
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/colorconfig ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+ require 'readline'
5
+ require 'rubygems'
6
+ require 'everyday-cli-utils'
7
+ include EverydayCliUtils
8
+ import :maputil, :ask
9
+
10
+ config_files = {
11
+ mvn2: '~/mvn2-colors.yaml',
12
+ mvr: '~/mvr-colors.yaml',
13
+ }
14
+
15
+ default_options = {
16
+ mvn2: {
17
+ time: {
18
+ fg: :green,
19
+ bg: :none,
20
+ },
21
+ percent: {
22
+ fg: :purple,
23
+ bg: :none,
24
+ },
25
+ average: {
26
+ fg: :cyan,
27
+ bg: :none,
28
+ },
29
+ },
30
+ mvr: {
31
+ normal: {
32
+ fg: :none,
33
+ bg: :none,
34
+ },
35
+ same: {
36
+ fg: :black,
37
+ bg: :white,
38
+ },
39
+ conflict: {
40
+ fg: :white,
41
+ bg: :red,
42
+ },
43
+ },
44
+ }
45
+
46
+ colors = [:black, :red, :green, :yellow, :blue, :purple, :cyan, :white, :none]
47
+
48
+ while true
49
+
50
+ Ask::ask('Which script do you want to configure colors for?', [:mvn2, :mvr, :Exit]) { |script|
51
+ if script == :Exit
52
+ exit(0)
53
+ end
54
+
55
+ config_file = File.expand_path(config_files[script])
56
+
57
+ options = Marshal.load(Marshal.dump(default_options[script]))
58
+
59
+ if File.exist?(config_file)
60
+ options = YAML::load_file(config_file)
61
+ end
62
+
63
+ brk = false
64
+ until brk
65
+ Ask::ask('Which config option do you want?', Ask::hash_to_options(options, [:Save, :'Up a level', :Exit])) { |opt|
66
+ if opt == :Exit
67
+ exit(0)
68
+ elsif opt == :'Up a level'
69
+ brk = true
70
+ elsif opt == :Save
71
+ IO.write(config_file, options.to_yaml)
72
+ puts "\nSaved\n\n"
73
+ else
74
+ brk2 = false
75
+ until brk2
76
+ Ask::ask("Configuring: #{opt.to_s}\nWhich color do you want to set?", Ask::hash_to_options(options[opt], [:'Up a level', :Exit])) { |which|
77
+ if which == :Exit
78
+ exit(0)
79
+ elsif which == :'Up a level'
80
+ brk2 = true
81
+ else
82
+ Ask::ask("Configuring: #{opt.to_s} -> #{which.to_s} (currently: #{options[opt][which].to_s}) (default: #{default_options[script][opt][which].to_s})\nWhich color do you want?", colors + [:Default, :Cancel]) { |color|
83
+ unless color == :Cancel
84
+ options[opt][which] = (color == :Default) ? default_options[script][opt][which] : color
85
+ end
86
+ }
87
+ end
88
+ }
89
+ end
90
+ end
91
+ }
92
+ end
93
+ }
94
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ #noinspection RubyResolve
5
+ require 'colorconfig/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'colorconfig'
9
+ spec.version = Colorconfig::VERSION
10
+ spec.authors = ['Eric Henderson']
11
+ spec.email = ['henderea@gmail.com']
12
+ spec.summary = %q{color configuration}
13
+ spec.description = %q{create/edit a color configuration file for `mvn2` and `mvr`}
14
+ spec.homepage = 'https://github.com/henderea/colorconfig'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.5'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+
25
+ spec.add_dependency 'everyday-cli-utils', '>= 1.1.0'
26
+ spec.add_dependency 'mvn2', '>= 2.0.0'
27
+ end
@@ -0,0 +1,3 @@
1
+ module Colorconfig
2
+ VERSION = '2.0.0'
3
+ end
@@ -0,0 +1 @@
1
+ require 'colorconfig/version'
@@ -0,0 +1,11 @@
1
+ require 'mvn2/plugin'
2
+ class ColorConfigPlugin
3
+ extend Mvn2::Plugin
4
+ extend Mvn2::PluginType
5
+
6
+ CONFIG_FILE = File.expand_path('~/mvn2-colors.yaml')
7
+
8
+ register :option, sym: :override_colors, names: %w(-v --override-colors), desc: 'override the colors with the ones configured by the colorconfig script'
9
+
10
+ register(:color_override, priority: 100) { |options| (options[:override_colors] && File.exist?(CONFIG_FILE)) ? YAML::load_file(CONFIG_FILE) : nil }
11
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: colorconfig
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Henderson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: everyday-cli-utils
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: mvn2
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
69
+ description: create/edit a color configuration file for `mvn2` and `mvr`
70
+ email:
71
+ - henderea@gmail.com
72
+ executables:
73
+ - colorconfig
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/colorconfig
83
+ - colorconfig.gemspec
84
+ - lib/colorconfig.rb
85
+ - lib/colorconfig/version.rb
86
+ - lib/mvn2/plugin/colorconfig.plugin.rb
87
+ homepage: https://github.com/henderea/colorconfig
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.0
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: color configuration
111
+ test_files: []
112
+ has_rdoc: