agent-s 0.0.2

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: 80b97c3e7a04a825d7774298938cc0890d30f978
4
+ data.tar.gz: b1545b7063c39d6e0760219f1031e47e0cd0e57f
5
+ SHA512:
6
+ metadata.gz: 729ca604f4aa4018a6210ed263326479749bea220b009bf08cc913a3aba63fbc2fa2c6a85a09a71e04382043e83d9304434a6a24ed1cbf52b4342bfb34e2d7cd
7
+ data.tar.gz: 61b8d29896202fb43fa76b0c1218c74987e1c5f42a6bde4714e23658bdc1aec2762d1c6807c49b1782d048eab53a144e1764b63e83b9feb10c43dd6f9079896f
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ agent (0.0.1)
5
+ gli (= 2.12.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aruba (0.6.2)
11
+ childprocess (>= 0.3.6)
12
+ cucumber (>= 1.1.1)
13
+ rspec-expectations (>= 2.7.0)
14
+ builder (3.2.2)
15
+ childprocess (0.5.5)
16
+ ffi (~> 1.0, >= 1.0.11)
17
+ cucumber (1.3.19)
18
+ builder (>= 2.1.2)
19
+ diff-lcs (>= 1.1.3)
20
+ gherkin (~> 2.12)
21
+ multi_json (>= 1.7.5, < 2.0)
22
+ multi_test (>= 0.1.2)
23
+ diff-lcs (1.2.5)
24
+ ffi (1.9.6)
25
+ gherkin (2.12.2)
26
+ multi_json (~> 1.3)
27
+ gli (2.12.3)
28
+ json (1.8.2)
29
+ multi_json (1.10.1)
30
+ multi_test (0.1.2)
31
+ rake (10.4.2)
32
+ rdoc (4.2.0)
33
+ json (~> 1.4)
34
+ rspec-expectations (3.2.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.2.0)
37
+ rspec-support (3.2.2)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ agent!
44
+ aruba
45
+ rake
46
+ rdoc
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ Agent
2
+ =====
3
+
4
+ ### Purpose #
5
+
6
+ Allows users to interact with the [Energy Tranistion Model] (http://www.energytransitionmodel.com/)
7
+ through the terminal.
8
+
9
+ ### Features #
10
+
11
+ * Displays JSON representaion of all/specific areas used in the ETM
12
+ * Displays simple/detailed JSON representation of any existing ETM Scenario
13
+ * TODO - Create new ETM Scenarios and update with your own settings/parameters
14
+ * TODO - See a collection of 'My Scenarios' for easy reference/access
15
+
16
+ ### Getting Started #
17
+
18
+ TODO
19
+ * Install gem
20
+ * Bundle
21
+ * `agent help` for info on commands
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+ Rake::RDocTask.new do |rd|
8
+ rd.main = "README.rdoc"
9
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
10
+ rd.title = 'Your application title'
11
+ end
12
+
13
+ spec = eval(File.read('agent.gemspec'))
14
+
15
+ Gem::PackageTask.new(spec) do |pkg|
16
+ end
17
+ CUKE_RESULTS = 'results.html'
18
+ CLEAN << CUKE_RESULTS
19
+ desc 'Run features'
20
+ Cucumber::Rake::Task.new(:features) do |t|
21
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
22
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
23
+ t.cucumber_opts = opts
24
+ t.fork = false
25
+ end
26
+
27
+ desc 'Run features tagged as work-in-progress (@wip)'
28
+ Cucumber::Rake::Task.new('features:wip') do |t|
29
+ tag_opts = ' --tags ~@pending'
30
+ tag_opts = ' --tags @wip'
31
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
32
+ t.fork = false
33
+ end
34
+
35
+ task :cucumber => :features
36
+ task 'cucumber:wip' => 'features:wip'
37
+ task :wip => 'features:wip'
38
+ require 'rake/testtask'
39
+ Rake::TestTask.new do |t|
40
+ t.libs << "test"
41
+ t.test_files = FileList['test/*_test.rb']
42
+ end
43
+
44
+ task :default => [:test,:features]
data/agent.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','agent','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'agent-s'
5
+ s.version = Agent::VERSION
6
+ s.author = 'Thomas Wilkinson'
7
+ s.email = 'twilkinson573@gmail.com'
8
+ s.homepage = 'http://github.com/twilkinson573/agent'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'Allows users to interact with the Energy Transition Model through the terminal'
11
+ s.files = `git ls-files`.split("
12
+ ")
13
+ s.require_paths << 'lib'
14
+ s.bindir = 'bin'
15
+ s.executables << 'agent'
16
+ s.add_development_dependency('rake')
17
+ s.add_development_dependency('rdoc')
18
+ s.add_development_dependency('aruba')
19
+ s.add_runtime_dependency('gli','2.12.3')
20
+ end
data/agent.rdoc ADDED
@@ -0,0 +1,5 @@
1
+ = agent
2
+
3
+ Generate this with
4
+ agent rdoc
5
+ After you have described your command line interface
data/bin/agent ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'json'
4
+ require 'agent'
5
+
6
+ include GLI::App
7
+
8
+ program_desc 'Interact with the Energy Transition Model through the terminal'
9
+
10
+ version Agent::VERSION
11
+
12
+ subcommand_option_handling :normal
13
+ arguments :strict
14
+
15
+ desc 'Returns a json object of all parameters of each market defined in the ETM'
16
+ arg_name 'area code (OPTIONAL)'
17
+ command :areas do |c|
18
+ c.action do |global_options,options,args|
19
+ unless args.empty?
20
+ areas = %x(curl -i http://et-engine.com/api/v3/areas/"#{ args.first }")
21
+ areas = '{' + areas.split('{', 2).last
22
+ else
23
+ areas = %x(curl -i http://et-engine.com/api/v3/areas/)
24
+ areas = "[" + areas.split('[').last
25
+ end
26
+
27
+ puts JSON.pretty_generate(JSON.parse(areas))
28
+ end
29
+ end
30
+
31
+ desc 'Display a specific ETM scenario by providing its ID'
32
+ arg_name 'scenario ID number'
33
+ command :show do |c|
34
+
35
+ c.desc 'Display complete scenario info including user modified slider settings'
36
+ c.switch [:d, :detailed]
37
+
38
+ c.action do |global_options,options,args|
39
+ exit_now!('id is required') if args.empty?
40
+ if options[:d]
41
+ scenario = %x(curl -i http://et-engine.com/api/v3/scenarios/"#{ args.first }"?detailed=true)
42
+ else
43
+ scenario = %x(curl -i http://et-engine.com/api/v3/scenarios/"#{ args.first }")
44
+ end
45
+ scenario = '{' + scenario.split('{', 2).last
46
+ puts JSON.pretty_generate(JSON.parse(scenario))
47
+ end
48
+ end
49
+
50
+ pre do |global,command,options,args|
51
+ # Pre logic here
52
+ # Return true to proceed; false to abort and not call the
53
+ # chosen command
54
+ # Use skips_pre before a command to skip this block
55
+ # on that command only
56
+ true
57
+ end
58
+
59
+ post do |global,command,options,args|
60
+ # Post logic here
61
+ # Use skips_post before a command to skip this
62
+ # block on that command only
63
+ end
64
+
65
+ on_error do |exception|
66
+ # Error logic here
67
+ # return false to skip default error handling
68
+ true
69
+ end
70
+
71
+ exit run(ARGV)
@@ -0,0 +1,8 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "agent"
8
+ Then the exit status should be 0
@@ -0,0 +1,6 @@
1
+ When /^I get help for "([^"]*)"$/ do |app_name|
2
+ @app_name = app_name
3
+ step %(I run `#{app_name} help`)
4
+ end
5
+
6
+ # Add more step definitions here
@@ -0,0 +1,15 @@
1
+ require 'aruba/cucumber'
2
+
3
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
4
+ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
5
+
6
+ Before do
7
+ # Using "announce" causes massive warnings on 1.9.2
8
+ @puts = true
9
+ @original_rubylib = ENV['RUBYLIB']
10
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
11
+ end
12
+
13
+ After do
14
+ ENV['RUBYLIB'] = @original_rubylib
15
+ end
data/lib/agent.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'agent/version.rb'
2
+
3
+ # Add requires for other files you add to your project here, so
4
+ # you just need to require this one file in your bin file
@@ -0,0 +1,3 @@
1
+ module Agent
2
+ VERSION = '0.0.2'
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class DefaultTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+
5
+ class Test::Unit::TestCase
6
+
7
+ # Add global extensions to the test case class here
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: agent-s
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Wilkinson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.12.3
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.12.3
69
+ description:
70
+ email: twilkinson573@gmail.com
71
+ executables:
72
+ - agent
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - Gemfile
77
+ - Gemfile.lock
78
+ - README.md
79
+ - Rakefile
80
+ - agent.gemspec
81
+ - agent.rdoc
82
+ - bin/agent
83
+ - features/agent.feature
84
+ - features/step_definitions/agent_steps.rb
85
+ - features/support/env.rb
86
+ - lib/agent.rb
87
+ - lib/agent/version.rb
88
+ - test/default_test.rb
89
+ - test/test_helper.rb
90
+ homepage: http://github.com/twilkinson573/agent
91
+ licenses: []
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.4.1
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Allows users to interact with the Energy Transition Model through the terminal
114
+ test_files: []