skele 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2.2)
10
+ rcov (0.9.11)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.6.4)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Alex Rehberg
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,24 @@
1
+ = skele
2
+
3
+ Skele is a simple command line too to build directory structures based on template directories. I built it for my personal use so it's not entirely feature rich and it was hacked together quickly so it's not pretty code. It's only been tested on OSX and ruby 1.9.2.
4
+
5
+ == Usage
6
+
7
+ Call skele <name> from the command line. Skele will look for ~/.skele/<name>. If it finds it it will copy the directory structre and files to the current working directory.
8
+
9
+ Additionally if skele finds a Gemfile in the root directory it will run "bundle install --path vendor/bundle".
10
+
11
+ == Future of skele
12
+
13
+ This is a quick tool I hacked together to make my own life easier. I may or may not update it. If there is interest at all you can either help me clean it up and push your commits, or you can let me know what you want and if I like it I will code it up. If there's enough interest in this I will eventually clean things up more.
14
+
15
+
16
+ == Test
17
+
18
+ Yeah, there's no tests. I'm a bad person, I know. I'm all for TDD but I think it would have been a waste here.
19
+
20
+ == Copyright
21
+
22
+ Copyright (c) 2011 Alex Rehberg. See LICENSE.txt for
23
+ further details.
24
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "skele"
18
+ gem.homepage = "http://github.com/arehberg/skele"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Skele is a simple command line too to build directory structures based on template directories}
21
+ gem.description = %Q{Skele is a simple command line too to build directory structures based on template directories}
22
+ gem.email = "hi@alexrehberg.com"
23
+ gem.authors = ["Alex Rehberg"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "skele #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/skele ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "find"
4
+ require "fileutils"
5
+
6
+ def colorize(text, color_code)
7
+ "\e[#{color_code}m#{text}\e[0m"
8
+ end
9
+
10
+ def red(text)
11
+ colorize text, 31
12
+ end
13
+
14
+ def green(text)
15
+ colorize text, 32
16
+ end
17
+
18
+ def blue(text)
19
+ colorize text, 34
20
+ end
21
+
22
+ def relative_path(abspath,relativeto)
23
+ path = abspath.split(File::SEPARATOR)
24
+ rel = relativeto.split(File::SEPARATOR)
25
+
26
+ while (path.length > 0) && (path.first == rel.first)
27
+ path.shift
28
+ rel.shift
29
+ end
30
+
31
+ path.join(File::SEPARATOR)
32
+ end
33
+
34
+ SKELETON = ARGV[0]
35
+
36
+ if SKELETON.nil?
37
+ STDOUT.puts "Usage: skele <name>"
38
+ else
39
+
40
+ SKELETON_ROOT = ENV['HOME'] + File::SEPARATOR + ".skele" + File::SEPARATOR
41
+ SKELETON_DIR = SKELETON_ROOT + SKELETON
42
+ SKELETON_TARGET = Dir.getwd + File::SEPARATOR
43
+
44
+ if File.directory? SKELETON_DIR
45
+ STDOUT.puts "\nSummoning skeleton '#{SKELETON}' from '#{SKELETON_DIR}', copying files:\n\n"
46
+
47
+ Find.find(SKELETON_DIR) do |file|
48
+ relative_path = relative_path file, SKELETON_DIR
49
+
50
+ # skip the containing directory
51
+ next if relative_path.empty?
52
+
53
+ # skip .git directory
54
+ next if relative_path.split(File::SEPARATOR)[0] == ".git"
55
+
56
+ # copy files
57
+ if(File.directory? file)
58
+ if File.exists?(SKELETON_TARGET + relative_path)
59
+ STDOUT.puts " #{red("exists")} #{SKELETON_TARGET + relative_path}"
60
+ else
61
+ Dir::mkdir(SKELETON_TARGET + relative_path)
62
+ STDOUT.puts " #{green("mkdir")} #{SKELETON_TARGET + relative_path}"
63
+ end
64
+ else
65
+ if File.exists?(SKELETON_TARGET + relative_path)
66
+ STDOUT.puts " #{red("exists")} #{SKELETON_TARGET + relative_path}"
67
+ else
68
+ FileUtils::copy(file, SKELETON_TARGET + relative_path)
69
+ STDOUT.puts " #{green("create")} #{SKELETON_TARGET + relative_path}"
70
+ end
71
+ end
72
+ end
73
+
74
+ # if there is a gemfile, run bundle install just to be nice
75
+ if File.exists? SKELETON_TARGET + "Gemfile"
76
+ STDOUT.puts "\nInstalling bundle from gemfile\n\n"
77
+ bundle_results = `bundle install --path vendor/bundle`
78
+
79
+ # STDOUT.puts bundleresults.dump
80
+ bundle_lines = bundle_results.split("\n")
81
+
82
+ bundle_lines.each do |line|
83
+ STDOUT.puts " " + line
84
+ end
85
+ end
86
+
87
+ STDOUT.puts "\n#{green("Skeleton summoned! Have fun!")}\n\n"
88
+ else
89
+ STDOUT.puts "#{red("Error")} skeleton: '#{SKELETON}' not found, expected in: #{SKELETON_DIR}"
90
+ end
91
+ end
data/lib/skele.rb ADDED
@@ -0,0 +1 @@
1
+ # Skele is just a command line tool right now
data/skele.gemspec ADDED
@@ -0,0 +1,61 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "skele"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Alex Rehberg"]
12
+ s.date = "2011-11-26"
13
+ s.description = "Skele is a simple command line too to build directory structures based on template directories"
14
+ s.email = "hi@alexrehberg.com"
15
+ s.executables = ["skele"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/skele",
29
+ "lib/skele.rb",
30
+ "skele.gemspec",
31
+ "test/helper.rb",
32
+ "test/test_skele.rb"
33
+ ]
34
+ s.homepage = "http://github.com/arehberg/skele"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.10"
38
+ s.summary = "Skele is a simple command line too to build directory structures based on template directories"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
45
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
46
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
47
+ s.add_development_dependency(%q<rcov>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<shoulda>, [">= 0"])
50
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
51
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
52
+ s.add_dependency(%q<rcov>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
58
+ s.add_dependency(%q<rcov>, [">= 0"])
59
+ end
60
+ end
61
+
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'skele'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestSkele < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: skele
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alex Rehberg
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: &2153871520 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2153871520
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &2153871040 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2153871040
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &2153870560 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.4
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2153870560
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &2153870080 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2153870080
58
+ description: Skele is a simple command line too to build directory structures based
59
+ on template directories
60
+ email: hi@alexrehberg.com
61
+ executables:
62
+ - skele
63
+ extensions: []
64
+ extra_rdoc_files:
65
+ - LICENSE.txt
66
+ - README.rdoc
67
+ files:
68
+ - .document
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE.txt
72
+ - README.rdoc
73
+ - Rakefile
74
+ - VERSION
75
+ - bin/skele
76
+ - lib/skele.rb
77
+ - skele.gemspec
78
+ - test/helper.rb
79
+ - test/test_skele.rb
80
+ homepage: http://github.com/arehberg/skele
81
+ licenses:
82
+ - MIT
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ segments:
94
+ - 0
95
+ hash: 526161455790606130
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 1.8.10
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: Skele is a simple command line too to build directory structures based on
108
+ template directories
109
+ test_files: []