Class: SimpleTool
- Inherits:
-
Thor
- Object
- Thor
- SimpleTool
- Includes:
- Thor::Actions
- Defined in:
- lib/simpletool.rb
Class Method Summary collapse
Instance Method Summary collapse
- #install_ftp(username, passwd) ⇒ Object
- #install_phpmyadmin ⇒ Object
- #install_pptp_vpn(user, pwd) ⇒ Object
- #install_zsh ⇒ Object
Class Method Details
.source_root ⇒ Object
7 8 9 |
# File 'lib/simpletool.rb', line 7 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#install_ftp(username, passwd) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/simpletool.rb', line 52 def install_ftp(username, passwd) `sudo apt-get --yes install wget vsftpd` `sudo useradd #{username}` `sudo mkdir /home/#{username}` `sudo chown "#{username}:#{username}" "/home/$1"` `sudo bash -c "echo '#{username}:#{passwd}' | /usr/sbin/chpasswd"` `sudo rm /etc/pam.d/vsftpd` cp_file('support/ftp/vsftpd.conf', '/etc/vsftpd.conf', true) `sudo service vsftpd restart` end |
#install_phpmyadmin ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/simpletool.rb', line 37 def install_phpmyadmin `sudo apt-get -y install nginx php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql php5-gd php-apc php5-common` #modify mysql.ini `sudo sed -i'' -e '/bind-address/d' /etc/mysql/my.cnf` `wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.8/phpMyAdmin-4.4.15.8-english.tar.gz -O phpmyadmin.tar.gz` `tar -xvzf phpmyadmin.tar.gz` `sudo mv phpMyAdmin-4.4.15.8-english /usr/share/nginx/html/phpmyadmin` cp_file('support/phpmyadmin/nginx.phpmyadmin.default', '/etc/nginx/sites-enabled/nginx.phpmyadmin.default', true) `sudo service nginx reload` `sudo service php5-fpm restart` end |
#install_pptp_vpn(user, pwd) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/simpletool.rb', line 23 def install_pptp_vpn(user, pwd) ap "hello" `sudo apt-get install --yes pptpd pptp-linux` cp_file('support/pptp_vpn/ubuntu/pptpd.conf', '/etc/pptpd.conf', true) cp_file('support/pptp_vpn/ubuntu/pptpd-options', '/etc/ppp/pptpd-options', true) `sudo bash -c "echo '#{user} * #{pwd} *' >> /etc/ppp/chap-secrets"` cp_file('support/pptp_vpn/ubuntu/sysctl.conf', '/etc/sysctl.conf', true) cp_file('support/pptp_vpn/ubuntu/rc.local', '/etc/rc.local', true) `sudo modprobe nf_conntrack_proto_gre nf_conntrack_pptp` `sudo /etc/init.d/pptpd restart` `echo 'pleaese reboot to make it works'` end |
#install_zsh ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/simpletool.rb', line 64 def install_zsh `sudo apt-get --yes install git zsh autojump` `mkdir ~/opensource` `git clone https://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh` `git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/opensource/zsh-syntax-highlighting` `git clone https://github.com/zsh-users/zsh-history-substring-search.git ~/opensource/zsh-history-substring-search` `git clone https://github.com/olivierverdier/zsh-git-prompt.git ~/opensource/zsh-git-prompt` cp_file('support/zsh/.zshrc', '~/.zshrc') `sudo chsh -s $(which zsh)` `zsh` end |