piggy 0.0.6
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/.gitignore +3 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +49 -0
- data/README +0 -0
- data/Rakefile +15 -0
- data/VERSION +1 -0
- data/bin/piggy +4 -0
- data/features/get_help.feature +8 -0
- data/features/git_hook.feature +27 -0
- data/features/step_definitions/event_steps.rb +9 -0
- data/features/step_definitions/file_system_steps.rb +10 -0
- data/features/step_definitions/git_steps.rb +4 -0
- data/features/subscription.feature +23 -0
- data/features/support/env.rb +15 -0
- data/lib/piggy/cli.rb +33 -0
- data/lib/piggy/event.rb +18 -0
- data/lib/piggy/events.rb +11 -0
- data/lib/piggy/version.rb +3 -0
- data/piggy.gemspec +81 -0
- data/spec/event.spec.rb +8 -0
- data/spec/spec_helper.rb +1 -0
- data/templates/git_hook +1 -0
- metadata +170 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.0.0)
|
5
|
+
activesupport (= 3.0.0)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
i18n (~> 0.4.1)
|
8
|
+
activesupport (3.0.0)
|
9
|
+
aruba (0.2.1)
|
10
|
+
builder (2.1.2)
|
11
|
+
cucumber (0.8.5)
|
12
|
+
builder (~> 2.1.2)
|
13
|
+
diff-lcs (~> 1.1.2)
|
14
|
+
gherkin (~> 2.1.4)
|
15
|
+
json_pure (~> 1.4.3)
|
16
|
+
term-ansicolor (~> 1.0.4)
|
17
|
+
diff-lcs (1.1.2)
|
18
|
+
gherkin (2.1.5)
|
19
|
+
trollop (~> 1.16.2)
|
20
|
+
git (1.2.5)
|
21
|
+
i18n (0.4.1)
|
22
|
+
jeweler (1.5.0.pre2)
|
23
|
+
bundler (>= 1.0.0.rc.5)
|
24
|
+
git (>= 1.2.5)
|
25
|
+
rake
|
26
|
+
json_pure (1.4.6)
|
27
|
+
rake (0.8.7)
|
28
|
+
rspec (2.0.0.beta.20)
|
29
|
+
rspec-core (= 2.0.0.beta.20)
|
30
|
+
rspec-expectations (= 2.0.0.beta.20)
|
31
|
+
rspec-mocks (= 2.0.0.beta.20)
|
32
|
+
rspec-core (2.0.0.beta.20)
|
33
|
+
rspec-expectations (2.0.0.beta.20)
|
34
|
+
diff-lcs (>= 1.1.2)
|
35
|
+
rspec-mocks (2.0.0.beta.20)
|
36
|
+
term-ansicolor (1.0.5)
|
37
|
+
thor (0.14.0)
|
38
|
+
trollop (1.16.2)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
activemodel
|
45
|
+
aruba
|
46
|
+
cucumber
|
47
|
+
jeweler (= 1.5.0.pre2)
|
48
|
+
rspec (= 2.0.0.beta.20)
|
49
|
+
thor
|
data/README
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "piggy"
|
5
|
+
gemspec.summary = "Record and analyse coding sessions"
|
6
|
+
gemspec.description = "Record and analyse coding sessions"
|
7
|
+
gemspec.email = "louismrose@gmail.com"
|
8
|
+
gemspec.homepage = "http://github.com/louismrose/piggy"
|
9
|
+
gemspec.authors = ["Louis Rose"]
|
10
|
+
gemspec.executables = ["piggy"]
|
11
|
+
end
|
12
|
+
Jeweler::GemcutterTasks.new
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
15
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.6
|
data/bin/piggy
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Use git hooks
|
2
|
+
In order to monitor the way I use git
|
3
|
+
As a programmer
|
4
|
+
I want to send git events to Piggy
|
5
|
+
|
6
|
+
Scenario: Install git post commit hook
|
7
|
+
When I run "piggy install"
|
8
|
+
Then the output should contain:
|
9
|
+
"""
|
10
|
+
Successfully installed git hook.
|
11
|
+
Piggy is now monitoring the git commits made in this project.
|
12
|
+
"""
|
13
|
+
And the file ".git/hooks/post-commit" should contain "Piggy"
|
14
|
+
And the file ".git/hooks/post-commit" should be executable
|
15
|
+
|
16
|
+
# @wip
|
17
|
+
# Scenario: A git commit should trigger a Piggy event
|
18
|
+
# Given the git hook is installed
|
19
|
+
# And an empty file named "foo.txt"
|
20
|
+
# When I run "git add foo.txt"
|
21
|
+
# And I run "git commit -m 'First commit'"
|
22
|
+
# Then an event should be triggered with title "First commit"
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Given /^an executable file named "([^"]*)" with:$/ do |path, contents|
|
2
|
+
Given "a file named \"#{path}\" with:", contents
|
3
|
+
When "I run \"chmod 755 #{path}\""
|
4
|
+
end
|
5
|
+
|
6
|
+
Then /^the file "([^"]*)" should be executable$/ do |path|
|
7
|
+
in_current_dir do
|
8
|
+
File.executable?(path).should be_true
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Subscription
|
2
|
+
In order to use Piggy events in other programs
|
3
|
+
As a Piggy developer
|
4
|
+
I want to subscribe to Piggy events
|
5
|
+
|
6
|
+
Scenario: Subscribe via the CLI
|
7
|
+
When I run "piggy subscribe writer.rb"
|
8
|
+
Then the output should contain:
|
9
|
+
"""
|
10
|
+
Piggy is now sending events to 'writer.rb'.
|
11
|
+
"""
|
12
|
+
|
13
|
+
Scenario: Receive events from Piggy
|
14
|
+
Given an executable file named "writer.rb" with:
|
15
|
+
"""
|
16
|
+
#!/usr/bin/env ruby
|
17
|
+
|
18
|
+
File.open('output.txt', 'w') {|f| f.write(ARGV.first) }
|
19
|
+
"""
|
20
|
+
And I run "piggy subscribe writer.rb"
|
21
|
+
And an event is triggered with title "Hello world!"
|
22
|
+
Then the file "output.txt" should contain "Hello world!"
|
23
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
2
|
+
|
3
|
+
require 'aruba'
|
4
|
+
|
5
|
+
module ArubaOverrides
|
6
|
+
def detect_ruby_script(cmd)
|
7
|
+
if cmd =~ /^piggy /
|
8
|
+
"ruby -I../../lib -S ../../bin/#{cmd}"
|
9
|
+
else
|
10
|
+
super(cmd)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
World(ArubaOverrides)
|
data/lib/piggy/cli.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
require 'piggy/version'
|
4
|
+
|
5
|
+
module Piggy
|
6
|
+
class CLI < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
File.expand_path('../../../templates', __FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "version", "Prints version information"
|
14
|
+
def version
|
15
|
+
puts Piggy::VERSION
|
16
|
+
end
|
17
|
+
map %w(-v --version) => :version
|
18
|
+
|
19
|
+
desc "install", "Installs a git post-commit hook for Piggy"
|
20
|
+
def install
|
21
|
+
copy_file "git_hook", ".git/hooks/post-commit"
|
22
|
+
chmod ".git/hooks/post-commit", 0755
|
23
|
+
puts "Successfully installed git hook."
|
24
|
+
puts "Piggy is now monitoring the git commits made in this project."
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "subscribe PROGRAM", "Add a program that will receive Piggy events"
|
28
|
+
def subscribe(subscriber)
|
29
|
+
create_file ".piggy/subscribers", subscriber
|
30
|
+
puts "Piggy is now sending events to '#{subscriber}'."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/piggy/event.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
|
3
|
+
module Piggy
|
4
|
+
class Event
|
5
|
+
include ActiveModel::Serializers::Xml
|
6
|
+
extend ActiveModel::Naming
|
7
|
+
|
8
|
+
attr_accessor :title
|
9
|
+
|
10
|
+
def initialize(title)
|
11
|
+
@title = title
|
12
|
+
end
|
13
|
+
|
14
|
+
def attributes
|
15
|
+
@attributes ||= {'title' => 'nil'}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/piggy/events.rb
ADDED
data/piggy.gemspec
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{piggy}
|
8
|
+
s.version = "0.0.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Louis Rose"]
|
12
|
+
s.date = %q{2010-09-07}
|
13
|
+
s.default_executable = %q{piggy}
|
14
|
+
s.description = %q{Record and analyse coding sessions}
|
15
|
+
s.email = %q{louismrose@gmail.com}
|
16
|
+
s.executables = ["piggy"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"README"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"README",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/piggy",
|
28
|
+
"features/get_help.feature",
|
29
|
+
"features/git_hook.feature",
|
30
|
+
"features/step_definitions/event_steps.rb",
|
31
|
+
"features/step_definitions/file_system_steps.rb",
|
32
|
+
"features/step_definitions/git_steps.rb",
|
33
|
+
"features/subscription.feature",
|
34
|
+
"features/support/env.rb",
|
35
|
+
"lib/piggy/cli.rb",
|
36
|
+
"lib/piggy/event.rb",
|
37
|
+
"lib/piggy/events.rb",
|
38
|
+
"lib/piggy/version.rb",
|
39
|
+
"piggy.gemspec",
|
40
|
+
"spec/event.spec.rb",
|
41
|
+
"spec/spec_helper.rb",
|
42
|
+
"templates/git_hook"
|
43
|
+
]
|
44
|
+
s.homepage = %q{http://github.com/louismrose/piggy}
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.7}
|
47
|
+
s.summary = %q{Record and analyse coding sessions}
|
48
|
+
s.test_files = [
|
49
|
+
"spec/event.spec.rb",
|
50
|
+
"spec/spec_helper.rb"
|
51
|
+
]
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
+
s.specification_version = 3
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
59
|
+
s.add_runtime_dependency(%q<activemodel>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<jeweler>, ["= 1.5.0.pre2"])
|
61
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<aruba>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<rspec>, ["= 2.0.0.beta.20"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
66
|
+
s.add_dependency(%q<activemodel>, [">= 0"])
|
67
|
+
s.add_dependency(%q<jeweler>, ["= 1.5.0.pre2"])
|
68
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
69
|
+
s.add_dependency(%q<aruba>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.20"])
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
74
|
+
s.add_dependency(%q<activemodel>, [">= 0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["= 1.5.0.pre2"])
|
76
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
77
|
+
s.add_dependency(%q<aruba>, [">= 0"])
|
78
|
+
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.20"])
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
data/spec/event.spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
|
data/templates/git_hook
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Piggy
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: piggy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Louis Rose
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-09-07 00:00:00 +01:00
|
18
|
+
default_executable: piggy
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: thor
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
prerelease: false
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activemodel
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
version: "0"
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: jeweler
|
48
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - "="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 1
|
55
|
+
- 5
|
56
|
+
- 0
|
57
|
+
- pre2
|
58
|
+
version: 1.5.0.pre2
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: cucumber
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: *id004
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: aruba
|
77
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: *id005
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: rspec
|
90
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - "="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
segments:
|
96
|
+
- 2
|
97
|
+
- 0
|
98
|
+
- 0
|
99
|
+
- beta
|
100
|
+
- 20
|
101
|
+
version: 2.0.0.beta.20
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: *id006
|
105
|
+
description: Record and analyse coding sessions
|
106
|
+
email: louismrose@gmail.com
|
107
|
+
executables:
|
108
|
+
- piggy
|
109
|
+
extensions: []
|
110
|
+
|
111
|
+
extra_rdoc_files:
|
112
|
+
- README
|
113
|
+
files:
|
114
|
+
- .gitignore
|
115
|
+
- Gemfile
|
116
|
+
- Gemfile.lock
|
117
|
+
- README
|
118
|
+
- Rakefile
|
119
|
+
- VERSION
|
120
|
+
- bin/piggy
|
121
|
+
- features/get_help.feature
|
122
|
+
- features/git_hook.feature
|
123
|
+
- features/step_definitions/event_steps.rb
|
124
|
+
- features/step_definitions/file_system_steps.rb
|
125
|
+
- features/step_definitions/git_steps.rb
|
126
|
+
- features/subscription.feature
|
127
|
+
- features/support/env.rb
|
128
|
+
- lib/piggy/cli.rb
|
129
|
+
- lib/piggy/event.rb
|
130
|
+
- lib/piggy/events.rb
|
131
|
+
- lib/piggy/version.rb
|
132
|
+
- piggy.gemspec
|
133
|
+
- spec/event.spec.rb
|
134
|
+
- spec/spec_helper.rb
|
135
|
+
- templates/git_hook
|
136
|
+
has_rdoc: true
|
137
|
+
homepage: http://github.com/louismrose/piggy
|
138
|
+
licenses: []
|
139
|
+
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
version: "0"
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
version: "0"
|
161
|
+
requirements: []
|
162
|
+
|
163
|
+
rubyforge_project:
|
164
|
+
rubygems_version: 1.3.7
|
165
|
+
signing_key:
|
166
|
+
specification_version: 3
|
167
|
+
summary: Record and analyse coding sessions
|
168
|
+
test_files:
|
169
|
+
- spec/event.spec.rb
|
170
|
+
- spec/spec_helper.rb
|