gooddata 0.6.0.pre10 → 0.6.0.pre11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +2 -0
  3. data/.gitignore +3 -0
  4. data/.travis.yml +7 -0
  5. data/.yardopts +3 -2
  6. data/README.md +8 -145
  7. data/Rakefile +23 -6
  8. data/bin/gooddata +3 -400
  9. data/doc/pages/GET_STARTED.md +5 -4
  10. data/doc/pages/HOMEPAGE.md +2 -0
  11. data/doc/pages/TUTORIALS.md +3 -3
  12. data/doc/pages/tutorial/BRICKS.md +4 -1
  13. data/doc/pages/tutorial/CREATING_A_MODEL.md +2 -0
  14. data/doc/pages/tutorial/CRUNCHING_NUMBERS.md +1 -3
  15. data/doc/pages/tutorial/TEST_DRIVEN_DEVELOPMENT.md +2 -0
  16. data/doc/pages/tutorial/YOUR_FIRST_PROJECT.md +4 -3
  17. data/doc/templates/default/class/setup.rb +1 -0
  18. data/doc/templates/default/method_details/setup.rb +2 -1
  19. data/doc/templates/default/module/setup.rb +1 -1
  20. data/gooddata +7 -0
  21. data/gooddata.gemspec +1 -0
  22. data/lib/gooddata.rb +15 -4
  23. data/lib/gooddata/bricks/base_downloader.rb +1 -0
  24. data/lib/gooddata/bricks/brick.rb +17 -12
  25. data/lib/gooddata/bricks/bricks.rb +7 -0
  26. data/lib/gooddata/bricks/middleware/base_middleware.rb +13 -0
  27. data/lib/gooddata/bricks/middleware/bench_middleware.rb +1 -0
  28. data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +2 -1
  29. data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +30 -0
  30. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +10 -8
  31. data/lib/gooddata/bricks/middleware/logger_middleware.rb +3 -2
  32. data/lib/gooddata/bricks/middleware/middleware.rb +4 -11
  33. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +2 -0
  34. data/lib/gooddata/bricks/middleware/stdout_middleware.rb +2 -0
  35. data/lib/gooddata/bricks/middleware/twitter_middleware.rb +2 -0
  36. data/lib/gooddata/cli/cli.rb +28 -0
  37. data/lib/gooddata/cli/commands/api_cmd.rb +30 -0
  38. data/lib/gooddata/cli/commands/auth_cmd.rb +17 -0
  39. data/lib/gooddata/cli/commands/console_cmd.rb +17 -0
  40. data/lib/gooddata/cli/commands/process_cmd.rb +55 -0
  41. data/lib/gooddata/cli/commands/profile_cmd.rb +22 -0
  42. data/lib/gooddata/cli/commands/project_cmd.rb +143 -0
  43. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +55 -0
  44. data/lib/gooddata/cli/commands/scaffold_cmd.rb +32 -0
  45. data/lib/gooddata/cli/hooks.rb +43 -0
  46. data/lib/gooddata/cli/shared.rb +51 -0
  47. data/lib/gooddata/client.rb +37 -24
  48. data/lib/gooddata/commands/api.rb +1 -0
  49. data/lib/gooddata/commands/auth.rb +8 -4
  50. data/lib/gooddata/commands/base.rb +2 -80
  51. data/lib/gooddata/commands/commands.rb +4 -9
  52. data/lib/gooddata/commands/datasets.rb +1 -1
  53. data/lib/gooddata/commands/runners.rb +6 -7
  54. data/lib/gooddata/connection.rb +40 -35
  55. data/lib/gooddata/core/core.rb +8 -0
  56. data/lib/gooddata/exceptions.rb +1 -1
  57. data/lib/gooddata/goodzilla/goodzilla.rb +12 -0
  58. data/lib/gooddata/models/attribute.rb +2 -0
  59. data/lib/gooddata/models/dashboard.rb +9 -2
  60. data/lib/gooddata/models/data_result.rb +3 -256
  61. data/lib/gooddata/models/data_set.rb +2 -0
  62. data/lib/gooddata/models/display_form.rb +2 -0
  63. data/lib/gooddata/models/empty_result.rb +37 -0
  64. data/lib/gooddata/models/fact.rb +2 -0
  65. data/lib/gooddata/models/metadata.rb +6 -1
  66. data/lib/gooddata/models/metric.rb +2 -1
  67. data/lib/gooddata/{model.rb → models/model.rb} +1 -1
  68. data/lib/gooddata/models/models.rb +4 -0
  69. data/lib/gooddata/models/project.rb +10 -6
  70. data/lib/gooddata/models/report.rb +6 -0
  71. data/lib/gooddata/models/report_data_result.rb +167 -0
  72. data/lib/gooddata/models/report_definition.rb +2 -0
  73. data/lib/gooddata/version.rb +15 -1
  74. data/spec/bricks/bricks_spec.rb +39 -0
  75. data/spec/helpers/blueprint_helper.rb +1 -1
  76. data/spec/helpers/connection_helper.rb +12 -0
  77. data/spec/{project_build_and_update_spec.rb → integration/command_projects_spec.rb} +0 -3
  78. data/spec/{full_project_spec.rb → integration/full_project_spec.rb} +0 -3
  79. data/spec/logging_in_logging_out_spec.rb +17 -0
  80. data/spec/spec_helper.rb +6 -1
  81. data/spec/unit/bricks/bricks_spec.rb +23 -0
  82. data/spec/unit/bricks/middleware/bench_middleware_spec.rb +9 -0
  83. data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +9 -0
  84. data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +9 -0
  85. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +9 -0
  86. data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +9 -0
  87. data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +9 -0
  88. data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +9 -0
  89. data/spec/unit/cli/cli_spec.rb +11 -0
  90. data/spec/unit/cli/commands/cmd_api_spec.rb +11 -0
  91. data/spec/unit/cli/commands/cmd_auth_spec.rb +11 -0
  92. data/spec/unit/cli/commands/cmd_process_spec.rb +11 -0
  93. data/spec/unit/cli/commands/cmd_profile_spec.rb +11 -0
  94. data/spec/unit/cli/commands/cmd_project_spec.rb +11 -0
  95. data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +11 -0
  96. data/spec/unit/cli/commands/cmd_scaffold_spec.rb +11 -0
  97. data/spec/unit/commands/command_api_spec.rb +12 -0
  98. data/spec/unit/commands/command_auth_spec.rb +12 -0
  99. data/spec/unit/commands/command_dataset_spec.rb +12 -0
  100. data/spec/unit/commands/command_process_spec.rb +12 -0
  101. data/spec/unit/commands/command_profile_spec.rb +12 -0
  102. data/spec/unit/commands/command_projects_spec.rb +12 -0
  103. data/spec/unit/commands/command_scaffold_spec.rb +12 -0
  104. data/spec/unit/core/connection_spec.rb +25 -0
  105. data/spec/unit/core/core_spec.rb +7 -0
  106. data/spec/{goodzilla_spec.rb → unit/godzilla/goodzilla_spec.rb} +0 -0
  107. data/spec/{blueprint_spec.rb → unit/model/blueprint_spec.rb} +3 -3
  108. data/spec/{merging_blueprints_spec.rb → unit/model/model_spec.rb} +28 -26
  109. data/spec/{model_spec.rb → unit/model/project_blueprint_spec.rb} +0 -0
  110. data/spec/{model_dsl_spec.rb → unit/model/schema_builder_spec.rb} +1 -1
  111. metadata +77 -61
@@ -1,3 +1,5 @@
1
+ # @title Get Started
2
+
1
3
  <div class="container-narrow">
2
4
 
3
5
  <h1>Get Started</h1>
@@ -240,11 +242,10 @@ report.save
240
242
  resolve to its first Label. If an attribute has more than one it will take the first.</p>
241
243
 
242
244
  <p>1) MD object. Metric, Attribute and Label
243
- 2) hash. If you do not have the object handy you can pass a hash structure like this {:type => :attribute, :title =>
244
- 'some title'}. It will perform the lookup for you. This currently works for :attribute and :metric. If you want to
245
- perform the lookup through identifier you can do it as well. Since id is unique {:identifier => 'some id'}
245
+ 2) hash. If you do not have the object handy you can pass a hash structure like this <pre>{:type => :attribute, :title => 'some title'}</pre>. It will perform the lookup for you. This currently works for :attribute and :metric. If you want to
246
+ perform the lookup through identifier you can do it as well. Since id is unique <pre>{:identifier => 'some id'}</pre>
246
247
  3) String. If you put there a string it is assumed it is a name of an attribute so 'some title' is equivalent with
247
- typing {:type => :attribute, :title => 'some title'}</p>
248
+ typing <pre>{:type => :attribute, :title => 'some title'}</pre></p>
248
249
 
249
250
  <p>TODO
250
251
  Describe filtering</p>
@@ -1,3 +1,5 @@
1
+ # @title Homepage
2
+
1
3
  <div class="jumbotron">
2
4
  <!-- style="background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,white), color-stop(100%,#6d3353));"> -->
3
5
 
@@ -1,7 +1,7 @@
1
+ # @title Tutorials
2
+
1
3
  <div class="container-narrow">
2
4
  <ul class="posts">
3
-
4
-
5
5
  <div>
6
6
  <a href="/docs/file/doc/pages/tutorial/YOUR_FIRST_PROJECT.md"><h3>Your first project</h3></a>
7
7
 
@@ -39,7 +39,7 @@
39
39
 
40
40
 
41
41
  <div>
42
- <a href="/docs/file/doc/pages/tutorial/ON_GOOD_DATA_PLATFORM.md"><h3>Executing ruby on GoodData plaform</h3>
42
+ <a href="/docs/file/doc/pages/tutorial/BRICKS.md"><h3>Executing ruby on GoodData plaform</h3>
43
43
  </a>
44
44
 
45
45
  <div>ETL is the back bone of every project. But project is not just about crunching numbers. What to do with
@@ -1,3 +1,5 @@
1
+ # @title Executing ruby on GoodData plaform
2
+
1
3
  You can run Ruby on GoodData platform. Let's have a look at the platform and walk step by step through doing the simplest possible deployment and then move to more advanced tasks.
2
4
 
3
5
  ## Not reinventing the wheel
@@ -9,6 +11,7 @@ The main idea is that only minority of people should be forced to write code. Th
9
11
  GoodData Ruby SDK stack is built so you can easily develop things locally and deploy them when you have tested them and are happy with how they work. You need to set up an environment first.
10
12
 
11
13
  ### Prerequisites
14
+
12
15
  * Git
13
16
  * Ruby (JRuby recommended)
14
17
  * Ruby Gems
@@ -44,7 +47,7 @@ Run this in console.
44
47
 
45
48
  It will take some time but after a while you should see green DONE on your console and a link for the log. Open it in your browser and you should see there something like this. On one of the lines there should be hello world. Great you just ran your first ruby brick.
46
49
 
47
- ###Looking inside Hello World
50
+ ### Looking inside Hello World
48
51
 
49
52
  Let's see what is happening inside. Open the main.rb file in your favorite editor. You should see something like this.
50
53
 
@@ -1,3 +1,5 @@
1
+ # @title Creating A Model
2
+
1
3
  There are several ways how to express a model and create it in GoodData. The most prominent way to do it is the visual modeler that is part of the CloudConnect package. There are clear advantages like being visual but there are also drawbacks. It is not repeatable, it is not programmable and it is not text based. Let's have a look how to create a simple model using Ruby SDK.
2
4
 
3
5
  ## The model
@@ -1,6 +1,4 @@
1
- <div markdown="1">
2
- This is *true* markdown text.
3
- </div>
1
+ # @title Crunching Numbers
4
2
 
5
3
  MAQL is a language that is fairly similar to SQL but it is aimed towards getting the data from OLAP system. You are never forced to talk about columns and specify joins explicitly. This is great but there are some drawbacks. Same as SQL MAQL is aimed towards users more than machines which does not help for automation but there is one more caveat that make it hard to use even for humans. Probably to your surprise
6
4
 
@@ -1,3 +1,5 @@
1
+ # @title Test Driven Development
2
+
1
3
  Test driven development is a holy grail for many developers. It gives you an additional sense of security and you can rely on the test suite to give you a safety net when you are refactoring and tweaking existing code. Testing reports was hard until now.
2
4
 
3
5
  ## The model
@@ -1,15 +1,16 @@
1
+ # @title Your First Project
1
2
 
2
3
  Ok welcome. Let's spin up an example project that we created so you can explore and see SDK in action. It is super simple. Since you are probably a developer we created simple project about developers.
3
4
 
4
- ###What we want to measure
5
+ ### What we want to measure
5
6
  Imagine you have a small dev shop. You have couple of developers. They crank out code. You also have couple of repositories for products. You want to measure how many lines of code each of the devs create. you wanna be able to track it by time by repository and by person. You want to see how many lines of code they committed.
6
7
 
7
- ###Model
8
+ ### Model
8
9
  This is how the model looks.
9
10
 
10
11
  ![Model](https://dl.dropboxusercontent.com/s/1y97ziv5anmpn9s/gooddata_devs_demo_model.png?token_hash=AAENC89d8XOfCr9AnyQCrd9vwfhb-bDuYcORQ0AIRP2RQQ)
11
12
 
12
- ###Spinning it up
13
+ ### Spinning it up
13
14
  Let's do this. I assume you have gooddata SDK installed and working. Run
14
15
 
15
16
  gooddata scaffold project my_test_project
@@ -4,6 +4,7 @@ def init
4
4
  super
5
5
  sections.place(:subclasses).before(:children)
6
6
  sections.place(:constructor_details, [T('method_details')]).before(:methodmissing)
7
+ sections.place(:specs).before(:children)
7
8
  end
8
9
 
9
10
  def constructor_details
@@ -1,5 +1,6 @@
1
1
  def init
2
- sections :header, [:method_signature, T('docstring'), :source]
2
+ super
3
+ sections :header, [:method_signature, T('docstring'), :source, :specs]
3
4
  end
4
5
 
5
6
  def source
@@ -1,7 +1,7 @@
1
1
  include Helpers::ModuleHelper
2
2
 
3
3
  def init
4
- sections :header, :box_info, :pre_docstring, T('docstring'), :children,
4
+ sections :header, :box_info, :pre_docstring, T('docstring'), :specs, :children,
5
5
  :constant_summary, [T('docstring')], :inherited_constants,
6
6
  :attribute_summary, [:item_summary], :inherited_attributes,
7
7
  :method_summary, [:item_summary], :inherited_methods,
data/gooddata ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), "lib/gooddata/cli/cli")
4
+
5
+ res = GoodData::CLI.main(ARGV)
6
+
7
+ exit(res)
data/gooddata.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency "simplecov", "~> 0.8.2"
34
34
  s.add_development_dependency "yard", "~> 0.8.7.3"
35
35
  s.add_development_dependency "yard-rspec", "~> 0.1"
36
+ s.add_development_dependency "ZenTest", "~> 4.9.5"
36
37
 
37
38
  s.add_dependency "activesupport", "~> 4.0.3"
38
39
  s.add_dependency "bundler", "~> 1.5.3"
data/lib/gooddata.rb CHANGED
@@ -1,7 +1,18 @@
1
1
  module GoodData; end
2
2
 
3
3
  require 'active_support/all'
4
- require 'gooddata/client'
5
- require 'gooddata/model'
6
- require 'gooddata/bricks/brick'
7
- require 'gooddata/exceptions'
4
+
5
+ # Modules
6
+ require File.join(File.dirname(__FILE__), 'gooddata/bricks/bricks')
7
+ require File.join(File.dirname(__FILE__), 'gooddata/cli/cli')
8
+ require File.join(File.dirname(__FILE__), 'gooddata/commands/commands')
9
+ require File.join(File.dirname(__FILE__), 'gooddata/core/core')
10
+ require File.join(File.dirname(__FILE__), 'gooddata/models/models')
11
+
12
+ # Files
13
+ require File.join(File.dirname(__FILE__), 'gooddata/client')
14
+ require File.join(File.dirname(__FILE__), 'gooddata/connection')
15
+ require File.join(File.dirname(__FILE__), 'gooddata/exceptions')
16
+ require File.join(File.dirname(__FILE__), 'gooddata/extract')
17
+ require File.join(File.dirname(__FILE__), 'gooddata/helpers')
18
+ require File.join(File.dirname(__FILE__), 'gooddata/version')
@@ -41,6 +41,7 @@ module GoodData::Bricks
41
41
  meta
42
42
  end
43
43
 
44
+ # Run downloader
44
45
  def run
45
46
  downloaded_data = download
46
47
  downloaded_data = pre_process(downloaded_data)
@@ -1,21 +1,26 @@
1
- require 'gooddata/bricks/utils'
2
- require 'gooddata/bricks/base_downloader'
3
- require 'gooddata/bricks/middleware/middleware'
4
- require 'gooddata/bricks/middleware/bench_middleware'
5
- require 'gooddata/bricks/middleware/gooddata_middleware'
6
- require 'gooddata/bricks/middleware/logger_middleware'
7
- require 'gooddata/bricks/middleware/stdout_middleware'
8
- require 'gooddata/bricks/middleware/restforce_middleware'
9
- require 'gooddata/bricks/middleware/bulk_salesforce_middleware.rb'
10
- require 'gooddata/bricks/middleware/twitter_middleware'
1
+ require File.join(File.dirname(__FILE__), 'base_downloader')
2
+ require File.join(File.dirname(__FILE__), 'utils')
3
+
4
+ Dir[File.dirname(__FILE__) + '/commands/**/*_cmd.rb'].each do |file|
5
+ require file
6
+ end
7
+
8
+ require File.join(File.dirname(__FILE__), 'middleware/middleware')
11
9
 
12
10
  module GoodData::Bricks
13
11
  class Pipeline
14
12
  def self.prepare(pipeline)
15
- pipeline.reverse.reduce(nil) {|memo, app| memo.nil? ? app.new : app.new(memo)}
13
+ pipeline.reverse.reduce(nil) do |memo, app|
14
+ if memo.nil?
15
+ app.respond_to?(:new) ? (app.new) : app
16
+ else
17
+ app.respond_to?(:new) ? (app.new(:app => memo)) : (app.app = memo; app)
18
+ end
19
+ end
16
20
  end
17
21
  end
18
-
22
+
23
+ # Brick base class
19
24
  class Brick
20
25
 
21
26
  def log(message)
@@ -0,0 +1,7 @@
1
+ base = Pathname(__FILE__).dirname.expand_path
2
+ Dir.glob(base + '*.rb').each do |file|
3
+ require file
4
+ end
5
+
6
+ # Require all middleware
7
+ require File.join(File.dirname(__FILE__), "middleware/middleware")
@@ -0,0 +1,13 @@
1
+ module GoodData::Bricks
2
+
3
+ class Middleware
4
+ attr_accessor :app
5
+
6
+ include GoodData::Bricks::Utils
7
+
8
+ def initialize(options={})
9
+ @app = options[:app]
10
+ end
11
+
12
+ end
13
+ end
@@ -1,4 +1,5 @@
1
1
  require 'benchmark'
2
+ require File.join(File.dirname(__FILE__), "base_middleware")
2
3
 
3
4
  module GoodData::Bricks
4
5
 
@@ -1,6 +1,7 @@
1
- require 'gooddata'
2
1
  require 'salesforce_bulk'
3
2
 
3
+ require File.join(File.dirname(__FILE__), "base_middleware")
4
+
4
5
  module GoodData::Bricks
5
6
  class BulkSalesforceMiddleware < GoodData::Bricks::Middleware
6
7
 
@@ -0,0 +1,30 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'pathname'
4
+
5
+ module GoodData::Bricks
6
+
7
+ class FsUploadMiddleware < GoodData::Bricks::Middleware
8
+
9
+ def initialize(options={})
10
+ super
11
+ @destination = options[:destination]
12
+ end
13
+
14
+ def call(params)
15
+ returning(@app.call(params)) do |result|
16
+ destination = @destination
17
+ (params["gdc_files_to_upload"] || []).each do |f|
18
+ path = f[:path]
19
+ case destination.to_s
20
+ when "staging"
21
+ url = GoodData.get_user_webdav_path(path)
22
+ GoodData.upload_to_user_webdav(path)
23
+ puts "Uploaded local file \"#{path}\" to url \"#{url + path}\""
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ end
30
+ end
@@ -1,24 +1,26 @@
1
1
  require 'gooddata'
2
2
 
3
+ require File.join(File.dirname(__FILE__), "base_middleware")
4
+
3
5
  module GoodData::Bricks
4
6
  class GoodDataMiddleware < GoodData::Bricks::Middleware
5
7
 
6
8
  def call(params)
7
- logger = params[:gdc_logger]
8
- token_name = :GDC_SST
9
- protocol_name = :GDC_PROTOCOL
10
- server_name = :GDC_HOSTNAME
11
- project_id = params[:GDC_PROJECT_ID]
9
+ logger = params["GDC_LOGGER"]
10
+ token_name = "GDC_SST"
11
+ protocol_name = "GDC_PROTOCOL"
12
+ server_name = "GDC_HOSTNAME"
13
+ project_id = params["GDC_PROJECT_ID"]
12
14
 
13
15
  fail "SST (SuperSecureToken) not present in params" if params[token_name].nil?
14
16
  server = if !params[protocol_name].empty? && !params[server_name].empty?
15
17
  params[protocol_name] + "://" + params[server_name]
16
18
  end
17
19
 
18
- fail "GoodData username is missing. Expected param :GDC_USERANME" if params[:GDC_USERNAME].nil?
19
- fail "GoodData password is missing. Expected param :GDC_PASSWORD" if params[:GDC_PASSWORD].nil?
20
+ fail "GoodData username is missing. Expected param \"GDC_USERNAME\"" if params["GDC_USERNAME"].nil?
21
+ fail "GoodData password is missing. Expected param \"GDC_PASSWORD\"" if params["GDC_PASSWORD"].nil?
20
22
 
21
- GoodData.connect(params[:GDC_USERNAME], params[:GDC_PASSWORD], {:server => server})
23
+ GoodData.connect(params["GDC_USERNAME"], params["GDC_PASSWORD"], {:server => server})
22
24
  GoodData.logger = logger
23
25
  GoodData.with_project(project_id) do |p|
24
26
  @app.call(params)
@@ -1,12 +1,13 @@
1
1
  require 'logger'
2
2
 
3
+ require File.join(File.dirname(__FILE__), "base_middleware")
4
+
3
5
  module GoodData::Bricks
4
6
  class LoggerMiddleware < GoodData::Bricks::Middleware
5
7
 
6
8
  def call(params)
7
- logger = params[:gdc_logger] = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
9
+ logger = params["GDC_LOGGER"] = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
8
10
  logger.info("Pipeline starts")
9
-
10
11
  returning(@app.call(params)) do |result|
11
12
  logger.info("Pipeline ending")
12
13
  end
@@ -1,11 +1,4 @@
1
- module GoodData::Bricks
2
-
3
- class Middleware
4
- include GoodData::Bricks::Utils
5
-
6
- def initialize(app)
7
- @app = app
8
- end
9
-
10
- end
11
- end
1
+ base = Pathname(__FILE__).dirname.expand_path
2
+ Dir.glob(base + '*_middleware.*').each do | file |
3
+ require file
4
+ end
@@ -1,5 +1,7 @@
1
1
  require 'gooddata'
2
2
 
3
+ require File.join(File.dirname(__FILE__), "base_middleware")
4
+
3
5
  module GoodData::Bricks
4
6
  class RestForceMiddleware < GoodData::Bricks::Middleware
5
7
 
@@ -1,3 +1,5 @@
1
+ require File.join(File.dirname(__FILE__), "base_middleware")
2
+
1
3
  module GoodData::Bricks
2
4
  class STDOUTLoggingMiddleware < GoodData::Bricks::Middleware
3
5
 
@@ -1,5 +1,7 @@
1
1
  # require 'twitter'
2
2
 
3
+ require File.join(File.dirname(__FILE__), "base_middleware")
4
+
3
5
  module GoodData::Bricks
4
6
 
5
7
  class TwitterMiddleware < GoodData::Bricks::Middleware
@@ -0,0 +1,28 @@
1
+ require 'gli'
2
+ require 'pp'
3
+
4
+ # Define GoodData::CLI as GLI Wrapper
5
+ module GoodData
6
+ module CLI
7
+ include GLI::App
8
+
9
+ # Require shared part of GLI::App - flags, meta, etc
10
+ require File.join(File.dirname(__FILE__), 'shared.rb')
11
+
12
+ # Require Hooks
13
+ require File.join(File.dirname(__FILE__), 'hooks.rb')
14
+
15
+ GLI::App.commands_from(File.join(File.dirname(__FILE__), 'commands'))
16
+
17
+ def self.init
18
+ end
19
+
20
+ def self.main(args = ARGV)
21
+ run(args)
22
+ end
23
+ end
24
+ end
25
+
26
+ if __FILE__ == $0
27
+ GoodData::CLI.main(ARGV)
28
+ end
@@ -0,0 +1,30 @@
1
+ require 'pp'
2
+
3
+ require File.join(File.dirname(__FILE__), "../shared")
4
+ require File.join(File.dirname(__FILE__), "../../commands/api")
5
+
6
+ GoodData::CLI.module_eval do
7
+ desc 'Some basic API stuff directly from CLI'
8
+ arg_name 'info|test|get|delete'
9
+ command :api do |c|
10
+
11
+ c.desc "Info about the API version etc"
12
+ c.command :info do |info|
13
+ info.action do |global_options, options, args|
14
+ opts = options.merge(global_options)
15
+ GoodData.connect(opts)
16
+ pp GoodData::Command::Api.info
17
+ end
18
+ end
19
+
20
+ c.desc "GET request on our API"
21
+ c.command :get do |get|
22
+ get.action do |global_options, options, args|
23
+ opts = options.merge(global_options)
24
+ GoodData.connect(opts)
25
+ pp GoodData::Command::Api.get(args[0])
26
+ end
27
+ end
28
+
29
+ end
30
+ end