commitphotos 0.0.3 → 0.0.4
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 +4 -4
- data/bin/commitphotos +1 -1
- data/lib/commitphotos.rb +35 -19
- data/lib/commitphotos/templates/post-commit.erb +4 -0
- data/lib/commitphotos/version.rb +1 -1
- metadata +19 -20
- data/lib/commitphotos/hooks/post-commit-image +0 -4
- data/lib/commitphotos/hooks/post-commit-video +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7ee4937724e306fce69143aa734a591b6b9ecf0
|
4
|
+
data.tar.gz: 5518c4cc3122445a1d3c972f9c630918208d6546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a86e338ff0e45e383e178a78f899ac88a75829b97d08d3b99a755a470cd9078d68f3bc8c04e48fc116fab0fc76036460c8ad96b8c40f40c6e063139447be6ad
|
7
|
+
data.tar.gz: 4cdbb9ac05a2922c3ec9bc00bf1a18720252349adce50ef31c3840c47b514c19ec6f97963bdd989e4cc49c7939afe64bfa465e4d7cdf4eee5637f42bddc28b31
|
data/bin/commitphotos
CHANGED
@@ -20,6 +20,6 @@ Choice.options do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
case ARGV[0]
|
23
|
-
when 'install' then CommitPhoto.
|
23
|
+
when 'install' then CommitPhoto.new.setup_hook(Choice.choices[:global], Choice.choices[:video])
|
24
24
|
else puts Choice.help
|
25
25
|
end
|
data/lib/commitphotos.rb
CHANGED
@@ -3,44 +3,61 @@ require 'commitphotos/version'
|
|
3
3
|
require 'mini_magick'
|
4
4
|
require 'rest-client'
|
5
5
|
require 'tempfile'
|
6
|
+
require 'ostruct'
|
7
|
+
require 'erb'
|
6
8
|
|
7
9
|
require 'commitphotos/video'
|
8
10
|
require 'commitphotos/image'
|
9
11
|
|
10
12
|
class CommitPhoto
|
13
|
+
|
14
|
+
def self.image
|
15
|
+
puts "Say cheese! Taking a photo."
|
16
|
+
Image.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.video
|
20
|
+
puts "Say cheese! Taking a video."
|
21
|
+
Video.new
|
22
|
+
end
|
23
|
+
|
11
24
|
# This will setup Commitphotos for the user.
|
12
|
-
def
|
25
|
+
def setup_hook(global, video)
|
26
|
+
|
13
27
|
if global
|
14
28
|
destination = File.expand_path(`git config --get init.templatedir`.chomp)
|
15
|
-
if destination.empty?
|
16
|
-
destination = '~/.gittemplates'
|
17
|
-
mkdir_p(destination) unless File.exist?(destination)
|
18
|
-
`git config --global init.templatedir #{destination}`
|
19
|
-
end
|
29
|
+
create_global_hook_dir if destination.empty?
|
20
30
|
else
|
21
|
-
|
31
|
+
# We shouldn't require the user to be in a git repo if they're installing globally.
|
22
32
|
abort 'Error: not a git repository.' unless File.exist? File.join(Dir.pwd, '.git')
|
33
|
+
destination = File.expand_path(File.join(Dir.pwd, '.git/hooks'))
|
23
34
|
end
|
24
35
|
|
25
|
-
type = video ?
|
36
|
+
type = video ? :video : :image
|
26
37
|
|
27
38
|
local_post_commit = "#{File.expand_path(File.dirname(__FILE__))}/commitphotos/hooks/post-commit-#{type}"
|
28
|
-
|
39
|
+
|
29
40
|
FileUtils.mkdir_p(destination)
|
30
|
-
|
41
|
+
content = hook_content(type)
|
42
|
+
File.open(File.join(destination, 'post-commit'), 'w') { |file| file.write(content) }
|
43
|
+
puts "You're good to go!"
|
31
44
|
end
|
32
45
|
|
33
|
-
|
34
|
-
puts "Say cheese!"
|
35
|
-
Image.new
|
36
|
-
end
|
46
|
+
private
|
37
47
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
48
|
+
def create_global_hook_dir
|
49
|
+
destination = '~/.gittemplates'
|
50
|
+
FileUtils.mkdir_p(destination) unless File.exist?(destination)
|
51
|
+
`git config --global init.templatedir #{destination}`
|
41
52
|
end
|
42
53
|
|
43
|
-
|
54
|
+
def hook_content(type)
|
55
|
+
os = OpenStruct.new
|
56
|
+
os.type = type
|
57
|
+
|
58
|
+
template = "#{File.expand_path(File.dirname(__FILE__))}/commitphotos/templates/post-commit.erb"
|
59
|
+
ERB.new(File.read(template)).result(os.instance_eval { binding })
|
60
|
+
end
|
44
61
|
|
45
62
|
def dir
|
46
63
|
File.expand_path(File.dirname(__FILE__))
|
@@ -50,7 +67,6 @@ class CommitPhoto
|
|
50
67
|
def post(file)
|
51
68
|
puts "Publishing to commitphotos.com..."
|
52
69
|
RestClient.post('http://commitphotos.com/',
|
53
|
-
email: `git config --get user.email`.chomp,
|
54
70
|
user_name: `git config --get user.name`.chomp,
|
55
71
|
message: `git log -1 HEAD --pretty=format:%s`,
|
56
72
|
photo: File.new(file, 'rb')
|
data/lib/commitphotos/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commitphotos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colby Aley
|
@@ -9,90 +9,90 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mini_magick
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: choice
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rest-client
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: bundler
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.3'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rake
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rspec
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
description: Record yourself every time you commit and show it to the world.
|
@@ -104,7 +104,7 @@ executables:
|
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
-
- .gitignore
|
107
|
+
- ".gitignore"
|
108
108
|
- Gemfile
|
109
109
|
- LICENSE.txt
|
110
110
|
- README.md
|
@@ -112,9 +112,8 @@ files:
|
|
112
112
|
- bin/commitphotos
|
113
113
|
- commitphotos.gemspec
|
114
114
|
- lib/commitphotos.rb
|
115
|
-
- lib/commitphotos/hooks/post-commit-image
|
116
|
-
- lib/commitphotos/hooks/post-commit-video
|
117
115
|
- lib/commitphotos/image.rb
|
116
|
+
- lib/commitphotos/templates/post-commit.erb
|
118
117
|
- lib/commitphotos/version.rb
|
119
118
|
- lib/commitphotos/video.rb
|
120
119
|
- lib/imagesnap
|
@@ -130,17 +129,17 @@ require_paths:
|
|
130
129
|
- lib
|
131
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
131
|
requirements:
|
133
|
-
- -
|
132
|
+
- - ">="
|
134
133
|
- !ruby/object:Gem::Version
|
135
134
|
version: '0'
|
136
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
136
|
requirements:
|
138
|
-
- -
|
137
|
+
- - ">="
|
139
138
|
- !ruby/object:Gem::Version
|
140
139
|
version: '0'
|
141
140
|
requirements: []
|
142
141
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.1
|
142
|
+
rubygems_version: 2.2.0.rc.1
|
144
143
|
signing_key:
|
145
144
|
specification_version: 4
|
146
145
|
summary: A photo or video on every commit.
|