pawnee 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,6 +33,7 @@ This system will:
33
33
  - and just overwrite it so files get copied to remote destinations if needed
34
34
 
35
35
 
36
+ A note on idempotence. Being idempotent is a big selling point for chef. Pawnee strives for idempotence but provides it in different ways. For example, where chef would provide a more dsl like way to declare what to do when changes are made, pawnee tries to avoid too much DSL, so the recipe developer will need to be aware that the task may be run multiple times. We find that either way the recipe developer needs to understand this situation, and with the Pawnee way, its made clearer in the code.
36
37
 
37
38
  ## Installation
38
39
 
data/docs/GUIDE.md CHANGED
@@ -6,7 +6,7 @@ Pawnee tries to make it very easy to create recipes for setting up things on rem
6
6
 
7
7
  pawnee gem [gemname]
8
8
 
9
- This will generate files for a gem in the current directory. The word Recipe is used to refer to these pawnee gems (since it is a standard term in the provisioning world.)
9
+ This will generate files for a gem in the current directory. All pawnee gems will be automatically prefixed with pawnee- so that they can be easily identified. The word Recipe is used to refer to these pawnee gems (since it is a standard term in the provisioning world.)
10
10
 
11
11
  ## base.rb
12
12
 
@@ -83,6 +83,8 @@ Pawnee also provides its own set of actions for common server tasks.
83
83
 
84
84
  install_package, remove_package, compile, create_user, delete_user
85
85
 
86
+ For more info see [the docs on pawnee actions](...)
87
+
86
88
  ## Options
87
89
 
88
90
  Pawnee also uses thor's option system. This means your tasks should use thor's #desc and #method_option. ([Read more here](https://github.com/wycats/thor/wiki/Getting-Started) and [here](https://github.com/wycats/thor/wiki/Method-Options)) This allows for an easily defined set of options for any task. This also allows anyone to see what options the tasks take:
data/docs/TODO.md CHANGED
@@ -8,3 +8,17 @@ TODO: Add a as_user('user') do .. end option
8
8
  TODO: Need to make a clear way for pawnee gems (and recipes) to provide actions (example, git gem provides git actions)
9
9
  TODO: Run actions in threads (across multiple servers)
10
10
  TODO: Test to make sure arguments work directly as well (they probably don't right now)
11
+ TODO: System to check for and register updates/modifications
12
+
13
+
14
+ def setup
15
+ install_package('build-essential')
16
+
17
+ modify_block do
18
+ install_package('nginx')
19
+
20
+ if modified?
21
+ invoke Pawnee::Nginx::Base restart
22
+ end
23
+ end
24
+ end
@@ -10,7 +10,7 @@ module Pawnee
10
10
  # This is copied in from thor/actions.rb#initialize,
11
11
  # we can't extend from a module, so we just move this setup
12
12
  # to a method
13
- def pawnee_setup_actions(args=[], options={}, config={})
13
+ def pawnee_setup_actions(args=[], options={}, config={}) #:nodoc:
14
14
  self.behavior = case config[:behavior].to_s
15
15
  when "force", "skip"
16
16
  _cleanup_options_and_set(options, config[:behavior])
@@ -23,8 +23,7 @@ module Pawnee
23
23
 
24
24
  attr_accessor :server
25
25
 
26
- # Calls the thor initializers, then if :server is passed in as
27
- # an option, it will set it up
26
+ # Creates an instance of the pawnee recipe
28
27
  #
29
28
  # ==== Parameters
30
29
  # args<Array[Object]>:: An array of objects. The objects are applied to their
@@ -97,8 +96,8 @@ module Pawnee
97
96
 
98
97
  desc "setup", 'setup on the destination server'
99
98
  # All recipies should subclass Pawnee::Base and implement setup to
100
- # install everything needed for the gem
101
- # setup should be able to be called multiple times
99
+ # install everything needed for the gem.
100
+ # Setup should be able to be called multiple times
102
101
  def setup
103
102
  raise 'this gem does not implement the setup method'
104
103
  end
@@ -112,7 +111,7 @@ module Pawnee
112
111
 
113
112
  # Guess the gem name based on the class name
114
113
  def self.gem_name
115
- self.name.gsub(/[:][:][^:]+$/, '').gsub(/^[^:]+[:][:]/, '').gsub('::', '-').downcase
114
+ self.name.gsub(/[:][:]Base$/, '').gsub(/^[^:]+[:][:]/, '').gsub('::', '-').downcase
116
115
  end
117
116
 
118
117
  no_tasks {
@@ -127,7 +126,11 @@ module Pawnee
127
126
  # Setup the server connections before we run the task
128
127
  servers = options[:servers] || options['servers']
129
128
 
130
- if !servers || self.class == Pawnee::CLI
129
+ # Don't run multiple times if:
130
+ # 1. they don't have any servers (then run locally)
131
+ # 2. the call is coming from the main CLI
132
+ # 3. they are calling a help task
133
+ if !servers || self.class == Pawnee::CLI || task.name == 'help'
131
134
  # No servers, just run locally
132
135
  task.run(self, *args)
133
136
  else
@@ -1,3 +1,3 @@
1
1
  module Pawnee
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/spec/base_spec.rb CHANGED
@@ -33,7 +33,7 @@ describe Pawnee::Base do
33
33
  end
34
34
 
35
35
 
36
- class Dep
36
+ class Dep #:nodoc:
37
37
  attr_accessor :name
38
38
 
39
39
  def initialize(name)
@@ -45,9 +45,9 @@ describe Pawnee::Base do
45
45
  Pawnee::Base.recipes.should == nil
46
46
 
47
47
  # These will persist between tests
48
- module Pawnee
49
- module Red
50
- class Base < Pawnee::Base
48
+ module Pawnee #:nodoc:
49
+ module Red #:nodoc:
50
+ class Base < Pawnee::Base #:nodoc:
51
51
  desc "setup", "setup"
52
52
  def setup
53
53
  puts "SETUP RED"
@@ -55,8 +55,8 @@ describe Pawnee::Base do
55
55
  end
56
56
  end
57
57
 
58
- module Blue
59
- class Base < Pawnee::Base
58
+ module Blue #:nodoc:
59
+ class Base < Pawnee::Base #:nodoc:
60
60
  desc "setup", "setup"
61
61
  def setup
62
62
  puts "SETUP BLUE"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pawnee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-06-10 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -301,7 +301,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
301
301
  version: '0'
302
302
  segments:
303
303
  - 0
304
- hash: 1925107233539140142
304
+ hash: -3877937215280368330
305
305
  required_rubygems_version: !ruby/object:Gem::Requirement
306
306
  none: false
307
307
  requirements:
@@ -310,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
310
  version: '0'
311
311
  segments:
312
312
  - 0
313
- hash: 1925107233539140142
313
+ hash: -3877937215280368330
314
314
  requirements: []
315
315
  rubyforge_project:
316
316
  rubygems_version: 1.8.22