pleaserun 0.0.23 → 0.0.24

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: a7071d1bf586259f396a87d0ba40e149902b07ba
4
- data.tar.gz: 63eba8936ca0b57bc61f97096913ffdb83bb2bfe
3
+ metadata.gz: 9996a6b80713eaaee8e724f2db15d03e077d83a0
4
+ data.tar.gz: 81f91ba1f891d4f5e84a81a7a146bb892abddcbd
5
5
  SHA512:
6
- metadata.gz: 62b2beabc557bf4629865e282f1dc17120c66ee401a558430039dd9ff4555b179b8d610dd797d4d0565b11585d6eaca3a1be78b2ad20fd6ef2e0562a6e0e4400
7
- data.tar.gz: aef5691cffd14cf40e566e56704be65af42ea7bb63c16ee0798dbd2c395ce36f54da90d2f9bc1077a344d2eb6abf5f04933d3711903ba65f2757675cfc59a49d
6
+ metadata.gz: 60d7e5dd2cad19f79b5ad2cfd5e61bda17885f4320ca37a6097cf563e2451162f4b00fca3e6bec3291f49883e309fbff2309a2db6077224cb4402ac075467ff4
7
+ data.tar.gz: ac733fa77a7d954f4d50c7595298125b431d5abeb0c1a52c56524e8af4a7787b5c7ce5fef1a859d3a4ea35f459fb9a717aa5f80e2af6146e20d69cf60796e9de
data/CHANGELOG.asciidoc CHANGED
@@ -1,5 +1,12 @@
1
1
  = Pleaserun Changes and Releases
2
2
 
3
+
4
+ == 0.0.24 (May 20, 2016)
5
+ * Fix bug where rubygem packages dont' seem to ship symlinks, so the
6
+ 'default' target version for some platforms was not found. Now, instead of
7
+ symlinking 'default' to whatever should be the default, we just have the
8
+ default as a directory specifically. Hopefully this helps.
9
+
3
10
  == 0.0.23 (May 19, 2016)
4
11
  * Catch JRuby IOError when execution of a missing file fails.
5
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pleaserun (0.0.21)
4
+ pleaserun (0.0.23)
5
5
  cabin (> 0)
6
6
  clamp
7
7
  insist
data/lib/pleaserun/cli.rb CHANGED
@@ -111,6 +111,7 @@ are made. If it fails, nagios will not start. Yay!
111
111
  runner = platform_klass.new(target_version)
112
112
 
113
113
  platform_klass.all_attributes.each do |facet|
114
+ next unless respond_to?(facet.name)
114
115
  # Get the value of this attribute
115
116
  # The idea here is to translate CLI options to runner settings
116
117
  value = send(facet.name)
@@ -0,0 +1,32 @@
1
+ require 'pleaserun/namespace'
2
+ require "pleaserun/platform/base"
3
+
4
+ # The platform implementation for systemd user services.
5
+ class PleaseRun::Platform::SystemdUser < PleaseRun::Platform::Base
6
+ def files
7
+ begin
8
+ # TODO(sissel): Make it easy for subclasses to extend validation on attributes.
9
+ insist { program } =~ /^\//
10
+ rescue Insist::Failure
11
+ raise PleaseRun::Configurable::ValidationError, "In systemd, the program must be a full path. You gave '#{program}'."
12
+ end
13
+
14
+ home = ENV["HOME"]
15
+ if home.nil? || home.empty?
16
+ raise PleaseRun::Configurable::ValidationError, "As a normal user (not root), I need to know where your home directory is, but the HOME environment variable seems to be not set."
17
+ end
18
+
19
+ if !File.directory?(home)
20
+ raise PleaseRun::Configurable::ValidationError, "HOME (#{home}) is not a directory. Cannot continue."
21
+ end
22
+
23
+ return Enumerator::Generator.new do |enum|
24
+ enum.yield(safe_filename("#{home}/.config/systemd/user/{{{ name }}}.service"), render_template("program.service"))
25
+ enum.yield(safe_filename("#{home}/.config/systemd/user/{{{ name }}}-prestart.sh"), render_template("prestart.sh"), 0755) if prestart
26
+ end
27
+ end # def files
28
+
29
+ def install_actions
30
+ return ["systemctl --user daemon-reload"]
31
+ end
32
+ end # class PleaseRun::Platform::SystemdUser
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.23"
5
+ spec.version = "0.0.24"
6
6
  spec.summary = "pleaserun"
7
7
  spec.description = "pleaserun"
8
8
  spec.license = "Apache 2.0"
@@ -47,6 +47,7 @@ lib/pleaserun/namespace.rb
47
47
  lib/pleaserun/platform/base.rb
48
48
  lib/pleaserun/platform/launchd.rb
49
49
  lib/pleaserun/platform/runit.rb
50
+ lib/pleaserun/platform/systemd-user.rb
50
51
  lib/pleaserun/platform/systemd.rb
51
52
  lib/pleaserun/platform/sysv.rb
52
53
  lib/pleaserun/platform/upstart.rb
@@ -54,6 +55,7 @@ lib/pleaserun/user/base.rb
54
55
  pleaserun.gemspec
55
56
  spec/pleaserun/cli_spec.rb
56
57
  spec/pleaserun/configurable_spec.rb
58
+ spec/pleaserun/detector_spec.rb
57
59
  spec/pleaserun/mustache_methods_spec.rb
58
60
  spec/pleaserun/platform/base_spec.rb
59
61
  spec/pleaserun/platform/launchd_spec.rb
@@ -63,20 +65,18 @@ spec/pleaserun/platform/upstart_spec.rb
63
65
  spec/pleaserun/user/base_spec.rb
64
66
  spec/shared_examples.rb
65
67
  spec/testenv.rb
66
- templates/launchd/10.9
67
68
  templates/launchd/default/program.plist
68
69
  templates/runit/log
69
70
  templates/runit/run
71
+ templates/systemd-user/default/prestart.sh
72
+ templates/systemd-user/default/program.service
70
73
  templates/systemd/default/prestart.sh
71
74
  templates/systemd/default/program.service
72
- templates/sysv/default
73
- templates/sysv/lsb-3.1/default
74
- templates/sysv/lsb-3.1/init.sh
75
+ templates/sysv/default/default
76
+ templates/sysv/default/init.sh
75
77
  templates/upstart/0.6.5/init.conf
76
78
  templates/upstart/0.6.5/init.d.sh
77
- templates/upstart/1.10
78
- templates/upstart/1.5/init.conf
79
- templates/upstart/1.5/init.d.sh
80
- templates/upstart/default
79
+ templates/upstart/default/init.conf
80
+ templates/upstart/default/init.d.sh
81
81
  templates/user/linux/default/installer.sh
82
82
  templates/user/linux/default/remover.sh
@@ -11,9 +11,11 @@ describe PleaseRun::CLI do
11
11
  before do
12
12
  subject.run(args)
13
13
  end
14
+
14
15
  after do
15
16
  FileUtils.rm_r(output) if File.directory?(output)
16
17
  end
18
+
17
19
  it "should write files there" do
18
20
  [ "/etc", "/etc/init.d", "/etc/init.d/#{name}" ].each do |path|
19
21
  expect(File).to be_exists(File.join(output, path))
@@ -0,0 +1,15 @@
1
+ require "pleaserun/detector"
2
+
3
+ describe PleaseRun::Detector do
4
+ context "#execute" do
5
+ it "should return a process failure if the path doesn't exist" do
6
+ out, success = subject.execute(["hopefully this program does not exist", "whatever"])
7
+ expect(success).to be_falsey
8
+ end
9
+
10
+ it "should return a process failure if the path is a directory" do
11
+ out, success = subject.execute(["/", "whatever"])
12
+ expect(success).to be_falsey
13
+ end
14
+ end
15
+ end
@@ -22,7 +22,7 @@ shared_examples_for PleaseRun::Platform do
22
22
  # monkeypatch StartLimitInterval=0 into the .service file to avoid
23
23
  # being throttled by systemd during these tests.
24
24
  # Fixes https://github.com/jordansissel/pleaserun/issues/11
25
- path = "/lib/systemd/system/#{subject.name}.service"
25
+ path = File.join(subject.unit_path, "#{subject.name}.service")
26
26
  File.write(path, File.read(path).sub(/^\[Service\]$/, "[Service]\nStartLimitInterval=0"))
27
27
  when "PleaseRun::Platform::Launchd"
28
28
  # Avoid being throttled during our tests.
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ {{{ prestart }}}
@@ -0,0 +1,14 @@
1
+ [Unit]
2
+ {{#description}}
3
+ Description={{{ description }}}
4
+ {{/description}}
5
+
6
+ [Service]
7
+ Type=simple
8
+ ExecStart={{{program}}} {{{shell_args}}}
9
+ Restart=always
10
+ WorkingDirectory={{{chdir}}}
11
+ StandardOutput=journal
12
+
13
+ [Install]
14
+ WantedBy=multi-user.target
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pleaserun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cabin
@@ -110,6 +110,7 @@ files:
110
110
  - lib/pleaserun/platform/base.rb
111
111
  - lib/pleaserun/platform/launchd.rb
112
112
  - lib/pleaserun/platform/runit.rb
113
+ - lib/pleaserun/platform/systemd-user.rb
113
114
  - lib/pleaserun/platform/systemd.rb
114
115
  - lib/pleaserun/platform/sysv.rb
115
116
  - lib/pleaserun/platform/upstart.rb
@@ -117,6 +118,7 @@ files:
117
118
  - pleaserun.gemspec
118
119
  - spec/pleaserun/cli_spec.rb
119
120
  - spec/pleaserun/configurable_spec.rb
121
+ - spec/pleaserun/detector_spec.rb
120
122
  - spec/pleaserun/mustache_methods_spec.rb
121
123
  - spec/pleaserun/platform/base_spec.rb
122
124
  - spec/pleaserun/platform/launchd_spec.rb
@@ -129,14 +131,16 @@ files:
129
131
  - templates/launchd/default/program.plist
130
132
  - templates/runit/log
131
133
  - templates/runit/run
134
+ - templates/systemd-user/default/prestart.sh
135
+ - templates/systemd-user/default/program.service
132
136
  - templates/systemd/default/prestart.sh
133
137
  - templates/systemd/default/program.service
134
- - templates/sysv/lsb-3.1/default
135
- - templates/sysv/lsb-3.1/init.sh
138
+ - templates/sysv/default/default
139
+ - templates/sysv/default/init.sh
136
140
  - templates/upstart/0.6.5/init.conf
137
141
  - templates/upstart/0.6.5/init.d.sh
138
- - templates/upstart/1.5/init.conf
139
- - templates/upstart/1.5/init.d.sh
142
+ - templates/upstart/default/init.conf
143
+ - templates/upstart/default/init.d.sh
140
144
  - templates/user/linux/default/installer.sh
141
145
  - templates/user/linux/default/remover.sh
142
146
  homepage: https://github.com/jordansissel/pleaserun