trick_bag 0.44.0 → 0.45.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3639923641e36b4ccd2a0808d3c8dd12ee4aead0
4
- data.tar.gz: 970e57c7fd017b5b0874365becffe207510e6b63
3
+ metadata.gz: 9dd2bb1d612aa8e0226d42c7b6fedd40c53ecd78
4
+ data.tar.gz: 21a9c91a86e7d593d724f06fa5442719818c7902
5
5
  SHA512:
6
- metadata.gz: d0f0c5de4061fb0a75d6913d0532aa124c5a05cc41cf794a0937e3aede9f934e9ae5b6021bcf8de27a270541282724a205562cea0fd92a1f7742976d3268be61
7
- data.tar.gz: 34ce55395d36c3d474e9406b97fddd1598ef957ceb9acfa003ee7f1da05b906dae8e2d51427a2a60e4b99a64df041247e75499a31e0ab5cd62dc0ee379e87bae
6
+ metadata.gz: d491400c1af1e5c0b0e87c5928850ba0ab0b4f54a83fee9f3255d5916cf8525d40dce72d3de4a7505b72686cbaaf264574aa4405d226a821e095cf5944eb529a
7
+ data.tar.gz: 6d0eddc1b2a7d2bcbcb8f94c4e3b4a5c3a65da14f1411ed491895bdd86e8200080df6d6e32acbcf9d801c5c2f99bbc3cb5cf16db7a0bba502e3b7841d41c08f3
data/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.45.0
2
+
3
+ * Add GemDependencyScript.
4
+
1
5
  ## v0.44.0
2
6
 
3
7
  * Fix missing require 'ostruct' in erb_renderer.rb.
@@ -0,0 +1,97 @@
1
+ require 'open3'
2
+ require 'fileutils'
3
+
4
+ module TrickBag
5
+
6
+ # Creates and optionally writes to file a scriopt that will check to see that
7
+ # the gemspec/Gemfile includes all necessary gems.
8
+ #
9
+ # Testing this by doing a simple 'require' instead does not test for the
10
+ # possibility that the gem was installed prior to the call to bundle.
11
+ #
12
+ # This script will create a new empty gemset and run bundle on that
13
+ # so we can know that any gems there were put there by the bundle call.
14
+ #
15
+ # Assumes the presence of rvm and that the script is run in the project root.
16
+ # Assumes also that any *gem files in the project root are not needed, and deletes them!
17
+ #
18
+ # Call one of the methods to get the script content, and be sure to source it when you
19
+ # run it, otherwise rvm may complain that it is not a login shell.
20
+ module GemDependencyScript
21
+
22
+ module_function
23
+
24
+ DEFAULT_SCRIPT_NAME = 'test_bundle_gems'
25
+
26
+ # The 'default' gemset activated by the command 'rvm gemset use default'
27
+ # will have the name of the active Ruby, so, for example:
28
+ #
29
+ # > rvm gemset use default
30
+ # Using ruby-2.1.0 with gemset default
31
+ # > rvm gemset name
32
+ # /Users/kbennett/.rvm/gems/ruby-2.1.0
33
+ # > rvm current
34
+ # ruby-2.1.0
35
+ #
36
+ # ...so when we get the gemset name to use later to restore the original gemset,
37
+ # we need to convert names like '/Users/kbennett/.rvm/gems/ruby-2.1.0' to 'default'.
38
+ # That's what this script does.
39
+ GEMSET_NAME_SCRIPT = %q{
40
+ gemset_name()
41
+ {
42
+ RUBY=`rvm current`
43
+ GEMSET=`rvm gemset name`
44
+
45
+ if [ "x$(echo $GEMSET | grep "${RUBY}$")" = "x" ] ; then
46
+ NAME=$GEMSET
47
+ else
48
+ NAME='default'
49
+ fi
50
+ echo $NAME
51
+ }
52
+
53
+ }
54
+
55
+ def script_for(gem_name, script_name = DEFAULT_SCRIPT_NAME)
56
+ require_command = "require '#{gem_name}'"
57
+
58
+ "#!#{ENV['SHELL']}\n" + GEMSET_NAME_SCRIPT +
59
+
60
+ [
61
+ "echo This script must be sourced due to rvm constraints, e.g.: . ./#{script_name}",
62
+ %Q{echo \"and was generated by TrickBag::GemDependencyScript (see https://github.com/keithrbennett/trick_bag/).\"},
63
+ "echo Lines output by this script are preceded by a colon and a space.",
64
+ "echo Pipe output to grep \"^:\" for terser output.",
65
+ "echo If this script aborts prematurely, you may need to manually restore your gemset, e.g.:",
66
+ "echo rvm gemset use default",
67
+ "export ORIG_GEMSET_NAME=$(gemset_name)",
68
+ "echo : Preserving original gemset name $ORIG_GEMSET_NAME.",
69
+ "export TEMP_GEMSET_NAME=gem_dep_checker_gemset",
70
+ "rvm gemset create $TEMP_GEMSET_NAME",
71
+ "rvm gemset use $TEMP_GEMSET_NAME",
72
+ "echo : Creating and using temporary gemset name of $TEMP_GEMSET_NAME.",
73
+ "echo : Using gemset: `rvm gemset name`",
74
+ "bundle install",
75
+ "gem build *gemspec",
76
+ "gem install *gem",
77
+ "echo : Testing #{require_command}",
78
+ %Q{ruby -e "#{require_command}"},
79
+ "echo : Require successful",
80
+ "rvm gemset use $ORIG_GEMSET_NAME",
81
+ "echo : Restored gemset to original gemset: `rvm gemset name`",
82
+ "rvm gemset delete --force $TEMP_GEMSET_NAME",
83
+ "echo : Deleted temporary gemset $TEMP_GEMSET_NAME",
84
+ "echo : Bundle, build, install, and require of gem all successful."
85
+ ].join(" && \\\n") +
86
+
87
+ "\n"
88
+ end
89
+
90
+
91
+ def write_script_for(gem_name, filespec = DEFAULT_SCRIPT_NAME)
92
+ File.write(filespec, script_for(gem_name, filespec))
93
+ FileUtils.chmod("u=wrx,go=rx", filespec)
94
+ end
95
+ end
96
+ end
97
+
@@ -1,3 +1,3 @@
1
1
  module TrickBag
2
- VERSION = "0.44.0"
2
+ VERSION = "0.45.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trick_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.0
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bennett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -128,6 +128,7 @@ files:
128
128
  - lib/trick_bag/operators/operators.rb
129
129
  - lib/trick_bag/system.rb
130
130
  - lib/trick_bag/timing/timing.rb
131
+ - lib/trick_bag/validations/gem_dependency_script.rb
131
132
  - lib/trick_bag/validations/hash_validations.rb
132
133
  - lib/trick_bag/validations/object_validations.rb
133
134
  - lib/trick_bag/validations/other_validations.rb
@@ -176,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
177
  version: '0'
177
178
  requirements: []
178
179
  rubyforge_project:
179
- rubygems_version: 2.2.2
180
+ rubygems_version: 2.2.1
180
181
  signing_key:
181
182
  specification_version: 4
182
183
  summary: Miscellaneous general useful tools.