penchant 0.2.11 → 0.2.12

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
@@ -37,6 +37,14 @@ gem 'rails', '3.2.3'
37
37
  # gem 'rack-rewrite'
38
38
  gems 'rake', 'nokogiri', 'rack-rewrite'
39
39
 
40
+ # define custom gem properties that get expanded to ones bundler understands
41
+ property :github, :git => 'git://github.com/$1/%s.git'
42
+ # values to the key are [ value ].flatten-ed and the $s are replaced on the fly,
43
+ # with $1 being the first parameter given
44
+
45
+ # set up defaults for all gems in a particular environment
46
+ defaults_for env(:local), :path => '../%s' # the %s is the name of the gem
47
+
40
48
  no_deployment do
41
49
  group :development, :test do
42
50
  gem 'rspec', '~> 2.6.0'
@@ -46,9 +54,6 @@ no_deployment do
46
54
  # set up defaults for certain gems that are probably being used in envs
47
55
  defaults_for dev_gems, :require => nil
48
56
 
49
- # set up defaults for all gems in a particular environment
50
- defaults_for env(:local), :path => '../%s' # the %s is the name of the gem
51
-
52
57
  env :local do
53
58
  # expands to:
54
59
  #
@@ -62,7 +67,7 @@ no_deployment do
62
67
  #
63
68
  # gem 'flowerbox', :git => 'git://github.com/johnbintz/flowerbox.git', :require => nil
64
69
  # gem 'guard-flowerbox', :git => 'git://github.com/johnbintz/guard-flowerbox.git', :require => nil
65
- gems dev_gems, :git => 'git://github.com/johnbintz/%s.git'
70
+ gems dev_gems, :github => 'johnbintz'
66
71
  end
67
72
 
68
73
  # only expanded on Mac OS X
@@ -122,7 +127,7 @@ shouldn't be changing the main versions of your application gems. It WORKSFORME
122
127
  ### Getting local gems all set up
123
128
 
124
129
  `penchant bootstrap` will go through and find all git repo references in your `Gemfile.penchant` and
125
- will download them to the specified directory (by default, '..'). This means blocks like this
130
+ will download them to the specified directory (by default, `..`). This means blocks like this
126
131
  will work as expected when you `penchant bootstrap` and then `penchant gemfile local`:
127
132
 
128
133
  ``` ruby
data/bin/penchant CHANGED
@@ -9,25 +9,32 @@ class PenchantCLI < Thor
9
9
  include Thor::Actions
10
10
  source_root File.expand_path('../..', __FILE__)
11
11
 
12
+ SCRIPT_DIR = 'script'
13
+ CLONE_DIR = '..'
14
+
12
15
  desc "install", "Copy the common scripts to the project"
13
- method_options :dir => 'script'
16
+ method_options :dir => SCRIPT_DIR
14
17
  def install
15
18
  directory 'template/script', options[:dir]
16
19
  Dir[File.join(options[:dir], '**/*')].each { |file| File.chmod(0755, file) }
17
20
 
18
- Dir['script/hooks/*'].each do |hook|
19
- FileUtils.ln_sf File.join(Dir.pwd, hook), ".git/hooks/#{File.split(hook).last}"
21
+ if File.directory?('.git')
22
+ Dir['script/hooks/*'].each do |hook|
23
+ FileUtils.ln_sf File.join(Dir.pwd, hook), ".git/hooks/#{File.split(hook).last}"
24
+ end
25
+ else
26
+ puts "No git repository detected here. Skipping git hook installation..."
20
27
  end
21
28
  end
22
29
 
23
30
  desc "update", "Update the installed scripts"
24
- method_options :dir => 'script'
31
+ method_options :dir => SCRIPT_DIR
25
32
  def update
26
33
  install
27
34
  end
28
35
 
29
36
  desc "convert", "Make an existing project Penchant-isized"
30
- method_options :dir => 'script'
37
+ method_options :dir => SCRIPT_DIR
31
38
  def convert
32
39
  install
33
40
  FileUtils.mv 'Gemfile', 'Gemfile.penchant'
@@ -63,10 +70,10 @@ class PenchantCLI < Thor
63
70
  puts get_current_env
64
71
  end
65
72
 
66
- desc "bootstrap [DIR = ..]", "Download all referred-to git repos to the specified directory"
67
- def bootstrap(dir = '..')
73
+ desc "bootstrap [DIR = #{CLONE_DIR}]", "Download all referred-to git repos to the specified directory"
74
+ def bootstrap(dir = CLONE_DIR)
68
75
  Penchant::Gemfile.defined_git_repos.each do |repo|
69
- puts "Cloning #{repo} to #{dir}."
76
+ puts "Cloning #{repo} to #{dir}"
70
77
  repo.clone_to(dir)
71
78
  end
72
79
  end
data/features/cli.feature CHANGED
@@ -16,3 +16,15 @@ Feature: CLI
16
16
  """
17
17
  And the output should include "fallback: other"
18
18
 
19
+ Scenario: Try to convert a project, ignoring git hooks
20
+ Given I have the file "tmp/Gemfile" with the content:
21
+ """
22
+ source :rubygems
23
+ """
24
+ When I run "bin/penchant convert" in the "tmp" directory
25
+ Then the file "tmp/Gemfile.penchant" should have the following content:
26
+ """
27
+ source :rubygems
28
+ """
29
+ And the output should include "No git"
30
+
@@ -2,7 +2,7 @@ require 'fakefs/safe'
2
2
  require 'penchant'
3
3
  require 'mocha'
4
4
 
5
- World(Mocha::Standalone)
5
+ World(Mocha::API)
6
6
 
7
7
  Before('@fakefs') do
8
8
  FakeFS.activate!
@@ -1,3 +1,3 @@
1
1
  module Penchant
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: penchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
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: 2012-07-10 00:00:00.000000000 Z
12
+ date: 2012-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -193,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  segments:
195
195
  - 0
196
- hash: -3735889517013965270
196
+ hash: 1854452012171480691
197
197
  required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  none: false
199
199
  requirements:
@@ -202,10 +202,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  segments:
204
204
  - 0
205
- hash: -3735889517013965270
205
+ hash: 1854452012171480691
206
206
  requirements: []
207
207
  rubyforge_project: penchant
208
- rubygems_version: 1.8.23
208
+ rubygems_version: 1.8.24
209
209
  signing_key:
210
210
  specification_version: 3
211
211
  summary: Things I do for my Rails projects to get up to speed in new environments