atmos-singem 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. data/LICENSE +20 -0
  2. data/README.md +36 -0
  3. data/Rakefile +63 -0
  4. data/TODO +1 -0
  5. data/bin/singem +26 -0
  6. data/lib/generators/cucumber/USAGE +5 -0
  7. data/lib/generators/cucumber/cucumber_generator.rb +82 -0
  8. data/lib/generators/cucumber/templates/LICENSE +20 -0
  9. data/lib/generators/cucumber/templates/README.md +4 -0
  10. data/lib/generators/cucumber/templates/Rakefile +73 -0
  11. data/lib/generators/cucumber/templates/TODO +4 -0
  12. data/lib/generators/cucumber/templates/config.ru.erb +11 -0
  13. data/lib/generators/cucumber/templates/features/basics.feature.erb +6 -0
  14. data/lib/generators/cucumber/templates/features/step_definitions/basics.rb.erb +8 -0
  15. data/lib/generators/cucumber/templates/features/support/env.rb.erb +32 -0
  16. data/lib/generators/cucumber/templates/lib/templates.rb.erb +9 -0
  17. data/lib/generators/cucumber/templates/lib/templates/app.rb.erb +7 -0
  18. data/lib/generators/cucumber/templates/spec/fixtures.rb.erb +0 -0
  19. data/lib/generators/cucumber/templates/spec/spec_helper.rb.erb +40 -0
  20. data/lib/generators/cucumber/templates/spec/templates_spec.rb.erb +8 -0
  21. data/lib/generators/singem/USAGE +5 -0
  22. data/lib/generators/singem/singem_generator.rb +77 -0
  23. data/lib/generators/singem/templates/LICENSE +20 -0
  24. data/lib/generators/singem/templates/README.md +4 -0
  25. data/lib/generators/singem/templates/Rakefile +66 -0
  26. data/lib/generators/singem/templates/TODO +4 -0
  27. data/lib/generators/singem/templates/config.ru.erb +11 -0
  28. data/lib/generators/singem/templates/lib/templates.rb.erb +9 -0
  29. data/lib/generators/singem/templates/lib/templates/app.rb.erb +7 -0
  30. data/lib/generators/singem/templates/spec/fixtures.rb.erb +0 -0
  31. data/lib/generators/singem/templates/spec/spec_helper.rb.erb +40 -0
  32. data/lib/generators/singem/templates/spec/templates_spec.rb.erb +8 -0
  33. data/lib/generators/twitter/USAGE +5 -0
  34. data/lib/generators/twitter/templates/LICENSE +20 -0
  35. data/lib/generators/twitter/templates/README.md +4 -0
  36. data/lib/generators/twitter/templates/Rakefile +72 -0
  37. data/lib/generators/twitter/templates/TODO +4 -0
  38. data/lib/generators/twitter/templates/config.ru.erb +14 -0
  39. data/lib/generators/twitter/templates/features/adding_items_from_the_bookmarklet.feature +16 -0
  40. data/lib/generators/twitter/templates/features/adding_items_to_my_wishlist.feature +19 -0
  41. data/lib/generators/twitter/templates/features/basics.feature.erb +11 -0
  42. data/lib/generators/twitter/templates/features/step_definitions/basics.rb.erb +15 -0
  43. data/lib/generators/twitter/templates/features/support/env.rb.erb +20 -0
  44. data/lib/generators/twitter/templates/features/viewing_my_wish_list.feature +14 -0
  45. data/lib/generators/twitter/templates/features/viewing_the_site_for_the_first_time.feature +6 -0
  46. data/lib/generators/twitter/templates/lib/templates.rb.erb +56 -0
  47. data/lib/generators/twitter/templates/lib/templates/models/user.rb.erb +38 -0
  48. data/lib/generators/twitter/templates/lib/templates/sinatra/app.rb.erb +66 -0
  49. data/lib/generators/twitter/templates/lib/templates/views/about.haml +5 -0
  50. data/lib/generators/twitter/templates/lib/templates/views/failed.haml +4 -0
  51. data/lib/generators/twitter/templates/lib/templates/views/home.haml +1 -0
  52. data/lib/generators/twitter/templates/spec/fixtures.rb.erb +0 -0
  53. data/lib/generators/twitter/templates/spec/helpers.rb.erb +43 -0
  54. data/lib/generators/twitter/templates/spec/spec_helper.rb.erb +38 -0
  55. data/lib/generators/twitter/templates/spec/templates_spec.rb.erb +59 -0
  56. data/lib/generators/twitter/twitter_generator.rb +90 -0
  57. data/lib/singen.rb +0 -0
  58. data/spec/singem_spec.rb +7 -0
  59. data/spec/spec_helper.rb +2 -0
  60. metadata +196 -0
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "<%= name.camelize %>" do
4
+ it "should do nothing" do
5
+ get '/'
6
+ last_response.should have_selector("h2:contains('Hello There, buddy!')")
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,77 @@
1
+ class SingemGenerator < RubiGen::Base
2
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
3
+ Config::CONFIG['ruby_install_name'])
4
+
5
+ default_options :author => nil
6
+ attr_reader :name
7
+
8
+ def initialize(runtime_args, runtime_options = {})
9
+ super
10
+ usage if args.empty?
11
+ @destination_root = File.expand_path(args.shift)
12
+ @name = base_name
13
+ extract_options
14
+ end
15
+
16
+ def manifest
17
+ record do |m|
18
+ # Ensure appropriate folder(s) exists
19
+ m.directory ''
20
+ BASEDIRS.each { |path| m.directory path }
21
+ m.directory "lib/#{name}"
22
+
23
+ # Create stubs
24
+ m.template "config.ru.erb", "config.ru.example"
25
+ m.template "lib/templates.rb.erb", "lib/#{name}.rb"
26
+ m.template "lib/templates/app.rb.erb", "lib/#{name}/app.rb"
27
+
28
+ m.template "spec/spec_helper.rb.erb", "spec/spec_helper.rb"
29
+ m.template "spec/templates_spec.rb.erb", "spec/#{name}_spec.rb"
30
+ m.template "spec/fixtures.rb.erb", "spec/fixtures.rb"
31
+
32
+ %w(LICENSE Rakefile README.md).each do |file|
33
+ m.template file, file
34
+ end
35
+ %w(TODO).each do |file|
36
+ m.file file, file
37
+ end
38
+
39
+ # m.dependency "install_rubigen_scripts", [destination_root, 'newgem_simple'],
40
+ # :shebang => options[:shebang], :collision => :force
41
+ end
42
+ end
43
+
44
+ protected
45
+ def banner
46
+ <<-EOS
47
+ Creates a simple RubyGems scaffold.
48
+
49
+ USAGE: #{spec.name} name --simple"
50
+ EOS
51
+ end
52
+
53
+ def add_options!(opts)
54
+ opts.separator ''
55
+ opts.separator 'Options:'
56
+ # For each option below, place the default
57
+ # at the top of the file next to "default_options"
58
+ # opts.on("-a", "--author=\"Your Name\"", String,
59
+ # "Some comment about this option",
60
+ # "Default: none") { |x| options[:author] = x }
61
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
62
+ end
63
+
64
+ def extract_options
65
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
66
+ # Templates can access these value via the attr_reader-generated methods, but not the
67
+ # raw instance variable value.
68
+ # @author = options[:author]
69
+ end
70
+
71
+ # Installation skeleton. Intermediate directories are automatically
72
+ # created so don't sweat their absence here.
73
+ BASEDIRS = %w(
74
+ lib
75
+ spec
76
+ )
77
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) <%= Time.now.year %> YOUR NAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ <%= name %>
2
+ <%= "=" * name.size %>
3
+
4
+ A gem that provides...
@@ -0,0 +1,66 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rubygems/specification'
4
+ require 'date'
5
+ require 'spec/rake/spectask'
6
+
7
+ GEM = "<%= name %>"
8
+ GEM_VERSION = "0.0.1"
9
+ AUTHOR = "Your Name"
10
+ EMAIL = "Your Email"
11
+ HOMEPAGE = "http://example.com"
12
+ SUMMARY = "A sinatra app that provides..."
13
+
14
+ spec = Gem::Specification.new do |s|
15
+ s.name = GEM
16
+ s.version = GEM_VERSION
17
+ s.platform = Gem::Platform::RUBY
18
+ s.has_rdoc = true
19
+ s.extra_rdoc_files = ["LICENSE", 'TODO']
20
+ s.summary = SUMMARY
21
+ s.description = s.summary
22
+ s.author = AUTHOR
23
+ s.email = EMAIL
24
+ s.homepage = HOMEPAGE
25
+
26
+ s.add_dependency "sinatra", ">=0.9.2"
27
+ s.add_dependency "rubigen", ">= 1.5.2"
28
+ s.add_dependency "rack-test", "~>0.1.0"
29
+ s.add_dependency "webrat", "~>0.4.3"
30
+ s.add_dependency "fakeweb", "~>1.2.0"
31
+ s.add_dependency 'haml', "~>2.0.9"
32
+
33
+ s.require_path = 'lib'
34
+ s.autorequire = GEM
35
+ s.files = %w(LICENSE README.md Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
36
+ end
37
+
38
+ Rake::GemPackageTask.new(spec) do |pkg|
39
+ pkg.gem_spec = spec
40
+ end
41
+
42
+ desc "install the gem locally"
43
+ task :install => [:package] do
44
+ sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
45
+ end
46
+
47
+ desc "create a gemspec file"
48
+ task :make_spec do
49
+ File.open("#{GEM}.gemspec", "w") do |file|
50
+ file.puts spec.to_ruby
51
+ end
52
+ end
53
+
54
+ task :default => :spec
55
+
56
+ desc "Run specs"
57
+ Spec::Rake::SpecTask.new do |t|
58
+ t.spec_files = FileList['spec/**/*_spec.rb']
59
+ t.spec_opts = %w(-fs --color)
60
+ t.spec_opts << '--loadby' << 'random'
61
+
62
+ t.rcov_opts << '--exclude' << 'spec'
63
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
64
+ t.rcov_opts << '--text-summary'
65
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
66
+ end
@@ -0,0 +1,4 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/<%= name %>.rb
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require '<%= name %>'
3
+
4
+ #DataMapper.setup(:default, "mysql://atmos:fail@localhost/<%= name.capitalize %>_production")
5
+
6
+ class <%= name.camelize %>Site < <%= name.camelize %>::App
7
+ set :public, File.expand_path(File.dirname(__FILE__), "public")
8
+ set :environment, :production
9
+ end
10
+
11
+ run <%= name.camelize %>Site
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'sinatra/base'
3
+ require 'haml/util'
4
+ require 'haml/engine'
5
+
6
+ module <%= name.camelize %>
7
+ end
8
+
9
+ require File.dirname(__FILE__)+'/<%= name %>/app'
@@ -0,0 +1,7 @@
1
+ module <%= name.camelize %>
2
+ class App < Sinatra::Default
3
+ get '/' do
4
+ haml "%h2= 'Hello There, buddy!'"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,40 @@
1
+ $TESTING=true
2
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'rubygems'
4
+ require 'randexp'
5
+ require '<%= name %>'
6
+ #require 'dm-core'
7
+ require 'rack/test'
8
+ require 'webrat/sinatra'
9
+ #require 'dm-sweatshop'
10
+ require 'fakeweb'
11
+ require 'pp'
12
+
13
+ FakeWeb.allow_net_connect = false
14
+
15
+ #require File.dirname(__FILE__)+'/fixtures'
16
+ #DataMapper.setup(:default, 'sqlite3::memory:')
17
+
18
+ class Net::HTTPResponse
19
+ def body=(content)
20
+ @body = content
21
+ @read = true
22
+ end
23
+ end
24
+
25
+ Spec::Runner.configure do |config|
26
+ config.include(Rack::Test::Methods)
27
+ config.include(Webrat::Methods)
28
+ config.include(Webrat::Matchers)
29
+
30
+ config.before(:each) do
31
+ #DataMapper.auto_migrate!
32
+ FakeWeb.clean_registry
33
+ end
34
+
35
+ def app
36
+ @app = Rack::Builder.new do
37
+ run <%= name.camelize %>::App
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "<%= name.camelize %>" do
4
+ it "should do nothing" do
5
+ get '/'
6
+ last_response.should have_selector("h2:contains('Hello There, buddy!')")
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) <%= Time.now.year %> YOUR NAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ <%= name %>
2
+ <%= "=" * name.size %>
3
+
4
+ A gem that provides...
@@ -0,0 +1,72 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rubygems/specification'
4
+ require 'date'
5
+
6
+ GEM = "<%= name %>"
7
+ GEM_VERSION = "0.0.1"
8
+ AUTHOR = "Your Name"
9
+ EMAIL = "Your Email"
10
+ HOMEPAGE = "http://example.com"
11
+ SUMMARY = "A sinatra app that provides..."
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = GEM
15
+ s.version = GEM_VERSION
16
+ s.platform = Gem::Platform::RUBY
17
+ s.has_rdoc = true
18
+ s.extra_rdoc_files = ["LICENSE", 'TODO']
19
+ s.summary = SUMMARY
20
+ s.description = s.summary
21
+ s.author = AUTHOR
22
+ s.email = EMAIL
23
+ s.homepage = HOMEPAGE
24
+
25
+ s.add_dependency "sinatra", ">=0.9.2"
26
+ s.add_dependency "rubigen", ">= 1.5.2"
27
+ s.add_dependency "rack-test", "~>0.1.0"
28
+ s.add_dependency "webrat", "~>0.4.3"
29
+ s.add_dependency "fakeweb", "~>1.2.4"
30
+ s.add_dependency 'haml', "~>2.0.9"
31
+
32
+ s.require_path = 'lib'
33
+ s.autorequire = GEM
34
+ s.files = %w(LICENSE README.md Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
35
+ end
36
+
37
+ Rake::GemPackageTask.new(spec) do |pkg|
38
+ pkg.gem_spec = spec
39
+ end
40
+
41
+ desc "install the gem locally"
42
+ task :install => [:package] do
43
+ sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
44
+ end
45
+
46
+ desc "create a gemspec file"
47
+ task :make_spec do
48
+ File.open("#{GEM}.gemspec", "w") do |file|
49
+ file.puts spec.to_ruby
50
+ end
51
+ end
52
+
53
+ task :default => :features
54
+
55
+ require 'cucumber/rake/task'
56
+ desc "Run cucumber"
57
+ Cucumber::Rake::Task.new do |t|
58
+ t.cucumber_opts = %w{--format pretty}
59
+ end
60
+
61
+ require 'spec/rake/spectask'
62
+ desc "Run specs"
63
+ Spec::Rake::SpecTask.new do |t|
64
+ t.spec_files = FileList['spec/**/*_spec.rb']
65
+ t.spec_opts = %w(-fs --color)
66
+ t.spec_opts << '--loadby' << 'random'
67
+
68
+ t.rcov_opts << '--exclude' << 'spec'
69
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
70
+ t.rcov_opts << '--text-summary'
71
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
72
+ end
@@ -0,0 +1,4 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/<%= name %>.rb
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require '<%= name %>'
3
+
4
+ ENV['<%= name.upcase %>_READKEY'] = /\w{18}/.gen # this should really be what twitter gives you
5
+ ENV['<%= name.upcase %>_READSECRET'] = /\w{24}/.gen # this should really be what twitter gives you
6
+
7
+ #DataMapper.setup(:default, "mysql://atmos:fail@localhost/<%= name.capitalize %>_production")
8
+
9
+ class <%= name.camelize %>Site < <%= name.camelize %>::App
10
+ set :public, File.expand_path(File.dirname(__FILE__), "public")
11
+ set :environment, :production
12
+ end
13
+
14
+ run <%= name.camelize %>Site
@@ -0,0 +1,16 @@
1
+ Feature: Viewing my wish list
2
+ In order to display a users' preferences
3
+ As a twitter user
4
+
5
+ Background:
6
+ Given I am logged in
7
+ And I have created a "53cm Pistas" category
8
+ And I have created a "54cm Cyclocross" category
9
+
10
+ Scenario: After Authenticating
11
+ When I visit the bookmarklet page
12
+ And I set the category to "53cm Pistas"
13
+ And the "description" is set to "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)"
14
+ And the "url" is set to "http://denver.craigslist.org/bik/1195971789.html"
15
+ When I click submit
16
+ Then I should see the window close
@@ -0,0 +1,19 @@
1
+ Feature: Viewing my wish list
2
+ In order to display a users' preferences
3
+ As a twitter user
4
+
5
+ Background:
6
+ Given I am logged in
7
+ And I have created a "53cm Pistas" category
8
+
9
+ Scenario: Posting to an existing category
10
+ When I post "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)" with a url of "http://denver.craigslist.org/bik/1195971789.html" to the "53cm Pistas" category
11
+ And I visit the "53cm Pistas" page
12
+ Then I should see the "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)" in the list
13
+ And the url should be set to "http://denver.craigslist.org/bik/1195971789.html"
14
+
15
+ Scenario: Posting to a new category
16
+ When I post "Bianchi Pista Size 54cm Medium - $500 (Downtown Denver)" with a url of "http://denver.craigslist.org/bik/1195971789.html" to the "54cm Pistas" category
17
+ And I visit the "54cm Pistas" page
18
+ Then I should see the "Bianchi Pista Size 54cm Medium - $500 (Downtown Denver)" in the list
19
+ And the url should be set to "http://denver.craigslist.org/bik/1195971789.html"