keen-cli 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +21 -13
- data/lib/keen-cli/cli.rb +8 -8
- data/lib/keen-cli/version.rb +1 -1
- data/spec/keen-cli/cli_spec.rb +9 -2
- metadata +2 -3
- data/Gemfile.lock +0 -54
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -18,13 +18,14 @@ Verify the `keen` command is in your path by running it:
|
|
18
18
|
|
19
19
|
``` shell
|
20
20
|
Commands:
|
21
|
-
keen events:add
|
22
|
-
keen help [COMMAND]
|
23
|
-
keen project:
|
24
|
-
keen project:
|
25
|
-
keen project:
|
26
|
-
keen
|
27
|
-
keen
|
21
|
+
keen events:add # Add one or more events and print the result
|
22
|
+
keen help [COMMAND] # Describe available commands or one specific command
|
23
|
+
keen project:collections # Print information about a project's collections
|
24
|
+
keen project:describe # Print information about a project
|
25
|
+
keen project:open # Open a project's overview page in a browser
|
26
|
+
keen project:workbench # Open a project's workbench page in a browser
|
27
|
+
keen queries:run # Run a query and print the result
|
28
|
+
keen version # Print the keen-cli version
|
28
29
|
```
|
29
30
|
|
30
31
|
You should see information about available commands.
|
@@ -33,7 +34,7 @@ If `keen` can't be found there might be an issue with your Ruby installation. If
|
|
33
34
|
|
34
35
|
### Environment configuration
|
35
36
|
|
36
|
-
Most keen-cli
|
37
|
+
Most keen-cli commands require the presence of a project and one or more API keys to do meaningful actions. By default, keen-cli attempts to find these in the process environment or a `.env` file in the current directory. This is the same heuristic that [keen-gem](https://github.com/keenlabs/keen-gem) uses and is based on [dotenv](https://github.com/bkeepers/dotenv).
|
37
38
|
|
38
39
|
An example .env file looks like this:
|
39
40
|
|
@@ -49,7 +50,7 @@ If you run `keen` from a directory with this .env file, it will assume the proje
|
|
49
50
|
To override the project context use the `--project` option:
|
50
51
|
|
51
52
|
``` shell
|
52
|
-
$ keen project:
|
53
|
+
$ keen project:describe --project XXXXXXXXXXXXXXX
|
53
54
|
```
|
54
55
|
|
55
56
|
Similar overrides are available for specifiying API keys: `--master-key`, `--read-key` and `--write-key`.
|
@@ -57,13 +58,13 @@ Similar overrides are available for specifiying API keys: `--master-key`, `--rea
|
|
57
58
|
For example:
|
58
59
|
|
59
60
|
``` shell
|
60
|
-
$ keen project:
|
61
|
+
$ keen project:describe --project XXXXXXXXXXXXXXX --master-key AAAAAAAAAAAAAA
|
61
62
|
```
|
62
63
|
|
63
64
|
Shorter aliases exist as well: `-p` for project, `-k` for master key, `-r` for read key, and `-w` for write key.
|
64
65
|
|
65
66
|
``` shell
|
66
|
-
$ keen project:
|
67
|
+
$ keen project:describe -p XXXXXXXXXXXXXXX -k AAAAAAAAAAAAAA
|
67
68
|
```
|
68
69
|
|
69
70
|
### Usage
|
@@ -75,8 +76,9 @@ keen-cli has a variety of commands, and most are namespaced for clarity.
|
|
75
76
|
##### Projects
|
76
77
|
|
77
78
|
* `project:open` - Open the Project Overview page in a browser
|
78
|
-
* `project:workbench` - Open the Project Workbench in a browser
|
79
|
-
* `project:
|
79
|
+
* `project:workbench` - Open the Project Workbench page in a browser
|
80
|
+
* `project:describe` - Get data about the project. Uses the [project row resource](https://keen.io/docs/api/reference/#project-row-resource).
|
81
|
+
* `project:collections` - Get schema information about the project's collections. Uses the [event resource](https://keen.io/docs/api/reference/#event-resource).
|
80
82
|
|
81
83
|
##### Events
|
82
84
|
|
@@ -169,6 +171,12 @@ $ keen queries:run --collection cli-tests --analysis-type median --target-proper
|
|
169
171
|
...
|
170
172
|
```
|
171
173
|
|
174
|
+
### Changelog
|
175
|
+
|
176
|
+
+ 0.1.2 – Change `project:show` to `project:describe`
|
177
|
+
+ 0.1.1 – Add `project:collections`
|
178
|
+
+ 0.1.0 - Initial version
|
179
|
+
|
172
180
|
### Contributing
|
173
181
|
|
174
182
|
keen-cli is open source, and contributions are very welcome!
|
data/lib/keen-cli/cli.rb
CHANGED
@@ -44,18 +44,18 @@ module KeenCli
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
desc 'project:
|
48
|
-
map 'project:
|
47
|
+
desc 'project:describe', 'Print information about a project'
|
48
|
+
map 'project:describe' => :project_describe
|
49
49
|
shared_options
|
50
50
|
|
51
|
-
def
|
51
|
+
def project_describe
|
52
52
|
Utils.process_options!(options)
|
53
53
|
response = HTTP.get(
|
54
54
|
"https://api.keen.io/3.0/projects/#{Keen.project_id}?api_key=#{Keen.master_key}")
|
55
55
|
JSON.pretty_generate(JSON.parse(response.to_s)).tap do |s| puts s end
|
56
56
|
end
|
57
57
|
|
58
|
-
desc 'project:collections', '
|
58
|
+
desc 'project:collections', 'Print information about a project\'s collections'
|
59
59
|
map 'project:collections' => :project_collections
|
60
60
|
shared_options
|
61
61
|
|
@@ -66,7 +66,7 @@ module KeenCli
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
desc 'project:open', 'Open
|
69
|
+
desc 'project:open', 'Open a project\'s overview page in a browser'
|
70
70
|
map 'project:open' => :project_open
|
71
71
|
shared_options
|
72
72
|
|
@@ -77,7 +77,7 @@ module KeenCli
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
desc 'project:workbench', 'Open
|
80
|
+
desc 'project:workbench', 'Open a project\'s workbench page in a browser'
|
81
81
|
map 'project:workbench' => :project_workbench
|
82
82
|
shared_options
|
83
83
|
|
@@ -88,7 +88,7 @@ module KeenCli
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
desc 'queries:run', 'Run a query'
|
91
|
+
desc 'queries:run', 'Run a query and print the result'
|
92
92
|
map 'queries:run' => :queries_run
|
93
93
|
shared_options
|
94
94
|
query_options
|
@@ -117,7 +117,7 @@ module KeenCli
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
desc 'events:add', 'Add
|
120
|
+
desc 'events:add', 'Add one or more events and print the result'
|
121
121
|
map 'events:add' => :events_add
|
122
122
|
|
123
123
|
shared_options
|
data/lib/keen-cli/version.rb
CHANGED
data/spec/keen-cli/cli_spec.rb
CHANGED
@@ -11,10 +11,17 @@ describe KeenCli::CLI do
|
|
11
11
|
expect(_).to match /version/
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'project:
|
14
|
+
describe 'project:describe' do
|
15
15
|
it 'gets the project' do
|
16
|
-
_, options = KeenCli::CLI.start(%w[project:
|
16
|
+
_, options = KeenCli::CLI.start(%w[project:describe])
|
17
17
|
expect(_).to match /\/3.0\/projects\/#{Keen.project_id}\/events/
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
describe 'project:collections' do
|
22
|
+
it 'prints the project\'s collections' do
|
23
|
+
_, options = KeenCli::CLI.start(%w[project:collections])
|
24
|
+
expect(_["properties"]["keen.timestamp"]).to eq 'datetime'
|
25
|
+
end
|
26
|
+
end
|
20
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keen-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: keen
|
@@ -133,7 +133,6 @@ files:
|
|
133
133
|
- .gitignore
|
134
134
|
- .travis.yml
|
135
135
|
- Gemfile
|
136
|
-
- Gemfile.lock
|
137
136
|
- LICENSE
|
138
137
|
- README.md
|
139
138
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
keen-cli (0.1.0)
|
5
|
-
dotenv
|
6
|
-
http
|
7
|
-
keen
|
8
|
-
thor
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
addressable (2.3.6)
|
14
|
-
columnize (0.8.9)
|
15
|
-
debugger (1.6.8)
|
16
|
-
columnize (>= 0.3.1)
|
17
|
-
debugger-linecache (~> 1.2.0)
|
18
|
-
debugger-ruby_core_source (~> 1.3.5)
|
19
|
-
debugger-linecache (1.2.0)
|
20
|
-
debugger-ruby_core_source (1.3.5)
|
21
|
-
diff-lcs (1.2.5)
|
22
|
-
dotenv (0.11.1)
|
23
|
-
dotenv-deployment (~> 0.0.2)
|
24
|
-
dotenv-deployment (0.0.2)
|
25
|
-
http (0.6.1)
|
26
|
-
http_parser.rb (~> 0.6.0)
|
27
|
-
http_parser.rb (0.6.0)
|
28
|
-
keen (0.8.3)
|
29
|
-
addressable (~> 2.3.5)
|
30
|
-
multi_json (~> 1.3)
|
31
|
-
multi_json (1.10.1)
|
32
|
-
rake (10.3.2)
|
33
|
-
rspec (3.0.0)
|
34
|
-
rspec-core (~> 3.0.0)
|
35
|
-
rspec-expectations (~> 3.0.0)
|
36
|
-
rspec-mocks (~> 3.0.0)
|
37
|
-
rspec-core (3.0.2)
|
38
|
-
rspec-support (~> 3.0.0)
|
39
|
-
rspec-expectations (3.0.2)
|
40
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.0.0)
|
42
|
-
rspec-mocks (3.0.2)
|
43
|
-
rspec-support (~> 3.0.0)
|
44
|
-
rspec-support (3.0.2)
|
45
|
-
thor (0.19.1)
|
46
|
-
|
47
|
-
PLATFORMS
|
48
|
-
ruby
|
49
|
-
|
50
|
-
DEPENDENCIES
|
51
|
-
debugger
|
52
|
-
keen-cli!
|
53
|
-
rake
|
54
|
-
rspec
|