jackdempsey-beet 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/TODO CHANGED
@@ -13,4 +13,6 @@ and want to verify things worked correctly
13
13
 
14
14
  * work on ubuntu install ideas
15
15
 
16
- * add a nicer looking prompt for when you ask a question of the user
16
+ * create a "if gem_exists?('browsercms')" type method
17
+
18
+ * print out a warning message if a recipe isn't found
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
data/beet.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{beet}
5
- s.version = "0.1.8"
5
+ s.version = "0.1.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jack Dempsey"]
9
- s.date = %q{2009-06-06}
9
+ s.date = %q{2009-06-07}
10
10
  s.default_executable = %q{beet}
11
11
  s.email = %q{jack.dempsey@gmail.com}
12
12
  s.executables = ["beet"]
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/beet/recipes/rack/middleware.rb",
36
36
  "lib/beet/recipes/rails/authlogic.rb",
37
37
  "lib/beet/recipes/rails/clean_files.rb",
38
+ "lib/beet/recipes/rails/cms/bcms_blog.rb",
38
39
  "lib/beet/recipes/rails/css/blueprint.rb",
39
40
  "lib/beet/recipes/rails/css/reset.rb",
40
41
  "lib/beet/recipes/rails/db/mysql.rb",
data/lib/beet/executor.rb CHANGED
@@ -40,15 +40,15 @@ module Beet
40
40
  end
41
41
  end
42
42
 
43
- if @display && options[:template]
44
- puts open(TEMPLATE_LOCATIONS[options[:template]]).read
43
+ if @display && @template
44
+ puts open(TEMPLATE_LOCATIONS[@template]).read
45
45
  else
46
46
  case @project_type
47
47
  when :rails
48
48
  if @generate
49
49
  puts "Generating rails project #{project_name}..."
50
- if @options[:template]
51
- system("rails #{project_name} -m #{TEMPLATE_LOCATIONS[options[:template]]}")
50
+ if @template
51
+ system("rails #{project_name} -m #{TEMPLATE_LOCATIONS[@template]}")
52
52
  else
53
53
  system("rails #{project_name}")
54
54
  end
@@ -88,7 +88,8 @@ module Beet
88
88
  # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
89
89
  #
90
90
  def gsub_file(relative_destination, regexp, *args, &block)
91
- path = destination_path(relative_destination)
91
+ #path = destination_path(relative_destination)
92
+ path = relative_destination
92
93
  content = File.read(path)
93
94
  check_for = args.first || yield('')
94
95
  regex = Regexp.new(regexp.source + Regexp.escape(check_for))
@@ -115,11 +116,23 @@ module Beet
115
116
  # add_after 'config/environment.rb', '# config.gem "aws-s3", :lib => "aws/s3"'
116
117
  #
117
118
  def add_after(filename, matching_text, data=nil, &block)
118
- gsub_file filename, /(#{Regexp.escape(matching_text)})/mi do |match|
119
+ gsub_file filename, /(\s*#{Regexp.escape(matching_text)})/mi do |match|
119
120
  "#{match}\n#{data || block.call}"
120
121
  end
121
122
  end
122
123
 
124
+ # Add text before matching line
125
+ #
126
+ # ==== Example
127
+ #
128
+ # add_before 'config/environment.rb', '# config.gem "aws-s3", :lib => "aws/s3"'
129
+ #
130
+ def add_before(filename, matching_text, data=nil, &block)
131
+ gsub_file filename, /^(\s*#{Regexp.escape(matching_text)})/mi do |match|
132
+ "#{data || block.call}#{match}"
133
+ end
134
+ end
135
+
123
136
  protected
124
137
 
125
138
  def destination_path(relative_destination)
@@ -8,7 +8,8 @@ module Beet
8
8
  # freeze! if ask("Should I freeze the latest Rails?") == "yes"
9
9
  #
10
10
  def ask(string)
11
- log '', string
11
+ log '', string
12
+ print '> '
12
13
  STDIN.gets.strip
13
14
  end
14
15
 
@@ -0,0 +1,21 @@
1
+ # install the gem
2
+ if `gem list bcms_blog | grep bcms_blog`.empty?
3
+ # Run this inside or outside your bcms_blog directory, otherwise download the code
4
+ git "clone git://github.com/browsermedia/bcms_blog.git" unless File.exists?('./bcms_blog') || File.basename(Dir.pwd) == 'bcms_blog'
5
+ FileUtils.chdir 'bcms_blog' do
6
+ system "gem build *.gemspec"
7
+ sudo "gem install bcms_blog*.gem"
8
+ end
9
+ if yes? "Should I delete bcms_blog/"
10
+ FileUtils.rm_rf('bcms_blog')
11
+ end
12
+ end
13
+
14
+ # add to project
15
+ add_after 'config/environment.rb', "config.gem 'browsercms'" do
16
+ "\tconfig.gem 'bcms_blog'"
17
+ end
18
+
19
+ add_before 'config/routes.rb', 'map.routes_for_browser_cms' do
20
+ "\tmap.routes_for_bcms_blog"
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackdempsey-beet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-06 00:00:00 -07:00
12
+ date: 2009-06-07 00:00:00 -07:00
13
13
  default_executable: beet
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,7 @@ files:
52
52
  - lib/beet/recipes/rack/middleware.rb
53
53
  - lib/beet/recipes/rails/authlogic.rb
54
54
  - lib/beet/recipes/rails/clean_files.rb
55
+ - lib/beet/recipes/rails/cms/bcms_blog.rb
55
56
  - lib/beet/recipes/rails/css/blueprint.rb
56
57
  - lib/beet/recipes/rails/css/reset.rb
57
58
  - lib/beet/recipes/rails/db/mysql.rb