evostream-event 0.3.2.pre.57 → 1.0.0.pre.58

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c407153d582e9753ed770aad13ca021b991eb408
4
- data.tar.gz: 683fc323e4fd66c5dea926cc52d40f420a0bbab6
3
+ metadata.gz: 72033db94983a8501bfa31d4feb6a2ff732cf3c2
4
+ data.tar.gz: b7ea36205bb79549b04d337b11260d4dae2bf473
5
5
  SHA512:
6
- metadata.gz: 62dbc34ca630037994129e46d9ea0c4c24026499eef63e5f2b6fef9747e81f5a0906d41e71e43f178fe1f694f7adfc02573359afed5c08cfc7ca5daf4fafd33e
7
- data.tar.gz: 92b34c87447162871f3bf0693a586f1fa12d0a7117cda6f8a097ded7dcab075512e1e36d41e0cee00a45958576a2d5a3d99e4b0649287d5cdfd9ca6ef177122b
6
+ metadata.gz: 589afbf4f87e26408dcc740ea0950de475d08043363b1f20dcbaa054da399e698c988860426a4f6fb250ab682f1d3a3a55185640912ded7ea188f924f85ba98f
7
+ data.tar.gz: 18e2062161390d9753df4aae82f7aadf9d9e2987f687515d867620a572e2bca297a39bbac8edc0745aa8e27e92c5cc306b9047d5cc1abc7941d5e3177f060f91
data/README.md CHANGED
@@ -77,6 +77,9 @@ event = Evostream::Event.new(params[:type], params[:payload].to_unsafe_h)
77
77
  event.execute_action
78
78
  ```
79
79
 
80
+ ### Usage in cli
81
+
82
+
80
83
  ## Development
81
84
 
82
85
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
@@ -0,0 +1,14 @@
1
+ Usage :
2
+ evostream [options] [command]
3
+
4
+ Example :
5
+ ### List to configuration in evostream
6
+ % evostream listConfig
7
+
8
+ -h, --help Display this help.
9
+
10
+ -c, --commands Display list command managed by this software.
11
+
12
+ -s, --server Evostream URL (http://1.2.3.4:7777)
13
+
14
+ -e, --environment Type of environment to send command (default :production).
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Evostream
4
+ module CLI
5
+ class Options
6
+ CASE_HELP = ['-h', '--help']
7
+ CASE_CMD = ['-c', '--commands']
8
+ CASE_SERVER = ['-s', '--server']
9
+ CASE_ENV = ['-e', '--environment']
10
+
11
+ def initialize
12
+ @file = File.read(File.join(__dir__, 'help'))
13
+ end
14
+
15
+ # Parse options and execute action if necessary
16
+ def parse(argv)
17
+ @command_line_args = argv
18
+ case
19
+ when include(CASE_HELP) then display_help
20
+ when include(CASE_CMD) then display_command
21
+ when @command_line_args.empty? then display_no_command
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def include(case_parse)
28
+ case_parse.any? { |value| @command_line_args.include?(value) }
29
+ end
30
+
31
+ def display_help
32
+ puts @file
33
+ end
34
+
35
+ def display_command
36
+ puts 'Commands :'
37
+ Evostream::Commands::Command.descendants.each do |cmd|
38
+ puts " - #{cmd.to_s.split('::').last}"
39
+ end
40
+ end
41
+
42
+ def display_no_command
43
+ puts 'No command executed !!'.red
44
+ display_help
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'colorize'
4
+ require 'option'
5
+
6
+ $LOAD_PATH.unshift("#{__dir__}/../")
7
+ require 'event'
8
+
9
+ module Evostream
10
+ class Runner
11
+
12
+ attr_reader :options
13
+
14
+ def initialize
15
+ txt = <<~INFO
16
+ ##################################
17
+ # Start Evostream CLI \t\t #
18
+ # Version #{Evostream::VERSION} \t\t #
19
+ ##################################
20
+ INFO
21
+ puts txt.red
22
+ @options = {}
23
+ prepare_configuration
24
+ end
25
+
26
+ def run(args = ARGV)
27
+ @options = CLI::Options.new
28
+ @options.parse(args)
29
+
30
+ execute_runner(args.last) if args.count >= 1
31
+ ensure
32
+ return 0
33
+ end
34
+
35
+ private
36
+
37
+ def prepare_configuration
38
+ Evostream::Service.uri_in = 'http://192.168.203.122:7777'
39
+ Evostream::Service.uri_out = 'http://192.168.203.122:80'
40
+ Evostream::Service.name = 'dazzl_'
41
+ Evostream::Service.web_root = '/var/www/html'
42
+ Evostream::Service.model = 'Channel'
43
+ Evostream::Service.model_id = '_id'
44
+ Evostream::Service.environment = :production
45
+ end
46
+
47
+ def execute_runner(cmd)
48
+ unless cmd.start_with?('-') || cmd.start_with?('--')
49
+ puts 'Prepare command'
50
+ act = Evostream::Action.new()
51
+ puts 'Sending command'
52
+ result = JSON.parse(act.execute_action(cmd))
53
+ puts "Result : #{result}"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -6,7 +6,7 @@
6
6
  # Define constant to gem.
7
7
  module Evostream
8
8
  # Define version to gem
9
- VERSION = '0.3.2'
9
+ VERSION = '1.0.0'
10
10
 
11
11
  # Name to gem
12
12
  GEM_NAME = 'evostream-event'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evostream-event
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.pre.57
4
+ version: 1.0.0.pre.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-11 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -243,13 +243,41 @@ dependencies:
243
243
  - - "~>"
244
244
  - !ruby/object:Gem::Version
245
245
  version: '4.2'
246
- type: :development
246
+ type: :runtime
247
247
  prerelease: false
248
248
  version_requirements: !ruby/object:Gem::Requirement
249
249
  requirements:
250
250
  - - "~>"
251
251
  - !ruby/object:Gem::Version
252
252
  version: '4.2'
253
+ - !ruby/object:Gem::Dependency
254
+ name: colorize
255
+ requirement: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - "~>"
258
+ - !ruby/object:Gem::Version
259
+ version: 0.8.1
260
+ type: :runtime
261
+ prerelease: false
262
+ version_requirements: !ruby/object:Gem::Requirement
263
+ requirements:
264
+ - - "~>"
265
+ - !ruby/object:Gem::Version
266
+ version: 0.8.1
267
+ - !ruby/object:Gem::Dependency
268
+ name: pry
269
+ requirement: !ruby/object:Gem::Requirement
270
+ requirements:
271
+ - - "~>"
272
+ - !ruby/object:Gem::Version
273
+ version: 0.10.4
274
+ type: :runtime
275
+ prerelease: false
276
+ version_requirements: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - "~>"
279
+ - !ruby/object:Gem::Version
280
+ version: 0.10.4
253
281
  description: |2
254
282
  Manipulate event evostream and send actions to evostream server.
255
283
  email:
@@ -262,6 +290,9 @@ files:
262
290
  - LICENSE
263
291
  - README.md
264
292
  - Rakefile
293
+ - lib/evostream/cli/help
294
+ - lib/evostream/cli/option.rb
295
+ - lib/evostream/cli/runner.rb
265
296
  - lib/evostream/event.rb
266
297
  - lib/evostream/event/action.rb
267
298
  - lib/evostream/event/commands.rb
@@ -349,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
380
  version: 1.3.1
350
381
  requirements: []
351
382
  rubyforge_project:
352
- rubygems_version: 2.4.5
383
+ rubygems_version: 2.6.13
353
384
  signing_key:
354
385
  specification_version: 4
355
386
  summary: EvoStream Event