git_ocd 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .DS_Store
2
+ results.html
3
+ pkg
4
+ html
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in git_ocd.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git_ocd (0.1.1)
5
+ listen (~> 2.4.1)
6
+ methadone (~> 1.3.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ aruba (0.5.4)
12
+ childprocess (>= 0.3.6)
13
+ cucumber (>= 1.1.1)
14
+ rspec-expectations (>= 2.7.0)
15
+ builder (3.2.2)
16
+ celluloid (0.15.2)
17
+ timers (~> 1.1.0)
18
+ childprocess (0.4.0)
19
+ ffi (~> 1.0, >= 1.0.11)
20
+ coderay (1.1.0)
21
+ cucumber (1.3.10)
22
+ builder (>= 2.1.2)
23
+ diff-lcs (>= 1.1.3)
24
+ gherkin (~> 2.12)
25
+ multi_json (>= 1.7.5, < 2.0)
26
+ multi_test (>= 0.0.2)
27
+ diff-lcs (1.2.5)
28
+ ffi (1.9.3)
29
+ gherkin (2.12.2)
30
+ multi_json (~> 1.3)
31
+ json (1.8.1)
32
+ listen (2.4.1)
33
+ celluloid (>= 0.15.2)
34
+ rb-fsevent (>= 0.9.3)
35
+ rb-inotify (>= 0.9)
36
+ methadone (1.3.1)
37
+ bundler
38
+ method_source (0.8.2)
39
+ multi_json (1.8.4)
40
+ multi_test (0.0.3)
41
+ pry (0.9.12.6)
42
+ coderay (~> 1.0)
43
+ method_source (~> 0.8)
44
+ slop (~> 3.4)
45
+ rake (0.9.6)
46
+ rb-fsevent (0.9.4)
47
+ rb-inotify (0.9.3)
48
+ ffi (>= 0.5.0)
49
+ rdoc (4.1.1)
50
+ json (~> 1.4)
51
+ rspec-expectations (2.14.5)
52
+ diff-lcs (>= 1.1.3, < 2.0)
53
+ slop (3.4.7)
54
+ timers (1.1.0)
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ aruba
61
+ bundler (~> 1.3)
62
+ git_ocd!
63
+ pry
64
+ rake (~> 0.9.2)
65
+ rdoc
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2014 Adam Bray
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # GitOcd
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'git_ocd'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install git_ocd
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/README.rdoc ADDED
@@ -0,0 +1,23 @@
1
+ = git_ocd - DESCRIBE YOUR GEM
2
+
3
+ Author:: YOUR NAME (YOUR EMAIL)
4
+ Copyright:: Copyright (c) 2014 YOUR NAME
5
+
6
+
7
+ License:: mit, see LICENSE.txt
8
+
9
+
10
+
11
+ DESCRIBE YOUR GEM HERE
12
+
13
+ == Links
14
+
15
+ * {Source on Github}[LINK TO GITHUB]
16
+ * RDoc[LINK TO RDOC.INFO]
17
+
18
+ == Install
19
+
20
+ == Examples
21
+
22
+ == Contributing
23
+
data/Rakefile ADDED
@@ -0,0 +1,61 @@
1
+ def dump_load_path
2
+ puts $LOAD_PATH.join("\n")
3
+ found = nil
4
+ $LOAD_PATH.each do |path|
5
+ if File.exists?(File.join(path,"rspec"))
6
+ puts "Found rspec in #{path}"
7
+ if File.exists?(File.join(path,"rspec","core"))
8
+ puts "Found core"
9
+ if File.exists?(File.join(path,"rspec","core","rake_task"))
10
+ puts "Found rake_task"
11
+ found = path
12
+ else
13
+ puts "!! no rake_task"
14
+ end
15
+ else
16
+ puts "!!! no core"
17
+ end
18
+ end
19
+ end
20
+ if found.nil?
21
+ puts "Didn't find rspec/core/rake_task anywhere"
22
+ else
23
+ puts "Found in #{path}"
24
+ end
25
+ end
26
+ require 'bundler'
27
+ require 'rake/clean'
28
+
29
+ require 'rake/testtask'
30
+
31
+ require 'cucumber'
32
+ require 'cucumber/rake/task'
33
+ gem 'rdoc' # we need the installed RDoc gem, not the system one
34
+ require 'rdoc/task'
35
+
36
+ include Rake::DSL
37
+
38
+ Bundler::GemHelper.install_tasks
39
+
40
+
41
+ Rake::TestTask.new do |t|
42
+ t.pattern = 'test/tc_*.rb'
43
+ end
44
+
45
+
46
+ CUKE_RESULTS = 'results.html'
47
+ CLEAN << CUKE_RESULTS
48
+ Cucumber::Rake::Task.new(:features) do |t|
49
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
50
+ t.fork = false
51
+ end
52
+
53
+ Rake::RDocTask.new do |rd|
54
+
55
+ rd.main = "README.rdoc"
56
+
57
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
58
+ end
59
+
60
+ task :default => [:test,:features]
61
+
data/bin/git_ocd ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pry'
4
+ require 'optparse'
5
+ require 'methadone'
6
+ require 'git_ocd'
7
+
8
+
9
+ class App
10
+ include Methadone::Main
11
+ include Methadone::CLILogging
12
+
13
+ main do |*repo_paths|
14
+
15
+ options['delay'] = options['delay'].to_i
16
+ observers = []
17
+
18
+ repo_paths.each do |path|
19
+ observers << GitOcd::Observer.new(path, options)
20
+ end
21
+
22
+ observers.map(&:start)
23
+
24
+ # we have to call trap after starting observers, otherwise the observers
25
+ # will intercept the trap
26
+ trap("SIGINT") { observers.map(&:stop); exit }
27
+
28
+ # main loop
29
+ loop do
30
+ sleep 1
31
+ end
32
+ end
33
+
34
+ description "git-ocd watches a git repo and auto-commits / pushes when files change."
35
+
36
+ version ::GitOcd::VERSION
37
+
38
+ options['delay'] = 5
39
+ on("--delay DELAY", "maximum delay (in seconds) between acting on changes; default is 5 seconds")
40
+ on("--commit-message MESSAGE", "commit message")
41
+
42
+ arg :repo_paths, :many, "Path(s) to the git repository(ies) that you want to observe"
43
+
44
+ use_log_level_option
45
+
46
+ go!
47
+ end
@@ -0,0 +1,13 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "git_ocd"
8
+ Then the exit status should be 0
9
+ And the banner should be present
10
+ And the banner should document that this app takes options
11
+ And the following options should be documented:
12
+ |--version|
13
+ And the banner should document that this app takes no arguments
@@ -0,0 +1 @@
1
+ # Put your step definitions here
@@ -0,0 +1,16 @@
1
+ require 'aruba/cucumber'
2
+ require 'methadone/cucumber'
3
+
4
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
5
+ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
6
+
7
+ Before do
8
+ # Using "announce" causes massive warnings on 1.9.2
9
+ @puts = true
10
+ @original_rubylib = ENV['RUBYLIB']
11
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
12
+ end
13
+
14
+ After do
15
+ ENV['RUBYLIB'] = @original_rubylib
16
+ end
data/git_ocd.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'git_ocd/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "git_ocd"
8
+ spec.version = GitOcd::VERSION
9
+ spec.authors = ["Adam Bray"]
10
+ spec.email = ["adam.bray@gmail.com"]
11
+ spec.description = %q{GitOCD watches a git repo for changes and automatically commits/pushes those changes}
12
+ spec.summary = %q{GitOCD is a terrible idea, well-executed. Have you every wanted your local repo to stay in sync with a remote repo, but you found the whole 'git add', 'git commit', 'git push' cycle was wearing you out?
13
+ GitOCD is here to save your day. Simply run 'git_ocd path_to_repo', and git_ocd will watch for changes and add/commit/push them for you! What could possibly go wrong?}
14
+ spec.homepage = "http://github.com/adambray/git_ocd"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency('rdoc')
25
+ spec.add_development_dependency('aruba')
26
+ spec.add_development_dependency('rake', '~> 0.9.2')
27
+ spec.add_development_dependency('pry')
28
+ spec.add_dependency('methadone', '~> 1.3.1')
29
+ spec.add_dependency('listen', '~> 2.4.1')
30
+ end
@@ -0,0 +1,23 @@
1
+ require 'listen'
2
+
3
+ module GitOcd
4
+ class Observer
5
+ def initialize(path, options)
6
+ @listener = Listen.to(path, wait_for_delay: options['delay']) do |modified, added, removed|
7
+ # puts "modified absolute path: #{modified}"
8
+ # puts "added absolute path: #{added}"
9
+ # puts "removed absolute path: #{removed}"
10
+ git_command_result = `cd #{path} && git commit -a -m "updated on save" && git push`
11
+ end
12
+ end
13
+
14
+ def start
15
+ @listener.start
16
+ end
17
+
18
+ def stop
19
+ @listener.stop
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module GitOcd
2
+ VERSION = "0.1.1"
3
+ end
data/lib/git_ocd.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "git_ocd/version"
2
+ require "git_ocd/observer"
3
+
4
+ module GitOcd
5
+ # Your code goes here...
6
+ end
data/tags ADDED
@@ -0,0 +1,8 @@
1
+ !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2
+ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3
+ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4
+ !_TAG_PROGRAM_NAME Exuberant Ctags //
5
+ !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
+ !_TAG_PROGRAM_VERSION 5.8 //
7
+ GitOcd lib/git_ocd.rb /^module GitOcd$/;" m
8
+ GitOcd lib/git_ocd/version.rb /^module GitOcd$/;" m
@@ -0,0 +1,7 @@
1
+ require 'test/unit'
2
+
3
+ class TestSomething < Test::Unit::TestCase
4
+ def test_truth
5
+ assert true
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git_ocd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam Bray
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rdoc
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: aruba
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.9.2
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.2
94
+ - !ruby/object:Gem::Dependency
95
+ name: pry
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: methadone
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.3.1
126
+ - !ruby/object:Gem::Dependency
127
+ name: listen
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 2.4.1
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 2.4.1
142
+ description: GitOCD watches a git repo for changes and automatically commits/pushes
143
+ those changes
144
+ email:
145
+ - adam.bray@gmail.com
146
+ executables:
147
+ - git_ocd
148
+ extensions: []
149
+ extra_rdoc_files: []
150
+ files:
151
+ - .gitignore
152
+ - Gemfile
153
+ - Gemfile.lock
154
+ - LICENSE.txt
155
+ - README.md
156
+ - README.rdoc
157
+ - Rakefile
158
+ - bin/git_ocd
159
+ - features/git_ocd.feature
160
+ - features/step_definitions/git_ocd_steps.rb
161
+ - features/support/env.rb
162
+ - git_ocd.gemspec
163
+ - lib/git_ocd.rb
164
+ - lib/git_ocd/observer.rb
165
+ - lib/git_ocd/version.rb
166
+ - tags
167
+ - test/tc_something.rb
168
+ homepage: http://github.com/adambray/git_ocd
169
+ licenses:
170
+ - MIT
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ segments:
182
+ - 0
183
+ hash: -1586818917989800141
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ segments:
191
+ - 0
192
+ hash: -1586818917989800141
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 1.8.23
196
+ signing_key:
197
+ specification_version: 3
198
+ summary: GitOCD is a terrible idea, well-executed. Have you every wanted your local
199
+ repo to stay in sync with a remote repo, but you found the whole 'git add', 'git
200
+ commit', 'git push' cycle was wearing you out? GitOCD is here to save your day.
201
+ Simply run 'git_ocd path_to_repo', and git_ocd will watch for changes and add/commit/push
202
+ them for you! What could possibly go wrong?
203
+ test_files:
204
+ - features/git_ocd.feature
205
+ - features/step_definitions/git_ocd_steps.rb
206
+ - features/support/env.rb
207
+ - test/tc_something.rb