GithubHelp home page GithubHelp logo

projectinitializationautomation's Introduction

Install:

git clone "https://github.com/KalleHallden/ProjectInitializationAutomation.git"
cd ProjectInitializationAutomation
pip install -r requirements.txt
touch .env
Then open the .env file and store your username, password, and desired file destination. Use the provided format at the bottom of this README.
source ~/.my_commands.sh

Usage:

To run the script type in 'create <name of your folder>'

Env File Format:

USERNAME="Username123"
PASSWORD="Password123"
FILEPATH="/path/to/your/project/"

projectinitializationautomation's People

Contributors

akashghanate avatar amlan-007 avatar andrewmayes avatar bhumilad avatar burkitt123 avatar ericdev52 avatar farhatnawaz avatar francisceril avatar ironsoul0 avatar itssitanshu avatar kallehallden avatar silv4b avatar wikyprash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

projectinitializationautomation's Issues

On the bash function it may be necessary to use python3

I am modifying the project to add a new file according to the user extension given in a second argument in the bash command. After setting all up my code cannot run and keep giving errors. In my case, I need to use python3 instead of python because I have Python 3. I would like to see this hint added to the README.md because it can be useful for troubleshooting on the installation.

The modified code in the bash command is:

function create() {
    source .env
    python3 create.py $1 $2
    git init
    git remote add origin [email protected]:$USERNAME/$1.git
    touch README.md
    touch main$2
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    code .
}

Folder Issue

Hey kalle, How to ask for a different folder each time?

Update to Run Fully Create.py

import sys
import os
from github import Github

path = "/home/cstevens/Documents/Code/"

username = "" #Insert your github username here
password = "" #Insert your github password here
password2 = "" #Insert your github web formated password here

def create():
folderName = str(sys.argv[1])
os.makedirs(path + str(sys.argv[1]))
user = Github(username, password).get_user()
repo = user.create_repo(sys.argv[1])
os. chdir(path + str(sys.argv[1]))
with open("README.md", "w") as text_file:
print("#Demo")
os.system("git init")
os.system("git add README.md")
os.system("git commit -m 'first commit'")
os.system("git remote add origin https://github.com/{0}/{1}.git".format(username,sys.argv[1]))
os.system("git push https://{0}:{1}@github.com/{0}/{2}.git --all".format(username,password2,sys.argv[1]))
print("Succesfully created repository {}".format(sys.argv[1]))

if name == "main":
create()

Open Licence

Add an open license if Kalle gives permission

npm module

I created a npm module github-init-cli which does the same thing but is easier to configure (without source code changes) and also works on properly on windows without using git bash.

To be able to just run create <name> instead of github-init-cli create <name> the following function could be added to ~/.bashrc

function create() {
    github-init-cli create $1
}

or if you are using PowerShell on windows add the function to ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1

function create($name) {
    github-init-cli create $name
}

BitBucket

Can anyone help how can I modify this to bitbucket? not Github?

Username conflict issue affecting git remote add

I found the issue on my Mac machine, with retrieving the username from the .env file. The issue arose because my Github and Mac machine usernames were different.

On the following line in create.py
username = os.getenv("USERNAME")

My Mac machine username was somehow being retrieved instead of the Github username I had set in the .env file. This was causing the command git remote add origin <[email protected]:$USERNAME/$1.git> to insert the wrong username, causing it to fail.

Renaming the USERNAME to GITHUBUSERNAME in the codebase alleviated the issue.

That is, and in the .env files, the following was changed:

In create.py
username = os.getenv("GITHUBUSERNAME")

In .my_commands.sh
git remote add origin https://github.com/$GITHUBUSERNAME/$1.git

And .env file
GITHUBUSERNAME="<my_username>"

Hide password and possible username under the system

I think it is pretty easy to conceal the password by using something like "cat" command to get the password in a file that has permissions only for your user:

# only your should be able to read this file, so we have to change its permissions
chmod 700 ~/.config/projetcname/credentials.txt

# in the bellow example we are using awk to read the line that has "password" and print the second field
password=$(awk '/password/ {print $2}' credentials.txt)

The credential files should be something like:

user: username
password: yourveryconvolutedpassword

I gave you a shell script example but it could perfectly be done using python. This way you do not have to exposure your credentials.

.env: No such file or directory

Hi,
I can't run the project, have a few issues. I am on MacOS

  1. it doesn't "recognize" / can't read my .env file

  2. Initialized empty Git repository in /Users/magomedvoraev/.git/ => it initialises git in a different FILEPATH from what I have in .env, so I thought I could maybe change path = os.getenv("FILEPATH") into path = myActualPathThatIWant but EVEN THEN it doesn't recognise the path......

  3. from github import Github doesn't work for me.
    Any ideas ?

conflict with the my_commands.sh

the first statement cd takes you to the home directory which makes create.py unaccessible. Therefore the cd should be removed

Windows script contains multiple issues.

Not to be harsh, but the windows version contains a few bugs. After some manual patching it is now running on my machine. Here's what needs to be done.

  • sys.arg[2] "g" isnever entered, so remove the IF for it. If you are making a project, it has a name. Otherwise script can fail at the Git level.

  • There is no automatic way to set up the environment vars. I've made a custom script to make this runnable form the User/NAME folder. In here there should be a way to set up vars.

These are some hard bugs which makes using this on Windows a hard recommendation.

can not run this script in windows OS

import sys
import os
from github import Github

path = "/Users/kalle/Documents/Projects/MyProjects/"

username = "" #Insert your github username here
password = "" #Insert your github password here

def create():
folderName = str(sys.argv[1])
os.makedirs(path + str(sys.argv[1]))
user = Github(username, password).get_user()
repo = user.create_repo(sys.argv[1])
print("Succesfully created repository {}".format(sys.argv[1]))

if name == "main":
create()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.