ggake 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3823a8eb83a04c2a03faa729634b5a02c139de68
4
+ data.tar.gz: f72d313016ad47a314c00d7b2a09e935b504b7d0
5
+ SHA512:
6
+ metadata.gz: 4174cd166544e11299ef0fcbdad2baf23ee68031d4ec4cbde85f76af8657dd753fbb5ab9562e36d4d5c239fb8589a185b97853399da6996fe413eac5e619713b
7
+ data.tar.gz: 009352e3a857d9be22ff42d92eca216c83aae4274752da89a9a4dc1a727ce27cd238c10cda6d62497b7ca94590b279ae96e90929b0285f8e2781dceb245c7ed8
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ggake.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Giles Alexander
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,59 @@
1
+ # Ggake
2
+
3
+ Over time I've written a bunch of useful little functions and tasks
4
+ that have been handy in the build systems of my projects. Finally,
5
+ I've decided to collect these together.
6
+
7
+ You might also find some of these useful if you use
8
+ [Rake](http://rake.rubyforge.org/).
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'ggake'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install ggake
23
+
24
+ ## Usage
25
+
26
+ This gem provides the following utilities:
27
+
28
+ * `haml_template`: Compiles a [Haml](http://haml.info/) template to an
29
+ HTML file.
30
+
31
+ * `transient`: Allows a Rake task to depend on a transient value,
32
+ such as an environment variable.
33
+
34
+ * `s3cp`: Simple copy of a directory to an S3 bucket.
35
+
36
+ More detailed usage below.
37
+
38
+ ### haml_template
39
+
40
+ haml_template(path_to_haml_template, output: path_to_output_directory)
41
+
42
+ ### transient
43
+
44
+ transient :calatrava_env, ENV['CALATRAVA_ENV']
45
+ task :build => :calatrava_env
46
+
47
+ ### s3cp
48
+
49
+ s3cp(directory, bucket: s3_bucket_name,
50
+ access_key: aws_access_key,
51
+ secret_key: aws_secret_key)
52
+
53
+ ## Contributing
54
+
55
+ 1. Fork it
56
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
57
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 4. Push to the branch (`git push origin my-new-feature`)
59
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/ggake.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ggake/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ggake"
8
+ spec.version = Ggake::VERSION
9
+ spec.authors = ["Giles Alexander"]
10
+ spec.email = ["giles.alexander@gmail.com"]
11
+ spec.description = %q{A collection of useful Rake utilities}
12
+ spec.summary = spec.description
13
+ spec.homepage = "http://github.com/gga/ggake"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rake"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ end
data/lib/ggake/haml.rb ADDED
@@ -0,0 +1,13 @@
1
+ module Rake
2
+ module DSL
3
+
4
+ def haml_template(tmpl, options)
5
+ (File.join(options[:output], File.basename(tmpl, '.haml')) + '.html').tap do |html_file|
6
+ file html_file => tmpl do
7
+ sh "haml #{tmpl} #{html_file}"
8
+ end
9
+ end
10
+ end
11
+
12
+ end
13
+ end
data/lib/ggake/s3cp.rb ADDED
@@ -0,0 +1,28 @@
1
+ module Rake
2
+ module DSL
3
+
4
+ def s3cp(dir, options)
5
+ # Done here to allow AWS::S3 to be an optional dependency
6
+ require 'aws/s3'
7
+
8
+ AWS::S3::Base.establish_connection!(:access_key_id => options[:access_key],
9
+ :secret_access_key => options[:secret_key])
10
+ cd dir do
11
+ upload_sub_dir('.', options[:bucket])
12
+ end
13
+ end
14
+
15
+ def upload_sub_dir(dir, bucket)
16
+ Dir["#{dir}/*"].each do |file|
17
+ if File.directory? file
18
+ upload_sub_dir(file, bucket)
19
+ else
20
+ file_name = file.gsub("./", '')
21
+ puts "Uploading: '#{file_name}'"
22
+ AWS::S3::S3Object.store(file_name, open(file), bucket)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,25 @@
1
+ require 'digest/sha1'
2
+
3
+ module Rake
4
+ module DSL
5
+
6
+ def transient(name, value)
7
+ transients = File.join('.rake', 'transients')
8
+ FileUtils.mkdir_p transients
9
+
10
+ value_file = File.join(transients, name.to_s)
11
+ value_hash = Digest::SHA1.hexdigest(value.to_s)
12
+ if File.exists? value_file
13
+ previous_hash = IO.read(value_file)
14
+ FileUtils.rm value_file if previous_hash != value_hash
15
+ end
16
+
17
+ file value_file do
18
+ File.open(value_file, "w+") { |f| f.print value_hash }
19
+ end
20
+
21
+ task name => value_file
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Ggake
2
+ VERSION = "0.1.0"
3
+ end
data/lib/ggake.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "ggake/version"
2
+
3
+ require "ggake/haml"
4
+ require "ggake/transient"
5
+ require "ggake/s3cp"
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Ggake do
4
+ it 'should have a version number' do
5
+ Ggake::VERSION.should_not be_nil
6
+ end
7
+
8
+ it 'should do something useful' do
9
+ false.should be_true
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'ggake'
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ggake
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Giles Alexander
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A collection of useful Rake utilities
70
+ email:
71
+ - giles.alexander@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - .travis.yml
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - ggake.gemspec
84
+ - lib/ggake.rb
85
+ - lib/ggake/haml.rb
86
+ - lib/ggake/s3cp.rb
87
+ - lib/ggake/transient.rb
88
+ - lib/ggake/version.rb
89
+ - spec/ggake_spec.rb
90
+ - spec/spec_helper.rb
91
+ homepage: http://github.com/gga/ggake
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.0.3
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: A collection of useful Rake utilities
115
+ test_files:
116
+ - spec/ggake_spec.rb
117
+ - spec/spec_helper.rb