charmkit 0.5.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/README.md +46 -94
  4. data/charmkit.gemspec +3 -3
  5. data/examples/Charmkitfile +66 -0
  6. data/examples/basic.rb +6 -0
  7. data/examples/demo/Gemfile +10 -0
  8. data/examples/demo/Gemfile.lock +64 -0
  9. data/examples/demo/README.md +27 -0
  10. data/examples/demo/Rakefile +9 -0
  11. data/examples/demo/config.yaml +2 -0
  12. data/examples/demo/hooks/config-changed +3 -0
  13. data/examples/{my-demo-charm → demo}/hooks/install +3 -5
  14. data/examples/demo/hooks/leader-elected +3 -0
  15. data/examples/demo/hooks/leader-settings-changed +3 -0
  16. data/examples/demo/hooks/start +3 -0
  17. data/examples/demo/hooks/stop +3 -0
  18. data/examples/demo/hooks/update-status +3 -0
  19. data/examples/demo/hooks/upgrade-charm +3 -0
  20. data/examples/demo/metadata.yaml +9 -0
  21. data/examples/load-charmkit-file.rb +2 -0
  22. data/examples/plugin_loader.rb +9 -0
  23. data/examples/template.rb +6 -0
  24. data/examples/templates/user_auth.txt +1 -0
  25. data/exe/charmkit +5 -0
  26. data/lib/charmkit.rb +6 -7
  27. data/lib/charmkit/cli.rb +124 -0
  28. data/lib/charmkit/dependencies.rb +26 -0
  29. data/lib/charmkit/helpers.rb +5 -0
  30. data/lib/charmkit/helpers/crypt.rb +8 -6
  31. data/lib/charmkit/helpers/fs.rb +0 -15
  32. data/lib/charmkit/helpers/hookenv.rb +10 -0
  33. data/lib/charmkit/helpers/runner.rb +2 -1
  34. data/lib/charmkit/helpers/template.rb +1 -0
  35. data/lib/charmkit/hook.rb +47 -0
  36. data/lib/charmkit/scroll.rb +15 -0
  37. metadata +48 -29
  38. data/examples/my-demo-charm/Gemfile +0 -5
  39. data/examples/my-demo-charm/Gemfile.lock +0 -15
  40. data/examples/my-demo-charm/README.md +0 -45
  41. data/examples/my-demo-charm/Rakefile +0 -63
  42. data/examples/my-demo-charm/config.yaml +0 -21
  43. data/examples/my-demo-charm/copyright +0 -21
  44. data/examples/my-demo-charm/hooks/config-changed +0 -3
  45. data/examples/my-demo-charm/hooks/upgrade-charm +0 -3
  46. data/examples/my-demo-charm/icon.svg +0 -322
  47. data/examples/my-demo-charm/metadata.yaml +0 -18
  48. data/examples/my-demo-charm/readme +0 -1
  49. data/examples/my-demo-charm/tasks/vim.rb +0 -8
  50. data/examples/my-demo-charm/templates/acl.auth.php +0 -10
  51. data/examples/my-demo-charm/templates/local.php +0 -15
  52. data/examples/my-demo-charm/templates/plugins.local.php +0 -12
  53. data/examples/my-demo-charm/templates/users.auth.php +0 -11
  54. data/examples/my-demo-charm/templates/vhost.conf +0 -42
  55. data/examples/render_inline.rb +0 -59
  56. data/lib/charmkit/extend/string_tools.rb +0 -14
  57. data/lib/charmkit/plugins/nginx.rb +0 -8
  58. data/lib/charmkit/plugins/php.rb +0 -19
  59. data/lib/charmkit/version.rb +0 -14
@@ -1,18 +0,0 @@
1
- name: dokuwiki
2
- summary: |
3
- Dokuwiki is a simple to use wiki.
4
- description: |
5
- DokuWiki is a simple to use and highly versatile Open Source wiki software
6
- that doesn't require a database. It is loved by users for its clean and
7
- readable syntax.
8
- maintainers: ['Adam Stokes <adam.stokes@ubuntu.com>']
9
- series:
10
- - xenial
11
- tags:
12
- - php
13
- - wiki
14
- resources:
15
- stable-release:
16
- type: file
17
- filename: stable.tgz
18
- description: "Dokuwiki stable wiki source"
@@ -1 +0,0 @@
1
- example charm demo using charmkit
@@ -1,8 +0,0 @@
1
- # The local task provide with the charm itself
2
-
3
- namespace :vim do
4
- desc "Install VIM"
5
- task :install do
6
- system("apt-get install -qyf vim")
7
- end
8
- end
@@ -1,10 +0,0 @@
1
- # acl.auth.php
2
- # <?php exit()?>
3
- # Don't modify the lines above
4
- #
5
- # Access Control Lists
6
- #
7
- # Auto-generated by install script
8
- # Date: Mon, 09 Nov 2015 01:28:56 +0000
9
- * @ALL 1
10
- * @user 8
@@ -1,15 +0,0 @@
1
- <?php
2
- /* Generated by Juju
3
- */
4
- $conf['title'] = 'Dokuwiki';
5
- $conf['tagline'] = 'deployed by Juju';
6
- $conf['license'] = 'cc-by-sa';
7
- $conf['useacl'] = 1;
8
- $conf['superuser'] = '@admin';
9
- $conf['disableactions'] = 'register';
10
- $conf['showuseras'] = 'username';
11
- $conf['youarehere'] = 1;
12
- $conf['gzip_output'] = 1;
13
- $conf['sitemap'] = 1;
14
- $conf['userewrite'] = '1';
15
- $conf['useslash'] = 1;
@@ -1,12 +0,0 @@
1
- <?php
2
- /*
3
- * Local plugin enable/disable settings
4
- *
5
- * Auto-generated by install script
6
- * Date: Tue, 15 Sep 2015 13:34:04 +0000
7
- */
8
-
9
- $plugins['authad'] = 0;
10
- $plugins['authldap'] = 0;
11
- $plugins['authmysql'] = 0;
12
- $plugins['authpgsql'] = 0;
@@ -1,11 +0,0 @@
1
- # users.auth.php
2
- # <?php exit()?>
3
- # Don't modify the lines above
4
- #
5
- # Userfile
6
- #
7
- # Format:
8
- #
9
- # login:passwordhash:Real Name:email:groups,comma,seperated
10
-
11
- <%= admin_user %>:<%= admin_password %>:<%= admin_name %>:<%= admin_email %>:admin,user
@@ -1,42 +0,0 @@
1
- # set cgi.fix_pathinfo = 0 in /etc/php/7.0/fpm/php.ini
2
-
3
- server {
4
- ## Your website name goes here.
5
- server_name <%= public_address %>;
6
- ## Your only path reference.
7
- root <%= app_path %>;
8
- location / {
9
- index doku.php;
10
- # This is cool because no php is touched for static content.
11
- # include the "?$args" part so non-default permalinks doesn't break when using query string
12
- try_files $uri $uri/ @dokuwiki;
13
- }
14
-
15
- location ~ ^/lib.*\.(gif|png|ico|jpg)$ {
16
- expires 30d;
17
- }
18
-
19
- location ^~ /conf/ { return 403; }
20
- location ^~ /data/ { return 403; }
21
-
22
- location @dokuwiki {
23
- rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
24
- rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
25
- rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
26
- rewrite ^/(.*) /doku.php?id=$1 last;
27
- }
28
-
29
- location ~ \.php$ {
30
- include fastcgi_params;
31
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
32
- fastcgi_pass unix:/run/php/php7.0-fpm.sock;
33
- }
34
- # Block access to data folders
35
- location ~ /(data|conf|bin|inc)/ {
36
- deny all;
37
- }
38
- # Block access to .htaccess files
39
- location ~ /\.ht {
40
- deny all;
41
- }
42
- }
@@ -1,59 +0,0 @@
1
- require 'charmkit'
2
-
3
- template('examples/my-demo-charm/templates/vhost.conf',
4
- '/tmp/nginx-data.conf',
5
- public_address: 'localhost',
6
- app_path: '/srv/app')
7
-
8
- inline_template('vhost.conf',
9
- '/tmp/output.txt',
10
- public_address: "localhost",
11
- app_path: "/srv/app")
12
- __END__
13
-
14
- @@ nginx.conf
15
-
16
- server_connections { 50m; }
17
-
18
- @@ vhost.conf
19
-
20
- server {
21
- ## Your website name goes here.
22
- server_name <%= public_address %>;
23
- ## Your only path reference.
24
- root <%= app_path %>;
25
- location / {
26
- index doku.php;
27
- # This is cool because no php is touched for static content.
28
- # include the "?$args" part so non-default permalinks doesn't break when using query string
29
- try_files $uri $uri/ @dokuwiki;
30
- }
31
-
32
- location ~ ^/lib.*\.(gif|png|ico|jpg)$ {
33
- expires 30d;
34
- }
35
-
36
- location ^~ /conf/ { return 403; }
37
- location ^~ /data/ { return 403; }
38
-
39
- location @dokuwiki {
40
- rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
41
- rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
42
- rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
43
- rewrite ^/(.*) /doku.php?id=$1 last;
44
- }
45
-
46
- location ~ \.php$ {
47
- include fastcgi_params;
48
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
49
- fastcgi_pass unix:/run/php/php7.0-fpm.sock;
50
- }
51
- # Block access to data folders
52
- location ~ /(data|conf|bin|inc)/ {
53
- deny all;
54
- }
55
- # Block access to .htaccess files
56
- location ~ /\.ht {
57
- deny all;
58
- }
59
- }
@@ -1,14 +0,0 @@
1
- class String
2
- # Simple classify to rename our hooks to their proper class
3
- #
4
- # charmkit config-changed
5
- #
6
- # This will load config-changed.rb and classify it's name to
7
- # ConfigChanged.
8
- #
9
- # Note most libraries use '_'(underscore) for word separation whereas
10
- # Juju hooks are '-'(hyphenated).
11
- def classify
12
- return self.split('-').collect!{ |w| w.capitalize }.join
13
- end
14
- end
@@ -1,8 +0,0 @@
1
- namespace :nginx do
2
- desc "Install NGINX"
3
- task :install do
4
- cmd.run "apt-get", "update"
5
- cmd.run "juju-log", "Installing NGINX and its dependencies."
6
- cmd.run "apt-get", "install", "-qyf", "nginx-full"
7
- end
8
- end
@@ -1,19 +0,0 @@
1
- namespace :php do
2
- desc "Install PHP"
3
- task :install do
4
- pkgs = [
5
- 'php-fpm',
6
- 'php-cgi',
7
- 'php-curl',
8
- 'php-gd',
9
- 'php-json',
10
- 'php-mcrypt',
11
- 'php-readline',
12
- 'php-mbstring',
13
- 'php-xml'
14
- ]
15
- cmd.run "apt-get update"
16
- cmd.run "juju-log Installing PHP7 and its dependencies."
17
- cmd.run "apt-get install -qyf #{pkgs.join(' ')}"
18
- end
19
- end
@@ -1,14 +0,0 @@
1
- module Charmkit
2
- def self.version
3
- Gem::Version.new VERSION::STRING
4
- end
5
-
6
- module VERSION
7
- MAJOR = 0
8
- MINOR = 5
9
- PATCH = 1
10
- PRE = nil
11
-
12
- STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
13
- end
14
- end