teacup 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +3 -0
  2. data/Dofile +6 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +26 -0
  5. data/README.md +151 -0
  6. data/Rakefile +39 -0
  7. data/lib/teacup.rb +41 -0
  8. data/lib/teacup/contributors.rb +7 -0
  9. data/lib/teacup/core_extensions/ui_view.rb +4 -0
  10. data/lib/teacup/core_extensions/ui_view_controller.rb +62 -0
  11. data/lib/teacup/layout.rb +207 -0
  12. data/lib/teacup/style_sheet.rb +195 -0
  13. data/lib/teacup/version.rb +5 -0
  14. data/lib/teacup/view.rb +123 -0
  15. data/pkg/teacup-0.0.0.gem +0 -0
  16. data/pkg/teacup-0.0.1.gem +0 -0
  17. data/proposals/other/README.md +45 -0
  18. data/proposals/other/app/config/application.rb +1 -0
  19. data/proposals/other/app/config/boot.rb +1 -0
  20. data/proposals/other/app/config/initializers/twitter.rb +7 -0
  21. data/proposals/other/app/controllers/events_controller.rb +28 -0
  22. data/proposals/other/app/controllers/venues_controller.rb +4 -0
  23. data/proposals/other/app/db/README.md +16 -0
  24. data/proposals/other/app/db/migrations/20120514201043_create_events.rb +9 -0
  25. data/proposals/other/app/db/migrations/20120514201044_add_price_to_events.rb +5 -0
  26. data/proposals/other/app/db/migrations/20120514201045_create_venues.rb +8 -0
  27. data/proposals/other/app/db/schema.rb +19 -0
  28. data/proposals/other/app/models/event.rb +14 -0
  29. data/proposals/other/app/models/venue.rb +3 -0
  30. data/proposals/other/app/views/events/edit.ipad.rb +8 -0
  31. data/proposals/other/app/views/events/edit.iphone.rb +7 -0
  32. data/proposals/other/app/views/events/show.ipad.rb +2 -0
  33. data/proposals/other/app/views/events/show.iphone.rb +3 -0
  34. data/samples/Hai/.gitignore +5 -0
  35. data/samples/Hai/Rakefile +12 -0
  36. data/samples/Hai/app/app_delegate.rb +9 -0
  37. data/samples/Hai/app/hai_controller.rb +9 -0
  38. data/samples/Hai/spec/main_spec.rb +9 -0
  39. data/samples/Hai/styles/ipad.rb +11 -0
  40. data/samples/Hai/styles/ipad_vertical.rb +3 -0
  41. data/samples/README.md +4 -0
  42. data/spec/spec_helper.rb +5 -0
  43. data/spec/teacup/contributions_spec.rb +13 -0
  44. data/spec/teacup/version_spec.rb +9 -0
  45. data/teacup.gemspec +27 -0
  46. metadata +130 -0
@@ -0,0 +1,5 @@
1
+ class AddPriceToEvents < Migration
2
+ def change
3
+ add_column :events, :price, :float, :default => 0.00
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class CreateVenues < Migration
2
+ def change
3
+ create_table(:venues) do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ Schema.define(:version => 20120514201043) do
2
+
3
+ create_table(:events) do |t|
4
+ t.string :name
5
+ t.references :venue
6
+ t.timestamps
7
+ end
8
+
9
+ create_table(:venues) do |t|
10
+ t.string :name
11
+ t.timestamps
12
+ end
13
+
14
+ # Idea: If we can't automagically infer from CoreData?
15
+ # create_table(:schema_migrations) do
16
+ # t.integer :version, :default => false
17
+ # end
18
+
19
+ end
@@ -0,0 +1,14 @@
1
+ class Event < Model
2
+
3
+ # Idea: By default the endpoint is considered a local Sqllite store, see db/README.md for more information.
4
+ #
5
+ # endpoint nil # uses sqlite, not required
6
+ #
7
+ # endpoint "http://example.com" # simple configuration
8
+ #
9
+ # # more advanced confiruations delegating to something, in this case the AppDelegate for a current_user
10
+ # endpoint lambda {
11
+ # "https://#{app.current_user.name}:pass@example.com"
12
+ # }
13
+
14
+ end
@@ -0,0 +1,3 @@
1
+ class Venue < Model
2
+ belongs_to :event
3
+ end
@@ -0,0 +1,8 @@
1
+ text_field{@event, :name, :autosave => true}
2
+ text_field{@event, :price, :autosave => false}
3
+
4
+ button("Save?").on(:press) do |btn|
5
+ alert("Slide to save the event")
6
+ end.on(:slide) do |btn|
7
+ update(@event.id) # invokes to controller or use @controller?
8
+ end
@@ -0,0 +1,7 @@
1
+ text_field{@event, :name}
2
+ text_field{@event, :price}
3
+ button("Save?").on(:press) do |btn|
4
+ alert("Slide to save the event")
5
+ end.on(:slide) do |btn|
6
+ update(@event.id)
7
+ end
@@ -0,0 +1,2 @@
1
+ # alternate devise layout
2
+ label{@event, :name, :color => "#ffffff", :font => {:name => "Helvetica-Bold", :size => 20} }
@@ -0,0 +1,3 @@
1
+ # element(object, attribute, props) => DSL
2
+ label{@event, :name, :background-color => "#ffffff", :font => UIFont.fontWithName("Helvetica-Bold")}
3
+ label{@event.venue, :name, :link_to => :show} # or a click handler?
@@ -0,0 +1,5 @@
1
+ .repl_history
2
+ build
3
+ resources/*.nib
4
+ resources/*.momd
5
+ resources/*.storyboardc
@@ -0,0 +1,12 @@
1
+ $:.unshift("/Library/RubyMotion/lib")
2
+ require 'motion/project'
3
+
4
+ Motion::Project::App.setup do |app|
5
+ app.name = 'Hai'
6
+
7
+ app.device_family = :ipad
8
+
9
+ app.files += Dir.glob(File.join(app.project_dir, 'teacup/**/*.rb'))
10
+ app.files += Dir.glob(File.join(app.project_dir, 'styles/**/*.rb'))
11
+ app.files += Dir.glob(File.join(app.project_dir, 'app/**/*.rb'))
12
+ end
@@ -0,0 +1,9 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
3
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
4
+ @window.rootViewController = HaiViewController.alloc.init.tap{ |c| c.wantsFullScreenLayout = true }
5
+ @window.makeKeyAndVisible
6
+
7
+ true
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class HaiViewController < UIViewController
2
+
3
+ def viewDidLoad
4
+ view.addSubview(Teacup.style(:label, UILabel.new))
5
+ self.setFrame([[0,0],[0,0]]) if rand > 1
6
+ true
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ describe "Application 'Hai'" do
2
+ before do
3
+ @app = UIApplication.sharedApplication
4
+ end
5
+
6
+ it "has one window" do
7
+ @app.windows.size.should == 1
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ Teacup::StyleSheet.new(:IPad) do
2
+
3
+ style :label,
4
+ text: 'Hai!',
5
+ backgroundColor: UIColor.whiteColor,
6
+ top: 10,
7
+ left: 100,
8
+ width: 200,
9
+ height: 50
10
+
11
+ end
@@ -0,0 +1,3 @@
1
+ Teacup::StyleSheet.new(:IPadVertical) do
2
+ include :IPad
3
+ end
@@ -0,0 +1,4 @@
1
+ Samples
2
+ =======
3
+
4
+ Welcome to the Teacup samples directory. Place sample apps using Teacup here.
@@ -0,0 +1,5 @@
1
+ # Add RSpec helpers here.
2
+
3
+ require 'rspec'
4
+ require File.expand_path '../../lib/teacup/version.rb', __FILE__
5
+ require File.expand_path '../../lib/teacup/contributors.rb', __FILE__
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Teacup::CONTRIBUTORS" do
4
+
5
+ it 'has contributors' do
6
+ Teacup::CONTRIBUTORS.should be
7
+ end
8
+
9
+ it 'is an array' do
10
+ Teacup::CONTRIBUTORS.should be_instance_of Array
11
+ end
12
+
13
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Teacup::VERSION' do
4
+
5
+ it 'has a version' do
6
+ Teacup::VERSION.should be
7
+ end
8
+
9
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path('../lib/teacup/version.rb', __FILE__)
2
+ require File.expand_path('../lib/teacup/contributors.rb', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+
6
+ gem.authors = Teacup::CONTRIBUTORS
7
+ gem.description = <<-DESC
8
+ Teacup is a community-driven DSL for making CSS-like templates for RubyMotion iOS
9
+ apps.
10
+ DESC
11
+
12
+ gem.summary = 'CSS-like templates for RubyMotion.'
13
+ gem.homepage = 'https://github.com/rubymotion/teacup'
14
+
15
+ gem.files = `git ls-files`.lines.map(&:strip)
16
+
17
+ gem.executables = gem.files.grep(%r(^bin/)).map { |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+
20
+ gem.name = 'teacup'
21
+ gem.require_paths = ['lib']
22
+ gem.version = "#{Teacup::VERSION}.pre"
23
+
24
+ gem.add_dependency 'rake'
25
+ gem.add_development_dependency 'rspec'
26
+
27
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: teacup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Chris Clarke
9
+ - Colin Thomas-Arnold
10
+ - Conrad Irwin
11
+ - Roland Oth
12
+ - Vladimir Pouzanov
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2012-05-24 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: rake
20
+ requirement: !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ! '>='
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ type: :runtime
27
+ prerelease: false
28
+ version_requirements: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
36
+ requirement: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ type: :development
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ description: ! " Teacup is a community-driven DSL for making CSS-like templates for
51
+ RubyMotion iOS\n apps.\n"
52
+ email:
53
+ executables: []
54
+ extensions: []
55
+ extra_rdoc_files: []
56
+ files:
57
+ - .gitignore
58
+ - .rspec
59
+ - Dofile
60
+ - Gemfile
61
+ - Gemfile.lock
62
+ - README.md
63
+ - Rakefile
64
+ - lib/teacup.rb
65
+ - lib/teacup/contributors.rb
66
+ - lib/teacup/core_extensions/ui_view.rb
67
+ - lib/teacup/core_extensions/ui_view_controller.rb
68
+ - lib/teacup/layout.rb
69
+ - lib/teacup/style_sheet.rb
70
+ - lib/teacup/version.rb
71
+ - lib/teacup/view.rb
72
+ - pkg/teacup-0.0.0.gem
73
+ - pkg/teacup-0.0.1.gem
74
+ - proposals/other/README.md
75
+ - proposals/other/app/config/application.rb
76
+ - proposals/other/app/config/boot.rb
77
+ - proposals/other/app/config/initializers/twitter.rb
78
+ - proposals/other/app/controllers/events_controller.rb
79
+ - proposals/other/app/controllers/venues_controller.rb
80
+ - proposals/other/app/db/README.md
81
+ - proposals/other/app/db/migrations/20120514201043_create_events.rb
82
+ - proposals/other/app/db/migrations/20120514201044_add_price_to_events.rb
83
+ - proposals/other/app/db/migrations/20120514201045_create_venues.rb
84
+ - proposals/other/app/db/schema.rb
85
+ - proposals/other/app/models/event.rb
86
+ - proposals/other/app/models/venue.rb
87
+ - proposals/other/app/views/events/edit.ipad.rb
88
+ - proposals/other/app/views/events/edit.iphone.rb
89
+ - proposals/other/app/views/events/show.ipad.rb
90
+ - proposals/other/app/views/events/show.iphone.rb
91
+ - samples/Hai/.gitignore
92
+ - samples/Hai/Rakefile
93
+ - samples/Hai/app/app_delegate.rb
94
+ - samples/Hai/app/hai_controller.rb
95
+ - samples/Hai/spec/main_spec.rb
96
+ - samples/Hai/styles/ipad.rb
97
+ - samples/Hai/styles/ipad_vertical.rb
98
+ - samples/README.md
99
+ - spec/spec_helper.rb
100
+ - spec/teacup/contributions_spec.rb
101
+ - spec/teacup/version_spec.rb
102
+ - teacup.gemspec
103
+ homepage: https://github.com/rubymotion/teacup
104
+ licenses: []
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>'
119
+ - !ruby/object:Gem::Version
120
+ version: 1.3.1
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 1.8.19
124
+ signing_key:
125
+ specification_version: 3
126
+ summary: CSS-like templates for RubyMotion.
127
+ test_files:
128
+ - spec/spec_helper.rb
129
+ - spec/teacup/contributions_spec.rb
130
+ - spec/teacup/version_spec.rb