zenaton 0.1.0

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
+ SHA256:
3
+ metadata.gz: fff7e96284604fd307b0d23ba51cffcfc648a5c58a8476c82c1eeaaa963cded8
4
+ data.tar.gz: 2614cccf266a28decaa5604014cb084fe61db038857ff650fd92d935ad928100
5
+ SHA512:
6
+ metadata.gz: fabadf49177012dc688a4163d7fb3a434c5c6a1c50f42d16251b0b9a1449d52914a7f08c516d5ad8c12bdeee45a259d78c6f7d70a6299dfe61e632f9ccd39862
7
+ data.tar.gz: 33b369adbc905e3ca269c79eb2f8b6712f6f6627607d7c09bd6b8e1b3170d612ed72a6da847cf5b9daa42ac191436f9efce70dd3320449386baa1dc2733dbc8a
@@ -0,0 +1,45 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: circleci/ruby:2.5.1
6
+
7
+ working_directory: ~/repo
8
+
9
+ steps:
10
+ - checkout
11
+
12
+ - restore_cache:
13
+ keys:
14
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
15
+ - v1-dependencies-
16
+
17
+ - run:
18
+ name: install dependencies
19
+ command: |
20
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
21
+
22
+ - save_cache:
23
+ paths:
24
+ - ./vendor/bundle
25
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
26
+
27
+ - run:
28
+ name: run code linter
29
+ command: |
30
+ bundle exec rubocop
31
+
32
+ - run:
33
+ name: run tests
34
+ command: |
35
+ bundle exec rake
36
+
37
+ - run:
38
+ name: audit dependencies for known CVEs
39
+ command: |
40
+ gem install bundler-audit
41
+ bundle audit check --update
42
+
43
+ - store_artifacts:
44
+ path: ./coverage
45
+ destination: coverage
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.3
5
+
6
+ Metrics/BlockLength:
7
+ Enabled: true
8
+ Exclude:
9
+ - 'spec/**/*_spec.rb'
10
+ - 'spec/shared_examples/*.rb'
11
+ - 'zenaton.gemspec'
12
+
13
+ Metrics/ClassLength:
14
+ Enabled: true
15
+ Exclude:
16
+ - 'lib/zenaton/client.rb'
17
+ - 'lib/zenaton/services/serializer.rb'
18
+
19
+ Style/NumericLiterals:
20
+ Enabled: false
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --no-private lib/**/*.rb - README.md LICENSE.txt CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at idabmat@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in zenaton.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,106 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zenaton (0.1.0)
5
+ activesupport
6
+ httparty
7
+ tzinfo-data
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (5.2.0)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ addressable (2.5.2)
18
+ public_suffix (>= 2.0.2, < 4.0)
19
+ ast (2.4.0)
20
+ coderay (1.1.2)
21
+ concurrent-ruby (1.0.5)
22
+ crack (0.4.3)
23
+ safe_yaml (~> 1.0.0)
24
+ diff-lcs (1.3)
25
+ docile (1.3.1)
26
+ hashdiff (0.3.7)
27
+ httparty (0.16.2)
28
+ multi_xml (>= 0.5.2)
29
+ i18n (1.0.1)
30
+ concurrent-ruby (~> 1.0)
31
+ jaro_winkler (1.5.1)
32
+ json (2.1.0)
33
+ method_source (0.9.0)
34
+ minitest (5.11.3)
35
+ multi_xml (0.6.0)
36
+ parallel (1.12.1)
37
+ parser (2.5.1.2)
38
+ ast (~> 2.4.0)
39
+ powerpack (0.1.2)
40
+ pry (0.11.3)
41
+ coderay (~> 1.1.0)
42
+ method_source (~> 0.9.0)
43
+ public_suffix (3.0.2)
44
+ rainbow (3.0.0)
45
+ rake (10.5.0)
46
+ rspec (3.7.0)
47
+ rspec-core (~> 3.7.0)
48
+ rspec-expectations (~> 3.7.0)
49
+ rspec-mocks (~> 3.7.0)
50
+ rspec-core (3.7.1)
51
+ rspec-support (~> 3.7.0)
52
+ rspec-expectations (3.7.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.7.0)
55
+ rspec-mocks (3.7.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.7.0)
58
+ rspec-support (3.7.1)
59
+ rubocop (0.58.2)
60
+ jaro_winkler (~> 1.5.1)
61
+ parallel (~> 1.10)
62
+ parser (>= 2.5, != 2.5.1.1)
63
+ powerpack (~> 0.1)
64
+ rainbow (>= 2.2.2, < 4.0)
65
+ ruby-progressbar (~> 1.7)
66
+ unicode-display_width (~> 1.0, >= 1.0.1)
67
+ rubocop-rspec (1.27.0)
68
+ rubocop (>= 0.56.0)
69
+ ruby-progressbar (1.9.0)
70
+ safe_yaml (1.0.4)
71
+ simplecov (0.16.1)
72
+ docile (~> 1.1)
73
+ json (>= 1.8, < 3)
74
+ simplecov-html (~> 0.10.0)
75
+ simplecov-html (0.10.2)
76
+ thread_safe (0.3.6)
77
+ timecop (0.9.1)
78
+ tzinfo (1.2.5)
79
+ thread_safe (~> 0.1)
80
+ tzinfo-data (1.2018.5)
81
+ tzinfo (>= 1.0.0)
82
+ unicode-display_width (1.4.0)
83
+ vcr (4.0.0)
84
+ webmock (3.4.2)
85
+ addressable (>= 2.3.6)
86
+ crack (>= 0.3.2)
87
+ hashdiff
88
+
89
+ PLATFORMS
90
+ ruby
91
+
92
+ DEPENDENCIES
93
+ bundler (~> 1.16)
94
+ pry
95
+ rake (~> 10.0)
96
+ rspec (~> 3.0)
97
+ rubocop
98
+ rubocop-rspec
99
+ simplecov
100
+ timecop
101
+ vcr
102
+ webmock
103
+ zenaton!
104
+
105
+ BUNDLED WITH
106
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Igor de Alcantara Barroso
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Zenaton library for Ruby
2
+ [![CircleCI](https://circleci.com/gh/zenaton/zenaton-ruby/tree/master.svg?style=svg&circle-token=99da357820821f49236b1e2f20657100fb382bd8)](https://circleci.com/gh/zenaton/zenaton-ruby/tree/master)
3
+
4
+ This Zenaton library for Ruby lets you code and launch workflows using Zenaton platform. You can sign up for an account at [https://zenaton/com](http://zenaton.com)
5
+
6
+ **DISCLAIMER** The ruby library is currently in public beta. Please open an
7
+ issue if you find any bugs.
8
+
9
+ ## Requirements
10
+
11
+ This gem has been tested with Ruby 2.3 or later.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'zenaton'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install zenaton
28
+
29
+ ## Usage
30
+
31
+ For more detailed examples, please check [Zenaton Ruby examples](https://github.com/zenaton/example-ruby).
32
+
33
+ ### Client Initialization
34
+
35
+ You will need to export three environment variables: `ZENATON_APP_ID`, `ZENATON_API_TOKEN`, `ZENATON_APP_ENV`. You'll find them [here](https://zenaton/app/api).
36
+
37
+ Then you can initialize your Zenaton client:
38
+ ```ruby
39
+ require 'dotenv/load' # We are using dotenv to load the variables from a .env file
40
+ require 'zenaton'
41
+
42
+ app_id = ENV['ZENATON_APP_ID']
43
+ api_token = ENV['ZENATON_API_TOKEN']
44
+ app_env = ENV['ZENATON_APP_ENV']
45
+
46
+ Zenaton::Client.init(app_id, api_token, app_env)
47
+ ```
48
+
49
+ ### Writing Workflows and Tasks
50
+
51
+ Writing a workflow is as simple as:
52
+
53
+ ```ruby
54
+ class MyWorkflow < Zenaton::Interfaces::Worflow
55
+ include Zenatonable
56
+
57
+ def handle
58
+ # Your workflow implementation
59
+ end
60
+ end
61
+ ```
62
+ Note that your workflow implementation should be idempotent. See [documentation](https://zenaton.com/app/documentation#workflow-basics-implementation).
63
+
64
+ Writing a task is as simple as:
65
+ ```ruby
66
+ class MyTask < Zenaton::Interfaces::Task
67
+ include Zenatonable
68
+
69
+ def handle
70
+ # Your task implementation
71
+ end
72
+ end
73
+ ```
74
+
75
+ ### Launching a workflow
76
+
77
+ Once your Zenaton client is initialized, you can start a workflow with
78
+
79
+ ```ruby
80
+ MyWorkflow.new.dispatch
81
+ ```
82
+
83
+ ### Worker Installation
84
+
85
+ Your workflow's tasks will be executed on your worker servers. Please install a Zenaton worker on it:
86
+
87
+ $ curl https://install.zenaton.com | sh
88
+
89
+ that you configure with
90
+
91
+ $ zenaton listen --env=.env --boot=boot.rb
92
+
93
+ where `.env` is the env file containing your credentials, and `boot.rb` is a file that will be included before each task execution - this file should load all workflow classes.
94
+
95
+ ## Documentation
96
+
97
+ Please see https://zenaton.com/documentation for complete documentation.
98
+
99
+ ## Development
100
+
101
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
102
+
103
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
104
+
105
+ ## Contributing
106
+
107
+ Bug reports and pull requests are welcome on GitHub at https://github.com/zenaton/zenaton-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
108
+
109
+ ## License
110
+
111
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
112
+
113
+ ## Code of Conduct
114
+
115
+ Everyone interacting in the zenaton-ruby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/zenaton/zenaton-ruby/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'zenaton'
6
+ require 'pry'
7
+ Pry.start