towels 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/License.md +7 -0
  2. data/Readme.md +6 -0
  3. data/bin/towels +99 -0
  4. metadata +77 -0
data/License.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2010 Opt-6 Products, LLC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Readme.md ADDED
@@ -0,0 +1,6 @@
1
+ ## towels ##
2
+ #### Whimsical dependency management for unpackaged projects ####
3
+
4
+ `towels` is a work-in-progress, but can be used if you're willing to find bugs as you go along. It is intended to be used as a way of keeping track things that you need to build your projects; especially projects that aren't packaged through a system that handles dependencies for you. Create a Towels directory in your project, fill it up with YAML files for each towel (dependency), then run `towel` from the parent directory. Done!
5
+
6
+ For now, you can see an example in our [Towel Rack repository](http://github.com/o6/Towel-Rack).
data/bin/towels ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "rubikon"
5
+ require "pathname"
6
+
7
+ $TOWELS_CONFIG_FILES = ["Towels.yml", "towels.yml", "config/towels.yml"]
8
+
9
+ class TowelCLI < Rubikon::Application::Base
10
+
11
+ def initialize
12
+
13
+ super
14
+
15
+ # Load Settings
16
+ set :config, YAML::load(File.open(Dir.glob($TOWELS_CONFIG_FILES).first))
17
+ set :help_banner, "\n\e[1mTowel - Whimsical dependency management for unpackaged projectse\e[0m\n\nUsage:"
18
+
19
+ # Load Towels
20
+ towel_directories = ["Towels"] unless @settings[:config]["towel_directories"]
21
+ towel_directories.each_index { |index| towel_directories[index] = (towel_directories[index] + "/**/*.yml") }
22
+ towels = []
23
+ Dir.glob(towel_directories).each do |file|
24
+ towels << YAML::load(File.open(file))
25
+ end
26
+ set :towels, towels
27
+
28
+
29
+ end
30
+
31
+ default do
32
+ @commands[:link].run
33
+ end
34
+
35
+ command :update, "Download/update all included towels" do
36
+ @settings[:towels].each do |towel|
37
+
38
+ # Git download type
39
+ if (towel["download"]["type"] === "git")
40
+ if File.exists?("Sources/#{towel["name"]}")
41
+ print_header "Updating #{towel["name"]}"
42
+ throbber do
43
+ %x[git --git-dir=Sources/#{towel["name"]}/.git --work-tree=../ pull #{"-q " if !$VERBOSE} origin master]
44
+ end
45
+ print "\n"
46
+ else
47
+ print_header "Cloning #{towel["name"]}"
48
+ throbber do
49
+ %x[git clone #{towel["download"]["url"]} Sources/#{towel["name"]}]
50
+ end
51
+ print "\n"
52
+ end
53
+ end
54
+
55
+ end
56
+ end
57
+
58
+ command :compile, "Update then compile all included towels" do
59
+ @commands[:update].run
60
+ @settings[:towels].each do |towel|
61
+
62
+ # Custom compile type
63
+ if (towel["compile"]["type"] === "custom" || !towel["compile"]["type"])
64
+ print_header "Compiling #{towel["name"]}"
65
+ throbber do
66
+ %x[cd Sources/#{towel["name"]}; #{towel["compile"]["command"]} #{towel["compile"]["flags"]}]
67
+ print "\n"
68
+ end
69
+ end
70
+
71
+ end
72
+ end
73
+
74
+ command :link, "Update, compile, then link all included towels." do
75
+ @commands[:compile].run
76
+ @settings[:towels].each do |towel|
77
+ print_header "Linking #{towel["name"]}"
78
+ towel["link"].each do |link_step|
79
+
80
+ link_step = towel["link"][link_step.first]
81
+ if (link_step["type"] === "soft_link")
82
+ dest_path = Pathname.new(File.expand_path(link_step["destination"]))
83
+ FileUtils.mkdir_p(dest_path.parent.to_s)
84
+ if (!File.exist?(dest_path.to_s))
85
+ FileUtils.ln_sf(File.expand_path("Sources/#{towel["name"]}/#{link_step["source"]}"), dest_path.to_s)
86
+ end
87
+ else (link_step["type"] === "include")
88
+ puts "include"
89
+ end
90
+
91
+ end
92
+ end
93
+ end
94
+
95
+ def print_header message
96
+ print "\e[1;36m==> " + message + "\e[0m\n"
97
+ end
98
+
99
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: towels
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Carter Allen, Opt-6 Products, LLC
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-10-08 00:00:00 -06:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: rubikon
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ version: "0"
29
+ type: :runtime
30
+ version_requirements: *id001
31
+ description: `towels` is a work-in-progress, but can be used if you're willing to find bugs as you go along. It is intended to be used as a way of keeping track things that you need to build your projects; especially projects that aren't packaged through a system that handles dependencies for you.
32
+ email:
33
+ - CarterA@opt-6.com
34
+ executables:
35
+ - towels
36
+ extensions: []
37
+
38
+ extra_rdoc_files: []
39
+
40
+ files:
41
+ - bin/towels
42
+ - License.md
43
+ - Readme.md
44
+ has_rdoc: true
45
+ homepage: http://github.com/o6/towels
46
+ licenses: []
47
+
48
+ post_install_message:
49
+ rdoc_options: []
50
+
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 1
66
+ - 8
67
+ - 0
68
+ version: 1.8.0
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.3.6
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: Whimsical dependency management for unpackaged projects.
76
+ test_files: []
77
+