diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 33983e9..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,11 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "hashicorp/precise32" - - config.vm.provision "shell", path: "scripts/setup.sh" -end diff --git a/contrib/archlinux/PKGBUILD b/contrib/archlinux/PKGBUILD deleted file mode 100644 index f1f4f3a..0000000 --- a/contrib/archlinux/PKGBUILD +++ /dev/null @@ -1,33 +0,0 @@ -# Maintainer: Samed Beyribey -pkgname=python-storm -pkgver=0 -pkgrel=1 -pkgdesc="storm is a command line tool to manage your hosts at sshconfig" -arch=('any') -url="https://github.com/emre/storm" -source=('git://github.com/emre/storm.git') -sha1sums=('SKIP') -license=('MIT') -makedepends=('git') -depends=('python-paramiko' 'python-termcolor' 'python-flask' 'python-six' - 'python-crypto' 'python-ecdsa' 'python-werkzeug' 'python-jinja' - 'python-itsdangerous' 'python-markupsafe') - -# See https://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines#Git -pkgver() { - cd "$srcdir/storm" - printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" - } - -build() { - cd "$srcdir/storm" - msg 'Building storm...' - python setup.py build -} - -package() { - cd "$srcdir/storm" - python setup.py install --root="$pkgdir/" -} - -# vim:set ts=2 sw=2 et: diff --git a/contrib/bash-completion/README.md b/contrib/bash-completion/README.md deleted file mode 100644 index 87f78aa..0000000 --- a/contrib/bash-completion/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Bash Completion for StormSSH - -Complete your SSH actions like a Boss! - -## Installation - -You can download bash script and add it to your environment. All you need -is to source it! - - cd /path/to/your/env/ - curl -O https://raw.githubusercontent.com/emre/storm/master/contrib/bash-completion/stormssh - - # add it to you .bashrc or so, - source /path/to/your/env/storm - -or, if you are an OSX user, you can download it from `brew`: - - brew install homebrew/completions/stormssh-completion - -## Usage - -Completes your **Host** names in required commands such as; `clone` `delete` -`edit` `move` `update` - - $ storm [TAB] - add clone delete_all list search version - backup delete edit move update web - - # completes your Hosts :) - $ storm clone [TAB] - you_connection_name1 you_connection_name3 you_connection_name5 you_connection_name7 - you_connection_name2 you_connection_name4 you_connection_name6 you_connection_name8 - diff --git a/contrib/bash-completion/stormssh b/contrib/bash-completion/stormssh deleted file mode 100644 index bdd6162..0000000 --- a/contrib/bash-completion/stormssh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash - -__stormssh(){ - local cur prev options storm_command - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - __stormssh_get_command - if [[ $cur = -* ]]; then - if [[ -z $storm_command ]]; then - options="$options -v --version -h --help" - fi - if [[ $storm_command ]]; then - common_options="-h --config" - add_edit_options="$common_options --id_file --o" - if [[ $storm_command = clone || - $storm_command = move || - $storm_command = backup || - $storm_command = delete || - $storm_command = list || - $storm_command = search || - $storm_command = delete_all ]]; then - options="$common_options" - fi - if [[ $storm_command = add || $storm_command = edit ]]; then - options="$add_edit_options" - fi - if [[ $storm_command = update ]]; then - options="$add_edit_options --connection_uri" - fi - if [[ $storm_command = web ]]; then - options="-h --debug --ssh_config" - fi - fi - else - if [[ -z $storm_command ]]; then - options="add backup clone delete delete_all edit list move search update version web" - fi - if [[ $storm_command ]]; then - if [[ $storm_command = clone || - $storm_command = delete || - $storm_command = edit || - $storm_command = move || - $storm_command = update ]]; then - options=$(storm list | grep "\->" | tr -d " " | awk -F"->" '{print $1}' | xargs | tr -d "[:cntrl:]" | sed 's/\[[0132]*m//g') - fi - fi - fi - COMPREPLY=($(compgen -W "$options" -- "$cur")) -} -__stormssh_get_command(){ - local i - for ((i=1; i < $COMP_CWORD; ++i)); do - local arg=${COMP_WORDS[$i]} - case $arg in - [^-]*) - storm_command=$arg - return;; - --version) - storm_command=- - return;; - --help) - storm_command=help - return;; - esac - done -} -complete -F __stormssh -o bashdefault -o default storm \ No newline at end of file diff --git a/contrib/suse/stormssh.spec b/contrib/suse/stormssh.spec deleted file mode 100644 index ee73f03..0000000 --- a/contrib/suse/stormssh.spec +++ /dev/null @@ -1,58 +0,0 @@ -# -# spec file for package python-stormssh -# -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. -# -# All modifications and additions to the file contributed by third parties -# remain the property of their copyright owners, unless otherwise agreed -# upon. The license for this file, and modifications and additions to the -# file, is the same license as for the pristine package itself (unless the -# license for the pristine package is not an Open Source License, in which -# case the license is the MIT License). An "Open Source License" is a -# license that conforms to the Open Source Definition (Version 1.9) -# published by the Open Source Initiative. - -# Please submit bugfixes or comments via http://bugs.opensuse.org/ - - -Name: python-stormssh -Version: 0.6.4 -Release: 0 -License: MIT -Summary: Management commands to ssh config files -Url: http://github.com/emre/storm -Group: Development/Languages/Python -Source: https://pypi.python.org/packages/source/s/stormssh/stormssh-%{version}.tar.gz -BuildRequires: python-devel -BuildRequires: python-setuptools -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else -BuildArch: noarch -%endif - -%description -Manage your SSH like a boss - -%prep -%setup -q -n stormssh-%{version} - -%build -python setup.py build - -%install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} - -%files -%defattr(-,root,root,-) -%{python_sitelib}/* -%{_prefix}/bin/storm - - -%changelog -------------------------------------------------------------------- -Tue Jul 22 11:42:58 UTC 2014 - lowks@lowkster.com - -- -Adding stormssh package diff --git a/scripts/setup.sh b/scripts/setup.sh deleted file mode 100755 index 6ce6280..0000000 --- a/scripts/setup.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# setup pip -apt-get update -apt-get install -y python-dev -apt-get install -y python-pip - -# install storm ssh dependencies -pip install -e /vagrant - -# setup pth file -echo /vagrant > /usr/local/lib/python2.7/dist-packages/storm.pth - -# add ssh entries -storm add google google.com -storm add yahoo yahoo.com - - - - diff --git a/storm/__init__.py b/storm/__init__.py index 2d68c9d..940f87b 100644 --- a/storm/__init__.py +++ b/storm/__init__.py @@ -6,7 +6,7 @@ import re from shutil import copyfile -from .parsers.ssh_config_parser import ConfigParser +from .parsers import ConfigParser from .defaults import get_default diff --git a/storm/__main__.py b/storm/__main__.py index 7f0b323..54d073a 100644 --- a/storm/__main__.py +++ b/storm/__main__.py @@ -10,7 +10,7 @@ import builtins from storm import Storm -from storm.parsers.ssh_uri_parser import parse +from storm.parsers import parse from storm.utils import (get_formatted_message, colored) from storm.kommandr import * from storm.defaults import get_default diff --git a/storm/parsers/__init__.py b/storm/parsers/__init__.py index e69de29..bd72745 100644 --- a/storm/parsers/__init__.py +++ b/storm/parsers/__init__.py @@ -0,0 +1,10 @@ +from ssh_config_parser import StormConfig, ConfigParser +from ssh_uri_parser import parse +from storm_config_parser import get_storm_config + +__all__ = [ + "StormConfig", + "ConfigParser", + "parse", + "get_storm_config" +] diff --git a/storm/static/js/main.js b/storm/static/js/main.js index fe42bbb..2f385be 100644 --- a/storm/static/js/main.js +++ b/storm/static/js/main.js @@ -12,7 +12,7 @@ function Storm($scope, $http) { } function fetch(callback) { - $http.get("/list").success(function (data) { + $http.get("/servers").success(function (data) { $scope.servers = data.map(function (host) { var port = host.options.port; var hostname = host.options.hostname; @@ -59,7 +59,7 @@ function Storm($scope, $http) { if ($scope.state.editIndex > -1) { $scope.isDisabled = false; - $http.put('/edit', JSON.stringify({name: $scope.title, connection_uri: $scope.uri, id_file: $scope.id_file})). + $http.put('/servers/' + $scope.title, JSON.stringify({connection_uri: $scope.uri, id_file: $scope.id_file})). success(function(data, status) { if (status == 200) { $scope.servers[$scope.state.editIndex] = { @@ -81,7 +81,7 @@ function Storm($scope, $http) { }); } else { - $http.post('/add', JSON.stringify({name: $scope.title, connection_uri: $scope.uri, id_file: $scope.id_file})). + $http.post('/servers/'+$scope.title, JSON.stringify({connection_uri: $scope.uri, id_file: $scope.id_file})). success(function (data, status) { if (status == 201) { $scope.servers.push({ @@ -137,7 +137,7 @@ function Storm($scope, $http) { }; $scope.delete = function (serverToDelete) { - $http.post("/delete", JSON.stringify({name: serverToDelete.host})). + $http.delete("/servers/" + serverToDelete.host). success(function () { fetch(function () { plural(); diff --git a/storm/web.py b/storm/web.py index 2661d90..2d39b04 100644 --- a/storm/web.py +++ b/storm/web.py @@ -5,7 +5,7 @@ send_from_directory) from storm import Storm, DELETED_SIGN -from storm.parsers.ssh_uri_parser import parse +from storm.parsers import parse app = Flask(__name__) @@ -28,16 +28,17 @@ def response(resp=None, status=200, content_type='application/json'): @app.route('/') +@app.route('/index') def index(): return render('index.html', __THEME__) -@app.route('/list', methods=['GET']) +@app.route('/servers', methods=['GET']) def list_keys(): storm_ = app.get_storm() return response(json.dumps(storm_.list_entries(True, only_servers=True))) -@app.route('/add', methods=['POST']) +@app.route('/servers', methods=['POST']) def add(): storm_ = app.get_storm() @@ -60,13 +61,17 @@ def add(): except (KeyError, TypeError): return response(status=400) +@app.route('/servers/', methods=['GET']) +def list_keys(name): + storm_ = app.get_storm() + return response(json.dumps(storm_.list_entries(True, only_servers=True).get(name))) + -@app.route('/edit', methods=['PUT']) -def edit(): +@app.route('/servers/', methods=['PUT','POST']) +def edit(name): storm_ = app.get_storm() try: - name = request.json['name'] connection_uri = request.json['connection_uri'] id_file = None if 'id_file' in request.json: @@ -82,13 +87,11 @@ def edit(): except (KeyError, TypeError): return response(status=400) - -@app.route('/delete', methods=['POST']) -def delete(): +@app.route('/servers/', methods=['DELETE']) +def delete(name): storm_ = app.get_storm() try: - name = request.json['name'] storm_.delete_entry(name) return response() except ValueError as exc: