Class: Awspec::Setup
- Inherits:
-
Object
- Object
- Awspec::Setup
- Defined in:
- lib/awspec/setup.rb
Class Method Summary collapse
- .generate_dotgitignore ⇒ Object
- .generate_dotrspec ⇒ Object
- .generate_rakefile ⇒ Object
- .generate_spec_helper ⇒ Object
- .run ⇒ Object
Class Method Details
.generate_dotgitignore ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/awspec/setup.rb', line 63 def self.generate_dotgitignore content = <<-'EOF' secrets.yml EOF if File.exist? 'spec/.gitignore' $stderr.puts '!! spec/.gitignore already exists' else File.open('spec/.gitignore', 'w') do |f| f.puts content end puts ' + spec/.gitignore' end end |
.generate_dotrspec ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/awspec/setup.rb', line 77 def self.generate_dotrspec content = <<-'EOF' --color --format documentation EOF if File.exist? '.rspec' $stderr.puts '!! .rspec already exists' else File.open('.rspec', 'w') do |f| f.puts content end puts ' + .rspec' end end |
.generate_rakefile ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/awspec/setup.rb', line 46 def self.generate_rakefile content = <<-'EOF' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new('spec') task :default => :spec EOF if File.exist? 'Rakefile' $stderr.puts '!! Rakefile already exists' else File.open('Rakefile', 'w') do |f| f.puts content end puts ' + Rakefile' end end |
.generate_spec_helper ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/awspec/setup.rb', line 13 def self.generate_spec_helper content = <<-'EOF' require 'awspec' if File.exist?('spec/secrets.yml') creds = YAML.load_file('spec/secrets.yml') Aws.config.update({ region: creds['region'], credentials: Aws::Credentials.new( creds['aws_access_key_id'], creds['aws_secret_access_key']) }) end EOF dir = 'spec' if File.exist? dir unless File.directory? dir $stderr.puts '!! #{dir} already exists and is not a directory' end else FileUtils.mkdir dir puts " + #{dir}/" end if File.exist? 'spec/spec_helper.rb' $stderr.puts '!! spec/spec_helper.rb already exists' else File.open('spec/spec_helper.rb', 'w') do |f| f.puts content end puts ' + spec/spec_helper.rb' end end |
.run ⇒ Object
6 7 8 9 10 11 |
# File 'lib/awspec/setup.rb', line 6 def self.run generate_spec_helper generate_rakefile generate_dotgitignore generate_dotrspec end |