rappa 0.0.6 → 0.0.7

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.
data/README.md CHANGED
@@ -5,6 +5,7 @@ Visit the ThunderCat project to understand how this works.
5
5
 
6
6
  [![Build Status](https://travis-ci.org/masterthought/rappa.png?branch=master)](https://travis-ci.org/masterthought/rappa)
7
7
  [![Code Climate](https://codeclimate.com/repos/51d89bb913d6376ff8018f91/badges/607d6b3238c1b52da631/gpa.png)](https://codeclimate.com/repos/51d89bb913d6376ff8018f91/feed)
8
+ [![rappa Downloads](http://www.gemetric.me/images/rappa.gif)](https://rubygems.org/gems/rappa)
8
9
 
9
10
  ## Background
10
11
 
data/bin/rappa CHANGED
@@ -11,6 +11,7 @@ Settings.define :output_archive, :flag => 'd', :description => 'Output directory
11
11
  Settings.define :input_rap, :flag => 'r', :description => 'Input .rap for deploy e.g. rappa deploy -r /path/to/.rap -u http://host/api/deploy -k api_key'
12
12
  Settings.define :url, :flag => 'u', :description => 'Url for deploy e.g. rappa deploy -r /path/to/.rap -u http://host/api/deploy -k api_key'
13
13
  Settings.define :api_key, :flag => 'k', :description => 'Api key for deploy e.g. rappa deploy -r /path/to/.rap -u http://host/api/deploy -k api_key'
14
+ Settings.define :excludes, :type => Array, :flag => 'e', :description => 'Files and folders to exclude from the rap e.g. rappa package -i /path/to/project -e file1,folder1'
14
15
 
15
16
  Settings.resolve!
16
17
 
@@ -74,8 +75,8 @@ else
74
75
  info=<<-EOF
75
76
 
76
77
  ---------------------------------------------------------------------------------
77
- Rappa Version: 0.0.5
78
- Released: 22 July 2013
78
+ Rappa Version: 0.0.7
79
+ Released: 17 November 2013
79
80
  ---------------------------------------------------------------------------------
80
81
 
81
82
  Usage:
@@ -83,10 +84,11 @@ Usage:
83
84
  Package:
84
85
  packages a directory containing a rap.yml into a .rap archive
85
86
 
86
- rappa package -i /path/to/project -o /path/to/output/location
87
+ rappa package -i /path/to/project -o /path/to/output/location -e 'file1,folder1'
87
88
 
88
89
  -i is the input directory location (mandatory)
89
90
  -o is the output directory location (mandatory)
91
+ -e is the list of files/folder to exclude from the rap (optional)
90
92
 
91
93
  Expand:
92
94
  expands a packaged .rap archive
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/rappa_error'
2
2
 
3
3
  class PropertyValidator
4
4
 
5
- def initialize(config,file)
5
+ def initialize(config, file)
6
6
  @config = config
7
7
  @file = file
8
8
  end
@@ -50,6 +50,12 @@ class PropertyValidator
50
50
  @config[:api_key]
51
51
  end
52
52
 
53
+ def excludes
54
+ return [] if @config[:excludes].nil?
55
+ raise RappaError, "property: excludes is optional but requires an array of files/folders to exclude e.g excludes: ['folder1','file1.txt']" unless @config[:excludes].is_a?(Array)
56
+ @config[:excludes]
57
+ end
58
+
53
59
 
54
60
  def validate_name(name)
55
61
  raise RappaError, "a rap archive already exists with the name: #{@config[:file_name]}.rap - please remove it and try again" if @file.exists?(name)
data/src/rappa.rb CHANGED
@@ -41,7 +41,7 @@ class Rappa
41
41
  end
42
42
 
43
43
  def generate
44
- sample = {:name => 'App Name', :description => 'App Description', :version => '1', :server_type => 'thin', :start_script => 'start.sh', :stop_script => 'stop.sh', :pids => 'tmp/pids', :bootstrap => 'bootstrap.sh'}
44
+ sample = {:name => 'App Name', :description => 'App Description', :version => '1', :server_type => 'thin', :start_script => 'start.sh', :stop_script => 'stop.sh', :pids => 'tmp/pids', :bootstrap => 'bootstrap.sh', :excludes => %w(file1 folder1)}
45
45
  @file.open('sample.rap.yml', 'w') { |f| f.puts sample.to_yaml }
46
46
  end
47
47
 
@@ -66,7 +66,9 @@ class Rappa
66
66
 
67
67
  def package_zip(input_directory, name)
68
68
  Zip::ZipFile.open(name, Zip::ZipFile::CREATE) do |zip_file|
69
- Dir[@file.join(input_directory, '**', '**')].each do |file|
69
+ glob = Dir[@file.join(input_directory, '**', '**')]
70
+ @property_validator.excludes.each{|ex| glob.reject!{|f| f[input_directory + ex]}}
71
+ glob.each do |file|
70
72
  zip_file.add(file.sub(input_directory, ''), file)
71
73
  end
72
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rappa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: