Initial commit
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000..33df9ca
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,7 @@
+
+git-formula
+===========
+
+0.0.1 (2015-08-03)
+
+- Initial formula setup
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..6f2b42f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2014-2015 tcp cloud a.s.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..e0c2227
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,46 @@
+
+===========
+Git formula
+===========
+
+Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
+
+Sample pillars
+==============
+
+.. code-block:: yaml
+
+Simplest GIT setup
+
+ git:
+ client:
+ enabled: true
+
+GIT with user setup
+
+.. code-block:: yaml
+
+ git:
+ client:
+ enabled: true
+ user:
+ - user:
+ name: jdoe
+ email: j@doe.com
+
+Reclass with GIT with user setup
+
+.. code-block:: yaml
+
+ git:
+ client:
+ enabled: true
+ user:
+ - user: ${linux:system:user:jdoe}
+
+Read more
+=========
+
+* http://git-scm.com/
+* http://git-scm.com/book/en/Customizing-Git-Git-Configuration
+* https://github.com/nesi/puppet-git/tree/master/manifests
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..3b04cfb
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.2
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..a3a4dd6
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,11 @@
+salt-formula-git (0.2) trusty; urgency=medium
+
+ * First public release
+
+ -- Filip Pytloun <filip.pytloun@tcpcloud.eu> Tue, 06 Oct 2015 16:38:40 +0200
+
+salt-formula-git (0.1) trusty; urgency=medium
+
+ * Initial release
+
+ -- Ales Komarek <ales.komarek@tcpcloud.eu> Thu, 13 Aug 2015 23:23:41 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..acffabe
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: salt-formula-git
+Maintainer: Ales Komarek <ales.komarek@tcpcloud.eu>
+Section: admin
+Priority: optional
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.6
+Homepage: http://www.tcpcloud.eu
+Vcs-Browser: https://github.com/tcpcloud/salt-formula-git
+Vcs-Git: https://github.com/tcpcloud/salt-formula-git.git
+
+Package: salt-formula-git
+Architecture: all
+Depends: ${misc:Depends}, salt-master, reclass
+Description: Git salt formula
+ Install and configure Git client.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..9ad668f
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,15 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: salt-formula-git
+Upstream-Contact: Ales Komarek <ales.komarek@tcpcloud.eu>
+Source: https://github.com/tcpcloud/salt-formula-git
+
+Files: *
+Copyright: 2014-2015 tcp cloud a.s.
+License: Apache-2.0
+ Copyright (C) 2014-2015 tcp cloud a.s.
+ .
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ .
+ On a Debian system you can find a copy of this license in
+ /usr/share/common-licenses/Apache-2.0.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..d585829
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+README.rst
+CHANGELOG.rst
+VERSION
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..f1c5970
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,2 @@
+git/* /usr/share/salt-formulas/env/git/
+metadata/service/* /usr/share/salt-formulas/reclass/service/git/
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..abde6ef
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,5 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/git/client.sls b/git/client.sls
new file mode 100644
index 0000000..3b5b854
--- /dev/null
+++ b/git/client.sls
@@ -0,0 +1,34 @@
+{%- from "git/map.jinja" import client with context %}
+{%- from "linux/map.jinja" import system with context %}
+{%- if client.enabled %}
+
+include:
+- linux.system.user
+
+git_packages:
+ pkg.installed:
+ - names: {{ client.pkgs }}
+
+{%- for user in client.user %}
+
+set_git_{{ user.user.name }}_param_username:
+ cmd.run:
+ - name: sudo -u {{ user.user.name }} -H git config --global user.name "{{ user.user.get('full_name', user.user.name) }}"
+ - cwd: ~
+ - require:
+ - user: system_user_{{ user.user.name }}
+
+{%- if user.user.email is defined %}
+
+set_git_{{ user.user.name }}_param_email:
+ cmd.run:
+ - name: sudo -u {{ user.user.name }} -H git config --global user.email "{{ user.user.email }}"
+ - cwd: ~
+ - require:
+ - user: system_user_{{ user.user.name }}
+
+{%- endif %}
+
+{%- endfor %}
+
+{%- endif %}
\ No newline at end of file
diff --git a/git/init.sls b/git/init.sls
new file mode 100644
index 0000000..f3e1991
--- /dev/null
+++ b/git/init.sls
@@ -0,0 +1,6 @@
+{%- if pillar.git is defined %}
+include:
+{%- if pillar.git.client is defined %}
+- git.client
+{%- endif %}
+{%- endif %}
\ No newline at end of file
diff --git a/git/map.jinja b/git/map.jinja
new file mode 100644
index 0000000..fc3f51e
--- /dev/null
+++ b/git/map.jinja
@@ -0,0 +1,23 @@
+
+{%- set client = salt['grains.filter_by']({
+ 'Arch': {
+ 'pkgs': ['git'],
+ 'user': [],
+ },
+ 'Debian': {
+ 'pkgs': ['git-core'],
+ 'user': [],
+ },
+ 'Gentoo': {
+ 'pkgs': ['dev-vcs/git'],
+ 'user': [],
+ },
+ 'MacOS': {
+ 'pkgs': ['git'],
+ 'user': [],
+ },
+ 'RedHat': {
+ 'pkgs': ['git'],
+ 'user': [],
+ },
+}, merge=salt['pillar.get']('git:client')) %}
diff --git a/metadata/service/client/init.yml b/metadata/service/client/init.yml
new file mode 100644
index 0000000..adaf5a5
--- /dev/null
+++ b/metadata/service/client/init.yml
@@ -0,0 +1,6 @@
+applications:
+- git
+parameters:
+ git:
+ client:
+ enabled: true