cogy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -1
- data/Rakefile +14 -12
- data/app/controllers/cogy/cogy_controller.rb +4 -4
- data/config/routes.rb +2 -2
- data/lib/cogy.rb +6 -6
- data/lib/cogy/capistrano.rb +1 -0
- data/lib/cogy/capistrano/v2/tasks.rb +1 -0
- data/lib/cogy/command.rb +18 -3
- data/lib/cogy/context.rb +4 -4
- data/lib/cogy/engine.rb +1 -1
- data/lib/cogy/version.rb +1 -1
- data/lib/generators/cogy/config_generator.rb +2 -2
- data/lib/generators/cogy/install_generator.rb +3 -3
- data/test/dummy/cogy/fully_fledged.rb +1 -1
- data/test/dummy/log/test.log +6215 -0
- data/test/integration/command_test.rb +10 -0
- data/test/integration/inventory_test.rb +0 -1
- data/test/support/helpers.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +18 -9
- data/lib/cogy/invocation.rb +0 -37
@@ -43,5 +43,15 @@ module Cogy
|
|
43
43
|
get "/cogy/cmd/rails_url_helpers/george"
|
44
44
|
assert_equal "http://dummy.com/baz /baz", response.body
|
45
45
|
end
|
46
|
+
|
47
|
+
def test_invalid_opts_declaration
|
48
|
+
exception = assert_raises(ArgumentError) do
|
49
|
+
Cogy.on "invalidopts", desc: "foo", opts: { foo: {} } do
|
50
|
+
1
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_match(/\[:type, :required\]/, exception.message)
|
55
|
+
end
|
46
56
|
end
|
47
57
|
end
|
data/test/support/helpers.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Configure Rails Environment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
|
4
|
-
require File.expand_path("../../test/dummy/config/environment.rb",
|
4
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
5
|
require "rails/test_help"
|
6
6
|
require "minitest/spec"
|
7
7
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cogy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agis Anastasopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 4.2.7.1
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +24,6 @@ dependencies:
|
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '4.2'
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 4.2.7.1
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: sqlite3
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +80,20 @@ dependencies:
|
|
86
80
|
- - ">="
|
87
81
|
- !ruby/object:Gem::Version
|
88
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
89
97
|
description: Cogy integrates Cog with Rails in a way that writing and deploying commands
|
90
98
|
from your application is a breeze.
|
91
99
|
email:
|
@@ -102,10 +110,11 @@ files:
|
|
102
110
|
- app/views/cogy/error.text.erb
|
103
111
|
- config/routes.rb
|
104
112
|
- lib/cogy.rb
|
113
|
+
- lib/cogy/capistrano.rb
|
114
|
+
- lib/cogy/capistrano/v2/tasks.rb
|
105
115
|
- lib/cogy/command.rb
|
106
116
|
- lib/cogy/context.rb
|
107
117
|
- lib/cogy/engine.rb
|
108
|
-
- lib/cogy/invocation.rb
|
109
118
|
- lib/cogy/version.rb
|
110
119
|
- lib/generators/cogy/config_generator.rb
|
111
120
|
- lib/generators/cogy/install_generator.rb
|
data/lib/cogy/invocation.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
module Cogy
|
2
|
-
# {Context} represents a particular invocation request of a {Command}
|
3
|
-
# performed by a user. It holds state like the command arguments, options etc.
|
4
|
-
# In other words, it provides the context in which a {Command} should be
|
5
|
-
# invoked.
|
6
|
-
#
|
7
|
-
# A {Context} essentially is an HTTP request performed by the `cogy:cogy`
|
8
|
-
# command (https://github.com/skroutz/cogy-bundle) on behalf of the user.
|
9
|
-
# You can think of it as the equivalent of the ActionPack's `Request` class.
|
10
|
-
class Context
|
11
|
-
# The Cog command arguments as provided by the user who invoked the command.
|
12
|
-
#
|
13
|
-
# See https://cog-book.operable.io/#_arguments
|
14
|
-
attr :args
|
15
|
-
|
16
|
-
# The Cog command options as provided by the user who invoked the command
|
17
|
-
#
|
18
|
-
# See https://cog-book.operable.io/#_options
|
19
|
-
attr :opts
|
20
|
-
|
21
|
-
# The chat handle of the user who invoked the command
|
22
|
-
#
|
23
|
-
# See https://cog-book.operable.io/#_general_metadata
|
24
|
-
attr :user
|
25
|
-
|
26
|
-
# The Cogy environment (ie. all environment variables in the Relay
|
27
|
-
# executable that start with 'COGY_')
|
28
|
-
attr :env
|
29
|
-
|
30
|
-
def initialize(args, opts, user, env)
|
31
|
-
@args = args
|
32
|
-
@opts = opts
|
33
|
-
@user = user
|
34
|
-
@env = env
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|