cronjob 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +49 -0
- data/Guardfile +70 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cronjob-0.1.0.gem +0 -0
- data/cronjob.gemspec +35 -0
- data/lib/cronjob/client.rb +13 -0
- data/lib/cronjob/configuration.rb +5 -0
- data/lib/cronjob/requests/create.rb +11 -0
- data/lib/cronjob/requests/delete.rb +11 -0
- data/lib/cronjob/requests/edit.rb +11 -0
- data/lib/cronjob/requests/list.rb +11 -0
- data/lib/cronjob/requests/ping.rb +11 -0
- data/lib/cronjob/requests/requests.rb +22 -0
- data/lib/cronjob/requests/show.rb +11 -0
- data/lib/cronjob/version.rb +3 -0
- data/lib/cronjob.rb +30 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1280d8a587b2cdcdbb7c956daf0d08517e47ebef
|
4
|
+
data.tar.gz: 1e95fdd8b39fa0bc7d6a1e57c210bbdfb9838d2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1e2f405e1b3fe1b909f75cc6ac215eb12e4075fcb5abfe0b6063a0f39fae650d79598e573e884064bd8787086095377b6dd265342e8a0687a799e4e2f7a4f1d
|
7
|
+
data.tar.gz: 518cfc245c4007300f41455349539b9e5a50897eff396eac67ebc852a6b9ef100edbc4e5d039c2bb04da8896e6f09ce65244d14b33d0fc56c6e91fccddd4a4bf
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cronjob (0.1.0)
|
5
|
+
faraday
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.4.0)
|
11
|
+
crack (0.4.3)
|
12
|
+
safe_yaml (~> 1.0.0)
|
13
|
+
diff-lcs (1.2.5)
|
14
|
+
faraday (0.9.2)
|
15
|
+
multipart-post (>= 1.2, < 3)
|
16
|
+
hashdiff (0.3.0)
|
17
|
+
multipart-post (2.0.0)
|
18
|
+
rake (10.5.0)
|
19
|
+
rspec (3.4.0)
|
20
|
+
rspec-core (~> 3.4.0)
|
21
|
+
rspec-expectations (~> 3.4.0)
|
22
|
+
rspec-mocks (~> 3.4.0)
|
23
|
+
rspec-core (3.4.4)
|
24
|
+
rspec-support (~> 3.4.0)
|
25
|
+
rspec-expectations (3.4.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.4.0)
|
28
|
+
rspec-mocks (3.4.1)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.4.0)
|
31
|
+
rspec-support (3.4.1)
|
32
|
+
safe_yaml (1.0.4)
|
33
|
+
webmock (2.0.3)
|
34
|
+
addressable (>= 2.3.6)
|
35
|
+
crack (>= 0.3.2)
|
36
|
+
hashdiff
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
bundler (~> 1.11)
|
43
|
+
cronjob!
|
44
|
+
rake (~> 10.0)
|
45
|
+
rspec (~> 3.0)
|
46
|
+
webmock
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
1.11.2
|
data/Guardfile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
# Rails files
|
44
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
+
dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
watch(rails.controllers) do |m|
|
49
|
+
[
|
50
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
51
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
52
|
+
rspec.spec.("acceptance/#{m[1]}")
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Rails config changes
|
57
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
# Capybara features specs
|
62
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
63
|
+
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
|
64
|
+
|
65
|
+
# Turnip features and steps
|
66
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
+
end
|
70
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Lorenzo Sinisi
|
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,55 @@
|
|
1
|
+
# Cronjob - Online Cron Job, Cron Job via JSON APis
|
2
|
+
|
3
|
+
Online Cron Jobs Guardiano is a web based API service for scheduled or recurring tasks (cron jobs). The API can be integrated into users' applications. Add new tasks via API and when the time comes, the API service will send an request to the url provided and the scheduled job starts. The API uses RESTful calls and responses are formatted in JSON.
|
4
|
+
|
5
|
+
Ruby 2.2.3
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'cronjob'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install cronjob
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Cronjob.configure do |config|
|
27
|
+
config.token = 'token you get when registering an account on http://guardiano.com'
|
28
|
+
end
|
29
|
+
```
|
30
|
+
```ruby
|
31
|
+
# Create a cronjob
|
32
|
+
Cronjob::Create.new(action: :get, url: 'http://yourapp.com/api/endpoing/cronjob1', params: 'something=true', cron: '* * * * *')
|
33
|
+
|
34
|
+
# List all cronjobs
|
35
|
+
Cronjob::List.new
|
36
|
+
|
37
|
+
# Delete a cronjob
|
38
|
+
Cronjob::Delete.new(id: CRONJOBID)
|
39
|
+
|
40
|
+
# Edit a cronjob
|
41
|
+
Cronjob::Edit.new(id: CRONJOBID, action: :get, url: 'http://yourapp.com/api/endpoing/cronjob1', params: 'something=true', cron: '* * * * *')
|
42
|
+
|
43
|
+
# Show a cronjob
|
44
|
+
Cronjob::Show.new(id: CRONJOBID)
|
45
|
+
```
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lorenzosinisi/cronjob.
|
50
|
+
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
55
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cronjob"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/cronjob-0.1.0.gem
ADDED
Binary file
|
data/cronjob.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cronjob/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cronjob"
|
8
|
+
spec.version = Cronjob::VERSION
|
9
|
+
spec.authors = ["Lorenzo Sinisi"]
|
10
|
+
spec.email = ["lorenzo.sinisi@modomoto.de"]
|
11
|
+
|
12
|
+
spec.summary = %q{Online Cron Jobs Guardiano is a web based API service for scheduled or recurring tasks (cron jobs)}
|
13
|
+
spec.description = %q{Online Cron Jobs Guardiano is a web based API service for scheduled or recurring tasks (cron jobs). The API can be integrated into users' applications. Add new tasks via API and when the time comes, the API service will send an request to the url provided and the scheduled job starts. The API uses RESTful calls and responses are formatted in JSON.}
|
14
|
+
spec.homepage = "https://github.com/lorenzosinisi"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
spec.add_dependency "faraday"
|
30
|
+
|
31
|
+
spec.add_development_dependency "webmock"
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Cronjob
|
2
|
+
class Requests
|
3
|
+
attr_accessor :response
|
4
|
+
|
5
|
+
def client
|
6
|
+
Client.new.conn
|
7
|
+
end
|
8
|
+
|
9
|
+
def parse(data)
|
10
|
+
JSON.parse(data)
|
11
|
+
rescue JSON::ParserError => e
|
12
|
+
data
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute(method, endpoint, args)
|
16
|
+
args[:auth_token] = Cronjob.configuration.token
|
17
|
+
data = client.send(method, endpoint, args)
|
18
|
+
parse(data.body)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/cronjob.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "cronjob/version"
|
2
|
+
require "cronjob/configuration"
|
3
|
+
# HTTP Client
|
4
|
+
require 'json'
|
5
|
+
require 'faraday'
|
6
|
+
require "cronjob/client"
|
7
|
+
require "cronjob/requests/requests"
|
8
|
+
# GET /ping
|
9
|
+
require "cronjob/requests/ping"
|
10
|
+
# POST /new
|
11
|
+
require "cronjob/requests/create"
|
12
|
+
# GET /list
|
13
|
+
require "cronjob/requests/list"
|
14
|
+
# DELETE /delete
|
15
|
+
require "cronjob/requests/delete"
|
16
|
+
# GET /show
|
17
|
+
require "cronjob/requests/show"
|
18
|
+
# PATCH /edit
|
19
|
+
require "cronjob/requests/edit"
|
20
|
+
|
21
|
+
module Cronjob
|
22
|
+
def self.configuration
|
23
|
+
# ugly but lets follow the convention
|
24
|
+
@configuration ||= Configuration.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.configure
|
28
|
+
yield(configuration)
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cronjob
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lorenzo Sinisi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
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: webmock
|
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: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: Online Cron Jobs Guardiano is a web based API service for scheduled or
|
84
|
+
recurring tasks (cron jobs). The API can be integrated into users' applications.
|
85
|
+
Add new tasks via API and when the time comes, the API service will send an request
|
86
|
+
to the url provided and the scheduled job starts. The API uses RESTful calls and
|
87
|
+
responses are formatted in JSON.
|
88
|
+
email:
|
89
|
+
- lorenzo.sinisi@modomoto.de
|
90
|
+
executables: []
|
91
|
+
extensions: []
|
92
|
+
extra_rdoc_files: []
|
93
|
+
files:
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- Guardfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- cronjob-0.1.0.gem
|
103
|
+
- cronjob.gemspec
|
104
|
+
- lib/cronjob.rb
|
105
|
+
- lib/cronjob/client.rb
|
106
|
+
- lib/cronjob/configuration.rb
|
107
|
+
- lib/cronjob/requests/create.rb
|
108
|
+
- lib/cronjob/requests/delete.rb
|
109
|
+
- lib/cronjob/requests/edit.rb
|
110
|
+
- lib/cronjob/requests/list.rb
|
111
|
+
- lib/cronjob/requests/ping.rb
|
112
|
+
- lib/cronjob/requests/requests.rb
|
113
|
+
- lib/cronjob/requests/show.rb
|
114
|
+
- lib/cronjob/version.rb
|
115
|
+
homepage: https://github.com/lorenzosinisi
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata:
|
119
|
+
allowed_push_host: https://rubygems.org
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.4.5.1
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Online Cron Jobs Guardiano is a web based API service for scheduled or recurring
|
140
|
+
tasks (cron jobs)
|
141
|
+
test_files: []
|