piedesaint 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +6 -6
- data/bin/sug +1 -1
- data/lib/piedesaint.rb +2 -2
- data/lib/piedesaint/cli.rb +42 -36
- data/lib/piedesaint/version.rb +1 -1
- data/piedesaint.gemspec +2 -2
- metadata +13 -13
- data/tasks/gem.thor +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd5187dd62378f733ea9756d5c7e6acbfca1683b
|
4
|
+
data.tar.gz: a2e52298d82e0e6bcaf2b9e7bd8ba14d298588b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4292e4a783972de57f212e20d46f5c31e29cbc21fc53e91da8ac81d0a4dbad0cd4ccfed05ff2ea74c141728a00cdb0ed187f83becbd60f2bfb938ae53907231c
|
7
|
+
data.tar.gz: ce9f94adb7f0af65c5c8767eefdf928d1ef87be604168915771679f1058bc61997b1a7d8df60a7ccaa9f25f8cf0006141897e4415b00b2ee6fba3b1436629b06
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -8,15 +8,15 @@
|
|
8
8
|
|
9
9
|
## In short
|
10
10
|
|
11
|
-
[Piedesaint](https://github.com/tnarik/piedesaint) is a minimal web server designed to expose directly files and directories (in [TAR](http://en.wikipedia.org/wiki/Tar_(computing) format) via HTTP or HTTPS.
|
11
|
+
[Piedesaint](https://github.com/tnarik/piedesaint) is a minimal web server designed to expose directly files and directories (in [TAR](http://en.wikipedia.org/wiki/Tar_(computing) format for convenience) via HTTP or HTTPS.
|
12
12
|
|
13
13
|
## Motivation
|
14
14
|
|
15
|
-
It was born
|
15
|
+
It was born out of the need of having the simplest web server possible (while still being reasonably fast and secure) to provide files and directories to be used by [remote_file](http://docs.opscode.com/resource_remote_file.html) Chef resources, solving the issue of distributing packages that for different reasons might not be public or require some interaction to get downloaded, without requiring the installation of a full fledged web server.
|
16
16
|
|
17
|
-
It also serves directories (packaging them on the fly) as a single resource.
|
17
|
+
It also serves directories (packaging them on the fly) as a single TAR resource.
|
18
18
|
|
19
|
-
This is useful in the case of using chef-
|
19
|
+
This is useful in the case of using chef-zero (combined with Vagrant or Test Kitchen, for instance) when database backups/internal git repositories/installation packages need to be transported to the client node but adding those packages to our cookbooks is not desired or possible.
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
@@ -38,7 +38,7 @@ After installation you will need to initialize the configuration by executing:
|
|
38
38
|
|
39
39
|
$ sug init [list of folders to serve, in cascade order]
|
40
40
|
|
41
|
-
This creates the
|
41
|
+
This creates the `.piedesaint` folder that you can inspect and configure (it contains a default shortlived and self-signed SSL key/certificate pair and some additional configuration in [YAML](http://en.wikipedia.org/wiki/YAML) format).
|
42
42
|
|
43
43
|
By default the configuration will serve the current directory, unless a list of folders is specified. If you want to serve a different folder or set of folders, just edit the configuration.
|
44
44
|
|
@@ -46,7 +46,7 @@ After this, whenever you want to serve the files/directories, just execute:
|
|
46
46
|
|
47
47
|
$ sug
|
48
48
|
|
49
|
-
Alternatively, by editing
|
49
|
+
Alternatively, by editing `.piedesaint/config`, you can disable compressed folders (`:tar: false`), the need for Basic Authorization credentials (using an empty `:username:`) or the SSL behaviour (using an empty `:key:`).
|
50
50
|
|
51
51
|
## License
|
52
52
|
|
data/bin/sug
CHANGED
data/lib/piedesaint.rb
CHANGED
@@ -120,14 +120,14 @@ module Piedesaint
|
|
120
120
|
#ctx.cert = "./server.crt"
|
121
121
|
#ctx.verify_mode = ::Puma::MiniSSL::VERIFY_NONE
|
122
122
|
|
123
|
-
puma.add_tcp_listener options[:
|
123
|
+
puma.add_tcp_listener options[:iface], options[:http_port]
|
124
124
|
|
125
125
|
if ( !options[:key].nil? and !options[:key].empty? )
|
126
126
|
ctx = ::OpenSSL::SSL::SSLContext.new
|
127
127
|
ctx.key = OpenSSL::PKey::RSA.new File.read(options[:key])
|
128
128
|
ctx.cert = OpenSSL::X509::Certificate.new File.read(options[:cert])
|
129
129
|
ctx.verify_mode = ::OpenSSL::SSL::VERIFY_NONE
|
130
|
-
puma.add_ssl_listener options[:
|
130
|
+
puma.add_ssl_listener options[:iface], options[:https_port], ctx
|
131
131
|
end
|
132
132
|
|
133
133
|
puma.min_threads = 1
|
data/lib/piedesaint/cli.rb
CHANGED
@@ -14,6 +14,7 @@ module Piedesaint
|
|
14
14
|
|
15
15
|
def execute
|
16
16
|
load_config
|
17
|
+
cert(@config[:host]) if @config[:refresh_cert]
|
17
18
|
piedesanto = Piedesaint.new @config
|
18
19
|
piedesanto.start
|
19
20
|
end
|
@@ -22,37 +23,52 @@ module Piedesaint
|
|
22
23
|
if File.exist?(".piedesaint")
|
23
24
|
abort "Configuration already exists at #{Dir.pwd}/.piedesaint"
|
24
25
|
end
|
25
|
-
key, cert = create_ssl_artifacts
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
config = { iface: "0.0.0.0",
|
28
|
+
http_port: 8080,
|
29
|
+
https_port: 9292,
|
30
|
+
refresh_cert: true,
|
31
|
+
host: "localhost",
|
32
|
+
key: File.join(".", ".piedesaint", "ssl", "server.key" ),
|
33
|
+
cert: File.join(".", ".piedesaint", "ssl", "server.crt" ),
|
34
|
+
username: "user",
|
35
|
+
password: "password",
|
36
|
+
freshness: 3600,
|
37
|
+
metastore: 'file:/tmp/rack/meta',
|
38
|
+
entitystore: 'file:/tmp/rack/body',
|
39
|
+
tar: true,
|
40
|
+
folders: parameters }
|
41
|
+
save_config config
|
42
|
+
cert
|
43
|
+
puts "Configuration created at #{Dir.pwd}/.piedesaint"
|
44
|
+
end
|
34
45
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
password: "password",
|
42
|
-
freshness: 3600,
|
43
|
-
metastore: 'file:/tmp/rack/meta',
|
44
|
-
entitystore: 'file:/tmp/rack/body',
|
45
|
-
tar: true,
|
46
|
-
folders: parameters }
|
46
|
+
def set_host ( host = [] )
|
47
|
+
load_config
|
48
|
+
@config[:host] = host[0]
|
49
|
+
save_config @config
|
50
|
+
cert host[0]
|
51
|
+
end
|
47
52
|
|
48
|
-
|
53
|
+
private
|
54
|
+
def load_config
|
55
|
+
config_path = find_default_config_path
|
56
|
+
if config_path.nil?
|
57
|
+
abort "Configuration not provided.\nExecute '#{$PROGRAM_NAME} init' to generate one"
|
49
58
|
end
|
50
59
|
|
51
|
-
|
60
|
+
@config = YAML.load_file File.join(config_path, "config")
|
52
61
|
end
|
53
62
|
|
54
|
-
def
|
55
|
-
|
63
|
+
def save_config ( config )
|
64
|
+
FileUtils.mkdir_p ".piedesaint"
|
65
|
+
FileUtils.cd ".piedesaint" do
|
66
|
+
open 'config', 'w' do |io| io.write config.to_yaml end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def cert ( cn = 'localhost' )
|
71
|
+
key, cert = create_ssl_artifacts cn
|
56
72
|
|
57
73
|
FileUtils.mkdir_p ".piedesaint"
|
58
74
|
FileUtils.cd ".piedesaint" do
|
@@ -64,17 +80,7 @@ module Piedesaint
|
|
64
80
|
end
|
65
81
|
end
|
66
82
|
|
67
|
-
|
68
|
-
def load_config
|
69
|
-
config_path = find_default_config_path
|
70
|
-
if config_path.nil?
|
71
|
-
abort "Configuration not provided.\nExecute '#{$PROGRAM_NAME} init' to generate one"
|
72
|
-
end
|
73
|
-
|
74
|
-
@config = YAML.load_file File.join(config_path, "config")
|
75
|
-
end
|
76
|
-
|
77
|
-
def create_ssl_artifacts ( cert_subject = 'CN=Piedesaint' )
|
83
|
+
def create_ssl_artifacts ( cn = 'localhost' )
|
78
84
|
key = OpenSSL::PKey::RSA.new 2048
|
79
85
|
|
80
86
|
cert = OpenSSL::X509::Certificate.new
|
@@ -83,7 +89,7 @@ module Piedesaint
|
|
83
89
|
cert.not_before = Time.now
|
84
90
|
cert.not_after = Time.now + 3 * 3600
|
85
91
|
cert.public_key = key.public_key
|
86
|
-
name = OpenSSL::X509::Name.parse
|
92
|
+
name = OpenSSL::X509::Name.parse "CN=#{cn}"
|
87
93
|
cert.subject = name
|
88
94
|
cert.issuer = name
|
89
95
|
cert.sign key, OpenSSL::Digest::SHA1.new
|
data/lib/piedesaint/version.rb
CHANGED
data/piedesaint.gemspec
CHANGED
@@ -23,8 +23,8 @@ EOF
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
# development dependencies
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
27
|
+
spec.add_development_dependency "rake"
|
28
28
|
|
29
29
|
# runtime dependencies
|
30
30
|
spec.add_dependency "puma", "~>1.6.3"
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piedesaint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tnarik Innael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: puma
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- ".gitignore"
|
95
95
|
- ".ruby-gemset"
|
96
96
|
- ".ruby-version"
|
97
|
+
- ".travis.yml"
|
97
98
|
- Gemfile
|
98
99
|
- LICENSE.txt
|
99
100
|
- README.md
|
@@ -103,7 +104,6 @@ files:
|
|
103
104
|
- lib/piedesaint/cli.rb
|
104
105
|
- lib/piedesaint/version.rb
|
105
106
|
- piedesaint.gemspec
|
106
|
-
- tasks/gem.thor
|
107
107
|
homepage: https://github.com/tnarik/piedesaint
|
108
108
|
licenses:
|
109
109
|
- MIT
|
data/tasks/gem.thor
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
class Gem < Thor
|
2
|
-
include Thor::Actions
|
3
|
-
|
4
|
-
# This allows for dynamic descriptions
|
5
|
-
begin
|
6
|
-
@gemhelper = Bundler::GemHelper.new
|
7
|
-
rescue
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize(*args)
|
11
|
-
super
|
12
|
-
@gemhelper = Bundler::GemHelper.new
|
13
|
-
end
|
14
|
-
|
15
|
-
# tasks
|
16
|
-
desc "build", @gemhelper.nil? ? "Building gem into the pkg directory" :
|
17
|
-
"Building #{@gemhelper.gemspec.name}-#{@gemhelper.gemspec.version}.gem into the pkg directory"
|
18
|
-
def build
|
19
|
-
@gemhelper.build_gem
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "install", @gemhelper.nil? ? "Build and install gem into system gems" :
|
23
|
-
"Build and install #{@gemhelper.gemspec.name}-#{@gemhelper.gemspec.version}.gem into system gems"
|
24
|
-
def install
|
25
|
-
@gemhelper.install_gem
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "release", @gemhelper.nil? ? "Create tag and build and push gem to Rubygems" :
|
29
|
-
"Create tag v#{@gemhelper.gemspec.version} and build and push #{@gemhelper.gemspec.name}-#{@gemhelper.gemspec.version}.gem to Rubygems"
|
30
|
-
def release
|
31
|
-
@gemhelper.release_gem
|
32
|
-
end
|
33
|
-
end
|