andy 0.0.1

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.
Files changed (4) hide show
  1. data/bin/andy +5 -0
  2. data/conf/andy.yaml +7 -0
  3. data/lib/andy.rb +70 -0
  4. metadata +64 -0
data/bin/andy ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'andy'
3
+
4
+ andy = Andy.new
5
+ andy.run
data/conf/andy.yaml ADDED
@@ -0,0 +1,7 @@
1
+ pints:
2
+ basic: 'git://github.com/georgecodes/andy.git'
3
+ skeleton: 'git://github.com/georgecodes/Skeleton.git'
4
+ homer: 'git://github.com/georgecodes/homer.git'
5
+
6
+ conf:
7
+ favourite: 'basic'
data/lib/andy.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'fileutils'
2
+ require 'git'
3
+
4
+ class Andy
5
+
6
+ ANDY_HOME=ENV['HOME'] + "/.andy"
7
+
8
+ def run
9
+ ensure_local_repo_built
10
+ siteName = ARGV[0]
11
+ if (!siteName)
12
+ puts "Usage: andy <siteName>"
13
+ return
14
+ end
15
+
16
+ directory_name = Dir::pwd + "/" + siteName
17
+ if FileTest::directory?(directory_name)
18
+ puts "That already exists, sorry"
19
+ return
20
+ end
21
+
22
+ load_config
23
+ pint = ARGV[1] || @conf['conf']['favourite']
24
+ puts "Creating a project from pint '#{pint}'"
25
+ ensure_pint_source_exists pint
26
+ pour_pint pint, directory_name
27
+
28
+ end
29
+
30
+ def pour_pint(pint, target)
31
+
32
+ pint_src = "#{ANDY_HOME}/pints/#{pint}"
33
+ FileUtils.cp_r pint_src, target
34
+
35
+ end
36
+
37
+ def ensure_pint_source_exists(pint)
38
+ root_of_pint = ANDY_HOME + "/pints/#{pint}"
39
+ if ( FileTest::directory?(root_of_pint) )
40
+ return
41
+ end
42
+
43
+ pump = @conf['pints'][pint]
44
+ begin
45
+ Git.export(pump, root_of_pint)
46
+ rescue => e
47
+ puts "Something went wrong trying to fetch pint '#{pint}' from '#{pump}' #{e}"
48
+ exit 1
49
+ end
50
+ end
51
+
52
+ def load_config
53
+
54
+ @conf = @conf || YAML.load(File.open(ANDY_HOME + '/andy.yaml'))
55
+
56
+ end
57
+
58
+ def ensure_local_repo_built
59
+ if FileTest::directory?ANDY_HOME
60
+ return
61
+ end
62
+ Dir::mkdir(ANDY_HOME)
63
+ $LOAD_PATH.each do | dir |
64
+ if dir =~ /andy.*\/conf$/
65
+ FileUtils.cp(dir + "/andy.yaml", ANDY_HOME )
66
+ end
67
+ end
68
+ end
69
+
70
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: andy
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - George McIntosh
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-11-21 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: A simple site generator gem
22
+ email: george@georgecodes.com
23
+ executables:
24
+ - andy
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/andy.rb
31
+ - conf/andy.yaml
32
+ has_rdoc: true
33
+ homepage: http://rubygems.org/gems/gen
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ - conf
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.6
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Site generator
63
+ test_files: []
64
+