Shorty 0.3.0 → 0.3.1

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.
data/README.md CHANGED
@@ -76,6 +76,58 @@ In your shell:
76
76
 
77
77
  Shorty ~/uptime.rb
78
78
 
79
+ Usage: Best Practices
80
+ -----
81
+
82
+ You are not allowed to pass arguments to :run calls:
83
+
84
+ # Not possible:
85
+ run :ssh, :restart, "my arg"
86
+
87
+ This is intentional. You want to put all logic in a separate class/object.
88
+ For example, let's say you use a different command for SSH start and restart
89
+ depending on the OS. In your Ruby file, you put:
90
+
91
+ require "./My_SSH"
92
+ add :ssh, My_SSH
93
+ run :ssh, :start
94
+
95
+ In a separate file, `My_SSH.rb`:
96
+
97
+ require "ohai"
98
+
99
+ O = Ohai::System.new
100
+ O.require_plugin "linux/platform"
101
+
102
+ class My_SSH
103
+ class << self
104
+
105
+ def start
106
+ case O[:platform]
107
+ when "ubuntu"
108
+ "service ssh start"
109
+ when ...
110
+ ....
111
+ end
112
+ end
113
+
114
+ end
115
+ end
116
+
117
+ If :run allowed arguments, you would be very tempted to
118
+ write Shorty/Ruby code with lots of mixed in logic:
119
+
120
+ if O[:platform] == 'ubuntu'
121
+ run :ssh, :restart, "sudo service ssh restart"
122
+ else
123
+ run :ssh, :restart, "some_program sshd start -now"
124
+ end
125
+
126
+ In summary:
127
+
128
+ * Write short lines of Shorty/Ruby code.
129
+ * Hide complicated logic in separate Ruby classes and objects.
130
+
79
131
  Run Tests
80
132
  ---------
81
133
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'rake'
25
25
  s.add_development_dependency 'Bacon_Colored'
26
26
  s.add_development_dependency 'pry'
27
- s.add_development_dependency 'Exit_Zero'
27
+ s.add_development_dependency 'Exit_0'
28
28
 
29
29
  # Specify any dependencies here; for example:
30
30
  # s.add_runtime_dependency 'rest-client'
@@ -1,3 +1,3 @@
1
1
  class Shorty
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -3,7 +3,7 @@ require File.expand_path('spec/helper')
3
3
  require 'Shorty'
4
4
  require 'Bacon_Colored'
5
5
  require 'pry'
6
- require 'Exit_Zero'
6
+ require 'Exit_0'
7
7
 
8
8
 
9
9
  # ======== Include the tests.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Shorty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-21 00:00:00.000000000 Z
12
+ date: 2012-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon
@@ -76,7 +76,7 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: Exit_Zero
79
+ name: Exit_0
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 1.8.19
137
+ rubygems_version: 1.8.23
138
138
  signing_key:
139
139
  specification_version: 3
140
140
  summary: A DSL to add before/after hooks to method calls.