boiler 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,3 +1,20 @@
1
- source 'https://rubygems.org'
1
+ require 'socket'
2
+ require 'uri'
3
+ Gem.configuration
4
+ if chalk_sources = ENV['BUNDLE_SOURCES']
5
+ sources = chalk_sources.split(',')
6
+ else
7
+ sources = Gem.sources
8
+ end
9
+ sources.each do |src|
10
+ begin
11
+ Socket.gethostbyname(URI.parse(src).host)
12
+ rescue SocketError => e
13
+ Bundler.ui.error("Unable to resolve gem source #{src}")
14
+ raise e
15
+ else
16
+ source src
17
+ end
18
+ end
2
19
 
3
20
  gemspec
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'chalk-rake/gem_tasks'
2
3
  require 'rake/testtask'
3
4
 
4
5
  Rake::TestTask.new do |t|
data/boiler.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency 'rake'
20
20
  gem.add_development_dependency 'minitest'
21
21
  gem.add_development_dependency 'mocha'
22
+ gem.add_development_dependency 'chalk-rake'
22
23
  gem.add_dependency 'escort'
23
24
  gem.add_dependency 'chalk-log'
24
25
  end
@@ -7,9 +7,11 @@ module Boiler::Generator
7
7
  # Ensure that these files exist
8
8
  gemspec = get_gemspec
9
9
  rakefile = get_rakefile
10
+ gemfile = get_gemfile
10
11
 
11
12
  modify_gemspec(gemspec)
12
13
  modify_rakefile(rakefile)
14
+ modify_gemfile(gemfile)
13
15
  end
14
16
 
15
17
  private
@@ -35,9 +37,19 @@ module Boiler::Generator
35
37
  path
36
38
  end
37
39
 
38
- def modify_gemspec(gemspec)
39
- addition = " gem.add_development_dependency 'rake'\n gem.add_development_dependency 'minitest'\n gem.add_development_dependency 'mocha'"
40
+ def get_gemfile
41
+ path = path('Gemfile')
42
+ raise "No Gemfile found at #{path}" unless File.exists?(path)
43
+ path
44
+ end
40
45
 
46
+ def modify_gemspec(gemspec)
47
+ addition = <<EOF.rstrip
48
+ gem.add_development_dependency 'rake'
49
+ gem.add_development_dependency 'minitest'
50
+ gem.add_development_dependency 'mocha'
51
+ gem.add_development_dependency 'chalk-rake'
52
+ EOF
41
53
  lines = File.read(gemspec).gsub('"', "'").split("\n")
42
54
  index = lines.index {|line| line =~ /gem\.require_paths/}
43
55
  raise "Could not find gem.require_paths line in #{gemspec}" unless index
@@ -53,6 +65,7 @@ module Boiler::Generator
53
65
  end
54
66
 
55
67
  append_to_file(rakefile, <<EOF)
68
+ require 'chalk-rake/gem_tasks'
56
69
  require 'rake/testtask'
57
70
 
58
71
  Rake::TestTask.new do |t|
@@ -65,5 +78,32 @@ Rake::TestTask.new do |t|
65
78
  end
66
79
  EOF
67
80
  end
81
+
82
+ def modify_gemfile(gemfile)
83
+ contents = File.read(gemfile)
84
+ contents = contents.gsub("source 'https://rubygems.org'") do
85
+ <<EOF.rstrip
86
+ require 'socket'
87
+ require 'uri'
88
+ Gem.configuration
89
+ if chalk_sources = ENV['BUNDLE_SOURCES']
90
+ sources = chalk_sources.split(',')
91
+ else
92
+ sources = Gem.sources
93
+ end
94
+ sources.each do |src|
95
+ begin
96
+ Socket.gethostbyname(URI.parse(src).host)
97
+ rescue SocketError => e
98
+ Bundler.ui.error("Unable to resolve gem source \#{src}")
99
+ raise e
100
+ else
101
+ source src
102
+ end
103
+ end
104
+ EOF
105
+ end
106
+ contents = write_file(gemfile, contents)
107
+ end
68
108
  end
69
109
  end
@@ -1,3 +1,3 @@
1
1
  module Boiler
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: chalk-rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: escort
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
143
  version: '0'
128
144
  segments:
129
145
  - 0
130
- hash: 2480003037247181513
146
+ hash: 499038418323727730
131
147
  required_rubygems_version: !ruby/object:Gem::Requirement
132
148
  none: false
133
149
  requirements:
@@ -136,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
152
  version: '0'
137
153
  segments:
138
154
  - 0
139
- hash: 2480003037247181513
155
+ hash: 499038418323727730
140
156
  requirements: []
141
157
  rubyforge_project:
142
158
  rubygems_version: 1.8.24