git-punch 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +83 -0
- data/Rakefile +6 -0
- data/git-punch.gemspec +31 -0
- data/lib/git_punch.rb +23 -0
- data/lib/git_punch/client.rb +25 -0
- data/lib/git_punch/client_errors.rb +48 -0
- data/lib/git_punch/media_config.rb +24 -0
- data/lib/git_punch/plugin.rb +50 -0
- data/lib/git_punch/project.rb +47 -0
- data/lib/git_punch/repository.rb +33 -0
- data/lib/git_punch/song.rb +52 -0
- data/lib/git_punch/user.rb +49 -0
- data/lib/git_punch/version.rb +3 -0
- data/lib/tasks/clean.rake +18 -0
- data/lib/templates/gitattributes.erb +2 -0
- data/lib/templates/gitconfig.erb +5 -0
- data/lib/templates/gitignore.erb +6 -0
- data/lib/templates/post-commit.sh +5 -0
- data/spec/lib/git_punch/media_config_spec.rb +11 -0
- data/spec/lib/git_punch/plugin_spec.rb +27 -0
- data/spec/lib/git_punch/repository_spec.rb +18 -0
- data/spec/lib/git_punch/song_spec.rb +14 -0
- data/spec/lib/git_punch/user_spec.rb +29 -0
- data/spec/spec_helper.rb +2 -0
- metadata +203 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2NhZTRiMGM0NzVlM2I1YmJiMjQ1MTc3ZmQ2NzlmYmYwMjUzYTNmMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODJkMGZhZTcxMDFkZTUyMmJkZTAwNjE4ZDI0MTZiMDQ5NTUxNGRlMQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzY3M2M5YjFkZDk1YzRkZDlhZGQwNTY1MmMzOGExYWQ4ZDdhM2I2YjFlNmIw
|
10
|
+
OTU2YjNlNGVjZWJlN2UyZGI3ZGY3OTYzYjMwZmNjOTI3YjkzZDI0NmZmNjM5
|
11
|
+
OWRjZWEyYmVjZDU0YjMyNGMwNjExNjNmNGFkZjc1NGUwYWZiZDU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YWQxN2ZmYjI4OTUxNTFjMjRiZjI3ODE2OTcwOGEzMWRlNDk5ZWYwMjdlMWI3
|
14
|
+
ODY4YmRiZTgwOWIyMzUxYzcyY2JkMjAzMmIxM2IzMGJiYjQxODg3M2ZmMWZk
|
15
|
+
NjdkMjdkOGMxNzBiNWUyOGQyODU4M2ZjM2VlZTY2M2U1ZDk4NWU=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Tom Scott
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# git-punch
|
2
|
+
|
3
|
+
The command-line toolkit for effective and productive NotePunch
|
4
|
+
goodness.
|
5
|
+
|
6
|
+
## Requirements
|
7
|
+
|
8
|
+
- Ruby v1.9 or above
|
9
|
+
- Git v1.7 or above
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Install to the global gemset:
|
14
|
+
|
15
|
+
$ gem install git-punch
|
16
|
+
|
17
|
+
You will now install the post-commit scripts that automatically upload
|
18
|
+
your large files to our servers. This will also edit your project
|
19
|
+
gitconfig to use `git-media`.
|
20
|
+
|
21
|
+
$ git punch install
|
22
|
+
|
23
|
+
to install the post-commit scripts.
|
24
|
+
|
25
|
+
These scripts will automatically upload large files to our file server,
|
26
|
+
and auto-configure your repo for such a task.
|
27
|
+
|
28
|
+
## Configuration
|
29
|
+
|
30
|
+
Make sure you have the following in your ~/.gitconfig:
|
31
|
+
|
32
|
+
```gitconfig
|
33
|
+
[notepunch]
|
34
|
+
username = YOUR_NOTEPUNCH_USERNAME
|
35
|
+
token = YOUR_NOTEPUNCH_API_KEY
|
36
|
+
```
|
37
|
+
|
38
|
+
You can find all of this information on the profile page.
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
To create a new song from the current repo:
|
43
|
+
|
44
|
+
$ git punch create --title="An easier to read title" --private
|
45
|
+
|
46
|
+
Songs are public unless specifically marked private.
|
47
|
+
|
48
|
+
To fork the current repo:
|
49
|
+
|
50
|
+
$ git punch fork
|
51
|
+
|
52
|
+
This will fork the repo to your user account.
|
53
|
+
|
54
|
+
You can also use `git-media`, auto-configured for NotePunch. Run the
|
55
|
+
following command to upload your files. Note: Your files are uploaded
|
56
|
+
automatically with the Git scripts!
|
57
|
+
|
58
|
+
$ git media sync
|
59
|
+
|
60
|
+
Check the status of your files at any time:
|
61
|
+
|
62
|
+
$ git media status
|
63
|
+
|
64
|
+
You can also force-upload all your files to our file server:
|
65
|
+
|
66
|
+
$ git media clear && git media sync
|
67
|
+
|
68
|
+
Type the following commands for help:
|
69
|
+
|
70
|
+
$ git punch help
|
71
|
+
$ git media help
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
1. Fork it
|
76
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
77
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
78
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
79
|
+
5. Create new Pull Request
|
80
|
+
|
81
|
+
## Notes
|
82
|
+
|
83
|
+
We have not tested this on Windows, at all.
|
data/Rakefile
ADDED
data/git-punch.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'git_punch/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "git-punch"
|
8
|
+
spec.version = GitPunch::VERSION
|
9
|
+
spec.authors = ["Tom Scott"]
|
10
|
+
spec.email = ["tubbo@psychedeli.ca"]
|
11
|
+
spec.description = %q{Command-line tools for NotePunch}
|
12
|
+
spec.summary = %q{Command-line tools for NotePunch}
|
13
|
+
spec.homepage = "http://code.notepunch.com/git-punch"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "pry"
|
25
|
+
|
26
|
+
spec.add_dependency 'trollop'
|
27
|
+
spec.add_dependency 'right_aws'
|
28
|
+
spec.add_dependency 'git-media'
|
29
|
+
spec.add_dependency 'thor'
|
30
|
+
spec.add_dependency 'httparty'
|
31
|
+
end
|
data/lib/git_punch.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'thor'
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
require "git_punch/version"
|
6
|
+
|
7
|
+
require "git_punch/repository"
|
8
|
+
require "git_punch/project"
|
9
|
+
require "git_punch/user"
|
10
|
+
require "git_punch/song"
|
11
|
+
|
12
|
+
require "git_punch/media_config"
|
13
|
+
require "git_punch/plugin"
|
14
|
+
|
15
|
+
module GitPunch
|
16
|
+
def self.template_path
|
17
|
+
"#{gemspec.full_gem_path}/lib/templates"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.gemspec
|
21
|
+
Gem::Specification.find_by_name 'git-punch'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module GitPunch
|
2
|
+
class Client
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
base_uri "notepunch.com"
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@user = User.from_config
|
9
|
+
end
|
10
|
+
|
11
|
+
def post url, body
|
12
|
+
request = {
|
13
|
+
body: body,
|
14
|
+
basic_auth: user.credentials,
|
15
|
+
content_type: 'application/json'
|
16
|
+
}
|
17
|
+
|
18
|
+
self.class.post url, request
|
19
|
+
end
|
20
|
+
|
21
|
+
def get url
|
22
|
+
self.class.get url, content_type: 'application/json'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module GitPunch
|
2
|
+
class ClientErrors
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@collection = Hash.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def each
|
10
|
+
collection.each { |item| yield item }
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
combined.join ', '
|
15
|
+
end
|
16
|
+
|
17
|
+
def add attribute, message
|
18
|
+
collection[attribute] ||= Array.new
|
19
|
+
|
20
|
+
collection[attribute].push message
|
21
|
+
end
|
22
|
+
|
23
|
+
def << hash_of_arrays
|
24
|
+
collection.merge hash_of_arrays
|
25
|
+
end
|
26
|
+
|
27
|
+
def any?
|
28
|
+
collection.any?
|
29
|
+
end
|
30
|
+
|
31
|
+
def messages
|
32
|
+
reduce([]) do |error_messages, (attribute,messages)|
|
33
|
+
error_messages << messages.reduce([]) do |all,message|
|
34
|
+
all << "#{attribute} #{message}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def attributes
|
40
|
+
collection.keys.uniq
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def collection
|
45
|
+
@collection ||= Hash.new
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module GitPunch
|
2
|
+
module MediaConfig
|
3
|
+
def git_media_config
|
4
|
+
config_template.result context
|
5
|
+
end
|
6
|
+
|
7
|
+
def repo
|
8
|
+
@repo ||= Repository.new
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def context
|
13
|
+
instance_eval 'binding'
|
14
|
+
end
|
15
|
+
|
16
|
+
def config_template
|
17
|
+
ERB.new from_source
|
18
|
+
end
|
19
|
+
|
20
|
+
def from_source
|
21
|
+
File.binread "#{GitPunch.template_path}/gitconfig.erb"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module GitPunch
|
2
|
+
class Plugin < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
include MediaConfig
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
GitPunch.template_path
|
8
|
+
end
|
9
|
+
|
10
|
+
desc :init, "Install GitPunch on this repo."
|
11
|
+
def init
|
12
|
+
install_configuration!
|
13
|
+
|
14
|
+
say %{
|
15
|
+
We strongly urge you to `gem install guard-live-set && guard init live-set`
|
16
|
+
so you can automatically keep your Live set changes in Git.
|
17
|
+
} if project.live? && !project.has_guard_installed?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def repo
|
22
|
+
@current_repository ||= Repository.current!
|
23
|
+
end
|
24
|
+
|
25
|
+
def project
|
26
|
+
@project ||= Project.detect!
|
27
|
+
end
|
28
|
+
|
29
|
+
def install_configuration!
|
30
|
+
run "git config punch.username '#{note_punch_username}'"
|
31
|
+
copy_file 'post-commit.sh', '.git/hooks/post-commit'
|
32
|
+
template 'gitattributes.erb', '.gitattributes'
|
33
|
+
template 'gitignore.erb', '.gitignore'
|
34
|
+
system 'cp .git/config .git/config.backup' # silently back up gitconfig
|
35
|
+
insert_into_file '.git/config', git_media_config, before: '[punch]'
|
36
|
+
end
|
37
|
+
|
38
|
+
def note_punch_username
|
39
|
+
@user_name ||= if configured_user_name.empty?
|
40
|
+
ask 'What is your NotePunch username?'
|
41
|
+
else
|
42
|
+
configured_user_name
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def configured_user_name
|
47
|
+
@user_name_from_gitconfig ||= `git config punch.username`.strip
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Represents your current project and basically figures out its type.
|
2
|
+
module GitPunch
|
3
|
+
class Project
|
4
|
+
EXTENSIONS = {
|
5
|
+
logic: "*.logic",
|
6
|
+
live: "*.als"
|
7
|
+
}
|
8
|
+
|
9
|
+
def initialize with_root_directory
|
10
|
+
@root = with_root_directory
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.detect!
|
14
|
+
new in_current_directory
|
15
|
+
end
|
16
|
+
|
17
|
+
def has_guard_installed?
|
18
|
+
not guard_command.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
def method_missing name, *args
|
23
|
+
if "#{name}" =~ /\?$/
|
24
|
+
is_project? "#{name}".gsub(/\?/, '').to_sym
|
25
|
+
else
|
26
|
+
super name, args
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def is_project? name
|
32
|
+
raise "project type '#{name}' not supported" \
|
33
|
+
unless EXTENSIONS.keys.include? name
|
34
|
+
|
35
|
+
extension_matcher = EXTENSIONS[name]
|
36
|
+
Dir[extension_matcher].any?
|
37
|
+
end
|
38
|
+
|
39
|
+
def guard_command
|
40
|
+
system 'guard'
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.in_current_directory
|
44
|
+
File.dirname File.expand_path(__FILE__)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'git_punch/user'
|
2
|
+
|
3
|
+
module GitPunch
|
4
|
+
class Repository
|
5
|
+
attr_accessor :path, :user
|
6
|
+
|
7
|
+
def initialize options={}
|
8
|
+
@path = options[:from]
|
9
|
+
@user = if options[:user].nil?
|
10
|
+
User.from_config
|
11
|
+
else
|
12
|
+
create_user_from options[:user]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def name
|
17
|
+
File.basename path
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.current!
|
21
|
+
new from: ENV['PWD']
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def create_user_from param
|
26
|
+
if param.is_a? String
|
27
|
+
User.new name: param
|
28
|
+
else
|
29
|
+
param
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module GitPunch
|
2
|
+
class Song
|
3
|
+
attr_accessor :attributes, :is_fork, :original_user, :original_song_id
|
4
|
+
|
5
|
+
alias is_fork? is_fork
|
6
|
+
|
7
|
+
def initialize with_options={}
|
8
|
+
@attributes = with_options.reduce({}) do |attrs,opt,val|
|
9
|
+
send "#{opt}=", val if respond_to? opt
|
10
|
+
attrs.merge opt => val
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.fork with_options={}
|
16
|
+
new with_options.merge \
|
17
|
+
is_fork: true,
|
18
|
+
original_user: User.from_origin.name
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid?
|
22
|
+
if is_fork? && original_user.present?
|
23
|
+
fork_url = "/songs/#{original_song_id}/fork"
|
24
|
+
create_repository_at fork_url
|
25
|
+
else
|
26
|
+
create_repository_at "/songs"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def errors
|
31
|
+
@errors ||= ClientErrors.new
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def create_repository_at url
|
36
|
+
request = note_punch.post url, attrbutes
|
37
|
+
response = JSON.parse request.body
|
38
|
+
status = request.status
|
39
|
+
|
40
|
+
unless status == '200'
|
41
|
+
errors << response['errors']
|
42
|
+
end
|
43
|
+
|
44
|
+
errors.add JSON.parse(response.body)['errors'] \
|
45
|
+
unless response.status == '200'
|
46
|
+
end
|
47
|
+
|
48
|
+
def note_punch
|
49
|
+
@client ||= Client.new
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module GitPunch
|
4
|
+
class User
|
5
|
+
EVERYTHING_BUT_THE_OWNER = /(git|http|https):\/\/notepunch\.com(\:|\/)\.git/
|
6
|
+
attr_reader :token
|
7
|
+
|
8
|
+
def initialize from_options={}
|
9
|
+
from_options.each do |key,value|
|
10
|
+
instance_variable_set "@#{key}", value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def name
|
15
|
+
@name.strip
|
16
|
+
end
|
17
|
+
|
18
|
+
def present?
|
19
|
+
not name.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.from_origin
|
23
|
+
remote = `git remote show origin`
|
24
|
+
raise "No origin configured" if remote.empty?
|
25
|
+
line = remote.split("\n").select { |l| l =~ /Fetch URL/ }.first
|
26
|
+
owner = if line =~ /\A(.*)\:(.*)\.git\Z/
|
27
|
+
$2.split('/')[-2]
|
28
|
+
else
|
29
|
+
""
|
30
|
+
end
|
31
|
+
|
32
|
+
new name: owner
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from_config
|
36
|
+
username = `git config punch.username`
|
37
|
+
api_key = `git config punch.token`
|
38
|
+
|
39
|
+
new name: username, token: api_key
|
40
|
+
end
|
41
|
+
|
42
|
+
def credentials
|
43
|
+
{
|
44
|
+
username: name,
|
45
|
+
password: token
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
namespace :clean do
|
4
|
+
task :filesystem do
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
sh 'git checkout HEAD .gitignore'
|
8
|
+
|
9
|
+
%w(.gitattributes .git/hooks/post-commit).each do |config_file|
|
10
|
+
rm config_file if File.exists? config_file
|
11
|
+
end
|
12
|
+
mv '.git/config.backup', '.git/config' \
|
13
|
+
if File.exists? '.git/config.backup'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Clean up any generated files left over from testing."
|
18
|
+
task :clean => ['clean:filesystem']
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'git_punch'
|
3
|
+
|
4
|
+
module GitPunch
|
5
|
+
describe MediaConfig do
|
6
|
+
it "finds the correct template source"
|
7
|
+
it "uses the current repo as context"
|
8
|
+
it "compiles the template with ERB"
|
9
|
+
it "configures git-media with compiled template"
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'git_punch/plugin'
|
3
|
+
|
4
|
+
module GitPunch
|
5
|
+
describe Plugin do
|
6
|
+
context "init" do
|
7
|
+
it "configures the note_punch username"
|
8
|
+
it "copies post commit hook"
|
9
|
+
it "copies gitattributes file"
|
10
|
+
it "copies gitignore file"
|
11
|
+
it "inserts git-media configuration into git config"
|
12
|
+
end
|
13
|
+
|
14
|
+
context "create" do
|
15
|
+
it "POSTs a new song to note_punch"
|
16
|
+
it "creates a new git remote to use"
|
17
|
+
it "instructs the user to push to that new git remote"
|
18
|
+
end
|
19
|
+
|
20
|
+
context "fork" do
|
21
|
+
it "POSTs a new fork request to note_punch for the current user"
|
22
|
+
it "creates a new git remote to use"
|
23
|
+
it "names git remote after current user"
|
24
|
+
it "instructs the user to push to that new git remote"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'git_punch/repository'
|
3
|
+
|
4
|
+
module GitPunch
|
5
|
+
describe Repository do
|
6
|
+
it "exists at a path, usually the current working dir" do
|
7
|
+
subject.path = ENV['PWD']
|
8
|
+
|
9
|
+
subject.name.should == 'git-punch'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "is owned by a user" do
|
13
|
+
subject.user.should be_a User
|
14
|
+
subject.user.name.should_not be_false
|
15
|
+
subject.user.name.should == 'lester'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'git_punch/song'
|
3
|
+
|
4
|
+
module GitPunch
|
5
|
+
describe Song do
|
6
|
+
context "with a new song" do
|
7
|
+
it "creates a repository"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "with an existing song" do
|
11
|
+
it "forks a repository to your account"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'git_punch/user'
|
3
|
+
|
4
|
+
module GitPunch
|
5
|
+
describe User do
|
6
|
+
it "finds the user from the origin of the repo" do
|
7
|
+
user = User.from_origin
|
8
|
+
|
9
|
+
user.name.should == 'repo'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "finds the user from the git config" do
|
13
|
+
system 'git config punch.username "lester"'
|
14
|
+
user = User.from_config
|
15
|
+
|
16
|
+
user.should be_present
|
17
|
+
user.name.should == 'lester'
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with a test user" do
|
21
|
+
subject { User.new name: 'username', token: '12345sixseveneight' }
|
22
|
+
|
23
|
+
it "builds credentials suitable for an http request" do
|
24
|
+
subject.credentials[:username].should == 'username'
|
25
|
+
subject.credentials[:password].should == '12345sixseveneight'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-punch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tom Scott
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: trollop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: right_aws
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: git-media
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: httparty
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Command-line tools for NotePunch
|
140
|
+
email:
|
141
|
+
- tubbo@psychedeli.ca
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- .gitignore
|
147
|
+
- Gemfile
|
148
|
+
- LICENSE.txt
|
149
|
+
- README.md
|
150
|
+
- Rakefile
|
151
|
+
- git-punch.gemspec
|
152
|
+
- lib/git_punch.rb
|
153
|
+
- lib/git_punch/client.rb
|
154
|
+
- lib/git_punch/client_errors.rb
|
155
|
+
- lib/git_punch/media_config.rb
|
156
|
+
- lib/git_punch/plugin.rb
|
157
|
+
- lib/git_punch/project.rb
|
158
|
+
- lib/git_punch/repository.rb
|
159
|
+
- lib/git_punch/song.rb
|
160
|
+
- lib/git_punch/user.rb
|
161
|
+
- lib/git_punch/version.rb
|
162
|
+
- lib/tasks/clean.rake
|
163
|
+
- lib/templates/gitattributes.erb
|
164
|
+
- lib/templates/gitconfig.erb
|
165
|
+
- lib/templates/gitignore.erb
|
166
|
+
- lib/templates/post-commit.sh
|
167
|
+
- spec/lib/git_punch/media_config_spec.rb
|
168
|
+
- spec/lib/git_punch/plugin_spec.rb
|
169
|
+
- spec/lib/git_punch/repository_spec.rb
|
170
|
+
- spec/lib/git_punch/song_spec.rb
|
171
|
+
- spec/lib/git_punch/user_spec.rb
|
172
|
+
- spec/spec_helper.rb
|
173
|
+
homepage: http://code.notepunch.com/git-punch
|
174
|
+
licenses:
|
175
|
+
- MIT
|
176
|
+
metadata: {}
|
177
|
+
post_install_message:
|
178
|
+
rdoc_options: []
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ! '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
requirements: []
|
192
|
+
rubyforge_project:
|
193
|
+
rubygems_version: 2.0.0
|
194
|
+
signing_key:
|
195
|
+
specification_version: 4
|
196
|
+
summary: Command-line tools for NotePunch
|
197
|
+
test_files:
|
198
|
+
- spec/lib/git_punch/media_config_spec.rb
|
199
|
+
- spec/lib/git_punch/plugin_spec.rb
|
200
|
+
- spec/lib/git_punch/repository_spec.rb
|
201
|
+
- spec/lib/git_punch/song_spec.rb
|
202
|
+
- spec/lib/git_punch/user_spec.rb
|
203
|
+
- spec/spec_helper.rb
|