kffpt 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b2a0e00b38433ebe084cb2e9d193dfb6d08d779c
4
+ data.tar.gz: 8907d5f02e89961d0664e9d145df9df4d348eae4
5
+ SHA512:
6
+ metadata.gz: b0b390189c197edd9aedac3c1a5f0930add3622483caf8e1d71f82f545e1b8f8ce765085e044df5a1937e8a7d8df4fec2a30ebd55a15b9a3c715cfbb9da280ac
7
+ data.tar.gz: 88ce7cad3af238bb1f9c2282244bc765553e190247b1fb9734f9ca1054c9d06a029dc641423a70302cf9742f16572152149305d623d8be1a29a9dac674048b70
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *~
2
+ *.gem
3
+ *.log
4
+ *.out
5
+ *.pid
6
+ *.swp
7
+ .DS_Store
8
+ .yardoc
9
+ doc
10
+ pkg
11
+ tmp
12
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'pry'
7
+ gem 'rake'
8
+ gem 'yard'
9
+ gem 'version'
10
+ gem 'rubygems-tasks'
11
+ end
12
+
13
+ group :test do
14
+ gem 'minitest'
15
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2014 Sean Clemmer
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ require 'rake'
4
+
5
+
6
+ # "rake test"
7
+ require 'rake/testtask'
8
+ Rake::TestTask.new(:test) do |test|
9
+ test.libs << 'lib' << 'test'
10
+ test.test_files = FileList['test/test*.rb']
11
+ test.verbose = true
12
+ end
13
+
14
+ task :default => :test
15
+
16
+
17
+ # "rake yard"
18
+ require 'yard'
19
+ YARD::Rake::YardocTask.new do |t|
20
+ t.files = %w[ --readme Readme.md lib/**/*.rb - VERSION ]
21
+ end
22
+
23
+
24
+ # "rake build"
25
+ require 'rubygems/tasks'
26
+ Gem::Tasks.new({
27
+ push: true,
28
+ sign: {}
29
+ }) do |tasks|
30
+ tasks.console.command = 'pry'
31
+ end
32
+ Gem::Tasks::Sign::Checksum.new sha2: true
33
+
34
+
35
+ # "rake version"
36
+ require 'rake/version_task'
37
+ Rake::VersionTask.new
data/Readme.md ADDED
@@ -0,0 +1,3 @@
1
+ # kffpt
2
+
3
+ Because it's easier to Google than "Chef"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/bin/kffpt ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'kffpt'
3
+
4
+ Kffpt::Main.start ARGV, shell: Thor::Shell::Color.new
data/kffpt.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path(File.join('..', 'lib'), __FILE__)
3
+ require 'kffpt/metadata'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'kffpt'
7
+ s.version = Kffpt::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.author = Kffpt::AUTHOR
10
+ s.email = Kffpt::EMAIL
11
+ s.summary = Kffpt::SUMMARY
12
+ s.description = Kffpt::SUMMARY + '.'
13
+ s.homepage = Kffpt::HOMEPAGE
14
+ s.license = Kffpt::LICENSE
15
+
16
+ s.add_runtime_dependency 'thor', '~> 0'
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- test/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File::basename(f) }
21
+ s.require_paths = %w[ lib ]
22
+ end
data/lib/kffpt.rb ADDED
@@ -0,0 +1,2 @@
1
+ require_relative 'kffpt/main'
2
+ require_relative 'kffpt/metadata'
@@ -0,0 +1,54 @@
1
+ module Logger
2
+ %w[ black red green yellow blue magenta cyan white ].each do |c|
3
+ define_method c do |m|
4
+ return m if options[:log]
5
+ set_color m, c.to_sym
6
+ end
7
+ end
8
+
9
+ def log message, level
10
+ '%s [%s] %s -- %s' % [
11
+ level,
12
+ Time.now.iso8601(6),
13
+ File::basename(caller[4]),
14
+ message
15
+ ]
16
+ end
17
+
18
+ def out
19
+ begin
20
+ @@log
21
+ rescue NameError
22
+ started = File.exist? options[:log]
23
+ @@log = File.open options[:log], 'a'
24
+ @@log.puts '# Log started %s' % Time.now unless started
25
+ @@log
26
+ end
27
+ end
28
+
29
+ def stderr
30
+ return out if options[:log]
31
+ $stderr
32
+ end
33
+
34
+ def stdout
35
+ return out if options[:log]
36
+ $stdout
37
+ end
38
+
39
+ def info m
40
+ if options[:debug] || options[:trace]
41
+ stdout.puts green(log(m, 'INFO'))
42
+ else
43
+ stdout.puts green(m)
44
+ end
45
+ end
46
+
47
+ def debug m
48
+ stderr.puts blue(log(m, 'DEBUG')) if options[:debug]
49
+ end
50
+
51
+ def trace m
52
+ stderr.puts magenta(log(m, 'TRACE')) if options[:trace]
53
+ end
54
+ end
data/lib/kffpt/main.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'thor'
2
+
3
+ require_relative 'logger'
4
+
5
+ module Kffpt
6
+ class Main < Thor
7
+ include Logger
8
+
9
+ class_option :debug, type: :boolean, default: false, desc: 'Enable debugging output'
10
+ class_option :trace, type: :boolean, default: false, desc: 'Enable tracing output'
11
+ class_option :log, type: :string, desc: 'Log to file, not STDOUT'
12
+
13
+ desc 'art', 'Show application art'
14
+ def art
15
+ puts
16
+ puts 'kffpt'.center(SUMMARY.length-4)
17
+ puts "v#{VERSION}".center(SUMMARY.length-4)
18
+ puts
19
+ puts SUMMARY
20
+ puts "#{AUTHOR} (#{EMAIL})".center(SUMMARY.length-2)
21
+ puts "\n\n\n"
22
+ # We're going to center the raw art and remove the pipes
23
+ art = ART.gsub(/^ +/, '').split("\n").map do |s|
24
+ s.center(SUMMARY.length-4)
25
+ end.join("\n").gsub('|',' ')
26
+ puts art
27
+ puts "\n\n\n"
28
+ end
29
+
30
+ desc 'version', 'Show application version'
31
+ def version
32
+ puts VERSION
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,26 @@
1
+ module Kffpt
2
+ # General information about the project
3
+ SUMMARY = %q.Because it's easier to Google than "Chef".
4
+ AUTHOR = 'Sean Clemmer'
5
+ EMAIL = 'sczizzo@gmail.com'
6
+ LICENSE = 'ISC'
7
+ HOMEPAGE = 'https://github.com/sczizzo/kffpt'
8
+
9
+ # Pull the project version out of the VERSION file
10
+ VERSION = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).strip
11
+
12
+ # Every project deserves its own ASCII art
13
+ ART = <<-EOART
14
+ |kffpt|
15
+ | ** |
16
+ |* * |
17
+ | *|
18
+ | |
19
+ |* |
20
+ | *|
21
+ | |
22
+ | |
23
+ | ** |
24
+ | * |
25
+ EOART
26
+ end
@@ -0,0 +1,24 @@
1
+ require 'tmpdir'
2
+ require 'tempfile'
3
+ require 'fileutils'
4
+ require 'pathname'
5
+
6
+ require 'minitest/autorun'
7
+
8
+ require_relative '../lib/kffpt'
9
+
10
+
11
+
12
+ class TestKffpt < MiniTest::Test
13
+ def setup
14
+ @tmpdir = Dir.mktmpdir
15
+ end
16
+
17
+ def teardown
18
+ FileUtils.rm_rf @tmpdir
19
+ end
20
+
21
+ def test_something
22
+ assert true
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kffpt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean Clemmer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Because it's easier to Google than "Chef".
28
+ email: sczizzo@gmail.com
29
+ executables:
30
+ - kffpt
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - LICENSE
37
+ - Rakefile
38
+ - Readme.md
39
+ - VERSION
40
+ - bin/kffpt
41
+ - kffpt.gemspec
42
+ - lib/kffpt.rb
43
+ - lib/kffpt/logger.rb
44
+ - lib/kffpt/main.rb
45
+ - lib/kffpt/metadata.rb
46
+ - test/test_kffpt.rb
47
+ homepage: https://github.com/sczizzo/kffpt
48
+ licenses:
49
+ - ISC
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.4.2
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Because it's easier to Google than "Chef"
71
+ test_files:
72
+ - test/test_kffpt.rb