poe 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gem 'cijoe'
@@ -0,0 +1,20 @@
1
+ poe
2
+ ===
3
+
4
+ Utility to configure a cijoe for a repository
5
+
6
+ - it copies `.build-failed` `.build-worked` files from your `~/.poe/` directory to
7
+ your `.git/hooks` directory
8
+
9
+ TODO
10
+ ====
11
+ 1. Create a directory called `~/.poe` on installation and copy the `hooks`
12
+ directory to `~/.poe` also copy the config file `poe.yml` to
13
+ 2. Change the script to check the config file for the default runner and the
14
+ *to* email id
15
+ 3. Finally, make it wireup cijoe so that it starts as a deamon on login
16
+
17
+ Copyright
18
+ =========
19
+
20
+ Copyright (c) 2010 Khaja Minhajuddin. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.2
data/bin/poe CHANGED
@@ -1,3 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- puts 'enough talk let\' fight'
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../lib/poe')
4
+
5
+ puts 'configuring your repo....'
6
+ Poe.new(ARGV[0]).run
7
+ puts '--------------------'
@@ -0,0 +1,2 @@
1
+ to: minhajuddin@mailinator.com
2
+ runner: bundle exec rspec spec
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require File.join(File.dirname(__FILE__), 'common')
3
+
4
+ #TODO include the name of the project in the subject
5
+ Notifier.new.send_mail :subject => "FAIL: Build failed for #{ENV['SHA']} #{ENV['MESSAGE']}"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require File.join(File.dirname(__FILE__), 'common')
3
+
4
+ #TODO include the name of the project in the subject
5
+ Notifier.new.send_mail :subject => "OK: Build successful for #{ENV['SHA']} #{ENV['MESSAGE']}"
@@ -0,0 +1,19 @@
1
+ require 'mail'
2
+ require 'yaml'
3
+
4
+
5
+ class Notifier
6
+ @@config = YAML::load_file(File.join('~/.poe', 'config.yml')
7
+
8
+ def send_mail(options => {:from => ENV['AUTHOR'], :to => @@config["to"], :body => ENV["OUTPUT"]})
9
+ mail = Mail.new do
10
+ from options[:from]
11
+ to options[:to]
12
+ subject options[:subject]
13
+ body options[:body]
14
+ end
15
+
16
+ mail.deliver!
17
+ end
18
+
19
+ end
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ echo "triggering ci build...."
3
+ curl http://localhost:8080/ -F build=build -s
data/lib/poe.rb CHANGED
@@ -1,2 +1,60 @@
1
+ require 'fileutils'
2
+
1
3
  class Poe
4
+
5
+ @@hooks = ['build-failed', 'build-worked', 'common.rb']
6
+
7
+ def initialize(dir)
8
+ @dir = dir
9
+ end
10
+
11
+ def run
12
+ unless valid?
13
+ display_errors
14
+ return
15
+ end
16
+ setup
17
+ puts "drop kick => '#@dir'"
18
+ end
19
+
20
+ def setup
21
+ #copy the hooks
22
+ copy_hooks
23
+ #setup the default runner
24
+ setup_runner
25
+ end
26
+
27
+
28
+ def copy_hooks
29
+ src_dir = File.join(home_dir, '.poe', 'hooks')
30
+ tgt_dir = File.join(@dir, '.git', 'hooks')
31
+
32
+ @@hooks.each do |h|
33
+ FileUtils.cp File.join(src_dir, h), tgt_dir
34
+ end
35
+
36
+ end
37
+
38
+ def setup_runner
39
+ `cd #@dir && git config --add cijoe.runner "bundle exec rspec spec"`
40
+ end
41
+
42
+ def home_dir
43
+ File.expand_path('~')
44
+ end
45
+
46
+ def valid?
47
+ errors << "'#{@dir}' does not exist" unless File.exists?(@dir)
48
+ errors << "'#{@dir}' is not a git repo" unless File.exists?(File.join(@dir, '.git'))
49
+ errors.empty?
50
+ end
51
+
52
+ def errors
53
+ @errors ||= []
54
+ end
55
+
56
+ def display_errors
57
+ puts "Dang! something's wrong:\n\t#{errors.join("\n\t")}"
58
+ end
59
+
2
60
  end
@@ -5,27 +5,33 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{poe}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Khaja Minhajuddin"]
12
- s.date = %q{2010-11-06}
12
+ s.date = %q{2010-11-08}
13
13
  s.default_executable = %q{poe}
14
14
  s.description = %q{utility to configure cijoe}
15
15
  s.email = %q{minhajuddin@cosmicvent.com}
16
16
  s.executables = ["poe"]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
- "README.rdoc"
19
+ "README.md"
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
23
  ".gitignore",
24
+ "Gemfile",
24
25
  "LICENSE",
25
- "README.rdoc",
26
+ "README.md",
26
27
  "Rakefile",
27
28
  "VERSION",
28
29
  "bin/poe",
30
+ "config.yml",
31
+ "hooks/build-failed",
32
+ "hooks/build-worked",
33
+ "hooks/common.rb",
34
+ "hooks/post-update",
29
35
  "lib/poe.rb",
30
36
  "poe.gemspec",
31
37
  "test/helper.rb",
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 0
10
- version: 0.0.0
8
+ - 2
9
+ version: 0.0.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Khaja Minhajuddin
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-11-06 00:00:00 +05:30
17
+ date: 2010-11-08 00:00:00 +05:30
19
18
  default_executable: poe
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -40,15 +38,21 @@ extensions: []
40
38
 
41
39
  extra_rdoc_files:
42
40
  - LICENSE
43
- - README.rdoc
41
+ - README.md
44
42
  files:
45
43
  - .document
46
44
  - .gitignore
45
+ - Gemfile
47
46
  - LICENSE
48
- - README.rdoc
47
+ - README.md
49
48
  - Rakefile
50
49
  - VERSION
51
50
  - bin/poe
51
+ - config.yml
52
+ - hooks/build-failed
53
+ - hooks/build-worked
54
+ - hooks/common.rb
55
+ - hooks/post-update
52
56
  - lib/poe.rb
53
57
  - poe.gemspec
54
58
  - test/helper.rb
@@ -67,7 +71,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
71
  requirements:
68
72
  - - ">="
69
73
  - !ruby/object:Gem::Version
70
- hash: 3
71
74
  segments:
72
75
  - 0
73
76
  version: "0"
@@ -76,7 +79,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
79
  requirements:
77
80
  - - ">="
78
81
  - !ruby/object:Gem::Version
79
- hash: 3
80
82
  segments:
81
83
  - 0
82
84
  version: "0"
@@ -1,17 +0,0 @@
1
- = poe
2
-
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2010 Khaja Minhajuddin. See LICENSE for details.