prometheus 0.1.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.
Files changed (39) hide show
  1. data/.gitignore +4 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +24 -0
  5. data/LICENSE +20 -0
  6. data/README.md +113 -0
  7. data/Rakefile +11 -0
  8. data/bin/prometheus +26 -0
  9. data/lib/prometheus/base.rb +34 -0
  10. data/lib/prometheus/extra/config/README +0 -0
  11. data/lib/prometheus/extra/config/config_commands.rb +37 -0
  12. data/lib/prometheus/extra/config/lib/.config.rb.swn +0 -0
  13. data/lib/prometheus/extra/config/lib/config.rb +53 -0
  14. data/lib/prometheus/extra/config/lib/plugin_dsl.rb +27 -0
  15. data/lib/prometheus/plugin_dsl.rb +13 -0
  16. data/lib/prometheus/plugins/app/README +1 -0
  17. data/lib/prometheus/plugins/app/app_commands.rb +20 -0
  18. data/lib/prometheus/plugins/core/core_commands.rb +7 -0
  19. data/lib/prometheus/plugins/plugin/README +1 -0
  20. data/lib/prometheus/plugins/plugin/plugin_commands.rb +25 -0
  21. data/lib/prometheus/repl/command.rb +34 -0
  22. data/lib/prometheus/repl.rb +103 -0
  23. data/lib/prometheus/version.rb +3 -0
  24. data/lib/prometheus.rb +8 -0
  25. data/prometheus.gemspec +26 -0
  26. data/templates/app/%name%.gemspec.tt +26 -0
  27. data/templates/app/.gitignore +4 -0
  28. data/templates/app/Gemfile +2 -0
  29. data/templates/app/README.md +1 -0
  30. data/templates/app/Rakefile +1 -0
  31. data/templates/app/bin/%name%.tt +4 -0
  32. data/templates/app/lib/%name%/plugins/.empty_directory +0 -0
  33. data/templates/app/lib/%name%/version.rb.tt +3 -0
  34. data/templates/app/lib/%name%.rb.tt +20 -0
  35. data/templates/app/templates/default_config.yml +2 -0
  36. data/templates/default_config.yml +2 -0
  37. data/templates/plugin/%name%_commands.rb.tt +12 -0
  38. data/templates/plugin/README.tt +1 -0
  39. metadata +135 -0
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ # For vim:
2
+ *.swp
3
+ *.swo
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create ruby-1.9.3-p0@prometheus_gem
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ prometheus (0.1.0)
5
+ active_support
6
+ settingslogic
7
+ thor
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ active_support (3.0.0)
13
+ activesupport (= 3.0.0)
14
+ activesupport (3.0.0)
15
+ rake (0.9.2.2)
16
+ settingslogic (2.0.8)
17
+ thor (0.14.6)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ prometheus!
24
+ rake
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Logan Koester
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,113 @@
1
+ ## Prometheus
2
+
3
+ Prometheus is a lightweight, modular framework built on [Thor](https://github.com/wycats/thor) to quickly create beautiful
4
+ command-line interfaces for your gems. It provides a standardized layout with generators,
5
+ smart configuration, and an interactive console to work with your tasks.
6
+
7
+ ### Getting Started
8
+
9
+ Install the gem and run it to enter interactive mode
10
+
11
+ $ gem install prometheus
12
+
13
+ ### Creating a new application
14
+
15
+ You can use the app generator to create a new application in your working directory.
16
+
17
+ $ prometheus app new my_app
18
+ create my_app
19
+ create my_app/my_app.gemspec
20
+ create my_app/.gitignore
21
+ create my_app/Gemfile
22
+ create my_app/README.md
23
+ create my_app/Rakefile
24
+ create my_app/bin/my_app
25
+ create my_app/lib/my_app.rb
26
+ create my_app/lib/my_app/version.rb
27
+ create my_app/templates/default_config.yml
28
+ chmod my_app/bin/my_app
29
+ $
30
+
31
+ ### Automatic Configuration
32
+
33
+ The first time you run a Prometheus app, it will create a config file in your $HOME
34
+
35
+ $ cd my_app
36
+ $ bin/my_app
37
+ Welcome to MyApp! You must be new, since you don't have a configuration file :-)
38
+ Okay to create at /home/ldk/.my_app/config? (Y/N)
39
+ create /home/ldk/.my_app/config
40
+ Prometheus Shell
41
+ Project root [~/hack]>
42
+
43
+ Configuration saved!
44
+ $
45
+
46
+ Your plugins can specify configurables that will be added to this file. Your app will
47
+ ensure that all the necessary values are set before running any tasks, even if you add
48
+ more later.
49
+
50
+ ### Interactive Mode
51
+
52
+ If you do not pass a task to run, a Prometheus application will open an interactive
53
+ console in the namespace you specify. You can use the application this way, jumping
54
+ into and out of namespaces as you please.
55
+
56
+ $ prometheus
57
+ Prometheus - Interactive mode, try 'exit' or 'help' for usage
58
+ Prometheus:commands> plugin
59
+ Manage Plugins - Interactive mode, try 'exit' or 'help' for usage
60
+ Prometheus:plugin> exit
61
+ Prometheus:commands> exit
62
+ $
63
+
64
+ You can also execute system or Ruby commands with the !! and !! operators.
65
+
66
+ "! cmd" - Execute a system command
67
+ "!! cmd" - Execute a line of Ruby
68
+ "!!" - Toggle "debug mode", an interactive ruby REPL in the current process.
69
+
70
+ ### Adding Plugins
71
+
72
+ Now that you have a barebones application, you can start implementing your own
73
+ functionality by way of plugins. Let's create one now.
74
+
75
+ $ cd my_app
76
+ $ prometheus plugin new say_hello
77
+ create lib/my_app/plugins/say_hello
78
+ create lib/my_app/plugins/say_hello/say_hello_commands.rb
79
+ create lib/my_app/plugins/say_hello/README
80
+ New plugin adding to application at /home/ldk/Dropbox/home/hack/oss/prometheus/my_app/lib/my_app/plugins/say_hello
81
+ Remember, this plugin will not be active until registered in your Prometheus::Commands subclass
82
+ $
83
+
84
+ If you open up `lib/my_app/plugins/say_hello/say_hello_commands.rb`, you will see something like this
85
+
86
+ module PrometheusApp
87
+ class SayHello < Prometheus::Base
88
+
89
+ full_name 'say_hello'
90
+ namespace :say_hello
91
+ readme File.read(File.expand_path('../README', __FILE__))
92
+
93
+ desc 'new_task', 'A newly generated plugin task'
94
+ def new_task
95
+ end
96
+ end
97
+ end
98
+
99
+ Remove the boilerplate `new_task` and add your own greeting. Then jump out into `lib/my_app.rb` and register your new plugin.
100
+
101
+ [...]
102
+
103
+ class Commands < Prometheus::Commands
104
+ readme File.read(File.expand_path('../../README.md', __FILE__))
105
+ register SayHello, 'hello', 'hello', 'Display a greeting'
106
+ end
107
+ end
108
+
109
+ That's all there is to it. From here on out, it's just regular [Thor](https://github.com/wycats/thor).
110
+
111
+ ### License
112
+
113
+ Released under the MIT License. See the LICENSE file for further details.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ module Rake
4
+ def self.remove_task(task_name)
5
+ Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)
6
+ end
7
+ end
8
+
9
+ Rake.class_eval do
10
+ remove_task 'release'
11
+ end
data/bin/prometheus ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'active_support/inflector'
4
+ require File.expand_path('../../lib/prometheus', __FILE__)
5
+ APP_NAME = 'Prometheus'
6
+ CONFIG_PATH = "#{ENV['HOME']}/.prometheus/config"
7
+ TEMPLATES_PATH = File.expand_path('../../templates', __FILE__)
8
+ PROMPT='Prometheus'
9
+
10
+ # Load all modules
11
+ Dir[File.expand_path(
12
+ File.join('..', '..', 'lib', 'prometheus', 'plugins', '**', '*_commands.rb'), __FILE__
13
+ )].each { |m| require m }
14
+
15
+ module PrometheusApp
16
+ include Prometheus
17
+ class Commands < Prometheus::Commands
18
+ namespace :core
19
+ full_name 'Prometheus Shell'
20
+ readme File.read(File.expand_path('../../README.md', __FILE__))
21
+ register App, 'app', 'app <command>', 'Prometheus application generator'
22
+ register Prometheus::Plugin, 'plugin', 'plugin <command>', 'Manage plugins for the current application'
23
+ end
24
+ end
25
+
26
+ PrometheusApp::Commands.start
@@ -0,0 +1,34 @@
1
+ require_relative 'plugin_dsl'
2
+ require_relative 'repl'
3
+
4
+ module Prometheus
5
+ class Base < Thor
6
+ extend PluginDSL
7
+ class << self
8
+ def repl_banner
9
+ "\e[34m#{self.full_name} \e[0m- Interactive mode, try 'exit' or 'help' for usage"
10
+ end
11
+
12
+ def banner(task, namespace = true, subcommand = false)
13
+ "#{task.formatted_usage(self, false, subcommand)}"
14
+ end
15
+ end
16
+
17
+ desc 'repl', 'Interactive mode', :hide => true
18
+ def repl
19
+ $interactive = true
20
+ Repl.start self
21
+ $interactive = false
22
+ end
23
+
24
+ default_task :repl
25
+
26
+ def help(task = nil, subcommand = false)
27
+ unless task && subcommand
28
+ say self.class.readme, :green
29
+ end
30
+ super(task, subcommand)
31
+ end
32
+
33
+ end
34
+ end
File without changes
@@ -0,0 +1,37 @@
1
+ require_relative 'lib/config'
2
+ require_relative 'lib/plugin_dsl'
3
+
4
+ module Prometheus
5
+ class ConfigCommands < Prometheus::Base
6
+ include Thor::Actions
7
+
8
+ full_name 'Configuration Management'
9
+ namespace :config
10
+ def self.source_root; TEMPLATES_PATH; end
11
+ readme File.read(File.expand_path('../README', __FILE__))
12
+
13
+ desc 'edit', "Write configuration to #{CONFIG_PATH} (interactive)"
14
+ def edit
15
+ if File.exists?(CONFIG_PATH)
16
+ Config.configure(self)
17
+ else
18
+ say "Welcome to #{APP_NAME}! You must be new, since you don't have a configuration file :-)", :blue
19
+ if yes? "Okay to create at #{CONFIG_PATH}? (Y/N)", :green
20
+ copy_file "default_config.yml", CONFIG_PATH
21
+ Config.configure(self)
22
+ else
23
+ say 'Sorry, you have to create a configuration file to proceed.', :red
24
+ exit
25
+ end
26
+ end
27
+ end
28
+
29
+ desc 'repair', 'Update configuration to fix missing values', :hide => true
30
+ def repair
31
+ say "Some configuration options have changed, please review", :green
32
+ say "You are missing: #{Config.missing_configurables.join(', ')}", :red
33
+ Config.configure(self)
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ module Prometheus
2
+ class Config < Settingslogic
3
+ source ::CONFIG_PATH
4
+ class << self
5
+ attr_accessor :configurables
6
+
7
+ # Options for hash:
8
+ # :label => 'Some Configurable'
9
+ # :default => 'default value'
10
+ def ask(shell, key, opts={})
11
+ default = Config[key] || opts[:default]
12
+ opts[:label] ||= key
13
+ answer = shell.ask(opts[:label] + " [#{default}]>")
14
+ Config[key] = (answer.size > 0) ? answer : default
15
+ end
16
+
17
+ def save(shell = Thor::Shell::Basic.new)
18
+ out = {}.update(self)
19
+ begin
20
+ File.open(CONFIG_PATH, 'w') { |f| f << out.to_yaml }
21
+ puts
22
+ shell.say 'Configuration saved!', :blue
23
+ puts
24
+ rescue Exception => e
25
+ shell.say e, :red
26
+ end
27
+ end
28
+
29
+ def configure(shell = Thor::Shell::Basic.new)
30
+ if @configurables
31
+ @configurables.each do |plugin, configurables|
32
+ shell.say plugin, :blue
33
+ configurables.each do |c|
34
+ Config.ask(shell, c[:key], :label => " #{c[:label]}", :default => c[:default])
35
+ end
36
+ end
37
+
38
+ Config.save
39
+ else
40
+ shell.say 'No plugins require configuration'
41
+ end
42
+ end
43
+
44
+ # Return an array of configurable keys that are not found in the user's config
45
+ def missing_configurables
46
+ return [] unless @configurables
47
+ configurable_keys = @configurables.map { |k, v| v.map { |i| i[:key].to_s } }.flatten
48
+ configurable_keys.reject { |k| Config.keys.include? k }
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,27 @@
1
+ module Prometheus
2
+ module PluginDSL
3
+ # Make sure the user has a complete config before continuing.
4
+ def start
5
+ if File.exists? CONFIG_PATH
6
+ if Config.missing_configurables.size > 0
7
+ Prometheus::ConfigCommands.new.invoke :repair
8
+ else
9
+ super
10
+ end
11
+ else
12
+ Prometheus::ConfigCommands.new.invoke :edit
13
+ end
14
+ end
15
+
16
+ # Options for hash:
17
+ # :label => 'Some Configurable'
18
+ # :default => 'default value'
19
+ def configurable(klass, key, opts={})
20
+ opts[:key] = key
21
+ opts[:label] ||= key
22
+ Config.configurables ||= {}
23
+ Config.configurables[klass.full_name] ||= []
24
+ Config.configurables[klass.full_name] << opts
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,13 @@
1
+ module Prometheus
2
+ module PluginDSL
3
+
4
+ def readme(text = nil)
5
+ @readme ||= text
6
+ end
7
+
8
+ def full_name(str = nil)
9
+ @full_name ||= str
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ Generate a new Prometheus application.
@@ -0,0 +1,20 @@
1
+ module PrometheusApp
2
+ class App < Prometheus::Base
3
+ include Thor::Actions
4
+ attr_accessor :name, :author_name, :author_email
5
+
6
+ full_name 'Application Generator'
7
+ namespace :app
8
+ def self.source_root; TEMPLATES_PATH; end
9
+ readme File.read(File.expand_path('../README', __FILE__))
10
+
11
+ desc 'new', 'Generate a new Prometheus application'
12
+ def new(name)
13
+ @name = name
14
+ @author_name = `git config --global --get user.name`.strip
15
+ @author_email = `git config --global --get user.email`.strip
16
+ directory 'app', @name
17
+ chmod "#{@name}/bin/#{@name}", '+x'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ module Prometheus
2
+ class Commands < Prometheus::Base
3
+ include Thor::Actions
4
+ source_root TEMPLATES_PATH
5
+ # Tasks added here will be available in all generated Prometheus applications.
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ Manage plugins for the current application
@@ -0,0 +1,25 @@
1
+ module Prometheus
2
+ class Plugin < Prometheus::Base
3
+ include Thor::Actions
4
+ attr_accessor :name
5
+
6
+ full_name 'Manage Plugins'
7
+ namespace :plugin
8
+ def self.source_root; TEMPLATES_PATH; end
9
+ readme File.read(File.expand_path('../README', __FILE__))
10
+
11
+ desc 'new', 'Add a plugin to the application in the working directory'
12
+ def new(name)
13
+ @name = name
14
+ plugin_dirs = Dir[File.join(Dir.pwd, 'lib', '**', 'plugins')]
15
+ unless plugin_dirs.empty?
16
+ plugin_dir = File.expand_path(File.join(plugin_dirs.first, @name))
17
+ directory 'plugin', plugin_dir
18
+ say "New plugin adding to application at #{plugin_dir}", :green
19
+ say "Remember, this plugin will not be active until registered in your Prometheus::Commands subclass", :yellow
20
+ else
21
+ say "#{Dir.pwd} does not appear to be a Prometheus application", :red
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ module Prometheus
2
+ module Repl
3
+ module Command
4
+
5
+ class << self
6
+ def commands
7
+ @commands ||= {}
8
+ end
9
+
10
+ def define(*names, &block)
11
+ names.each do |name|
12
+ commands[name.to_sym] = block
13
+ end
14
+ end
15
+
16
+ def find(line)
17
+ if name = line.split(/\s+/, 2)[0]
18
+ commands[name.to_sym]
19
+ else
20
+ nil
21
+ end
22
+ end
23
+
24
+ def command_names
25
+ commands.keys
26
+ end
27
+
28
+ def [](name)
29
+ commands[name.to_sym]
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,103 @@
1
+ require_relative 'repl/command'
2
+
3
+ module Prometheus
4
+ module Repl
5
+ require 'readline'
6
+
7
+ Command.define 'exit', 'q' do
8
+ exit
9
+ end
10
+
11
+ Command.define 'system', '!' do |arg|
12
+ system arg
13
+ end
14
+
15
+ Command.define 'debug', '!!' do |arg|
16
+ if arg
17
+ @context.say eval(arg), :cyan
18
+ else
19
+ @debug_mode = true
20
+ end
21
+ end
22
+
23
+ class << self
24
+
25
+ def start(context)
26
+ @context = context
27
+ @debug_mode = false
28
+ setup_readline
29
+
30
+ puts @context.class.repl_banner
31
+
32
+ while buf = Readline.readline(prompt, true)
33
+ line = buf.strip
34
+ next if line.empty?
35
+ begin
36
+ if @debug_mode
37
+ if line == '!!'
38
+ @debug_mode = false
39
+ else
40
+ @context.say eval(line), :cyan
41
+ end
42
+ else
43
+ execute line
44
+ end
45
+ rescue SystemExit
46
+ raise
47
+ rescue Exception => e
48
+ @context.say "#{e.message}\n#{e.backtrace.join("\n")}", :red
49
+ end
50
+ setup_readline
51
+ end
52
+ end
53
+
54
+ def prompt
55
+ ns = @context.class.namespace.split(':').last
56
+ ns = 'debug' if @debug_mode
57
+ "\e[34m#{PROMPT}:\e[35m#{ns}\e[0m>\e "
58
+ end
59
+
60
+ def setup_readline
61
+ Readline.basic_word_break_characters = ""
62
+ Readline.completion_proc = lambda do |word|
63
+ (
64
+ @context.class.tasks.keys.map { |name| name } +
65
+ Command.command_names.map { |name| name.to_s } +
66
+ ['help']
67
+ ).grep(/#{Regexp.quote(word)}/)
68
+ end
69
+ end
70
+
71
+ def execute(line)
72
+ if command = Command.find(line)
73
+ arg = line.split(/\s+/, 2)[1] rescue nil
74
+ command.call(arg)
75
+ else
76
+ invoke(line.strip)
77
+ end
78
+ end
79
+
80
+ def invoke(line)
81
+ start = Time.now
82
+
83
+ name, *args = line.split(/\s+/)
84
+ pid = fork do
85
+ args.each do |arg|
86
+ env, value = arg.split('=')
87
+ next unless env && !env.empty? && value && !value.empty?
88
+ ENV[env] = value
89
+ end
90
+ begin
91
+ @context.invoke(name, args)
92
+ rescue Exception => e
93
+ raise unless e.to_s == "undefined method `<=' for nil:NilClass"
94
+ @context.say "I don't know that task, try 'help' to see what's available", :red
95
+ end
96
+ end
97
+ Process.waitpid(pid)
98
+ end
99
+
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,3 @@
1
+ module Prometheus
2
+ VERSION = "0.1.0"
3
+ end
data/lib/prometheus.rb ADDED
@@ -0,0 +1,8 @@
1
+ $interactive = false
2
+
3
+ require 'rubygems'
4
+ require File.expand_path('../prometheus/version', __FILE__)
5
+ %w{thor fileutils logger yaml settingslogic}.each { |r| require r }
6
+ require 'thor/group'
7
+
8
+ require File.expand_path('../prometheus/base', __FILE__)
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'prometheus/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "prometheus"
7
+ s.version = Prometheus::VERSION
8
+ s.authors = ["Logan Koester"]
9
+ s.email = ["logan@logankoester.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{A lightweight layer above Thor to quickly create beautiful command-line interfaces.}
12
+ s.description = %q{A lightweight layer above Thor to quickly create beautiful command-line interfaces.}
13
+ s.executables = ['prometheus']
14
+ s.default_executable = %q{prometheus}
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'thor'
22
+ s.add_dependency 'settingslogic'
23
+ s.add_dependency 'active_support'
24
+
25
+ s.add_development_dependency 'rake'
26
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "<%= @name %>/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "<%= @name %>"
7
+ s.version = <%= @name.camelize %>::VERSION
8
+ s.authors = [<%= @author_name %>]
9
+ s.email = ["<%= @author_email %>"]
10
+ s.homepage = ""
11
+ s.summary = %q{TODO: Write a gem summary}
12
+ s.description = %q{TODO: Write a gem description}
13
+
14
+ s.rubyforge_project = "<%= @name %>"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+
25
+ s.add_dependency 'prometheus'
26
+ end
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1 @@
1
+ A new project generated by Prometheus
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path('../../lib/<%= @name %>', __FILE__)
4
+ <%= @name.camelize %>::Commands.start
File without changes
@@ -0,0 +1,3 @@
1
+ module <%= @name.camelize %>
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ require_relative "<%= @name %>/version"
2
+ require 'prometheus'
3
+
4
+ APP_NAME = '<%= @name.camelize %>'
5
+ CONFIG_PATH = "#{ENV['HOME']}/.<%= @name %>/config"
6
+ TEMPLATES_PATH = File.expand_path('../../templates', __FILE__)
7
+ PROMPT='<%= @name.camelize %>'
8
+
9
+ require 'prometheus/extra/config/config_commands'
10
+ require 'prometheus/plugins/core/core_commands'
11
+ module <%= @name.camelize %>
12
+ include Prometheus
13
+
14
+ # Load all modules
15
+ Dir['lib/<%= @name %>/plugins/**/*_commands.rb'].each { |m| require File.expand_path("../../#{m}", __FILE__) }
16
+
17
+ class Commands < Prometheus::Commands
18
+ readme File.read(File.expand_path('../../README.md', __FILE__))
19
+ end
20
+ end
@@ -0,0 +1,2 @@
1
+ ---
2
+ project_root: ~/hack
@@ -0,0 +1,2 @@
1
+ ---
2
+ project_root: ~/hack
@@ -0,0 +1,12 @@
1
+ module PrometheusApp
2
+ class <%= @name.camelize %> < Prometheus::Base
3
+
4
+ full_name '<%= @name %>'
5
+ namespace :<%= @name %>
6
+ readme File.read(File.expand_path('../README', __FILE__))
7
+
8
+ desc 'new_task', 'A newly generated plugin task'
9
+ def new_task
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ A newly generated plugin.
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prometheus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Logan Koester
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &9169380 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *9169380
25
+ - !ruby/object:Gem::Dependency
26
+ name: settingslogic
27
+ requirement: &9168860 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *9168860
36
+ - !ruby/object:Gem::Dependency
37
+ name: active_support
38
+ requirement: &9168380 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *9168380
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &9167740 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *9167740
58
+ description: A lightweight layer above Thor to quickly create beautiful command-line
59
+ interfaces.
60
+ email:
61
+ - logan@logankoester.com
62
+ executables:
63
+ - prometheus
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - .gitignore
68
+ - .rvmrc
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE
72
+ - README.md
73
+ - Rakefile
74
+ - bin/prometheus
75
+ - lib/prometheus.rb
76
+ - lib/prometheus/base.rb
77
+ - lib/prometheus/extra/config/README
78
+ - lib/prometheus/extra/config/config_commands.rb
79
+ - lib/prometheus/extra/config/lib/.config.rb.swn
80
+ - lib/prometheus/extra/config/lib/config.rb
81
+ - lib/prometheus/extra/config/lib/plugin_dsl.rb
82
+ - lib/prometheus/plugin_dsl.rb
83
+ - lib/prometheus/plugins/app/README
84
+ - lib/prometheus/plugins/app/app_commands.rb
85
+ - lib/prometheus/plugins/core/core_commands.rb
86
+ - lib/prometheus/plugins/plugin/README
87
+ - lib/prometheus/plugins/plugin/plugin_commands.rb
88
+ - lib/prometheus/repl.rb
89
+ - lib/prometheus/repl/command.rb
90
+ - lib/prometheus/version.rb
91
+ - prometheus.gemspec
92
+ - templates/app/%name%.gemspec.tt
93
+ - templates/app/.gitignore
94
+ - templates/app/Gemfile
95
+ - templates/app/README.md
96
+ - templates/app/Rakefile
97
+ - templates/app/bin/%name%.tt
98
+ - templates/app/lib/%name%.rb.tt
99
+ - templates/app/lib/%name%/plugins/.empty_directory
100
+ - templates/app/lib/%name%/version.rb.tt
101
+ - templates/app/templates/default_config.yml
102
+ - templates/default_config.yml
103
+ - templates/plugin/%name%_commands.rb.tt
104
+ - templates/plugin/README.tt
105
+ homepage: ''
106
+ licenses: []
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ segments:
118
+ - 0
119
+ hash: -4079501309383063987
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
127
+ - 0
128
+ hash: -4079501309383063987
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 1.8.10
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: A lightweight layer above Thor to quickly create beautiful command-line interfaces.
135
+ test_files: []