joomla-rake 1.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: 89cea9fa8b93f775b6ad17b8b3812c9b265f2a24
4
+ data.tar.gz: 057bfb447210e210e9dc3e1911b6e5ab1bfe528e
5
+ SHA512:
6
+ metadata.gz: c18443a041a7b98b5e443d65a370779e70052f99acb8c46ebc1320a46d329bfda7009b8043e729f268039155eadb94261a85d46764b796346a56b0a51f43667b
7
+ data.tar.gz: f55267d9891373bda7c464a4341b0758794776564270326eb8190749e1788f838a2c112b2f578e04ecff788d82439498803e7ab8580a13f378c2509863ea569e
@@ -0,0 +1,73 @@
1
+ require 'yaml'
2
+ require 'rake'
3
+ require 'rugged'
4
+ require 'builder'
5
+ require 'logger'
6
+
7
+ #
8
+ # Load Configuration from package.yaml
9
+ #
10
+ $package = YAML.load_file("./package.yml")
11
+
12
+ # Logging
13
+ $logger = Logger.new(STDOUT)
14
+ $logger.level = Logger::INFO
15
+
16
+ Rake.application.options.quiet = true if ENV['LOUD_RAKE'].nil?
17
+
18
+ ##
19
+ # Get Version Name.
20
+ #
21
+ # Version name is taken from the package description.
22
+ #
23
+ # @return [String] Verison Name
24
+ def version_name
25
+ $package['package']['version'].to_s + '.' + commit_count
26
+ end
27
+
28
+ ##
29
+ # Get the commit count
30
+ #
31
+ # Uses the git CLI to get the commit count
32
+ #
33
+ # @return [String] Commit Count
34
+ def commit_count
35
+ v = `git rev-list HEAD --count`
36
+ v.strip!
37
+ end
38
+
39
+ ## Get the package name
40
+ #
41
+ # @return [String] Package Name
42
+ def package_name
43
+ "pkg_#{$package['name']}-#{version_name}"
44
+ end
45
+
46
+
47
+ # Path file Location
48
+ def package_file_path
49
+ "./packages/#{$package['name']}/#{package_name}.zip"
50
+ end
51
+
52
+ # Get files to (not) be packaged
53
+ # @deprecated
54
+ def package_files
55
+ package_files = Rake::FileList.new "**/*"
56
+ package_files.exclude(/^(packages\/.*|Rakefile|\.git|README\.md)/)
57
+
58
+ package_files
59
+ end
60
+
61
+ # Get the build area path
62
+ def build_area
63
+ "./packages/#{$package['name']}-#{version_name}"
64
+ end
65
+
66
+ # Replace template values
67
+ def template( template, values )
68
+ output = template.clone()
69
+ values.keys.each { |key|
70
+ output.gsub!( /{{#{key}}}/, values[ key ].to_s )
71
+ }
72
+ output
73
+ end
@@ -0,0 +1,29 @@
1
+ # Get the update manifest
2
+ def update_manifest
3
+ document = Builder::XmlMarkup.new(:indent => 2)
4
+
5
+ document.updates do |updates|
6
+ updates.comment! "Update manifest: Generated by Builder Script at #{Time.now}"
7
+ updates.update do |u|
8
+ u.name $package['package']['name']
9
+ u.description $package['package']['description']
10
+ u.element "pkg_#{$package['name']}"
11
+ u.type 'package'
12
+ u.version version_name
13
+ u.downloads do |d|
14
+ d.downloadurl({:type => "full" , :format => "zip"}, "#{$package['package']['update_site']}/#{package_name}.zip")
15
+ end
16
+ u.tags do |t|
17
+ u.tag 'Stable'
18
+ end
19
+ u.infourl "http://www.mrzen.com/travelzen"
20
+ u.maintainer 'MrZen Ltd'
21
+ u.maintainerurl 'http://www.mrzen.com'
22
+ u.targetplatform({:name => 'joomla', :version => $package['package']['target_version']})
23
+ u.section 'Updates'
24
+ u.client_id 1
25
+ end
26
+ end
27
+
28
+ document.target!
29
+ end
@@ -0,0 +1,23 @@
1
+ ##
2
+ # Joomla Rake Master File
3
+
4
+
5
+ JRAKE_ROOT = File.dirname(File.join __FILE__)
6
+
7
+ # Load Gems
8
+ require 'rake'
9
+ require 'rugged'
10
+ require 'builder'
11
+ require 'nokogiri'
12
+ require 'redcarpet'
13
+
14
+ Rake.application.init
15
+
16
+ # Load Helpers
17
+ Dir[File.join(JRAKE_ROOT, 'helpers', '*.rb')].each do |helper|
18
+ require helper
19
+ end
20
+
21
+ Dir[File.join(JRAKE_ROOT, 'tasks', '*.rb')].each do |tasks|
22
+ require tasks
23
+ end
@@ -0,0 +1,38 @@
1
+ =begin rdoc
2
+
3
+ Helpers for Codesniffing
4
+
5
+ =end
6
+
7
+ def get_php_files
8
+
9
+ Dir["**/*.php"]
10
+
11
+ end
12
+
13
+
14
+ def get_js_files
15
+
16
+ Dir["**/*.js"]
17
+
18
+ end
19
+
20
+
21
+ desc 'Code sniff PHP code'
22
+ task :sniff_php do |t|
23
+ files = get_php_files
24
+
25
+ sh %{command -v phpcs >/dev/null 2>&1 && phpcs #{files.join ' '} || echo "phpcs is not installed"}
26
+ end
27
+
28
+
29
+ desc 'Code sniff JS code'
30
+ task :sniff_js do |t|
31
+ files = get_js_files
32
+
33
+ sh %{command -v jslint >/dev/null 2>&1 && jslint #{files.join ' '} || echo "jslint is not installed"}
34
+ end
35
+
36
+
37
+ desc 'Sniff PHP & JS Code'
38
+ task :sniff_code => [:sniff_php , :sniff_js]
@@ -0,0 +1,152 @@
1
+ # -*- coding: utf-8 -*-
2
+ desc "Build the Components"
3
+ task :build_components do
4
+
5
+ if $package['contents'].keys.include? 'components'
6
+ $package['contents']['components'].each { |c| build_component c }
7
+ end
8
+
9
+ end
10
+
11
+ def build_component(name)
12
+ component_build_area = File.join(build_area, 'com_' + name)
13
+
14
+ mkdir_p component_build_area
15
+
16
+ {"/administrator" => "admin","" => "site"}.each do |context,target_context|
17
+ # Do Languages
18
+ language_dirs = Dir.glob(".#{context}/language/*")
19
+
20
+ language_dirs.each do |language_dir|
21
+ language = language_dir.split("/").last
22
+
23
+ language_files = Rake::FileList.new(".#{context}/language/#{language}/*")
24
+
25
+ language_files.each do |language_file|
26
+
27
+ if language_file.include?(name)
28
+
29
+ copy_to_dir = File.join(component_build_area, target_context, "language" , language)
30
+ mkdir_p copy_to_dir rescue nil
31
+ cp language_file , copy_to_dir
32
+
33
+ end
34
+
35
+ end
36
+ end
37
+
38
+ # Do the other stuff
39
+ mkdir_p File.join(component_build_area , target_context)
40
+ files = Rake::FileList.new(".#{context}/components/com_#{name}/**/*")
41
+
42
+ # Copy the installer script.
43
+ if context == '/administrator'
44
+ cp "./administrator/components/com_#{name}/script.php" , File.join(component_build_area, 'script.php')
45
+ end
46
+
47
+ files.each do |file_name|
48
+ target_file_name = file_name.gsub(".#{context}/components/com_#{name}", target_context)
49
+ if File.directory?(file_name)
50
+ mkdir_p File.join(component_build_area, target_file_name)
51
+ else
52
+ copy_to = File.join(component_build_area, File.dirname(target_file_name))
53
+ mkdir_p copy_to unless File.exist?(copy_to)
54
+ cp file_name, File.join(copy_to, File.basename(target_file_name))
55
+ end
56
+ end
57
+ end
58
+
59
+ # Build the manifest
60
+ manifest_path = File.join(component_build_area , name + '.xml')
61
+ manifest_file = File.open(manifest_path, 'w:UTF-8')
62
+ manifest = Builder::XmlMarkup.new(:indent => 4, :target => manifest_file)
63
+
64
+ manifest.instruct!
65
+
66
+ manifest.extension({
67
+ :type => "component" ,
68
+ :version => $package['package']['target_version'] ,
69
+ :method => "upgrade"}) do |ext|
70
+
71
+ ext.comment! "Manifest generated by builder script at #{Time.now}"
72
+
73
+ ext.name 'com_' + name
74
+ ext.description"COM_#{name.upcase}_XML_DESCRIPTION"
75
+ ext.version version_name
76
+ ext.copyright $package['package']['copyright']
77
+ ext.creationDate "01 Jan 2010"
78
+ ext.author $package['package']['author']
79
+ ext.authorEmail $package['package']['author_email']
80
+ ext.authorUrl $package['package']['author_url']
81
+
82
+ ext.install do |install|
83
+ install.sql do |sql|
84
+ sql.file({:driver => "mysql" , :charset => "utf8"}, "sql/install.mysql.utf8.sql")
85
+ end
86
+ end
87
+
88
+
89
+ ext.uninstall do |uninstall|
90
+ uninstall.sql do |sql|
91
+ sql.file({:driver => "mysql" , :charset => "utf8"}, "sql/uninstall.mysql.utf8.sql")
92
+ end
93
+ end
94
+
95
+ ext.update do |update|
96
+ update.schemas do |schema|
97
+ schema.schemapath({:type => "mysql"}, "sql/updates")
98
+ end
99
+ end
100
+
101
+
102
+ ext.scriptfile "script.php" if File.exist?( File.join(component_build_area , 'admin' , 'script.php') )
103
+
104
+ ext.administration do |admin|
105
+ admin.menu({:img => "components/com_#{name}/assets/menu_icon.png"}, "COM_#{name.upcase}_MENUTITLE")
106
+
107
+ admin.languages do |languages|
108
+ language_dirs = Dir.glob( File.join(component_build_area, 'admin', 'language', '*') )
109
+ language_dirs.each do |language_dir|
110
+
111
+ language_code = language_dir.split('/').last
112
+ language_files = Dir.glob(File.join(language_dir , '*.ini'))
113
+
114
+ language_files.each do |language_file|
115
+ language_path = File.join('language', (File.basename language_file))
116
+ languages.language({:tag => language_code}, language_path)
117
+ end # language_files.each
118
+ end # language_dir.each
119
+ end # admin.languages
120
+
121
+
122
+ admin.files({:folder => "admin"}) do |files|
123
+ Dir.glob(File.join(component_build_area , 'admin' , '*')).each do |f|
124
+ if File.directory? f
125
+ files.folder File.basename( f )
126
+ else
127
+ files.filename File.basename( f )
128
+ end
129
+ end
130
+ end # Admin files
131
+ end # Admin
132
+
133
+ ext.files({:folder => "site"}) do |files|
134
+ Dir.glob(File.join(component_build_area, 'site' , '*')).each do |f|
135
+ if File.directory? f
136
+ files.folder File.basename( f )
137
+ else
138
+ files.filename File.basename( f )
139
+ end # IF
140
+ end # Files.each
141
+ end # Files
142
+ end # Manifest
143
+
144
+ manifest.target!
145
+ manifest_file.flush
146
+ manifest_file.close
147
+
148
+ chdir(component_build_area) do
149
+ sh %{zip -r ../com_#{name}.zip *}
150
+ end
151
+
152
+ end
@@ -0,0 +1,16 @@
1
+ # Heplper tasks
2
+ desc "List files to be packaged"
3
+ task :show_files do
4
+ puts package_files
5
+ end
6
+
7
+ desc "Show update manifest"
8
+ task :show_manifest do
9
+ puts update_manifest
10
+ end
11
+
12
+ desc "Clean up"
13
+ task :clean do
14
+ rm_rf "./packages"
15
+ end
16
+
data/lib/tasks/less.rb ADDED
@@ -0,0 +1,43 @@
1
+ ##
2
+ # Helpers for working with LESS files
3
+ # Requires nodejs to operate
4
+
5
+
6
+ ##
7
+ # Compile less styles
8
+ #
9
+ # Compiles less styles defined in +definition+
10
+ #
11
+ # @param [array] definitions file definitions
12
+ def compile_less_styles(base_dir, definitions)
13
+
14
+ chdir(base_dir) do
15
+ definitions.each do |definition|
16
+
17
+ lessc = 'lessc'
18
+ flags = []
19
+
20
+ if definition['optimize']
21
+ case definition['optimize']
22
+ when TrueClass then
23
+ flags << '-O2'
24
+ else
25
+ flags << '-O' + definition['optimize']
26
+ end
27
+ end
28
+
29
+ if definition['compress']
30
+ flags << '-x'
31
+ end
32
+
33
+ if definition['include']
34
+ flags << "--include-path=" + definition['include'].join(':')
35
+ end
36
+
37
+ sources = definition['inputs'].join(' ')
38
+
39
+ sh %{#{lessc} #{flags.join(' ')} #{sources} #{definition['output']}}
40
+
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,64 @@
1
+ # -*- coding: utf-8 -*-
2
+ task :build_libraries do
3
+ if $package['contents'].keys.include?('libraries')
4
+ $package['contents']['libraries'].each { |lib| build_library lib }
5
+ end
6
+ end
7
+
8
+ def build_library(name)
9
+ lib_build_area = File.join(build_area , 'lib_' + name)
10
+
11
+ mkdir_p lib_build_area
12
+ files = Rake::FileList.new("./libraries/#{name}/**/*")
13
+
14
+ files.each do |file_name|
15
+ new_file_name = file_name.gsub("./libraries/#{name}/",'')
16
+ if File.directory?(file_name)
17
+ mkdir_p File.join(lib_build_area, new_file_name)
18
+ else
19
+ copy_to = File.join(lib_build_area , File.dirname(new_file_name))
20
+ mkdir_p copy_to unless File.exist?(copy_to)
21
+ cp file_name, File.join(copy_to , File.basename(file_name))
22
+ end
23
+ end
24
+
25
+ manifest_path = File.join(lib_build_area, name + '.xml')
26
+ manifest_file = File.open(manifest_path , 'w')
27
+ manifest = Builder::XmlMarkup.new(:indent => 2, :target => manifest_file)
28
+
29
+ manifest.instruct!
30
+
31
+ manifest.extension({
32
+ :type => "library",
33
+ :version => $package['package']['target_version'],
34
+ :method => "upgrade"}) do |ext|
35
+ ext.name "#{name.capitalize} Library"
36
+ ext.libraryname name
37
+ ext.version version_name
38
+ ext.copyright $package['package']['copyright']
39
+ ext.creationDate "01 Jen 2010"
40
+ ext.author $package['package']['author']
41
+ ext.authorEmail $package['package']['author_email']
42
+ ext.authorUrl $package['package']['author_url']
43
+
44
+ ext.files do |files|
45
+ chdir(lib_build_area) do
46
+ Dir.glob('*').each do |f|
47
+ if File.directory? f
48
+ files.folder f
49
+ else
50
+ files.file f
51
+ end # File.directory?
52
+ end # Dir.glob.each
53
+ end # chdir
54
+ end # ext.files
55
+ end # ext
56
+
57
+ manifest.target!
58
+ manifest_file.flush
59
+ manifest_file.close
60
+
61
+ chdir(lib_build_area) do
62
+ sh %{zip -r ../lib_#{name}.zip *}
63
+ end
64
+ end
@@ -0,0 +1,31 @@
1
+ desc 'Build Modules'
2
+ task :build_modules do
3
+ if $package['contents'].keys.include? 'modules'
4
+ $package['contents']['modules'].each { |m| build_module m }
5
+ end
6
+ end
7
+
8
+ def build_module(module_name)
9
+ module_build_area = File.join(build_area, 'mod_' + module_name)
10
+
11
+ mkdir_p module_build_area
12
+
13
+ files = Rake::FileList.new("./modules/mod_#{module_name}/**/*")
14
+
15
+ files.each do |file_name|
16
+ new_file_name = file_name.gsub("./modules/mod_#{module_name}", '')
17
+
18
+ if File.directory? file_name
19
+ mkdir_p File.join(module_build_area, new_file_name)
20
+ else
21
+ copy_to = File.join(module_build_area, File.dirname(new_file_name))
22
+ mkdir_p copy_to unless File.exist? copy_to
23
+ cp file_name, File.join(copy_to, File.basename(new_file_name))
24
+ end
25
+ end
26
+
27
+ chdir(module_build_area) do
28
+ sh %{zip -r ../mod_#{module_name}.zip *}
29
+ end
30
+
31
+ end
@@ -0,0 +1,120 @@
1
+ def generate_release_notes
2
+
3
+ require 'redcarpet'
4
+
5
+ renderer = Redcarpet::Render::HTML.new({with_toc_data: true, hard_wrap: true})
6
+ markdown = Redcarpet::Markdown.new(renderer, {no_intra_emphasis: true, tables: true})
7
+
8
+ release_note_source = File.read("./release_notes.md")
9
+
10
+ markdown.render(release_note_source)
11
+ end
12
+
13
+ desc "Generate Package Manifest"
14
+ task :package_manifest do
15
+ require 'builder'
16
+
17
+ if File.exists?("./release_notes.md")
18
+ File.open( File.join(build_area , "./release_notes.html") ,'w').write(generate_release_notes)
19
+ end
20
+
21
+ manifest_path = File.join(build_area, 'pkg_' + $package['name'] + '.xml')
22
+ manifest_file = File.open(manifest_path, 'w')
23
+
24
+ manifest = Builder::XmlMarkup.new(:indent => 2, :target => manifest_file)
25
+ manifest.extension({:type => "package" , :version => $package['package']['target_version']}) do |ext|
26
+ ext.comment! "Package Manifest Generated by Builder Script at #{Time.now}"
27
+ ext.name $package['package']['name']
28
+ ext.description $package['package']['description']
29
+ ext.author $package['package']['author']
30
+ ext.packagename $package['name']
31
+ ext.update $package['package']['update_site'] + '/updates.xml'
32
+ ext.version version_name
33
+
34
+ ext.files do |package_part|
35
+ if $package['contents'].keys.include? 'components'
36
+ $package['contents']['components'].each do |component|
37
+ ext.file({:type => "component" , :id => "com_#{component}"} , "com_#{component}.zip")
38
+ end # Components
39
+ end # if components
40
+
41
+ if $package['contents'].keys.include? 'modules'
42
+ $package['contents']['modules'].each do |mod|
43
+ ext.file({:type => "module" , :id => "mod_#{mod}"} , "mod_#{mod}.zip")
44
+ end # Components
45
+ end # if components
46
+
47
+ if $package['contents'].keys.include? 'plugins'
48
+ $package['contents']['plugins'].keys.each do |group|
49
+ $package['contents']['plugins'][group].each do |plugin|
50
+ ext.file({:type => "plugin" , :id => plugin , :group => group}, "plg_#{group}_#{plugin}.zip")
51
+ end # Plugins
52
+ end # Plugin Groups
53
+ end # If plugins
54
+
55
+ if $package['contents'].keys.include? 'libraries'
56
+ $package['contents']['libraries'].each do |library|
57
+ ext.file({:type => "library", :id => library}, "lib_#{library}.zip")
58
+ end # Libraries
59
+ end # If Libraries
60
+
61
+
62
+ if $package['contents'].keys.include? 'templates'
63
+ $package['contents']['templates'].each do |template|
64
+ ext.file({:type => "template", :id => template , :client => "site"}, "tpl_#{template}.zip")
65
+ end
66
+ end
67
+
68
+ end # Package Parts
69
+
70
+ ext.updateservers do |server|
71
+ ext.server({:type => "extension", :name => $package['package']['name']}, $package['package']['update_site'] + '/updates.xml')
72
+ end
73
+
74
+ end # Document (Extension)
75
+
76
+ manifest.target!
77
+ manifest_file.flush
78
+ manifest_file.close
79
+ end
80
+
81
+ # Prepare files in `package_files` for packaging
82
+ directory build_area => [
83
+ :build_libraries,
84
+ :build_components,
85
+ :build_plugins,
86
+ :build_templates,
87
+ :build_modules,
88
+ :package_manifest
89
+ ]
90
+
91
+ # Build the package zip
92
+ desc 'Build package zip archive'
93
+ task :package => [package_file_path]
94
+
95
+ file package_file_path => [build_area] do
96
+ chdir(build_area) do
97
+
98
+ # Remove the do_not_include files
99
+ if $package.keys.include? 'do_not_include'
100
+ $package['do_not_include'].each do |glob|
101
+ Dir[glob].each do |f|
102
+ rm f
103
+ end
104
+ end
105
+ end
106
+
107
+ sh "zip -r ../#{package_name}.zip *.zip pkg_#{$package['name']}.xml release_notes.html"
108
+ end
109
+ end
110
+
111
+
112
+ desc 'Preview the release notes'
113
+ task :release_notes do
114
+ p generate_release_notes
115
+ end
116
+
117
+ desc 'Preview the update manifest'
118
+ task :update_manifest do
119
+ p update_manifest
120
+ end
@@ -0,0 +1,64 @@
1
+ task :build_plugins do
2
+ if $package['contents'].keys.include? 'plugins'
3
+ $package['contents']['plugins'].each do |g|
4
+ g.last.each do |p|
5
+ build_plugin( g.first , p )
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+ def build_plugin(group, name)
12
+
13
+ plugin_build_area = File.join(build_area , 'plg_'+ group + '_' + name)
14
+
15
+ mkdir_p plugin_build_area
16
+
17
+ files = Rake::FileList.new("./plugins/#{group}/#{name}/**/*")
18
+
19
+ files.each do |file_name|
20
+ new_file_name = file_name.gsub("./plugins/#{group}/#{name}",'')
21
+ if File.directory? file_name
22
+ mkdir_p File.join(plugin_build_area, new_file_name)
23
+ else
24
+ copy_to = File.join(plugin_build_area , File.dirname(new_file_name))
25
+ mkdir_p copy_to unless File.exist? copy_to
26
+ cp file_name, File.join( copy_to, File.basename(new_file_name))
27
+ end
28
+ end
29
+
30
+ # Handle language files
31
+ language_dirs = Dir.glob("./administrator/language/*")
32
+ language_dirs.each do |language_dir|
33
+ language_code = File.basename(language_dir)
34
+
35
+ language_files = Rake::FileList.new(File.join(language_dir, "#{language_code}.plg_#{group}_#{name}.*ini"))
36
+ language_files.each do |f|
37
+ cp f , File.join(plugin_build_area , File.basename(f))
38
+ end
39
+ end
40
+
41
+ # Update the manifest meta data:
42
+ manifest_file = "#{plugin_build_area}/#{name}.xml"
43
+ manifest = ''
44
+
45
+ File.open(manifest_file, "r") do |file|
46
+ manifest = file.read()
47
+ manifest = template(manifest, {
48
+ 'release.version' => version_name,
49
+ 'project.creation.date' => '01 Jan 2010',
50
+ 'project.author' => $package['package']['author'],
51
+ 'project.licence' => $package['package']['licence'],
52
+ 'project.copyright' => $package['package']['copyright'],
53
+ 'project.author.email' => $package['package']['author_email'],
54
+ 'project.author.url' => $package['package']['author_url']
55
+ })
56
+ end
57
+ File.open(manifest_file, "w") do |file|
58
+ file.puts manifest
59
+ end
60
+
61
+ chdir(plugin_build_area) do
62
+ sh %{zip -r ../plg_#{group}_#{name}.zip *}
63
+ end
64
+ end
@@ -0,0 +1,46 @@
1
+ # -*- mode: ruby -*-
2
+ # -*- coding: utf-8 -*-
3
+
4
+ ##
5
+ # Get the S3 Credentials
6
+ def s3_credentials
7
+
8
+ {
9
+ :access_key_id => ENV['AWS_ACCESS_KEY_ID'] || $package['s3']['access_key_id'],
10
+ :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'] || $package['s3']['secret_access_key'],
11
+ :region => ENV['AWS_REGION'] || $package['s3']['region']
12
+ }
13
+
14
+ end
15
+
16
+
17
+ desc 'Upload the package to S3'
18
+ task :upload => [:package] do
19
+
20
+ require 'aws-sdk'
21
+
22
+ s3 = AWS::S3.new(s3_credentials)
23
+ bucket = s3.buckets[$package['s3']['bucket']]
24
+
25
+ package_files = [
26
+ File.join( $package['s3']['path'] , package_name + '.zip'),
27
+ File.join( $package['s3']['path'] , $package['name'] + '-latest.zip')
28
+ ]
29
+
30
+ package_files.each do |file|
31
+ o = bucket.objects[file]
32
+ o.write(Pathname.new( File.join('.' , 'packages', package_name + '.zip' )))
33
+ o.acl = :public_read
34
+ end
35
+
36
+ o = bucket.objects[ File.join($package['s3']['path'] , 'updates.xml') ]
37
+ o.write(update_manifest)
38
+ o.acl = :public_read
39
+
40
+ p "Uploaded package #{package_name}.zip and update manifest to S3"
41
+
42
+ end
43
+
44
+
45
+ desc "Make a new Release (bump, package and upload)"
46
+ task :release => [:bump, :package, :upload]
@@ -0,0 +1,54 @@
1
+ # -*- coding 'utf-8' -*-
2
+
3
+ desc "Build Templates"
4
+ task :build_templates do
5
+ if $package['contents'].keys.include? 'templates'
6
+ $package['contents']['templates'].each { |t| build_template t }
7
+ end
8
+ end
9
+
10
+
11
+ def build_template(template_name)
12
+ template_build_area = File.join(build_area, 'tpl_' + template_name)
13
+
14
+ # Copy Files
15
+ mkdir_p template_build_area
16
+
17
+ template_files = Rake::FileList.new("./templates/#{template_name}/**/*")
18
+
19
+ template_files.each do |file_name|
20
+ target_file_name = file_name.gsub("./templates/#{template_name}", '')
21
+
22
+ if File.directory? file_name
23
+ mkdir_p File.join(template_build_area, target_file_name)
24
+ else
25
+ copy_to = File.join(template_build_area, File.dirname(target_file_name))
26
+ mkdir_p copy_to unless File.exist?(copy_to)
27
+ cp file_name, File.join(copy_to, File.basename(target_file_name))
28
+ end
29
+ end
30
+
31
+ # Copy Language Files
32
+ language_codes = Dir.glob("./languages/*").each { |d| File.basename d }
33
+
34
+ language_codes.each do |language|
35
+ language_files = Rake::FileList.new("./languages/#{language}/*.ini")
36
+
37
+ language_files.each do |language_file|
38
+ if language_file.include? template_name
39
+ cp language_file , File.join(template_build_area, File.basename(language_file) )
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ # Process any LESS files
46
+ if $package['less'].keys.include? template_name
47
+ compile_less_styles(template_build_area, $package['less'][template_name])
48
+ end
49
+
50
+ chdir(template_build_area) do
51
+ sh %{zip -r ../tpl_#{template_name}.zip *}
52
+ end
53
+
54
+ end
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+ def next_version(current_version)
3
+ # Semantic Versioning Bump
4
+ v = current_version.split '.'
5
+
6
+ # Increase PATCH version
7
+ v[-1] = v[-1].to_i + 1
8
+
9
+ v.join '.'
10
+
11
+ end
12
+
13
+ def bump_version
14
+
15
+ version_file = File.read("./package.yml")
16
+ old_version_line = version_file[/^\s{2}version:\s*[\d\.]+$/]
17
+ new_version = next_version($package['package']['version'])
18
+
19
+ version_file.sub!( old_version_line , " version: #{new_version}")
20
+ File.write("./package.yml", version_file)
21
+
22
+ new_version
23
+ end
24
+
25
+ desc "Increase the version number by 1 PATCH"
26
+ task :bump do |t|
27
+ puts "Version upgrade: #{version_name} → #{bump_version}"
28
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: joomla-rake
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Leo Adamek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Rake tasks to build Joomla packages using a YAML DSL
14
+ email: info@mrzen.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/helpers/helpers.rb
20
+ - lib/helpers/manifest_generators.rb
21
+ - lib/joomla-rake.rb
22
+ - lib/tasks/codesniff.rb
23
+ - lib/tasks/components.rb
24
+ - lib/tasks/helper_tasks.rb
25
+ - lib/tasks/less.rb
26
+ - lib/tasks/libraries.rb
27
+ - lib/tasks/modules.rb
28
+ - lib/tasks/package.rb
29
+ - lib/tasks/plugins.rb
30
+ - lib/tasks/s3_upload.rb
31
+ - lib/tasks/templates.rb
32
+ - lib/tasks/versioning.rb
33
+ homepage: http://mrzen.com
34
+ licenses:
35
+ - GPL2+
36
+ metadata: {}
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 2.2.2
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Rake tasks to build Joomla packages.
57
+ test_files: []
58
+ has_rdoc: