summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZack Hobson2013-12-27 10:15:59 -0800
committerZack Hobson2013-12-27 10:15:59 -0800
commit40610cb63b577bed614bc6d5348dfde1ba66e26f (patch)
tree8a8cbbf23c56b4847587e5963886a7f39dbbe5a2 /lib
parent51236213fdf0a62d2795e2a3c341e87ab8d83117 (diff)
parentf0eee83fcdf3047674db3310f2847704021e54e1 (diff)
downloadhcl-40610cb63b577bed614bc6d5348dfde1ba66e26f.tar.bz2
Merge branch 'master' into resource_routes
Diffstat (limited to 'lib')
-rw-r--r--lib/hcl.rb1
-rw-r--r--lib/hcl/commands.rb6
-rw-r--r--lib/hcl/console.rb19
3 files changed, 26 insertions, 0 deletions
diff --git a/lib/hcl.rb b/lib/hcl.rb
index 5d6f108..b041538 100644
--- a/lib/hcl.rb
+++ b/lib/hcl.rb
@@ -3,6 +3,7 @@ module HCl
autoload :App, 'hcl/app'
autoload :Net, 'hcl/net'
autoload :Commands, 'hcl/commands'
+ autoload :Console, 'hcl/console'
autoload :TimesheetResource, 'hcl/timesheet_resource'
autoload :Utility, 'hcl/utility'
autoload :Project, 'hcl/project'
diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb
index 08d8a1e..834ba2c 100644
--- a/lib/hcl/commands.rb
+++ b/lib/hcl/commands.rb
@@ -1,5 +1,6 @@
require 'chronic'
require 'highline'
+require 'pry'
module HCl
module Commands
@@ -10,6 +11,11 @@ module HCl
Net.config_hash.merge(password:'***').map {|k,v| "#{k}: #{v}" }.join("\n")
end
+ def console
+ Console.new(self)
+ nil
+ end
+
def tasks project_code=nil
tasks = Task.all
if tasks.empty? # cache tasks
diff --git a/lib/hcl/console.rb b/lib/hcl/console.rb
new file mode 100644
index 0000000..da0f7c5
--- /dev/null
+++ b/lib/hcl/console.rb
@@ -0,0 +1,19 @@
+require 'pp'
+
+module HCl
+ class Console
+ attr_reader :hcl
+ def initialize app
+ @hcl = app
+ binding.pry quiet: true,
+ prompt:[->(a,b,c){"#{$PROGRAM_NAME}> "}],
+ print:->(io, *p){ pp p }
+ end
+
+ Commands.instance_methods.each do |command|
+ define_method command do |*args|
+ puts @hcl.send(command, *args)
+ end
+ end
+ end
+end