Skip to content

Commit

Permalink
Merge pull request #47 from fenix-hub/v0.9.0
Browse files Browse the repository at this point in the history
Update v0.9.0
  • Loading branch information
fenix-hub authored Jun 11, 2020
2 parents 0d6f8f7 + bfc75bb commit 3a19c66
Show file tree
Hide file tree
Showing 19 changed files with 450 additions and 187 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ user/




6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![version](https://img.shields.io/badge/plugin%20version-0.8.7-blue)](https://github.com/fenix-hub/godot-engine.github-integration)
[![version](https://img.shields.io/badge/plugin%20version-0.9.0-blue)](https://github.com/fenix-hub/godot-engine.github-integration)
[![updates](https://img.shields.io/badge/plugin%20updates-on%20discord-purple)](https://discord.gg/JNrcucg)
[![paypal](https://img.shields.io/badge/donations-PayPal-cyan)](https://paypal.me/NSantilio?locale.x=it_IT)

Expand All @@ -7,13 +7,11 @@ Check my **[Discord](https://discord.gg/KnJGY9S)** to stay updated on this repos

This plugin is now supported in [Godot Extended Library Discord](https://discord.gg/JNrcucg), check out the [Godot Extended Library Project](https://github.com/godot-extended-libraries)!

<img src="addons/github-integration/github-logo.png" width="64" height="64" align="left">

# GitHub Integration
A complete GitHub integration for your Godot Editor! Manage your project without even opening your browser.

Author: *"Nicolo (fenix) Santilio"*
Version: *0.8.7*
Version: *0.9.0*
Wiki: *[supported](https://github.com/fenix-hub/godot-engine.github-integration/wiki)*
Godot Version: *3.2stable*

Expand Down
7 changes: 7 additions & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ Please, visit [this site](https://help.github.com/en/github/authenticating-to-gi
*added*
- introduced a java extraction method for zip files.

-------------------
**version 0.9.0**
*fixed*
- opening shared repositories

*added*
- new repositories explorer
- search bar for repositories

-----------------
> This text file was created via [TextEditor Integration](https://github.com/fenix-hub/godot-engine.text-editor) inside Godot Engine's Editor.
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion addons/github-integration/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="GitHub integration"
description="Plugin to integrate GitHub requests directly via Godot Engine Editor"
author="Nicolo (fenix) Santilio"
version="0.8.7"
version="0.9.0"
script="scripts/github-integration.gd"
Binary file added addons/github-integration/resources/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions addons/github-integration/resources/search.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/search.png-9b9b7cef4594258a01318d95c85ad610.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/github-integration/resources/search.png"
dest_files=[ "res://.import/search.png-9b9b7cef4594258a01318d95c85ad610.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=true
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
324 changes: 192 additions & 132 deletions addons/github-integration/scenes/GitHub.tscn

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions addons/github-integration/scenes/RepositoryItem.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/github-integration/scripts/RepositoryItem.gd" type="Script" id=1]

[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 0.0
content_margin_right = 0.0
content_margin_top = 0.0
content_margin_bottom = 0.0
bg_color = Color( 0.6, 0.6, 0.6, 0 )

[node name="RepositoryItem" type="PanelContainer"]
anchor_right = 1.0
anchor_bottom = 0.027
margin_bottom = 1.8
custom_styles/panel = SubResource( 1 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="BG" type="ColorRect" parent="."]
visible = false
margin_right = 1024.0
margin_bottom = 18.0
color = Color( 1, 1, 1, 0.235294 )

[node name="Repository" type="HBoxContainer" parent="."]
margin_right = 1024.0
margin_bottom = 18.0
custom_constants/separation = 0
alignment = 1

[node name="Name" type="HBoxContainer" parent="Repository"]
margin_right = 341.0
margin_bottom = 18.0
size_flags_horizontal = 3
alignment = 1

[node name="Icon" type="TextureRect" parent="Repository/Name"]
margin_top = 1.0
margin_right = 16.0
margin_bottom = 17.0
rect_min_size = Vector2( 16, 16 )
size_flags_horizontal = 0
size_flags_vertical = 4
expand = true
stretch_mode = 6

[node name="Text" type="Label" parent="Repository/Name"]
margin_left = 20.0
margin_top = 2.0
margin_right = 341.0
margin_bottom = 16.0
size_flags_horizontal = 3
text = "RepositoryName"

[node name="Stars" type="HBoxContainer" parent="Repository"]
margin_left = 341.0
margin_right = 682.0
margin_bottom = 18.0
size_flags_horizontal = 3
alignment = 1

[node name="Icon" type="TextureRect" parent="Repository/Stars"]
margin_top = 1.0
margin_right = 16.0
margin_bottom = 17.0
rect_min_size = Vector2( 16, 16 )
size_flags_horizontal = 0
size_flags_vertical = 4
expand = true
stretch_mode = 6

[node name="Amount" type="Label" parent="Repository/Stars"]
margin_left = 20.0
margin_top = 2.0
margin_right = 341.0
margin_bottom = 16.0
size_flags_horizontal = 3
text = "Stars: 0"

[node name="Forks" type="HBoxContainer" parent="Repository"]
margin_left = 682.0
margin_right = 1024.0
margin_bottom = 18.0
size_flags_horizontal = 3
alignment = 1

[node name="Icon" type="TextureRect" parent="Repository/Forks"]
margin_top = 1.0
margin_right = 16.0
margin_bottom = 17.0
rect_min_size = Vector2( 16, 16 )
size_flags_horizontal = 0
size_flags_vertical = 4
expand = true
stretch_mode = 6

[node name="Amount" type="Label" parent="Repository/Forks"]
margin_left = 20.0
margin_top = 2.0
margin_right = 342.0
margin_bottom = 16.0
size_flags_horizontal = 3
text = "Forks: 0"
[connection signal="gui_input" from="." to="." method="_on_RepositoryItem_gui_input"]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 8 additions & 8 deletions addons/github-integration/scripts/Commit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ func load_gitignore():

func request_sha_latest_commit():
requesting = REQUESTS.LATEST_COMMIT
new_repo.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo_selected.name+"/git/refs/heads/"+_branch.get_item_text(branch_idx),UserData.header,false,HTTPClient.METHOD_GET,"")
new_repo.request("https://api.github.com/repos/"+repo_selected.owner.login+"/"+repo_selected.name+"/git/refs/heads/"+_branch.get_item_text(branch_idx),UserData.header,false,HTTPClient.METHOD_GET,"")
yield(self,"latest_commit")
request_base_tree()

func request_base_tree():
requesting = REQUESTS.BASE_TREE
new_repo.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo_selected.name+"/git/commits/"+sha_latest_commit,UserData.header,false,HTTPClient.METHOD_GET,"")
new_repo.request("https://api.github.com/repos/"+repo_selected.owner.login+"/"+repo_selected.name+"/git/commits/"+sha_latest_commit,UserData.header,false,HTTPClient.METHOD_GET,"")
yield(self,"base_tree")
request_blobs()

Expand Down Expand Up @@ -358,7 +358,7 @@ func request_blobs():
"encoding":encoding,
}

new_repo.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo_selected.name+"/git/blobs",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
new_repo.request("https://api.github.com/repos/"+repo_selected.owner.login+"/"+repo_selected.name+"/git/blobs",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
yield(self,"file_blobbed")
else:
get_parent().print_debug_message("pointing large file, please wait...")
Expand Down Expand Up @@ -411,7 +411,7 @@ func request_commit_tree():
"tree":tree
}

new_repo.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo_selected.name+"/git/trees",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
new_repo.request("https://api.github.com/repos/"+repo_selected.owner.login+"/"+repo_selected.name+"/git/trees",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
yield(self,"new_tree")
request_new_commit()

Expand All @@ -424,7 +424,7 @@ func request_new_commit():
"message": message
}

new_repo.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo_selected.name+"/git/commits",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
new_repo.request("https://api.github.com/repos/"+repo_selected.owner.login+"/"+repo_selected.name+"/git/commits",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
yield(self,"new_commit")
request_push_commit()

Expand All @@ -433,20 +433,20 @@ func request_push_commit():
var bod = {
"sha": sha_new_commit
}
new_repo.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo_selected.name+"/git/refs/heads/"+_branch.get_item_text(branch_idx),UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
new_repo.request("https://api.github.com/repos/"+repo_selected.owner.login+"/"+repo_selected.name+"/git/refs/heads/"+_branch.get_item_text(branch_idx),UserData.header,false,HTTPClient.METHOD_POST,JSON.print(bod))
yield(self,"pushed")

if lfs.size() > 0:
requesting = REQUESTS.LFS
var body = {"operation": "upload","ref": {"name":"refs/heads/"+_branch.get_item_text(branch_idx)},"transfers": [ "basic" ],"objects": lfs}
new_repo.request("https://github.com/"+UserData.USER.login+"/"+repo_selected.name+UserData.gitlfs_request,UserData.gitlfs_header,false,HTTPClient.METHOD_POST,JSON.print(body))
new_repo.request("https://github.com/"+repo_selected.owner.login+"/"+repo_selected.name+UserData.gitlfs_request,UserData.gitlfs_header,false,HTTPClient.METHOD_POST,JSON.print(body))
yield(self,"lfs")

if lfs.size() > 0:
requesting = REQUESTS.POST_LFS
print(lfs)
var body = { "transfer":"basic" , "objects":lfs}
new_repo.request("https://github.com/"+UserData.USER.login+"/"+repo_selected.name+UserData.gitlfs_request,UserData.gitlfs_header,false,HTTPClient.METHOD_PUT,JSON.print(body))
new_repo.request("https://github.com/"+repo_selected.owner.login+"/"+repo_selected.name+UserData.gitlfs_request,UserData.gitlfs_header,false,HTTPClient.METHOD_PUT,JSON.print(body))
yield(self,"lfs_push")

empty_fileds()
Expand Down
1 change: 1 addition & 0 deletions addons/github-integration/scripts/GitHub.gd
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ func print_debug_message(message : String = "",type : int = 0):

func _on_debug_toggled(button_pressed):
debug = button_pressed

27 changes: 13 additions & 14 deletions addons/github-integration/scripts/Repo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,13 @@ func load_icons(r):
pull_btn.set_button_icon(IconLoaderGithub.load_icon_from_name("download"))
git_lfs.set_button_icon(IconLoaderGithub.load_icon_from_name("git_lfs"))

func open_repo(repo : TreeItem):
item_repo = repo

func open_repo(repo : Dictionary):
contents_.clear()
branches_.clear()
branches.clear()
contents.clear()

var r = repo.get_metadata(0)
var r = repo
current_repo = r
html_url_.text = r.html_url
owner_.text = r.owner.login
Expand All @@ -148,13 +146,13 @@ func request_branches(rep : String):
branches_.clear()
branch3.clear()
requesting = REQUESTS.BRANCHES
request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+rep+"/branches",UserData.header,false,HTTPClient.METHOD_GET,"")
request.request("https://api.github.com/repos/"+owner_.text+"/"+rep+"/branches",UserData.header,false,HTTPClient.METHOD_GET,"")
yield(self,"get_branches")

if branches.size() > 0:
requesting = REQUESTS.TREES
for b in branches:
request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+rep+"/branches/"+b.name,UserData.header,false,HTTPClient.METHOD_GET,"")
request.request("https://api.github.com/repos/"+owner_.text+"/"+rep+"/branches/"+b.name,UserData.header,false,HTTPClient.METHOD_GET,"")
yield(self,"get_branches_contents")

var i = 0
Expand Down Expand Up @@ -182,7 +180,7 @@ func request_contents(rep : String, branch):
contents_.clear()

requesting = REQUESTS.CONTENTS
request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+rep+"/git/trees/"+branch.commit.commit.tree.sha+"?recursive=1",UserData.header,false,HTTPClient.METHOD_GET,"")
request.request("https://api.github.com/repos/"+owner_.text+"/"+rep+"/git/trees/"+branch.commit.commit.tree.sha+"?recursive=1",UserData.header,false,HTTPClient.METHOD_GET,"")

func open_html():
get_parent().loading(true)
Expand Down Expand Up @@ -218,7 +216,7 @@ func delete_repo():
func request_delete(repo : String):
get_parent().loading(true)
requesting = REQUESTS.DELETE
request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+repo,UserData.header,false,HTTPClient.METHOD_DELETE,"")
request.request("https://api.github.com/repos/"+owner_.text+"/"+repo,UserData.header,false,HTTPClient.METHOD_DELETE,"")

func request_delete_resource(path : String, item : TreeItem = null):
get_parent().loading(true)
Expand All @@ -239,14 +237,14 @@ func request_delete_resource(path : String, item : TreeItem = null):
"branch":current_branch.name
}

request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+current_repo.name+"/contents/"+path,UserData.header,false,HTTPClient.METHOD_DELETE,JSON.print(body))
request.request("https://api.github.com/repos/"+owner_.text+"/"+current_repo.name+"/contents/"+path,UserData.header,false,HTTPClient.METHOD_DELETE,JSON.print(body))

func commit():
hide()
get_parent().CommitRepo.show()
get_parent().CommitRepo.load_branches(branches,current_repo,contents,gitignore_file)

func request_completed(result, response_code, headers, body ):
func request_completed(result, response_code, headers, body):
if result == 0:
match requesting:
REQUESTS.DELETE:
Expand Down Expand Up @@ -294,6 +292,8 @@ func request_completed(result, response_code, headers, body ):
REQUESTS.PULLING:
if response_code == 200:
emit_signal("zip_pulled")
else:
print(result," ",response_code," ",JSON.parse(body.get_string_from_utf8()).result)

func build_list():
get_parent().loading(true)
Expand Down Expand Up @@ -362,7 +362,7 @@ func build_list():

func request_file_content(path : String):
requesting = REQUESTS.FILE_CONTENT
request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+current_repo.name+"/contents/"+path,UserData.header,false,HTTPClient.METHOD_GET)
request.request("https://api.github.com/repos/"+owner_.text+"/"+current_repo.name+"/contents/"+path,UserData.header,false,HTTPClient.METHOD_GET)
yield(self,"get_contents")

func _on_branch2_item_selected(ID):
Expand Down Expand Up @@ -416,7 +416,7 @@ func on_newbranch_confirmed():
"sha": branch3.get_item_metadata(branch3.get_selected_id()).commit.sha
}

request.request("https://api.github.com/repos/"+UserData.USER.login+"/"+current_repo.name+"/git/refs",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(body))
request.request("https://api.github.com/repos/"+owner_.text+"/"+current_repo.name+"/git/refs",UserData.header,false,HTTPClient.METHOD_POST,JSON.print(body))
get_parent().print_debug_message("creating new branch...")
yield(self,"new_branch_created")

Expand All @@ -436,15 +436,14 @@ func _on_reload_pressed():
contents_.clear()
branches_.clear()
branches.clear()
current_repo = ""
current_branch = ""
branches.clear()
branches_contents.clear()
contents.clear()
dirs.clear()
commit_sha = ""
tree_sha = ""
open_repo(item_repo)
open_repo(current_repo)

func gdscript_extraction():
var archive = unzipper._load(zip_filepath)
Expand Down
Loading

0 comments on commit 3a19c66

Please sign in to comment.