servicedesk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.vagrant +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +28 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/Vagrantfile +43 -0
- data/bin/servicedesk +21 -0
- data/cookbooks/client_prepare/files/default/dumbhello_1.0_amd64.deb +0 -0
- data/cookbooks/client_prepare/files/default/hellotest_1.0.0_i386.deb +0 -0
- data/cookbooks/client_prepare/files/default/sources.list +68 -0
- data/cookbooks/client_prepare/recipes/default.rb +13 -0
- data/cookbooks/host_prepare/files/default/config.ru +7 -0
- data/cookbooks/host_prepare/files/default/distributions +17 -0
- data/cookbooks/host_prepare/files/default/dropbox.rb +65 -0
- data/cookbooks/host_prepare/files/default/options +0 -0
- data/cookbooks/host_prepare/files/default/override.lenny +0 -0
- data/cookbooks/host_prepare/files/default/override.precise +0 -0
- data/cookbooks/host_prepare/recipes/default.rb +32 -0
- data/cookbooks/ruby/recipes/default.rb +34 -0
- data/lib/servicedesk.rb +13 -0
- data/lib/servicedesk/config.rb +23 -0
- data/lib/servicedesk/uploader.rb +44 -0
- data/lib/servicedesk/version.rb +3 -0
- data/pkg/servicedesk-0.0.1.gem +0 -0
- data/servicedesk.gemspec +26 -0
- data/vendor/cache/methadone-1.2.3.gem +0 -0
- data/vendor/cache/rack-1.4.1.gem +0 -0
- data/vendor/cache/rack-protection-1.3.2.gem +0 -0
- data/vendor/cache/rake-10.0.3.gem +0 -0
- data/vendor/cache/sinatra-1.3.3.gem +0 -0
- data/vendor/cache/tilt-1.3.3.gem +0 -0
- metadata +143 -0
data/.vagrant
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"active":{"host":"04b3a446-d4c8-485b-93b0-2eb3eb3b512b","client":"2e2d0c54-b5c9-4714-bef5-88d334c6ae2b"}}
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
servicedesk (0.0.1)
|
5
|
+
methadone
|
6
|
+
sinatra
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
methadone (1.2.3)
|
12
|
+
bundler
|
13
|
+
rack (1.4.1)
|
14
|
+
rack-protection (1.3.2)
|
15
|
+
rack
|
16
|
+
rake (10.0.3)
|
17
|
+
sinatra (1.3.3)
|
18
|
+
rack (~> 1.3, >= 1.3.6)
|
19
|
+
rack-protection (~> 1.2)
|
20
|
+
tilt (~> 1.3, >= 1.3.3)
|
21
|
+
tilt (1.3.3)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
rake
|
28
|
+
servicedesk!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 pagodabox
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# ServiceDesk
|
2
|
+
|
3
|
+
A web service interface into the repository dropbox.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'servicedesk'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install servicedesk
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Usage: servicedesk package built_on url
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Vagrantfile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'vagrant-vbguest' unless defined? VagrantVbguest::Config
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
Vagrant::Config.run do |config|
|
8
|
+
|
9
|
+
[[:host, "192.168.78.8"],[:client, "192.168.78.9"]].each do |env, ip|
|
10
|
+
|
11
|
+
config.vbguest.auto_update = true
|
12
|
+
config.vm.define env do |env_config|
|
13
|
+
|
14
|
+
env_config.vm.network :hostonly, ip
|
15
|
+
env_config.vm.customize ["modifyvm", :id, "--cpus", 4, "--memory", 512]
|
16
|
+
env_config.vm.share_folder("v-root", "/vagrant", ".", nfs: true)
|
17
|
+
env_config.vm.share_folder("v-ssh", "/tmp/.ssh", "#{Dir.home}/.ssh")
|
18
|
+
|
19
|
+
case env.to_s
|
20
|
+
when /^host/
|
21
|
+
puts "host section entered"
|
22
|
+
env_config.vm.box = "precise32"
|
23
|
+
env_config.vm.box_url = "http://files.vagrantup.com/precise32.box"
|
24
|
+
|
25
|
+
config.vm.provision :chef_solo do |chef|
|
26
|
+
chef.cookbooks_path = ['cookbooks']
|
27
|
+
chef.add_recipe 'ruby'
|
28
|
+
chef.add_recipe 'host_prepare'
|
29
|
+
end
|
30
|
+
when /^client/
|
31
|
+
puts "client section entered"
|
32
|
+
env_config.vm.box = "precise32"
|
33
|
+
env_config.vm.box_url = "http://files.vagrantup.com/precise32.box"
|
34
|
+
|
35
|
+
config.vm.provision :chef_solo do |chef|
|
36
|
+
chef.cookbooks_path = ['cookbooks']
|
37
|
+
chef.add_recipe 'ruby'
|
38
|
+
chef.add_recipe 'client_prepare'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/bin/servicedesk
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'methadone'
|
5
|
+
require 'servicedesk'
|
6
|
+
|
7
|
+
include Methadone::Main
|
8
|
+
include Methadone::CLILogging
|
9
|
+
|
10
|
+
main do |package, built_on, url|
|
11
|
+
puts "in main"
|
12
|
+
Servicedesk.push(package, built_on, url)
|
13
|
+
end
|
14
|
+
|
15
|
+
description 'A tool for accepting binary packages and uploading the package to a repository via POST method'
|
16
|
+
|
17
|
+
arg :package, :required
|
18
|
+
arg :built_on, :required
|
19
|
+
arg :url, :required
|
20
|
+
|
21
|
+
go!
|
Binary file
|
Binary file
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#
|
2
|
+
deb http://192.168.78.8/repo/ precise main
|
3
|
+
deb-src http://192.168.78.8/repo/ precise main
|
4
|
+
|
5
|
+
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/main/binary-i386/
|
6
|
+
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/restricted/binary-i386/
|
7
|
+
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ precise main restricted
|
8
|
+
|
9
|
+
#deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/main/binary-i386/
|
10
|
+
#deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/restricted/binary-i386/
|
11
|
+
#deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ precise main restricted
|
12
|
+
|
13
|
+
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
|
14
|
+
# newer versions of the distribution.
|
15
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
|
16
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted
|
17
|
+
|
18
|
+
## Major bug fix updates produced after the final release of the
|
19
|
+
## distribution.
|
20
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
|
21
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
|
22
|
+
|
23
|
+
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
24
|
+
## team. Also, please note that software in universe WILL NOT receive any
|
25
|
+
## review or updates from the Ubuntu security team.
|
26
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
|
27
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
|
28
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
|
29
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
|
30
|
+
|
31
|
+
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
32
|
+
## team, and may not be under a free licence. Please satisfy yourself as to
|
33
|
+
## your rights to use the software. Also, please note that software in
|
34
|
+
## multiverse WILL NOT receive any review or updates from the Ubuntu
|
35
|
+
## security team.
|
36
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
|
37
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
|
38
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
|
39
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
|
40
|
+
|
41
|
+
## N.B. software from this repository may not have been tested as
|
42
|
+
## extensively as that contained in the main release, although it includes
|
43
|
+
## newer versions of some applications which may provide useful features.
|
44
|
+
## Also, please note that software in backports WILL NOT receive any review
|
45
|
+
## or updates from the Ubuntu security team.
|
46
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
|
47
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
|
48
|
+
|
49
|
+
deb http://security.ubuntu.com/ubuntu precise-security main restricted
|
50
|
+
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
|
51
|
+
deb http://security.ubuntu.com/ubuntu precise-security universe
|
52
|
+
deb-src http://security.ubuntu.com/ubuntu precise-security universe
|
53
|
+
deb http://security.ubuntu.com/ubuntu precise-security multiverse
|
54
|
+
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
|
55
|
+
|
56
|
+
## Uncomment the following two lines to add software from Canonical's
|
57
|
+
## 'partner' repository.
|
58
|
+
## This software is not part of Ubuntu, but is offered by Canonical and the
|
59
|
+
## respective vendors as a service to Ubuntu users.
|
60
|
+
# deb http://archive.canonical.com/ubuntu precise partner
|
61
|
+
# deb-src http://archive.canonical.com/ubuntu precise partner
|
62
|
+
|
63
|
+
## Uncomment the following two lines to add software from Ubuntu's
|
64
|
+
## 'extras' repository.
|
65
|
+
## This software is not part of Ubuntu, but is offered by third-party
|
66
|
+
## developers who want to ship their latest software.
|
67
|
+
# deb http://extras.ubuntu.com/ubuntu precise main
|
68
|
+
# deb-src http://extras.ubuntu.com/ubuntu precise main
|
@@ -0,0 +1,13 @@
|
|
1
|
+
## CLIENT RECIPE
|
2
|
+
|
3
|
+
gem_package "fpm"
|
4
|
+
|
5
|
+
execute "gem install /vagrant/pkg/servicedesk-0.0.1.gem"
|
6
|
+
|
7
|
+
directory "/file"
|
8
|
+
cookbook_file "/file/dumbhello_1.0_amd64.deb"
|
9
|
+
cookbook_file "/file/hellotest_1.0.0_i386.deb"
|
10
|
+
cookbook_file "/etc/apt/sources.list"
|
11
|
+
|
12
|
+
package "git"
|
13
|
+
package "curl"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Origin: Tyler
|
2
|
+
Label: Tyler's Personal Debs
|
3
|
+
Codename: precise
|
4
|
+
Architectures: i386 amd64 source lpia
|
5
|
+
Components: main
|
6
|
+
Description: Tylers Personal Debian Repository
|
7
|
+
DebOverride: override.precise
|
8
|
+
DscOverride: override.precise
|
9
|
+
|
10
|
+
Origin: Tyler
|
11
|
+
Label: Tyler's Personal Debs
|
12
|
+
Codename: lenny
|
13
|
+
Architectures: i386 amd64 source lpia
|
14
|
+
Components: main
|
15
|
+
Description: Tylers Personal Debian Repository
|
16
|
+
DebOverride: override.lenny
|
17
|
+
DscOverride: override.lenny
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'digest'
|
3
|
+
|
4
|
+
set :static, enable
|
5
|
+
set :public_folder, '/webservice/'
|
6
|
+
|
7
|
+
UPLOAD_DIR = File.expand_path('../dropbox', __FILE__)
|
8
|
+
|
9
|
+
# get '/' do
|
10
|
+
# content_type :text
|
11
|
+
# ensure_upload_dir!
|
12
|
+
# files = Dir.glob(File.join(UPLOAD_DIR, '/**/*')).join("\n")
|
13
|
+
# "Files:\n\n#{files}"
|
14
|
+
# end
|
15
|
+
|
16
|
+
get '/' do
|
17
|
+
"This is the pagodabox.com repository and dropbox server."
|
18
|
+
end
|
19
|
+
|
20
|
+
# get '/repo/*' do
|
21
|
+
# puts "request = #{request}"
|
22
|
+
# if File.exists?("/webservice" + request.fullpath)
|
23
|
+
# puts "enters file exists"
|
24
|
+
# send_file("/webservice" + request.fullpath)
|
25
|
+
# else
|
26
|
+
# puts "File /webservice#{request.fullpath} is not in repository"
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
post '/dropbox' do
|
31
|
+
|
32
|
+
path = "#{UPLOAD_DIR}/#{params[:distro]}"
|
33
|
+
FileUtils.mkdir_p(path) if not File.directory?(path)
|
34
|
+
# ensures that the file path exists if not create it
|
35
|
+
# if %w(name version architecture ext built_on).all? { |type| params[type].present? }
|
36
|
+
if params[:ext] == 'deb'
|
37
|
+
file = File.join(path, "#{params[:name]}_#{params[:version]}_#{params[:architecture]}.#{params[:ext]}")
|
38
|
+
else
|
39
|
+
file = File.join(path, "#{params[:name]}-#{params[:version]}-#{params[:architecture]}.#{params[:ext]}")
|
40
|
+
end
|
41
|
+
# puts "#{params[:data][:tempfile]}"
|
42
|
+
# FileUtils.copy(params[:data][:tempfile], file) # failing on to_str
|
43
|
+
puts Digest::MD5.hexdigest("#{params[:file][:tempfile].read}")
|
44
|
+
puts "params[:file][:tempfile] = #{params[:file][:tempfile]}"
|
45
|
+
if params[:file][:tempfile].respond_to?(:path)
|
46
|
+
FileUtils.copy(params[:file][:tempfile].path, file)
|
47
|
+
end
|
48
|
+
# File.open(file, 'w+') {|f| f.write(params[:data][:tempfile]) } # result file not matching original in md5 hash
|
49
|
+
"wrote #{file} to #{path}\n"
|
50
|
+
|
51
|
+
params[:file][:tempfile].unlink
|
52
|
+
# else
|
53
|
+
# "Not all parameters met, requires; :name, :version, :architecture, :ext, :built_on"
|
54
|
+
# end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
## HOST RECIPE
|
2
|
+
|
3
|
+
# Used by the footman gem
|
4
|
+
package "reprepro"
|
5
|
+
package "git"
|
6
|
+
# Vary simple server for testing
|
7
|
+
gem_package "thin"
|
8
|
+
gem_package "sinatra"
|
9
|
+
|
10
|
+
# not needed but i like it to show the tree structure of the repo, so much more insight is gained than with ls
|
11
|
+
package "tree"
|
12
|
+
|
13
|
+
# Apt repo setup files
|
14
|
+
directory "/webservice"
|
15
|
+
directory "/webservice/repo"
|
16
|
+
directory "/webservice/repo/conf"
|
17
|
+
cookbook_file "/webservice/repo/conf/distributions"
|
18
|
+
cookbook_file "/webservice/repo/conf/options"
|
19
|
+
cookbook_file "/webservice/repo/conf/override.precise"
|
20
|
+
cookbook_file "/webservice/repo/conf/override.lenny"
|
21
|
+
|
22
|
+
# dropbox setup files
|
23
|
+
directory "/webservice/dropbox"
|
24
|
+
directory "/webservice/dropbox/precise"
|
25
|
+
directory "/webservice/dropbox/lenny"
|
26
|
+
|
27
|
+
cookbook_file "/webservice/dropbox.rb"
|
28
|
+
cookbook_file "/webservice/config.ru"
|
29
|
+
|
30
|
+
# install footman
|
31
|
+
gem_package "footman"
|
32
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
execute "apt-get update"
|
2
|
+
|
3
|
+
rv = `ruby -v`
|
4
|
+
if rv.include? "1.9.3"
|
5
|
+
puts "Ruby already at -v 1.9.3"
|
6
|
+
else
|
7
|
+
%w{build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev}.each do |pkg|
|
8
|
+
package pkg do
|
9
|
+
action :install
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
execute "wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz" do
|
14
|
+
cwd "/tmp"
|
15
|
+
end
|
16
|
+
|
17
|
+
execute "tar -xvzf ruby-1.9.3-p194.tar.gz" do
|
18
|
+
cwd "/tmp"
|
19
|
+
end
|
20
|
+
|
21
|
+
execute "./configure --prefix=/usr --disable-install-doc" do
|
22
|
+
cwd "/tmp/ruby-1.9.3-p194"
|
23
|
+
end
|
24
|
+
|
25
|
+
execute "make" do
|
26
|
+
cwd "/tmp/ruby-1.9.3-p194"
|
27
|
+
end
|
28
|
+
|
29
|
+
execute "make install" do
|
30
|
+
cwd "/tmp/ruby-1.9.3-p194"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# un comment when you need to install ruby
|
data/lib/servicedesk.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "servicedesk/version"
|
2
|
+
require "servicedesk/config"
|
3
|
+
require "servicedesk/uploader"
|
4
|
+
|
5
|
+
module Servicedesk
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def push(package, built_on, url)
|
9
|
+
Uploader.upload( Config.new(package, built_on, url) )
|
10
|
+
puts "\nFile uploaded\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Servicedesk
|
2
|
+
class Config
|
3
|
+
|
4
|
+
attr_accessor :built_on, :name, :ext, :version, :architecture, :file, :url
|
5
|
+
|
6
|
+
def initialize(package, built_on, url)
|
7
|
+
puts "in config initialize"
|
8
|
+
@file = package
|
9
|
+
@built_on = built_on
|
10
|
+
@url = url
|
11
|
+
parse(package)
|
12
|
+
end
|
13
|
+
|
14
|
+
def parse(package)
|
15
|
+
captures = package.match(/.*\/(?<name>[^_]+)[_|-](?<version>[^_]+)[_|-](?<arch>[^\.]+)\.(?<ext>\S+)\z/i)
|
16
|
+
@name = "#{captures[:name]}"
|
17
|
+
@version = "#{captures[:version]}"
|
18
|
+
@architecture = "#{captures[:arch]}"
|
19
|
+
@ext = "#{captures[:ext]}"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
module Servicedesk
|
4
|
+
class Uploader
|
5
|
+
|
6
|
+
def self.upload(config)
|
7
|
+
puts "in uploader"
|
8
|
+
puts "file #{config.file}"
|
9
|
+
puts "config stuff #{config.url}/#{config.built_on}"
|
10
|
+
puts "name #{config.name}"
|
11
|
+
puts "version #{config.version}"
|
12
|
+
puts "ext #{config.ext}"
|
13
|
+
puts "architecture #{config.architecture}"
|
14
|
+
|
15
|
+
`curl -F "file=@#{config.file}" \
|
16
|
+
-F "name=#{config.name}" \
|
17
|
+
-F "version=#{config.version}" \
|
18
|
+
-F "ext=#{config.ext}" \
|
19
|
+
-F "architecture=#{config.architecture}" \
|
20
|
+
-F "distro=#{config.built_on}" \
|
21
|
+
#{config.url}`
|
22
|
+
|
23
|
+
# RestClient.post( "#{config.url}/#{config.built_on}", :data => File.new("#{config.file}", 'rb'),
|
24
|
+
# :name => "#{config.name}",
|
25
|
+
# :version => "#{config.version}",
|
26
|
+
# :ext => "#{config.ext}",
|
27
|
+
# :architecture => "#{config.architecture}" )
|
28
|
+
#maybe one day this rest will work and be used
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# Working example do not touch !!!!
|
37
|
+
# curl \
|
38
|
+
# -F "data=@/vagrant/dumbhello_1.0_amd64.deb" \
|
39
|
+
# -F "name=blahblah" \
|
40
|
+
# -F "version=1.0.1" \
|
41
|
+
# -F "ext=arr" \
|
42
|
+
# -F "architecture=i386" \
|
43
|
+
# -F "distro=precise" \
|
44
|
+
# http://0.0.0.0:80/dropbox/
|
Binary file
|
data/servicedesk.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'servicedesk/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "servicedesk"
|
8
|
+
gem.version = Servicedesk::VERSION
|
9
|
+
gem.authors = ["tylerjones"]
|
10
|
+
gem.email = ["tjones@pagodabox.com"]
|
11
|
+
gem.description = %q{Uploads packages to the dropbox via http post method.}
|
12
|
+
gem.summary = %q{Takes a package, what it was built_on, and the url of the dropbox.
|
13
|
+
Then uploads the package to the dropbox with the needed params using POST.}
|
14
|
+
gem.homepage = "https://github.com/Pagoda/servicedesk"
|
15
|
+
|
16
|
+
gem.add_dependency "sinatra"
|
17
|
+
gem.add_dependency "methadone"
|
18
|
+
gem.add_dependency "rest-client"
|
19
|
+
|
20
|
+
gem.add_development_dependency "rake"
|
21
|
+
|
22
|
+
gem.files = `git ls-files`.split($/)
|
23
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
24
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
25
|
+
gem.require_paths = ["lib"]
|
26
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: servicedesk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- tylerjones
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sinatra
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: methadone
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rest-client
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Uploads packages to the dropbox via http post method.
|
79
|
+
email:
|
80
|
+
- tjones@pagodabox.com
|
81
|
+
executables:
|
82
|
+
- servicedesk
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .vagrant
|
87
|
+
- Gemfile
|
88
|
+
- Gemfile.lock
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- Vagrantfile
|
93
|
+
- bin/servicedesk
|
94
|
+
- cookbooks/client_prepare/files/default/dumbhello_1.0_amd64.deb
|
95
|
+
- cookbooks/client_prepare/files/default/hellotest_1.0.0_i386.deb
|
96
|
+
- cookbooks/client_prepare/files/default/sources.list
|
97
|
+
- cookbooks/client_prepare/recipes/default.rb
|
98
|
+
- cookbooks/host_prepare/files/default/config.ru
|
99
|
+
- cookbooks/host_prepare/files/default/distributions
|
100
|
+
- cookbooks/host_prepare/files/default/dropbox.rb
|
101
|
+
- cookbooks/host_prepare/files/default/options
|
102
|
+
- cookbooks/host_prepare/files/default/override.lenny
|
103
|
+
- cookbooks/host_prepare/files/default/override.precise
|
104
|
+
- cookbooks/host_prepare/recipes/default.rb
|
105
|
+
- cookbooks/ruby/recipes/default.rb
|
106
|
+
- lib/servicedesk.rb
|
107
|
+
- lib/servicedesk/config.rb
|
108
|
+
- lib/servicedesk/uploader.rb
|
109
|
+
- lib/servicedesk/version.rb
|
110
|
+
- pkg/servicedesk-0.0.1.gem
|
111
|
+
- servicedesk.gemspec
|
112
|
+
- vendor/cache/methadone-1.2.3.gem
|
113
|
+
- vendor/cache/rack-1.4.1.gem
|
114
|
+
- vendor/cache/rack-protection-1.3.2.gem
|
115
|
+
- vendor/cache/rake-10.0.3.gem
|
116
|
+
- vendor/cache/sinatra-1.3.3.gem
|
117
|
+
- vendor/cache/tilt-1.3.3.gem
|
118
|
+
homepage: https://github.com/Pagoda/servicedesk
|
119
|
+
licenses: []
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 1.8.24
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: Takes a package, what it was built_on, and the url of the dropbox. Then
|
142
|
+
uploads the package to the dropbox with the needed params using POST.
|
143
|
+
test_files: []
|