cogy 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28ec300393c739ebc8a9f7b3d84fb9934e8f9778
4
- data.tar.gz: b685e1a2685d49340dbadf54550375a9689d2ac8
3
+ metadata.gz: 0dc60289e97c5f49e30bfd90581fe24743fc04c6
4
+ data.tar.gz: 422827094a27717584a27c0f2e1812cd7297811f
5
5
  SHA512:
6
- metadata.gz: 90b69b70b3b6a243ff59c6bf7ec4ea8f1c0e8ed6a88a9ea5b0579126c78e34a574379975ebcbdc3ee8a0ff54f40b5609893fcad0ee0bf2b72160712cb6ab7f9e
7
- data.tar.gz: a944b9dafce7515bdf84a95547228ba832b11dfc1d02ce40ab16c136005ca7be0930f3022fcc2d384ff9c833cf79211b5897ad39afa2d896416083ac3a314643
6
+ metadata.gz: a21ad7aa25394ee9eeeb6423f49ad6c122c82a7ed4efce6e81d8704da2bf69850a03ddb69d0bf67b7c6f00b4e042980272c51c4828b754853d27b81a8fc83d7a
7
+ data.tar.gz: 9c5f3b2626f38622200600577c4f20fc59510414455b5e0db88d32b6e6cccc4f01b4777700fd4673d62e35949d35ce832b305df610056038967cb3e31d430d75
data/README.md CHANGED
@@ -1,36 +1,52 @@
1
1
  # Cogy
2
2
 
3
- Cogy provides a way to integrate Cog with Rails apps, in a way that managing
4
- and adding commands is a breeze.
3
+ Cogy integrates [Cog](https://operable.io/) with Rails
4
+ in a way that managing commands becomes a breeze.
5
+
6
+ ## Status
7
+
8
+ *DISCLAIMER*: While we use Cogy in production, it's still in public alpha and
9
+ is under heavy development.
10
+
11
+ This means that a few critical bits are missing (the Relay executable and
12
+ RSpec helpers to name a few) and the API is not stable yet.
13
+
14
+ However, feel free to test it and gives us your feedback!
5
15
 
6
16
  ## Why
7
17
 
8
- Creating a command that talks with a Rails app, typically involves writing
18
+ Creating a Cog command that talks with a Rails app typically involves writing
9
19
  a route, maybe a controller, an action and code to handle the command arguments
10
20
  and options.
11
21
 
12
- This is a repetitive task and Cogy provides a way to get rid of this tedious
13
- boilerplate code.
22
+ This is a tedious and repetitive task and involves writing a lot of boilerplate
23
+ code each time someone wants to add a new command.
24
+
25
+ Cogy is an opinionated library that provides a way to get rid of all the
26
+ repetitive work and makes writing commands a breeze!
14
27
 
15
- With Cogy, writing a new command is as simple as adding the following line
28
+ Making a new command available for use is as simple as adding the following line
16
29
  to a file in your application:
17
30
 
18
31
  ```ruby
19
32
  # in cogy/my_commands.rb
20
33
 
21
- on "foo", desc: "Echo a foo bar back at you!" do |req_args, _, user|
34
+ on "foo", desc: "Echo a foo bar back at you!" do |_args, _opts, user|
22
35
  "@#{user}: foo bar"
23
36
  end
24
37
  ```
25
38
 
39
+ ...and deploying!
40
+
26
41
  ## How it works
27
42
 
28
43
  Cogy is essentially three things:
29
44
 
30
- 1. An opinionated way to build commands: All Cogy commands are defined in your
31
- Rails app and end up in a single executable within the Relay (see below).
32
- Cogy provides versioning and dynamically generates the bundle config, which
33
- is also served by your Rails app. This, accompanied with the command [TODO: INSERT LINK HERE] that
45
+ 1. An opinionated way to write, manage & ship commands: All Cogy commands are
46
+ defined in your Rails app and end up invoking a single executable within the
47
+ Relay (see below). Cogy provides versioning and dynamically generates the
48
+ bundle config, which is also served by your Rails app (via a Rails Engine).
49
+ This, accompanied with the command [TODO: INSERT LINK HERE] that
34
50
  can install bundles from other bundles, makes it possible to automatically
35
51
  install the newly-written commands by invoking a trigger when you deploy
36
52
  your app.
@@ -120,7 +136,7 @@ on "calc",
120
136
  args: [:a, :b],
121
137
  opts: { op: { type: "string", required: true, short_flag: "o" } },
122
138
  desc: "Performs a calculation between numbers <a> and <b>",
123
- example: "!myapp:calc sum 1 2" do |req_args, req_opts, user|
139
+ examples: "!myapp:calc sum 1 2" do |req_args, req_opts, user|
124
140
  op = req_opts[:op].to_sym
125
141
  result = req_args.map(&:to_i).inject(&op)
126
142
  "Hello @#{user}, the result is: #{result}"
@@ -144,11 +160,9 @@ However it can be overriden in the application by creating a view in
144
160
  ## Authors
145
161
 
146
162
  * [Agis Anastasopoulos](https://github.com/agis-)
163
+ * [Mpampis Kostas](https://github.com/charkost)
147
164
 
148
165
  ## License
149
166
 
150
167
  Cogy is licensed under MIT. See [LICENSE](LICENSE).
151
168
 
152
-
153
-
154
-
data/lib/cogy/command.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  module Cogy
2
2
  class Command
3
- attr :name, :args, :opts, :desc, :long_desc, :example, :rules, :handler
3
+ attr :name, :args, :opts, :desc, :long_desc, :examples, :rules, :handler
4
4
 
5
- def initialize(name, args: [], opts: {}, desc:, long_desc: nil, example: nil, rules: nil)
5
+ def initialize(name, args: [], opts: {}, desc:, long_desc: nil, examples: nil, rules: nil)
6
6
  @name = name
7
7
  @args = [args].flatten.map!(&:to_s)
8
8
  @opts = opts.with_indifferent_access
9
9
  @desc = desc
10
10
  @long_desc = long_desc
11
- @example = example
11
+ @examples = examples
12
12
  @rules = rules || ["allow"]
13
13
  end
14
14
 
data/lib/cogy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cogy
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/cogy.rb CHANGED
@@ -10,8 +10,8 @@ module Cogy
10
10
  @@commands = {}
11
11
 
12
12
  # Bundle config-related stuff
13
- mattr_accessor :bundle_name
14
- @@bundle_name = "cogy"
13
+ mattr_accessor :bundle_name
14
+ @@bundle_name = "cogy"
15
15
 
16
16
  mattr_accessor :bundle_description
17
17
  @@bundle_description = "Cogy-generated commands"
@@ -74,8 +74,8 @@ module Cogy
74
74
  config["commands"][name]["long_description"] = cmd.long_desc
75
75
  end
76
76
 
77
- if cmd.example
78
- config["commands"][name]["example"] = cmd.example
77
+ if cmd.examples
78
+ config["commands"][name]["examples"] = cmd.examples
79
79
  end
80
80
  end
81
81
 
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.0.2
4
+ version: 0.0.3
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-02 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails