pori 0.0.0
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 +17 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/pori +3 -0
- data/lib/pori/commands.rb +18 -0
- data/lib/pori/context.rb +38 -0
- data/lib/pori/version.rb +3 -0
- data/lib/pori.rb +4 -0
- data/pori.gemspec +16 -0
- metadata +57 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Akira Maeda
|
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,30 @@
|
|
1
|
+
# Pori
|
2
|
+
|
3
|
+
A command line toos for Bitbucket to create repository.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pori'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pori
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
$ cd path/to/local-git-directory
|
22
|
+
$ pori
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/pori
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'pit'
|
4
|
+
|
5
|
+
config = Pit.get("bitbucket", :require => {
|
6
|
+
"username" => "your account in bitbucket",
|
7
|
+
"password" => "your password in bitbucket"
|
8
|
+
})
|
9
|
+
|
10
|
+
username = config['username']
|
11
|
+
password = config['password']
|
12
|
+
|
13
|
+
repo = new_repo_name
|
14
|
+
|
15
|
+
puts "curl --request POST --user #{username}:#{password} https://api.bitbucket.org/1.0/repositories/ --data name=#{repo} --data scm=git --data is_private=true"
|
16
|
+
system "curl --request POST --user #{username}:#{password} https://api.bitbucket.org/1.0/repositories/ --data name=#{repo} --data scm=git --data is_private=true"
|
17
|
+
puts "git remote add origin ssh://git@bitbucket.org/#{username}/#{repo}.git"
|
18
|
+
system "git remote add origin ssh://git@bitbucket.org/#{username}/#{repo}.git"
|
data/lib/pori/context.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
PWD = Dir.pwd
|
4
|
+
|
5
|
+
def git_command
|
6
|
+
`which git`.chomp
|
7
|
+
end
|
8
|
+
|
9
|
+
def current_dir
|
10
|
+
PWD
|
11
|
+
end
|
12
|
+
|
13
|
+
def git_dir
|
14
|
+
`#{git_command} rev-parse -q --git-dir`
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_repo?
|
18
|
+
!!git_dir
|
19
|
+
end
|
20
|
+
|
21
|
+
def new_repo_name
|
22
|
+
is_git_repo=system("git rev-parse -q --git-dir")
|
23
|
+
|
24
|
+
if is_git_repo
|
25
|
+
tmp_dir = `git rev-parse -q --git-dir`.chomp
|
26
|
+
if tmp_dir == ".git"
|
27
|
+
repo_name = File.basename(Dir.pwd)
|
28
|
+
else
|
29
|
+
repo_dir_name = File.dirname("#{tmp_dir}") # => /Users/akira/repos/pori/.git
|
30
|
+
repo_name = File.basename("#{repo_dir_name}")
|
31
|
+
end
|
32
|
+
else
|
33
|
+
raise FatalError, "Not a git repository"
|
34
|
+
end
|
35
|
+
repo_name
|
36
|
+
end
|
37
|
+
|
38
|
+
|
data/lib/pori/version.rb
ADDED
data/lib/pori.rb
ADDED
data/pori.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/pori/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Akira Maeda"]
|
6
|
+
gem.email = ["glidenote@gmail.com"]
|
7
|
+
gem.summary = %q{A command line tool for Bitbucket to create repositories.}
|
8
|
+
gem.homepage = ""
|
9
|
+
|
10
|
+
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = "pori"
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = Pori::VERSION
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pori
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Akira Maeda
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-04 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description:
|
15
|
+
email:
|
16
|
+
- glidenote@gmail.com
|
17
|
+
executables:
|
18
|
+
- pori
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/pori
|
28
|
+
- lib/pori.rb
|
29
|
+
- lib/pori/commands.rb
|
30
|
+
- lib/pori/context.rb
|
31
|
+
- lib/pori/version.rb
|
32
|
+
- pori.gemspec
|
33
|
+
homepage: ''
|
34
|
+
licenses: []
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.8.11
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: A command line tool for Bitbucket to create repositories.
|
57
|
+
test_files: []
|