pully 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/README.md +18 -19
- data/Rakefile +5 -0
- data/lib/pully.rb +137 -1
- data/lib/pully/version.rb +1 -1
- data/pully.gemspec +3 -2
- data/spec/assets/gh_key.private +27 -0
- data/spec/assets/gh_key.public +1 -0
- data/spec/assets/git_ssh +5 -0
- data/spec/assets/test.yml +5 -0
- data/spec/env_spec.rb +18 -0
- data/spec/lib_spec.rb +52 -0
- data/spec/lib_test_spec.rb +55 -0
- metadata +59 -7
- data/bin/pully +0 -41
- data/spec/cli_spec.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac6ecacdbc362f4fc022fc9fa9fa2d81013a25fa
|
4
|
+
data.tar.gz: 1c878608104e3d72f23702a2f153382c11fccc11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c6131eabbc8ba34f82a79c0a39de726c50cfa5716a039921cfb2d3cd84284b7b3ce0d227596a7044ad95e307683ae54369ccdd86a6e0b383d8e12fd21e770d4
|
7
|
+
data.tar.gz: 2497f645f7e725aec7a42812de990f69061f297280ce70ff2483676ce2c2f9bb26363eff0bfabe728696dc111dca677c17920b707a0e1e31a1451f5c01376cc6
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
![pully: A command line interface for building a pull request bot](https://raw.githubusercontent.com/sotownsend/pully/master/logo.png)
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/
|
4
|
-
[![Build Status](https://travis-ci.org/sotownsend/
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/pully.svg)](http://badge.fury.io/rb/pully)
|
4
|
+
[![Build Status](https://travis-ci.org/sotownsend/Pully.svg?branch=master)](https://travis-ci.org/sotownsend/Pully)
|
5
5
|
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/sotownsend/pully/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
6
6
|
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/sotownsend/pully/blob/master/LICENSE)
|
7
7
|
|
@@ -9,33 +9,31 @@
|
|
9
9
|
|
10
10
|
A work in progress
|
11
11
|
|
12
|
-
#
|
13
|
-
|
12
|
+
# Basic usage
|
13
|
+
```ruby
|
14
|
+
require 'pully'
|
14
15
|
|
15
|
-
#
|
16
|
-
|
16
|
+
#Create a new pully object, each pully object targets (1) repository.
|
17
|
+
pully = Pully.new("github_username", "github_password", "my_repository")
|
17
18
|
|
18
|
-
#
|
19
|
-
|
19
|
+
#Create a new pull request to merge 'my_branch' into 'master' with the title 'My pull request' and the message 'Hey XXX...'
|
20
|
+
pull_number = pully.create_pull_request(from:"my_branch", to:"master", subject:"My pull request", message:"Hey XXXX, can you merge this for me?")
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
- send and receive events from a global or internal source.
|
24
|
-
- set interval and timeout timers.
|
25
|
-
- store temporary data in it's own heap '$__'
|
22
|
+
#Comment on that pull request
|
23
|
+
pully.write_comment_to_pull_request(pull_number, "Test Comment")
|
26
24
|
|
27
|
-
|
28
|
-
|
25
|
+
#Get all comments
|
26
|
+
comments = pully.comments_for_pull_request(pull_number)
|
27
|
+
```
|
29
28
|
|
30
29
|
## Requirements
|
31
30
|
|
32
|
-
- Mac OS X 10.9+ (Untested)
|
33
31
|
- Ruby 2.1 or Higher
|
34
32
|
|
35
33
|
## Communication
|
36
34
|
|
37
|
-
- If you **found a bug**,
|
38
|
-
- If you **have a feature request**,
|
35
|
+
- If you **found a bug**, submit a pull request.
|
36
|
+
- If you **have a feature request**, submit a pull request.
|
39
37
|
- If you **want to contribute**, submit a pull request.
|
40
38
|
|
41
39
|
## Installation
|
@@ -48,7 +46,8 @@ Run `sudo gem install pully`
|
|
48
46
|
|
49
47
|
### When should I use pully?
|
50
48
|
|
51
|
-
|
49
|
+
When you want to automate GitHub pull requests. Pully provides the necessary facilities for you to authenticate and control GitHub pull requests in
|
50
|
+
any way you wish. Duplicate the functionality of many popular CI solutions.
|
52
51
|
|
53
52
|
### What's Fittr?
|
54
53
|
|
data/Rakefile
CHANGED
data/lib/pully.rb
CHANGED
@@ -1,5 +1,141 @@
|
|
1
1
|
require "pully/version"
|
2
|
+
require 'ghee'
|
3
|
+
require 'octokit'
|
4
|
+
require 'git'
|
5
|
+
require 'tempfile'
|
2
6
|
|
3
7
|
module Pully
|
4
|
-
|
8
|
+
class Pully
|
9
|
+
def initialize(user:, pass:, repo:)
|
10
|
+
@user = user
|
11
|
+
@pass = pass
|
12
|
+
@repo = repo
|
13
|
+
@repo_selector = "#{@user}/#{@repo}"
|
14
|
+
|
15
|
+
@ghee = Ghee.basic_auth(@user, @pass)
|
16
|
+
@gh_client = Octokit::Client.new(:login => @user, :password => @pass)
|
17
|
+
|
18
|
+
#Test authentication, to_s required to have side-effects
|
19
|
+
@ghee.repos(user, repo).to_s
|
20
|
+
@gh_client.user #throw exception if auth is bad
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_pull_request(from:, to:, subject:, message:)
|
24
|
+
@ghee.repos(@user, @repo).pulls.create(:title => subject, :body => message, :base => to, :head => from)["number"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def comments_for_pull_request pull_number
|
28
|
+
@gh_client.issue_comments(@repo_selector, pull_number)
|
29
|
+
end
|
30
|
+
|
31
|
+
def write_comment_to_pull_request pull_number, comment
|
32
|
+
@gh_client.add_comment(@repo_selector, pull_number, comment)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module TestHelpers
|
37
|
+
class Branch
|
38
|
+
module Error
|
39
|
+
class NoSuchRepository < StandardError; end
|
40
|
+
class BadRepoSelector < StandardError; end
|
41
|
+
class BadLogin < StandardError; end
|
42
|
+
class NoSuchCloneURL< StandardError; end
|
43
|
+
end
|
44
|
+
|
45
|
+
#repo_selector is like 'my_user/repo'
|
46
|
+
def initialize(user:, pass:, repo_selector:, clone_url:)
|
47
|
+
@user = user
|
48
|
+
@pass = pass
|
49
|
+
@repo_selector = repo_selector
|
50
|
+
@clone_url = clone_url
|
51
|
+
|
52
|
+
|
53
|
+
#Setup the local git client
|
54
|
+
##############################################################
|
55
|
+
Git.configure do |config|
|
56
|
+
config.git_ssh = "./spec/assets/git_ssh"
|
57
|
+
end
|
58
|
+
##############################################################
|
59
|
+
|
60
|
+
clone_repo
|
61
|
+
|
62
|
+
#Setup Octocat client
|
63
|
+
##############################################################
|
64
|
+
@gh_client = Octokit::Client.new(:login => @user, :password => @pass)
|
65
|
+
begin
|
66
|
+
@gh_client.user #throw exception if auth is bad
|
67
|
+
rescue Octokit::Unauthorized
|
68
|
+
raise Error::BadLogin
|
69
|
+
end
|
70
|
+
|
71
|
+
begin
|
72
|
+
@repo = @gh_client.repo(repo_selector)
|
73
|
+
rescue ArgumentError
|
74
|
+
raise Error::BadRepoSelector
|
75
|
+
rescue Octokit::NotFound
|
76
|
+
raise Error::NoSuchRepository
|
77
|
+
end
|
78
|
+
##############################################################
|
79
|
+
end
|
80
|
+
|
81
|
+
#Will clone down repo and set @gh_client to the new repo
|
82
|
+
def clone_repo
|
83
|
+
#Create a temp path
|
84
|
+
temp_file = Tempfile.new('pully')
|
85
|
+
@path = temp_file.path
|
86
|
+
temp_file.close
|
87
|
+
temp_file.unlink
|
88
|
+
|
89
|
+
#Clone repo
|
90
|
+
begin
|
91
|
+
@git_client = Git.clone(@clone_url, 'pully', :path => @path)
|
92
|
+
@git_client.config("user.name", "pully-test-account")
|
93
|
+
@git_client.config("user.email", "pully-test-account@gmail.com")
|
94
|
+
rescue Git::GitExecuteError => e
|
95
|
+
raise Error::NoSuchCloneURL if e.message =~ /fatal: repository.*does not exist/
|
96
|
+
raise "Unknown git execute error: #{e}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def create_branch(new_branch_name)
|
101
|
+
#Checkout what ever real master is
|
102
|
+
@git_client.branch(master_branch).checkout
|
103
|
+
|
104
|
+
#Create a new branch
|
105
|
+
@git_client.branch(new_branch_name)
|
106
|
+
@git_client.branch(new_branch_name).checkout
|
107
|
+
end
|
108
|
+
|
109
|
+
def delete_branch(branch_name)
|
110
|
+
@git_client.push("origin", ":#{branch_name}")
|
111
|
+
end
|
112
|
+
|
113
|
+
def list_branches
|
114
|
+
#Re-pull repo from github
|
115
|
+
clone_repo
|
116
|
+
@git_client.branches.remote.map{|e| e.name}
|
117
|
+
end
|
118
|
+
|
119
|
+
def master_branch
|
120
|
+
@repo.default_branch
|
121
|
+
end
|
122
|
+
|
123
|
+
#Create, commit, and push to github
|
124
|
+
def commit_new_random_file(branch_name)
|
125
|
+
#Create a new file
|
126
|
+
Dir.chdir "#{@path}/pully" do
|
127
|
+
File.write branch_name, branch_name
|
128
|
+
end
|
129
|
+
|
130
|
+
#Commit
|
131
|
+
@git_client.add(:all => true)
|
132
|
+
@git_client.commit_all("New branch from Pully Test Suite #{SecureRandom.hex}")
|
133
|
+
@git_client.push("origin", branch_name)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.new(user:, pass:, repo:)
|
139
|
+
Pully.new(user: user, pass: pass, repo: repo)
|
140
|
+
end
|
5
141
|
end
|
data/lib/pully/version.rb
CHANGED
data/pully.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "rake", "~> 10.3"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.2"
|
24
24
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
25
|
-
spec.
|
26
|
-
|
25
|
+
spec.add_runtime_dependency "ghee", "~> 0.12.17"
|
26
|
+
spec.add_runtime_dependency "octokit", "~> 3.0"
|
27
|
+
spec.add_runtime_dependency "git", "~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z0TCa+WvsGXoMph97skgAgJhRB5kjYDJone72W00T2QDp4e5UlRwXOJCtCMrC5ahLQZZ+GVtaeFEkkcf8gRgODwpQGMW7ScGzY5suuEu71cmwwhXwyvAJEv7yGvVV4uHJ2M/epxDjhhDG6saZxuBfuSbd1UWQ9M89sLEeG/V5XArYqpunz Seo@imac.local
|
data/spec/assets/git_ssh
ADDED
data/spec/env_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'ghee'
|
3
|
+
require './lib/pully.rb'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
RSpec.describe "Test Environment" do
|
7
|
+
it "Can write to a tempfile" do
|
8
|
+
#Create a temp path
|
9
|
+
temp_file = Tempfile.new('pully')
|
10
|
+
@path = temp_file.path
|
11
|
+
temp_file.close
|
12
|
+
temp_file.unlink
|
13
|
+
|
14
|
+
File.write temp_file, "test"
|
15
|
+
str = File.read temp_file
|
16
|
+
expect(str).to eq("test")
|
17
|
+
end
|
18
|
+
end
|
data/spec/lib_spec.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'ghee'
|
3
|
+
require './lib/pully.rb'
|
4
|
+
|
5
|
+
#Get github information
|
6
|
+
def gh_info
|
7
|
+
yaml = YAML.load_file("./spec/assets/test.yml")
|
8
|
+
return yaml["github"]
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.describe "Library" do
|
12
|
+
it "Does throw an exception with INcorrect credentials while creating an object" do
|
13
|
+
expect { pully = Pully.new(user: "abcdefgh", pass: "abcdefgh", repo: "abcdefgh") }.to raise_error(Ghee::Unauthorized)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "Does NOT throw an exception with correct credentials while creating an object" do
|
17
|
+
pully = Pully.new(user: gh_info["user"], pass: gh_info["pass"], repo: gh_info["repo"])
|
18
|
+
end
|
19
|
+
|
20
|
+
it "Can call create a new pull request and returns an integer for the pull request #" do
|
21
|
+
#test branch creator
|
22
|
+
new_branch_name = SecureRandom.hex
|
23
|
+
th = Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: repo_selector, clone_url: gh_info["clone_url"])
|
24
|
+
th.create_branch(new_branch_name)
|
25
|
+
th.commit_new_random_file(new_branch_name)
|
26
|
+
|
27
|
+
pully = Pully.new(user: gh_info["user"], pass: gh_info["pass"], repo: gh_info["repo"])
|
28
|
+
n = pully.create_pull_request(from:new_branch_name, to:"master", subject:"My pull request", message:"Hey XXXX, can you merge this for me?")
|
29
|
+
expect(n.class).to be(Fixnum)
|
30
|
+
|
31
|
+
th.delete_branch(new_branch_name)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "Can call create a new pull request and write a comment on that pull request" do
|
35
|
+
#test branch creator
|
36
|
+
new_branch_name = SecureRandom.hex
|
37
|
+
th = Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: repo_selector, clone_url: gh_info["clone_url"])
|
38
|
+
th.create_branch(new_branch_name)
|
39
|
+
th.commit_new_random_file(new_branch_name)
|
40
|
+
|
41
|
+
pully = Pully.new(user: gh_info["user"], pass: gh_info["pass"], repo: gh_info["repo"])
|
42
|
+
pull_number = pully.create_pull_request(from:new_branch_name, to:"master", subject:"My pull request", message:"Hey XXXX, can you merge this for me?")
|
43
|
+
|
44
|
+
before_create = pully.comments_for_pull_request(pull_number).length
|
45
|
+
pully.write_comment_to_pull_request(pull_number, "Test Comment")
|
46
|
+
after_create = pully.comments_for_pull_request(pull_number).length
|
47
|
+
|
48
|
+
expect(after_create).to eq(before_create+1)
|
49
|
+
|
50
|
+
th.delete_branch(new_branch_name)
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'ghee'
|
3
|
+
require './lib/pully.rb'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
#Get github information
|
7
|
+
def gh_info
|
8
|
+
yaml = YAML.load_file("./spec/assets/test.yml")
|
9
|
+
return yaml["github"]
|
10
|
+
end
|
11
|
+
|
12
|
+
def repo_selector
|
13
|
+
return "#{gh_info["user"]}/#{gh_info["repo"]}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def rand_repo_selector
|
17
|
+
return "#{gh_info["user"]}/#{SecureRandom.hex}"
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.describe "Test Library" do
|
21
|
+
it "Fails creation with incorrect credentials" do
|
22
|
+
expect { Pully::TestHelpers::Branch.new(user: SecureRandom.hex, pass: SecureRandom.hex, repo_selector: repo_selector, clone_url: gh_info["clone_url"]) }.to raise_error(Pully::TestHelpers::Branch::Error::BadLogin)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "does not fail creation with incorrect credentials" do
|
26
|
+
Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: repo_selector, clone_url: gh_info["clone_url"])
|
27
|
+
end
|
28
|
+
|
29
|
+
it "does fail creation with bad repo selector if passed a repo_selector without a /" do
|
30
|
+
expect { Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: SecureRandom.hex, clone_url: gh_info["clone_url"]) }.to raise_error(Pully::TestHelpers::Branch::Error::BadRepoSelector)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "does fail creation with unreal repository selector" do
|
34
|
+
expect { Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: rand_repo_selector, clone_url: gh_info["clone_url"]) }.to raise_error(Pully::TestHelpers::Branch::Error::NoSuchRepository)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "does fail creation with bad clone url" do
|
38
|
+
expect { Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: rand_repo_selector, clone_url: "#{SecureRandom.hex}.com") }.to raise_error(Pully::TestHelpers::Branch::Error::NoSuchCloneURL)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "Can create a new branch from our repository and delete it" do
|
42
|
+
new_branch_name = SecureRandom.hex
|
43
|
+
th = Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: repo_selector, clone_url: gh_info["clone_url"])
|
44
|
+
|
45
|
+
th.create_branch(new_branch_name)
|
46
|
+
th.commit_new_random_file(new_branch_name)
|
47
|
+
|
48
|
+
#Make sure the branch is listed in the names
|
49
|
+
expect(th.list_branches).to include(new_branch_name)
|
50
|
+
|
51
|
+
#Delete the branch
|
52
|
+
th.delete_branch(new_branch_name)
|
53
|
+
expect(th.list_branches).not_to include(new_branch_name)
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seo Townsend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,11 +66,52 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.19'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ghee
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.12.17
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.12.17
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: octokit
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: git
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.2.9.1
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.2.9.1
|
69
111
|
description: Create your own pull request GitHub bot with ease
|
70
112
|
email:
|
71
113
|
- seotownsend@icloud.com
|
72
|
-
executables:
|
73
|
-
- pully
|
114
|
+
executables: []
|
74
115
|
extensions: []
|
75
116
|
extra_rdoc_files: []
|
76
117
|
files:
|
@@ -80,12 +121,17 @@ files:
|
|
80
121
|
- LICENSE
|
81
122
|
- README.md
|
82
123
|
- Rakefile
|
83
|
-
- bin/pully
|
84
124
|
- lib/pully.rb
|
85
125
|
- lib/pully/version.rb
|
86
126
|
- logo.png
|
87
127
|
- pully.gemspec
|
88
|
-
- spec/
|
128
|
+
- spec/assets/gh_key.private
|
129
|
+
- spec/assets/gh_key.public
|
130
|
+
- spec/assets/git_ssh
|
131
|
+
- spec/assets/test.yml
|
132
|
+
- spec/env_spec.rb
|
133
|
+
- spec/lib_spec.rb
|
134
|
+
- spec/lib_test_spec.rb
|
89
135
|
homepage: https://github.com/sotownsend/pully
|
90
136
|
licenses:
|
91
137
|
- MIT
|
@@ -111,5 +157,11 @@ signing_key:
|
|
111
157
|
specification_version: 4
|
112
158
|
summary: A ruby library for managing GitHub pull requests
|
113
159
|
test_files:
|
114
|
-
- spec/
|
160
|
+
- spec/assets/gh_key.private
|
161
|
+
- spec/assets/gh_key.public
|
162
|
+
- spec/assets/git_ssh
|
163
|
+
- spec/assets/test.yml
|
164
|
+
- spec/env_spec.rb
|
165
|
+
- spec/lib_spec.rb
|
166
|
+
- spec/lib_test_spec.rb
|
115
167
|
has_rdoc:
|
data/bin/pully
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'pully'
|
4
|
-
require 'thor'
|
5
|
-
|
6
|
-
class PullyCLI < Thor
|
7
|
-
desc "test", "Test the binary, returns 'ok\\n' on stdout"
|
8
|
-
def test
|
9
|
-
puts "ok"
|
10
|
-
end
|
11
|
-
#desc "new <path>", "Create a new flok project and/or module, you may supply an absolute path or relative, the last entry in the path will be the module name and folder name of the project"
|
12
|
-
#def new path
|
13
|
-
#name = File.basename(path)
|
14
|
-
#Dir.chdir File.dirname(path) do
|
15
|
-
#`bundle gem #{name}`
|
16
|
-
|
17
|
-
#Dir.chdir name do
|
18
|
-
#Dir.mkdir "app"
|
19
|
-
#Dir.mkdir "config"
|
20
|
-
#end
|
21
|
-
#end
|
22
|
-
#end
|
23
|
-
|
24
|
-
#option :compress, type: :boolean
|
25
|
-
#desc "build", "Build a flok project, you must be in the root of the project"
|
26
|
-
#def build
|
27
|
-
#Dir.mkdir("./public") unless File.exists?("./public")
|
28
|
-
#FileUtils.touch "./public/application.js"
|
29
|
-
|
30
|
-
#src = Flok::MergeSource.merge_all
|
31
|
-
|
32
|
-
##Compress by writing to a temporary dir, run closure, and then put back
|
33
|
-
#if options["compress"] == true
|
34
|
-
#src = Closure::Compiler.new.compile(src)
|
35
|
-
#end
|
36
|
-
|
37
|
-
#File.write("./public/application.js", src)
|
38
|
-
#end
|
39
|
-
end
|
40
|
-
|
41
|
-
PullyCLI.start(ARGV)
|
data/spec/cli_spec.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require './lib/pully.rb'
|
2
|
-
require 'tempfile'
|
3
|
-
require 'securerandom'
|
4
|
-
|
5
|
-
def ensure_tmp
|
6
|
-
tmp_spec_path = './spec/tmp'
|
7
|
-
Dir.mkdir(tmp_spec_path) unless File.exists?(tmp_spec_path)
|
8
|
-
end
|
9
|
-
|
10
|
-
RSpec.describe "CLI" do
|
11
|
-
it "Runs" do
|
12
|
-
a = `ruby -Ilib ./bin/pully test`
|
13
|
-
expect(a).to eq("ok\n")
|
14
|
-
end
|
15
|
-
end
|