git-sleep 0.0.0 → 0.0.2

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/README.md CHANGED
@@ -1 +1,13 @@
1
- README.md
1
+ # git sleep
2
+
3
+ `gem install git-sleep`
4
+
5
+ to be used in conjunction with [website goes here](#)
6
+
7
+ ## usage (planned):
8
+
9
+ `git sleep authorize` will walk you through authorizing with Jawbone
10
+
11
+ `git sleep init` (from within a git repo) will install a git pre-commit hook for you
12
+
13
+ now when you try to commit to this repo, it will check if you really *should* be committing to this repo
data/bin/git-sleep CHANGED
@@ -1,6 +1,41 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
+ require 'rubygems'
4
+ require 'netrc'
3
5
  require File.expand_path('../../lib/git-sleep', __FILE__)
4
- require 'optparse'
5
6
 
6
- puts "go to bed!"
7
+ netrc = Netrc.read(GitSleep::NETRC_PATH)
8
+
9
+ help_text = "Available commands:
10
+ git sleep authorize
11
+ git sleep init"
12
+
13
+ case ARGV.length
14
+ when 0
15
+ puts help_text
16
+ when 1
17
+ case ARGV.first.downcase.to_sym
18
+ when :init
19
+ current_path = File.expand_path(".")
20
+ if Dir.entries(current_path).include?(".git")
21
+ puts "This is a git repo, so I'll now install the hook"
22
+ else
23
+ puts "This is not a git repo!"
24
+ end
25
+ when :authorize
26
+ puts "Visit #{GitSleep::OUR_SITE} to get the necessary information"
27
+ puts "what is your xid?"
28
+ print "> "
29
+ xid = $stdin.gets.chomp
30
+ puts "what is your token?"
31
+ print "> "
32
+ token = $stdin.gets.chomp
33
+ netrc.new_item_prefix = "\n# jawbone xid and sleepytime token\n"
34
+ netrc["sleepytime.com"] = xid, token
35
+ netrc.save
36
+ else # unrecognized command
37
+ puts help_text
38
+ end
39
+ else # other amounts of arguments
40
+ puts help_text
41
+ end
data/git-sleep.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |git_sleep|
20
20
  git_sleep.license = "MIT"
21
21
  git_sleep.required_ruby_version = '>= 1.8.7'
22
22
  git_sleep.add_runtime_dependency 'httparty'
23
+ git_sleep.add_runtime_dependency 'netrc'
23
24
  end
data/lib/git-sleep.rb CHANGED
@@ -2,6 +2,8 @@ require 'rubygems'
2
2
  require 'httparty'
3
3
 
4
4
  module GitSleep
5
- VERSION = "0.0.0"
5
+ VERSION = "0.0.2"
6
6
  LAST_UPDATED = "2013-08-11"
7
+ NETRC_PATH = File.expand_path('~/.netrc')
8
+ OUR_SITE = "http://sleepytime.com"
7
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-sleep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -29,6 +29,22 @@ dependencies:
29
29
  - - ! '>='
30
30
  - !ruby/object:Gem::Version
31
31
  version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: netrc
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
32
48
  description: Uses Jawbone to figure out if you are awake enough to code
33
49
  email:
34
50
  - maxwell.jacobson@gmail.com