penchant 0.0.1 → 0.0.2

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/Gemfile CHANGED
@@ -8,3 +8,4 @@ gem 'guard-rspec'
8
8
  gem 'mocha'
9
9
  gem 'fakefs'
10
10
  gem 'rspec', '~> 2.6.0'
11
+ gem 'rake'
data/Rakefile CHANGED
@@ -1,2 +1,13 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
+
4
+ begin
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ rescue LoadError
9
+ "#$! - no rspec"
10
+ end
11
+
12
+ task :default => :spec
13
+
@@ -1,3 +1,3 @@
1
1
  module Penchant
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/script/gemfile ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'penchant'
5
+
6
+ if Penchant::Gemfile.do_full_env_switch!(ARGV[0])
7
+ puts "Gemfile switched to #{ARGV[0]}"
8
+ else
9
+ exit 0
10
+ end
11
+
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ OLD_GIT_DIR=$GIT_DIR
4
+
5
+ if [ "$(penchant gemfile-env)" != "remote" ]; then
6
+ unset GIT_DIR
7
+ penchant gemfile remote
8
+ GIT_DIR=$OLD_GIT_DIR
9
+ git add Gemfile*
10
+ fi
11
+
12
+ bundle exec rake
13
+ R=$?
14
+ if [ $R -ne 0 ]; then exit $R; fi
15
+
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if File.file?('Gemfile.erb')
4
+ pwd = Dir.pwd
5
+
6
+ Dir.chdir '..' do
7
+ File.readlines(File.join(pwd, 'Gemfile.erb')).find_all { |line| line[':git'] }.each do |line|
8
+ repo = line[%r{:git => (['"])(.*)\1}, 2]
9
+
10
+ puts "Installing #{repo}"
11
+ system %{git clone #{repo}}
12
+ end
13
+ end
14
+
15
+ puts "Bundling for local environment"
16
+ system %{script/gemfile local}
17
+ else
18
+ puts "Bundling..."
19
+ system %{bundle}
20
+ end
21
+
22
+ puts "Installing git hooks"
23
+ system %{script/install-git-hooks}
24
+
25
+ bundle = File.file?('Gemfile') ? 'bundle exec' : ''
26
+
27
+ command = [ bundle, 'rake', '-s', '-T', 'bootstrap' ]
28
+
29
+ if !(%x{#{command.join(' ')}}).empty?
30
+ puts "Trying to run rake bootstrap..."
31
+ system %{#{bundle} rake bootstrap}
32
+ end
33
+
34
+ puts "Done!"
35
+
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ for hook in script/hooks/* ; do
4
+ ln -sf $PWD/$hook .git/hooks/${hook##*/}
5
+ done
6
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  OLD_GIT_DIR=$GIT_DIR
4
4
 
5
- if [ $(penchant gemfile-env) != "remote" ]; then
5
+ if [ "$(penchant gemfile-env)" != "remote" ]; then
6
6
  unset GIT_DIR
7
7
  penchant gemfile remote
8
8
  GIT_DIR=$OLD_GIT_DIR
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.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -30,6 +30,10 @@ files:
30
30
  - lib/penchant/gemfile.rb
31
31
  - lib/penchant/version.rb
32
32
  - penchant.gemspec
33
+ - script/gemfile
34
+ - script/hooks/pre-commit
35
+ - script/initialize-environment
36
+ - script/install-git-hooks
33
37
  - spec/lib/penchant/gemfile_spec.rb
34
38
  - spec/lib/penchant_spec.rb
35
39
  - spec/spec_helper.rb