retreat 0.1.0 → 0.1.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.
data/README.rdoc ADDED
@@ -0,0 +1,64 @@
1
+ = Retreat
2
+
3
+ coderetreat/starting_points holds empty starting points in a variety of languages. This gem allows you to easily start new iterations from a starting point from the command line without having to manually copy files around.
4
+
5
+ It works by pulling down a local copy of the github repo into ~/.retreat and building iterations from your local copy. That way you can set everything up as a one-time operation and you don't need to worry if the WiFi is a bit wobbly on the day!
6
+
7
+ Commands are also provided to pull the latest starting points down from github.
8
+
9
+ == Installation
10
+
11
+ Install the gem
12
+
13
+ $ gem install retreat
14
+
15
+ Pull the starting points down from github
16
+
17
+ $ retreat install
18
+
19
+ == How to get started
20
+
21
+ Show information
22
+
23
+ $ retreat info
24
+
25
+ Returns
26
+
27
+ Source Repo: https://github.com/coreyhaines/coderetreat.git
28
+ Local Repo: /Users/adrian/.retreat/retreat
29
+ Languages Available: ruby
30
+
31
+ Choose your preferred language from the list of available languages and then
32
+
33
+ $ cd <code retreat dir>
34
+ $ retreat start <language> <target>
35
+
36
+ So, for example, if we want to start a new ruby iteration in ~/projects
37
+
38
+ $ cd ~/projects
39
+ $ retreat start ruby iteration1
40
+ Created ruby iteration starting point at /Users/adrian/projects/iteration1
41
+ $ ls iteration1
42
+ lib spec test
43
+
44
+ Note that the target defaults to '.' if you don't supply one.
45
+
46
+ == How to add new languages
47
+
48
+ * Clone (or fork) the coderetreat repo from github (i.e this one!)
49
+ * Create your starting point at starting_points/<your language>
50
+ * Push your changes (or send a pull request)
51
+ * Update retreat
52
+
53
+ $ retreat update
54
+
55
+ You should now be able to start a new iteration by running
56
+
57
+ $ retreat start <your langauge>
58
+
59
+ == For support
60
+
61
+ Please raise an issue or contact Adrian Mowat (github: mowat27) for help
62
+
63
+
64
+
@@ -46,13 +46,37 @@ module CodeRetreat
46
46
  def ls
47
47
  Dir["#{@path}/*"].map{|listing_item| Path.new(listing_item)}
48
48
  end
49
+
50
+ def flip_into_and_run
51
+ starting_dir = Dir.getwd
52
+ begin
53
+ Dir.chdir @path
54
+ yield
55
+ ensure
56
+ Dir.chdir starting_dir
57
+ end
58
+ end
59
+ end
60
+
61
+ class Git
62
+ def self.clone(source_repo, local_repo)
63
+ %x{git clone #{source_repo} #{local_repo}}
64
+ raise EnvError.new("Could not clone #{source_repo}") unless $? == 0
65
+ end
66
+
67
+ def self.pull(local_repo)
68
+ local_repo.flip_into_and_run do
69
+ %x{git pull origin master}
70
+ raise EnvError.new("Could not pull origin into #{local_repo}") unless $? == 0
71
+ end
72
+ end
49
73
  end
50
74
 
51
75
  module Actions
52
76
  class Action
53
77
  def initialize
54
78
  @home = Path.new(Etc.getpwuid.dir, '.retreat')
55
- @local_repo = Path.new(Etc.getpwuid.dir, '.retreat', 'retreat')
79
+ @local_repo = Path.new(Etc.getpwuid.dir, '.retreat', 'coderetreat')
56
80
  @source_repo = "https://github.com/coreyhaines/coderetreat.git"
57
81
  @starting_points = @local_repo.join("starting_points")
58
82
  end
@@ -90,7 +114,7 @@ module CodeRetreat
90
114
  def run!
91
115
  validate_environment!
92
116
  puts "Pulling coderetreat repo into #{@local_repo}..."
93
- %x{git clone #{@source_repo} #{@local_repo}}
117
+ Git.clone @source_repo, @local_repo
94
118
  puts "\nInstallation completed! Here is some information..."
95
119
  Info.run!
96
120
  puts "\nRun 'retreat start <language> [location]' to start a new iteration"
@@ -111,7 +135,7 @@ module CodeRetreat
111
135
  def run!
112
136
  validate_environment!
113
137
  puts "Updating sources at #{@local_repo}"
114
- %x{git pull #{@local_repo}}
138
+ Git.pull @local_repo
115
139
  end
116
140
 
117
141
  def validate_environment!
@@ -136,7 +160,7 @@ EOS
136
160
  result =<<EOS
137
161
  Source Repo: #{@source_repo}
138
162
  Local Repo: #{@local_repo}
139
- Langauges Avilable: #{languages.join(",")}
163
+ Languages Available: #{languages.join(", ")}
140
164
  EOS
141
165
 
142
166
  result
data/retreat.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  SPEC = Gem::Specification.new do |s|
4
4
  s.name = "retreat"
5
- s.version = '0.1.0'
5
+ s.version = '0.1.1'
6
6
  s.author = "Adrian Mowat"
7
7
  s.homepage = "https://github.com/coreyhaines/coderetreat"
8
8
  s.summary = "Command line utilities for coderetreat"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retreat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-19 00:00:00.000000000Z
12
+ date: 2011-09-21 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: ! 'retreat allows you to easily start new coderetreat iterations in different
15
15
  languges. Starting point "skeletons" are held in a git repo and copied as needed.
@@ -21,6 +21,7 @@ executables:
21
21
  extensions: []
22
22
  extra_rdoc_files: []
23
23
  files:
24
+ - README.rdoc
24
25
  - bin/retreat
25
26
  - lib/coderetreat/retreat.rb
26
27
  - retreat.gemspec