mrwolf 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 00a09151e7b2fed67a04e39814763bf14804d84e
4
+ data.tar.gz: 0fe2f5920eb36dffc0a1a78bd17bcfbcd97b00a2
5
+ SHA512:
6
+ metadata.gz: 1d7a1723a53ec3b75beefdade4e847b4a92fcff6141d052532964cc63db3b4fe944eda191f0aaabd34901ab0cfff396b559843c6d97224fcb7e3adf0eb7fdaaf
7
+ data.tar.gz: 85674a7628dbbc784cc8a6a4c711c58976481855475661ee536a5393d454063ca617e6633622d6f075a57c975d7ece4ac4ec55e6d4218b33c6926d9c0a5b2faa
data/bin/mrwolf ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+ require 'mrwolf'
3
+ ########fixing the arguments for the program#
4
+ options=[]
5
+ ARGV.each do |arg|
6
+ options.push(arg)
7
+
8
+ end
9
+
10
+ hash_of_args=Hash.new{nil}
11
+ i=1
12
+ #first argument is whether to package or to publish
13
+ while i < options.length
14
+ hash_of_args[options[i]]=options[i+1]
15
+ i=i+2
16
+ end
17
+ #hash_of_args[-p]=project
18
+ #hash_of_args[-n]=name_of_project
19
+ #hash_of_args[-v]=version of rpm file
20
+ path =hash_of_args["-p"]
21
+ project =hash_of_args["-n"]
22
+ version =hash_of_args["-v"]
23
+ ########################################
24
+
25
+ fixer=Mrwolf.new(path,project,version)
26
+ if options[0]=="package"
27
+ fixer.package
28
+ elsif options[0]=="publish"
29
+ fixer.transport
30
+ elsif options[0]=="--help"
31
+ print "
32
+ mrwolf package => to package a directory,
33
+ -p => path of directory to package.
34
+ -n => name of the rpm generated
35
+ -v => version of the rpm
36
+
37
+ mrwolf publish => to publish a directory to s3....set aws variable as ENV variables
38
+ -p => path of directory to package.
39
+ -n => name of the rpm generated
40
+ -v => version of the rpm"
41
+ else
42
+ puts "Error:enter a task"
43
+ end
@@ -0,0 +1,28 @@
1
+
2
+ class Mrwolf::Packager
3
+
4
+ def initialize(path,project,version)
5
+ @project = project
6
+ @path = path
7
+ @version = version
8
+ end
9
+
10
+ def package
11
+ require 'fpm'
12
+ package = FPM::Package::Dir.new
13
+ package.input("#{@path}")
14
+
15
+ package.attributes = { :rpm_defattrfile => "-", :rpm_user => "$USER", :rpm_group => "$USER", :rpm_defattrdir => "-" }
16
+ rpm = package.convert(FPM::Package::RPM)
17
+ rpm.name = "#{@project}"
18
+ rpm.version = "#{@version}"
19
+ rpm.architecture="noarch"
20
+ begin
21
+ output = "NAME-VERSION.ARCH.rpm"
22
+ rpm.output(rpm.to_s(output))
23
+ ensure
24
+ rpm.cleanup
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,32 @@
1
+ class Mrwolf::Transporter
2
+ def initialize(project,version)
3
+
4
+ @PROJECT = project
5
+ @AWS_ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID']
6
+ @AWS_SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY']
7
+ @S3_BUCKET = ENV['S3_BUCKET']
8
+ @version = version
9
+ end
10
+
11
+ def publish
12
+ require 'rubygems'
13
+ require 'fog'
14
+
15
+ connection = Fog::Storage.new( provider: :AWS,
16
+ aws_access_key_id: @AWS_ACCESS_KEY_ID,
17
+ aws_secret_access_key: @AWS_SECRET_ACCESS_KEY)
18
+
19
+ directory = connection.directories.new( key: @S3_BUCKET )
20
+
21
+ artifact = "#{@PROJECT}/#{@PROJECT}-#{@version}.noarch.rpm"
22
+ artifact_path = "#{@PROJECT}-#{@version}.noarch.rpm"
23
+
24
+ directory.files.create(key: artifact, body: File.open(artifact_path), public: false)
25
+
26
+ if directory.files.head("#{@PROJECT}/#{@PROJECT}-#{@version}.noarch.rpm")
27
+ "success"
28
+ else
29
+ "failure"
30
+ end
31
+ end
32
+ end
data/lib/mrwolf.rb ADDED
@@ -0,0 +1,21 @@
1
+ class Mrwolf
2
+ def initialize(path,project,version)
3
+ @path =path
4
+ @project =project
5
+ @version =version
6
+ end
7
+
8
+ def package
9
+ task = Packager.new(@path,@project,@version)
10
+ task.package
11
+ end
12
+
13
+ def transport
14
+ task = Transporter.new(@project,@version)
15
+ task.publish
16
+ end
17
+
18
+ end
19
+
20
+ require 'mrwolf/transporter_to_s3'
21
+ require 'mrwolf/packager_to_rpm'
@@ -0,0 +1,13 @@
1
+ require "mrwolf"
2
+ require "test/unit"
3
+
4
+ class TC_mrwolf < Test::Unit::TestCase
5
+
6
+ def test_package
7
+ path="path of the file to packaged"
8
+ project="project"
9
+ version="version default is 1.0"
10
+ Mrwolf.new(path,project,version).package
11
+ assert_same(File.exist?("#{project}"+"-"+"#{version}"+".noarch.rpm"),true)
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ require "mrwolf"
2
+ require "test/unit"
3
+
4
+ class TC_mrwolf < Test::Unit::TestCase
5
+
6
+ def test_package
7
+ path="path of the directory to be packaged"
8
+ project="project"
9
+ version="version for eg 1.0"
10
+ assert_equal Mrwolf.new(path,project,version).transport,"success"
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrwolf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - codeignition
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: cleaner
14
+ email: hello@codeignition.co
15
+ executables:
16
+ - mrwolf
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/mrwolf.rb
21
+ - lib/mrwolf/transporter_to_s3.rb
22
+ - lib/mrwolf/packager_to_rpm.rb
23
+ - bin/mrwolf
24
+ - test/test_transporter.rb
25
+ - test/test_packager.rb
26
+ homepage:
27
+ licenses: []
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.0.3
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: mrwolf the cleaner!
49
+ test_files: []