Initial commit

James Peret 8 years ago
commit
720ec8710d
8 changed files with 400 additions and 0 deletions
  1. 2 0
      .gitignore
  2. 139 0
      atom-installer.sh
  3. 84 0
      configs.sh
  4. 105 0
      core.sh
  5. 24 0
      countdown.sh
  6. 34 0
      install.sh
  7. 12 0
      node-config.sh
  8. 0 0
      script.sh

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
1
+.DS_Store
2
+log.txt

+ 139 - 0
atom-installer.sh

@@ -0,0 +1,139 @@
1
+#!/bin/bash
2
+
3
+clear
4
+printf "\n\033[104mAtom IDE Installer & Configuration Script\033[49m\n"
5
+printf "by James Peret - http://jamesperet.com\n\n"
6
+
7
+# Load installer script dependencies
8
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
9
+source $DIR/core.sh
10
+
11
+function install_plugins {
12
+  # install Atom Plugins
13
+  echo "Installing Atom Plugins:"
14
+  apm install graphite-ui
15
+  apm install railscast-theme
16
+  apm install browser-plus
17
+  apm install term2
18
+  apm install file-icons
19
+  apm install pane-layout-plus
20
+  apm install pigments
21
+  apm install project-manager
22
+  apm install project-sidebar
23
+  #apm install git-tab-status
24
+  apm install less-than-slash
25
+  apm install wordcount
26
+  apm install markdown-preview-opener
27
+  apm install markdown-scroll-sync
28
+  apm install maybs-quit
29
+  apm install time-status
30
+  apm install wakatime
31
+  #apm install toggle-tabs
32
+  apm install pane-info
33
+  apm install rails-partials
34
+}
35
+
36
+function configure_keymap {
37
+  echo "Configuring keymap"
38
+  printf "
39
+  'body':
40
+    'f6': 'status-bar:toggle'
41
+    'ctrl-tab': 'pane:show-next-item'
42
+    'ctrl-shift-tab': 'pane:show-previous-item'
43
+    'ctrl-alt-tab' : 'window:focus-next-pane'
44
+    'ctrl-alt-shift-tab' : 'window:focus-previous-pane'
45
+    'ctrl-alt-cmd-p' : 'project-sidebar:toggle'
46
+  " >> $HOME/.atom/keymap.cson
47
+}
48
+
49
+function configure_styles {
50
+  echo "Configuring sytles"
51
+  printf "
52
+atom-workspace .browser-page webview {
53
+  margin: 0px;
54
+}
55
+
56
+webview {
57
+  margin: 0px;
58
+}
59
+
60
+.pane-info {
61
+  margin-right: 12px;
62
+  margin-top: 8px;
63
+}
64
+
65
+.right.tool-panel.panel-right {
66
+  background-color: #2B2E31;
67
+}
68
+
69
+.project-sidebar.padded {
70
+  background-color: #3a3e42;
71
+  line-height: 32px;
72
+  height: 40px;
73
+  padding: 0px;
74
+  color: #ffffff;
75
+}
76
+
77
+.project-sidebar.padded h1 {
78
+  margin: 0px;
79
+  padding: 0px;
80
+  height: 40px;
81
+  font-size: 13px;
82
+  font-weight: 400;
83
+  padding-top: 16px;
84
+  padding-left: 8px;
85
+}
86
+
87
+.project-sidebar.padded li {
88
+  padding-left: 8px;
89
+  padding-right: 10px;
90
+}
91
+
92
+body {
93
+  -webkit-font-smoothing: antialiased;
94
+  -moz-osx-font-smoothing: grayscale;
95
+  /*text-rendering: optimizeLegibility; */
96
+}
97
+
98
+.tree-view-resizer, .editor {
99
+  ::-webkit-scrollbar {
100
+    width: 0.5em;
101
+    height: 0.5em;
102
+  }
103
+  ::-webkit-scrollbar-track {
104
+    background-color: #303030;
105
+  }
106
+
107
+  ::-webkit-scrollbar-thumb {
108
+    background-color: lighten(#303030, 15%%);
109
+  }
110
+}
111
+\n
112
+" > $HOME/.atom/styles.less
113
+}
114
+
115
+function check_dependencies {
116
+  if [ $(program_is_installed atom) ] ; then
117
+    if [ $(program_is_installed node) ] ; then
118
+      if [ ! $(program_is_installed apm) ] ; then
119
+        echo "APM is not installed. Opening the Atom editor and click on Install Shell Commands."
120
+        return false
121
+      fi
122
+      return true
123
+    else
124
+      echo "Node is not installed. Please make sure it is intalled before procedding with this script."
125
+      return false
126
+    fi
127
+  else
128
+    echo "Atom is not installed. Please make sure it is intalled before procedding with this script."
129
+    return false
130
+  fi
131
+}
132
+
133
+# Run Program
134
+if [ check_dependencies ] ; then
135
+  install_plugins
136
+  configure_keymap
137
+  configure_styles
138
+  echo "\n\n\033[32mMAC OSX CONFIGURED SUCCESFULLY\n\n"
139
+fi

+ 84 - 0
configs.sh

@@ -0,0 +1,84 @@
1
+clear
2
+printf "\n\033[104mMac Configuration Script\033[49m\n"
3
+printf "by James Peret - http://jamesperet.com\n\n"
4
+sleep 1
5
+
6
+# Config timezone
7
+echo "- Timezone set to America/Sao_Paulo"
8
+{
9
+  systemsetup -settimezone America/Sao_Paulo
10
+} >> log.txt 2>&1
11
+
12
+
13
+# Don’t hide the Library folder
14
+echo "- User ~/Library folder is now visible"
15
+chflags nohidden ~/Library
16
+
17
+# Disable Gate Keeper
18
+echo "- Gate Keeper disabled"
19
+spctl --master-disable
20
+
21
+# Enable trackpad tap-to-click
22
+echo "- Trackpad tap-to-click enabled"
23
+defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
24
+defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
25
+defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
26
+defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -int 1
27
+defaults write com.apple.AppleMultitouchTrackpad Clicking 1
28
+defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
29
+defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
30
+
31
+echo "- Dock configured"
32
+
33
+# Pin dock to the bottom
34
+defaults write com.apple.dock orientation -string bottom
35
+
36
+# Enable dock auto-hide
37
+defaults write com.apple.dock autohide -bool true
38
+
39
+# Enable dock magnification
40
+defaults write com.apple.dock magnification -boolean true
41
+
42
+# Resize dock icons
43
+defaults write com.apple.dock tilesize -integer 30
44
+defaults write com.apple.dock largesize -integer 64
45
+
46
+# Show finder path bar
47
+echo "- Finder show path bar enabled"
48
+defaults write com.apple.finder ShowPathbar -bool true
49
+
50
+# Show finder status bar
51
+echo "- Finder show status bar enabled"
52
+defaults write com.apple.finder ShowStatusBar -bool true
53
+
54
+# Disable the “Are you sure you want to open this application?” dialog
55
+echo "- Quarantine dialog disabled"
56
+defaults write com.apple.LaunchServices LSQuarantine -bool false
57
+
58
+# Set the screen resolution (be carefull)
59
+#echo "- Screen resolution changed to 2048x1280"
60
+#$HOME/dotfiles/screenresolution/screenresolution get
61
+#$HOME/dotfiles/screenresolution/screenresolution list
62
+#$HOME/dotfiles/screenresolution/screenresolution set 2048x1280x32@0
63
+
64
+# Set Wallpaper
65
+{
66
+  mkdir $HOME/Pictures/Wallpapers
67
+  curl -o $HOME/Pictures/Wallpapers/minimalistic-gray-2560x1440-wallpaper-905780.jpg https://s3-sa-east-1.amazonaws.com/jamesperet/files/wallpapers/minimalistic-gray-2560x1440-wallpaper-905780.jpg
68
+  sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '$HOME/Pictures/Wallpapers/minimalistic-gray-2560x1440-wallpaper-905780.jpg'";
69
+} >> log.txt 2>&1
70
+echo "- Wallpaper set"
71
+
72
+# Set the login screen wallpaper
73
+{
74
+  mv /Library/Caches/com.apple.desktop.admin.png $HOME/Desktop/
75
+  cp $HOME/Pictures/Wallpapers/minimalistic-gray-2560x1440-wallpaper-905780.jpg /Library/Caches/com.apple.desktop.admin.jpg
76
+} >> log.txt 2>&1
77
+echo "- Login screen wallpaper set"
78
+
79
+# Restart apps
80
+echo "\nRestarting Apps..."
81
+killall Dock
82
+killall Finder
83
+sleep 1
84
+echo "\n\n\033[32mMAC OSX CONFIGURED SUCCESFULLY\n\n"

+ 105 - 0
core.sh

@@ -0,0 +1,105 @@
1
+# Functions ==============================================
2
+
3
+function app_is_installed {
4
+  local file1="/Applications/$1/"
5
+  local file2="/opt/homebrew-cask/Caskroom/atom/latest/$1/"
6
+  if [ -d  "$file1" ] || [ -d  "$file2" ]
7
+  then
8
+  	local return_=1
9
+  else
10
+    local return_=0
11
+  fi
12
+  echo "$return_"
13
+}
14
+
15
+
16
+# return 1 if global command line program installed, else 0
17
+# example
18
+# echo "node: $(program_is_installed node)"
19
+function program_is_installed {
20
+  # set to 1 initially
21
+  local return_=1
22
+  # set to 0 if not found
23
+  type $1 >/dev/null 2>&1 || { local return_=0; }
24
+  # return value
25
+  echo "$return_"
26
+}
27
+
28
+# return 1 if local npm package is installed at ./node_modules, else 0
29
+# example
30
+# echo "gruntacular : $(npm_package_is_installed gruntacular)"
31
+function npm_package_is_installed {
32
+  # set to 1 initially
33
+  local return_=1
34
+  # set to 0 if not found
35
+  ls /usr/local/bin | grep $1 >/dev/null 2>&1 || { local return_=0; }
36
+  # return value
37
+  echo "$return_"
38
+}
39
+
40
+# display a message in red with a cross by it
41
+# example
42
+# echo echo_fail "No"
43
+function echo_fail {
44
+  # echo first argument in red
45
+  printf "\e[31m✘ ${1}"
46
+  # reset colours back to normal
47
+  echo "\033[0m"
48
+}
49
+
50
+# display a message in green with a tick by it
51
+# example
52
+# echo echo_fail "Yes"
53
+function echo_pass {
54
+  # echo first argument in green
55
+  printf "\e[32m✔ ${1}"
56
+  # reset colours back to normal
57
+  echo "\033[0m"
58
+}
59
+
60
+# echo pass or fail
61
+# example
62
+# echo echo_if 1 "Passed"
63
+# echo echo_if 0 "Failed"
64
+function echo_if {
65
+  if [ $1 == 1 ]; then
66
+    echo_pass $2
67
+  else
68
+    echo_fail $2
69
+  fi
70
+}
71
+
72
+function install_app {
73
+  tput sc
74
+  tput rc
75
+  tput ed
76
+  echo "$1\t\t\t\t$(echo_if $(app_is_installed $2))                   "
77
+  if [ $(app_is_installed $2) == 0 ]; then
78
+    sleep 1
79
+    tput rc
80
+    tput ed
81
+    echo "$1\t\t\t\t$(echo_if $(app_is_installed $2))   Installing... "
82
+    sleep 3
83
+    tput rc
84
+    tput ed
85
+    echo "$1\t\t\t\t$(echo_if $(app_is_installed $2))                 "
86
+    tput sc
87
+  fi
88
+}
89
+
90
+function test {
91
+  echo "\nALL DONE\n\n"
92
+
93
+  {
94
+    echo "Does it work?"
95
+  } &> log.txt
96
+
97
+  if hash redis-server 2>/dev/null; then
98
+      echo "   - Redis already installed"
99
+  else
100
+      brew install redis
101
+      echo "   - Redis  installed"
102
+  fi
103
+}
104
+
105
+# ============================================== Functions

+ 24 - 0
countdown.sh

@@ -0,0 +1,24 @@
1
+tput sc
2
+tput rc
3
+tput ed
4
+echo "waiting 3"
5
+sleep 1
6
+tput rc
7
+tput ed
8
+echo "waiting 2"
9
+sleep 1
10
+tput rc
11
+tput ed
12
+echo "waiting 1"
13
+sleep 1
14
+tput rc
15
+tput ed
16
+echo "waiting 0"
17
+sleep 1
18
+tput rc
19
+tput ed
20
+echo "Done      "
21
+
22
+tput sc
23
+printf "\n\n"
24
+tput cnorm   -- normal

+ 34 - 0
install.sh

@@ -0,0 +1,34 @@
1
+printf "\n\033[104mInstall Script\033[49m\n"
2
+printf "by James Peret - http://jamesperet.com\n\n"
3
+
4
+# Load installer script dependencies
5
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
6
+source $DIR/core.sh
7
+
8
+# Install xCode Command Line Tools
9
+echo "- Intalling command line tools"
10
+xcode-select --install
11
+
12
+# Install all Max OS X Updates
13
+echo "- Installing Mac OSX Updates"
14
+sw_vers |grep ProductVersion
15
+sudo softwareupdate -i -a
16
+sw_vers |grep ProductVersion
17
+
18
+
19
+# command line programs
20
+
21
+# Atom
22
+tput civis -- invisible
23
+install_app atom Atom.app
24
+install_app craxxxp Crap.app
25
+
26
+echo "node\t\t\t\t$(echo_if $(program_is_installed node))"
27
+#echo "grunt\t\t\t\t$(echo_if $(program_is_installed grunt))"
28
+#echo "testacular\t\t\t$(echo_if $(program_is_installed testacular))"
29
+#echo "uglifyjs\t\t\t$(echo_if $(program_is_installed uglifyjs))"
30
+#echo "requirejs\t\t\t$(echo_if $(program_is_installed r.js))"
31
+
32
+# local npm packages
33
+echo "grunt\t\t\t\t$(echo_if $(npm_package_is_installed grunt))"
34
+echo "serve\t\t\t\t$(echo_if $(npm_package_is_installed serve))"

+ 12 - 0
node-config.sh

@@ -0,0 +1,12 @@
1
+# Set permissions to the node modules folder
2
+sudo chown -R $(whoami) ~/.npm
3
+sudo chown -R $(whoami) /usr/local/lib/node_modules/
4
+
5
+npm install -g grunt-cli
6
+npm install -g serve
7
+
8
+
9
+# Ruby configured
10
+brew install redis
11
+brew install pgcli
12
+#brew install go

+ 0 - 0
script.sh