pleaserun 0.0.14 → 0.0.15

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63e41be2339270af8c483bb10dea4913fcc86fdf
4
- data.tar.gz: 4860638d5e5a611c41343455441047329f06b611
3
+ metadata.gz: c29e0d279d9fef769d2e5f2a9fe7eedecf49c040
4
+ data.tar.gz: 9ae82dbc342d7420006fbc5b4b3dd20dea878058
5
5
  SHA512:
6
- metadata.gz: 22cd6e4da961c7d4e23de4f81b77bce41f28896f7cfb35c7465d4d7c77b652671bf664cd03b23d1c94636975a5341b5b62ff2fa7159a9e079eaafc67dc4b374c
7
- data.tar.gz: 85cf0ed77e3a4c152ee16cea342e90d2e90e8ae68c45e6919e98dbd10e7ef976746c879286f19884bab3efe551adbafbd1857ffa11baa7a0ec7d2a60eaec9c9c
6
+ metadata.gz: ff95f6b8fe980982108526a02b2d9137a94838bc368841814a1a05db03fbdd8ab81108e35c570d7d709d3ae26ad69c03b2b728b4ccd040dd1301059f85dfa32a
7
+ data.tar.gz: 208c373ec9d7bda71130c93734668cb2ec70b4787ec3e2d5205885d1d8b2da8c91931424f45e7a03bcdc691f23d1514c51554772edb6b1446f5ba6e010f8815c
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ libdir = File.expand_path("../lib", File.dirname(__FILE__))
4
+ $LOAD_PATH << libdir if File.exist?(File.join(libdir, "pleaserun", "user", "base.rb"))
5
+
6
+ require "pleaserun/user/base"
7
+ require "fileutils"
8
+ require "clamp"
9
+
10
+ # A PoC to do user management scripting
11
+ #
12
+ # This is targeted at fpm's `--after-install` and friends, but it is certainly
13
+ # not limited to that.
14
+ class PleaseRun::ManageUserCLI < Clamp::Command
15
+ class ConfigurationError < StandardError; end
16
+ option "--platform", "PLATFORM", "The platform to target ('linux', etc)", :default => "linux"
17
+ option "--version", "VERSION", "The version of the platform to target"
18
+ option "--output", "PATH", "The destination directory to write the management scripts", :required => true
19
+
20
+ parameter "USERNAME", "The username to manage"
21
+
22
+ def execute
23
+ validate
24
+ File.write(File.join(output, "installer.sh"), user.render_installer)
25
+ File.write(File.join(output, "remover.sh"), user.render_remover)
26
+ end
27
+
28
+ def user
29
+ return @user if @user
30
+ @user = PleaseRun::User::Base.new
31
+ @user.name = username
32
+ @user.platform = platform
33
+ @user.version = version
34
+ return @user
35
+ end
36
+
37
+ def validate
38
+ if File.exist?(output)
39
+ if !File.directory?(output)
40
+ raise ConfigurationError, "The output path exists but is not a directory. I cannot continue. Path is #{output}"
41
+ end
42
+ else
43
+ FileUtils.mkdir_p(output)
44
+ end
45
+ end
46
+ end
47
+
48
+ PleaseRun::ManageUserCLI.run
@@ -1,3 +1,4 @@
1
- PleaseRun = Module.new
2
- PleaseRun::Platform = Module.new
3
- PleaseRun::User = Module.new
1
+ module PleaseRun
2
+ module Platform; end
3
+ module User; end
4
+ end
@@ -1,4 +1,6 @@
1
1
  require "pleaserun/namespace"
2
+ require "pleaserun/configurable"
3
+ require "pleaserun/mustache_methods"
2
4
 
3
5
  class PleaseRun::User::Base
4
6
  include PleaseRun::Configurable
data/pleaserun.gemspec CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |spec|
2
2
  files = File.read(__FILE__)[/^__END__$.*/m].split("\n")[1..-1]
3
3
 
4
4
  spec.name = "pleaserun"
5
- spec.version = "0.0.14"
5
+ spec.version = "0.0.15"
6
6
  spec.summary = "pleaserun"
7
7
  spec.description = "pleaserun"
8
8
  spec.license = "Apache 2.0"
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.homepage = "https://github.com/jordansissel/pleaserun"
25
25
  end
26
26
 
27
- # Files list, populate it with `git ls-files | grep -v gitignore`
27
+ # Files list, populate it with this: :.,$!git ls-files | grep -v gitignore
28
28
  __END__
29
29
  .rubocop.yml
30
30
  CHANGELOG.asciidoc
@@ -34,6 +34,7 @@ Guardfile
34
34
  LICENSE
35
35
  Makefile
36
36
  README.md
37
+ bin/please-manage-user
37
38
  bin/pleaserun
38
39
  examples/runit.rb
39
40
  lib/pleaserun/cli.rb
@@ -1,3 +1,5 @@
1
+ #!/bin/sh
2
+
1
3
  user_check() {
2
4
  getent passwd "$1" > /dev/null 2>&1
3
5
  }
@@ -1,3 +1,5 @@
1
+ #!/bin/sh
2
+
1
3
  user_check() {
2
4
  getent passwd "$1" > /dev/null 2>&1
3
5
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pleaserun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
@@ -96,6 +96,7 @@ files:
96
96
  - LICENSE
97
97
  - Makefile
98
98
  - README.md
99
+ - bin/please-manage-user
99
100
  - bin/pleaserun
100
101
  - examples/runit.rb
101
102
  - lib/pleaserun/cli.rb