geminstaller_builder 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +105 -0
- data/VERSION +1 -1
- data/geminstaller_builder.gemspec +3 -4
- data/lib/geminstaller_builder.rb +37 -1
- metadata +4 -5
- data/README.rdoc +0 -17
- data/lib/geminstaller_builder/geminstaller_file.rb +0 -38
data/.gitignore
CHANGED
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# geminstaller_builder
|
2
|
+
|
3
|
+
A simple tool for generating valid and up-to-date geminstaller files. Bundler
|
4
|
+
is probably what you want, but if you're supporting legacy apps or you just
|
5
|
+
like geminstaller, this could be helpful.
|
6
|
+
|
7
|
+
# Use
|
8
|
+
|
9
|
+
## Solo
|
10
|
+
|
11
|
+
require 'geminstaller_builder'
|
12
|
+
geminstaller = GeminstallerBuilder.new
|
13
|
+
geminstaller.add 'haml'
|
14
|
+
geminstaller.add 'state_machine'
|
15
|
+
geminstaller.add 'shoulda', :test
|
16
|
+
geminstaller.save
|
17
|
+
|
18
|
+
Will create two files:
|
19
|
+
|
20
|
+
`config/geminstaller.yml`:
|
21
|
+
|
22
|
+
---
|
23
|
+
defaults:
|
24
|
+
install-options: '--no-rdoc --no-ri'
|
25
|
+
gems:
|
26
|
+
- name: haml
|
27
|
+
version: '= 2.2.22'
|
28
|
+
- name: state_machine
|
29
|
+
version: '= 0.8.1'
|
30
|
+
|
31
|
+
`config/test/geminstaller.yml`:
|
32
|
+
|
33
|
+
---
|
34
|
+
defaults:
|
35
|
+
install-options: '--no-rdoc --no-ri'
|
36
|
+
gems:
|
37
|
+
- name: shoulda
|
38
|
+
version: '= 2.10.3'
|
39
|
+
|
40
|
+
relative to the directory from which the script was run.
|
41
|
+
|
42
|
+
By default, the `:default` and `:test` environments are assumed. To change the names of the files generated, pass in a `:paths` option with the full filenames. For example:
|
43
|
+
|
44
|
+
require 'geminstaller_builder'
|
45
|
+
geminstaller = GeminstallerBuilder.new :paths => {:default => 'geminstaller.yml', :test => 'geminstaller-test.yml'}
|
46
|
+
geminstaller.add 'haml'
|
47
|
+
geminstaller.add 'state_machine'
|
48
|
+
geminstaller.add 'shoulda', :test
|
49
|
+
geminstaller.save
|
50
|
+
|
51
|
+
will create `geminstaller.yml` and `geminstaller-test.yml`.
|
52
|
+
|
53
|
+
## In a Rails application template
|
54
|
+
|
55
|
+
Looks pretty much the same. I use it like this:
|
56
|
+
|
57
|
+
`template.rb`:
|
58
|
+
|
59
|
+
# use geminstaller instead of gem
|
60
|
+
require 'geminstaller_builder'
|
61
|
+
@geminstaller = GeminstallerFile.new
|
62
|
+
def geminstaller s, env=:default
|
63
|
+
@geminstaller.add s, env
|
64
|
+
end
|
65
|
+
|
66
|
+
# later on ...
|
67
|
+
geminstaller 'will_paginate'
|
68
|
+
geminstaller 'hpricot'
|
69
|
+
geminstaller 'json'
|
70
|
+
geminstaller 'state_machine'
|
71
|
+
geminstaller 'paperclip'
|
72
|
+
|
73
|
+
load_template 'http://github.com/smartlogic/rails-templates/raw/master/test.rb'
|
74
|
+
|
75
|
+
and in `test.rb`:
|
76
|
+
|
77
|
+
geminstaller 'factory_girl', :test
|
78
|
+
geminstaller 'shoulda', :test
|
79
|
+
geminstaller 'redgreen', :test
|
80
|
+
geminstaller 'timecop', :test
|
81
|
+
geminstaller 'hydra', :test
|
82
|
+
geminstaller 'mocha', :test
|
83
|
+
|
84
|
+
# etc...
|
85
|
+
|
86
|
+
Finally, at the end of `template.rb`, I have:
|
87
|
+
|
88
|
+
@geminstaller.save
|
89
|
+
|
90
|
+
at which point, geminstaller_build consults the currently available gems to build the appropriate geminstaller.yml files.
|
91
|
+
|
92
|
+
## Note on Patches/Pull Requests
|
93
|
+
|
94
|
+
* Fork the project.
|
95
|
+
* Make your feature addition or bug fix.
|
96
|
+
* Add tests for it. This is important so I don't break it in a
|
97
|
+
future version unintentionally. But then, I haven't included any
|
98
|
+
tests. So do what feels good.
|
99
|
+
* Commit, do not mess with rakefile, version, or history.
|
100
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
101
|
+
* Send me a pull request. Bonus points for topic branches.
|
102
|
+
|
103
|
+
## Copyright
|
104
|
+
|
105
|
+
Copyright (c) 2010 Adam Bachman. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{geminstaller_builder}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Adam Bachman"]
|
@@ -14,19 +14,18 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = %q{adam.bachman@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"LICENSE",
|
23
|
-
"README.
|
23
|
+
"README.md",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"geminstaller_builder.gemspec",
|
27
27
|
"lib/geminstaller_builder.rb",
|
28
28
|
"lib/geminstaller_builder/gem_helper.rb",
|
29
|
-
"lib/geminstaller_builder/geminstaller_file.rb",
|
30
29
|
"test/helper.rb",
|
31
30
|
"test/test_geminstaller_builder.rb"
|
32
31
|
]
|
data/lib/geminstaller_builder.rb
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
-
require 'geminstaller_builder/
|
1
|
+
require 'geminstaller_builder/gem_helper'
|
2
|
+
|
3
|
+
# Convert a list of gems into a valid geminstaller.yml file.
|
2
4
|
class GeminstallerBuilder
|
5
|
+
include GemHelper
|
6
|
+
|
7
|
+
def initialize options={}
|
8
|
+
options = {
|
9
|
+
:env => :default,
|
10
|
+
:gems => {
|
11
|
+
:default => [],
|
12
|
+
:test => []
|
13
|
+
},
|
14
|
+
:paths => {
|
15
|
+
:default => "config/geminstaller.yml",
|
16
|
+
:test => "config/test/geminstaller.yml"
|
17
|
+
}
|
18
|
+
}.merge(options)
|
19
|
+
|
20
|
+
@gems = options[:gems]
|
21
|
+
@paths = options[:paths]
|
22
|
+
end
|
23
|
+
|
24
|
+
def add gem, env=:default
|
25
|
+
@gems[env.to_sym] << gem
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :<<, :add
|
29
|
+
|
30
|
+
def save
|
31
|
+
puts "\e[34m[ Saving Gems ]\e[0m"
|
32
|
+
@gems.keys.each do |env|
|
33
|
+
File.open(@paths[env], 'w') do |f|
|
34
|
+
yaml_gems = @gems[env].map {|_g| gem_to_yaml(_g)}
|
35
|
+
f.write "---\ndefaults:\n install-options: '--no-rdoc --no-ri'\ngems:\n" + yaml_gems.join("\n")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
3
39
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Adam Bachman
|
@@ -37,18 +37,17 @@ extensions: []
|
|
37
37
|
|
38
38
|
extra_rdoc_files:
|
39
39
|
- LICENSE
|
40
|
-
- README.
|
40
|
+
- README.md
|
41
41
|
files:
|
42
42
|
- .document
|
43
43
|
- .gitignore
|
44
44
|
- LICENSE
|
45
|
-
- README.
|
45
|
+
- README.md
|
46
46
|
- Rakefile
|
47
47
|
- VERSION
|
48
48
|
- geminstaller_builder.gemspec
|
49
49
|
- lib/geminstaller_builder.rb
|
50
50
|
- lib/geminstaller_builder/gem_helper.rb
|
51
|
-
- lib/geminstaller_builder/geminstaller_file.rb
|
52
51
|
- test/helper.rb
|
53
52
|
- test/test_geminstaller_builder.rb
|
54
53
|
has_rdoc: true
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= geminstaller-builder
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Adam Bachman. See LICENSE for details.
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'geminstaller_builder/gem_helper'
|
2
|
-
|
3
|
-
# Convert a list of gems into a valid geminstaller.yml file.
|
4
|
-
class GeminstallerFile
|
5
|
-
include GemHelper
|
6
|
-
def initialize options={}
|
7
|
-
options = {
|
8
|
-
:env => :default,
|
9
|
-
:gems => {
|
10
|
-
:default => [],
|
11
|
-
:test => []
|
12
|
-
},
|
13
|
-
:paths => {
|
14
|
-
:default => "config/geminstaller.yml",
|
15
|
-
:test => "config/test/geminstaller.yml"
|
16
|
-
}
|
17
|
-
}.merge(options)
|
18
|
-
|
19
|
-
@gems = options[:gems]
|
20
|
-
@paths = options[:paths]
|
21
|
-
end
|
22
|
-
|
23
|
-
def add gem, env=:default
|
24
|
-
@gems[env.to_sym] << gem
|
25
|
-
end
|
26
|
-
|
27
|
-
alias_method :<<, :add
|
28
|
-
|
29
|
-
def save
|
30
|
-
puts "\e[34m[ Saving Gems ]\e[0m"
|
31
|
-
@gems.keys.each do |env|
|
32
|
-
File.open(@paths[env], 'w') do |f|
|
33
|
-
yaml_gems = @gems[env].map {|_g| gem_to_yaml(_g)}
|
34
|
-
f.write "---\ndefaults:\n install-options: '--no-rdoc --no-ri'\ngems:\n" + yaml_gems.join("\n")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|