tyrone 0.4.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ *.gemspec
data/README.md CHANGED
@@ -1,48 +1,63 @@
1
1
  ![tyrone](http://cloud.github.com/downloads/chrislloyd/tyrone/logo.png)
2
2
 
3
- <small>a rapid prototyping fix. tyrone be great with uis. he loves em so much and will care the shit out of them. my boy tyrone is definitely the right man for the job, i aint playin. by [chris](http://chrislloyd.com.au).</small>
3
+ <small>a rapid prototyping fix. tyrone be great with uis. he loves em so much and will care the shit out of them. my boy tyrone is definitely the right man for the job, i aint playin. by [the poacher](http://thelincolnshirepoacher.com).</small>
4
4
 
5
5
  It's always better to work from the UI down. Nobody cares about what database you are using or if you have 100% test coverage if the app itself _sucks_. Tyrone likes UIs. Like his community boxing gym, he likes to encourage good practices right from the start. He helps you get up and running prototyping UIs as quickly as possible so you can't procrastinate solving the real problems in your app.
6
6
 
7
- (For more information about Tyrone's intentions, please read the [associated article](http://chrislloyd.com.au/post/154530835/databases-are-for-pussies))
7
+ (For more information about Tyrone's intentions, please read the [associated article](http://thelincolnshirepoacher.com/pages/databases-are-for-pussies))
8
8
 
9
9
  ![screenshot](http://cloud.github.com/downloads/chrislloyd/tyrone/tyrone-0.1.0.png)
10
10
 
11
11
 
12
12
  ## Installing
13
13
 
14
- {gem,rip} install tyrone
14
+ gem install tyrone
15
15
 
16
- Then, to get Tyrone started on your job:
16
+ Then, to get Tyrone started on your jobs directory:
17
17
 
18
- tyrone [NAME OF JOB]
18
+ tyrone init
19
19
 
20
- Bada bing!
20
+ Bada bing! To make a new mockup a convenience helper is
21
21
 
22
- If you want the `states.js` or the `grid.js` you can do so like this:
22
+ tyrone mock "my awesome new feature"
23
23
 
24
- tyrone [NAME OF JOB] --states --grid
24
+ ## Running
25
25
 
26
- ## Features
26
+ rake dev
27
+
28
+ Then open up [http://localhost:4567](http://localhost:4567)
27
29
 
28
- Tyrone believes in tough love. You're going to have to do alot of work yourself. However, he does want to give the pups a headstart. Your job _will_ use HTML 5 and comes with a HTML 5 `reset.css`. It's the way of the future and will save you time (see `input[placeholder]`). If you really object you can turn HTML 5 off, just by placeing this line in your Sinatra file:
30
+ ## Philosophy
29
31
 
30
- set :haml => {:format => :xhtml}
32
+ * **Undefined scope is bad**. So define it quickly.
33
+ * **Mockups are not apps**. They shouldn't have tests. They shouldn't support IE.
34
+ * **Sensible Power**. Good defaults for dev but power when you need it.
35
+
36
+ ## Features
31
37
 
32
- Remember, it's just a Sinatra app so everything you can do in Sinatra you can do in Tyrone. However, you should note that the default behaviour of Sinatra is to process Sass files in the 'views' directory (or 'mockups' in Tyrone). Tyrone doesn't think that sytles are "views" so you can place your Sass files in 'public/css' and they'll get processed automagically. Word.
38
+ Tyrone believes in tough love. You're going to have to do a lot of work yourself. However, he does want to give the pups a head-start. Your job uses HTML 5 and comes with a HTML 5 `reset.css`.
33
39
 
34
- Straight out of compton, Tyrone be givin' u some crunk prototyping scripts.
40
+ Straight out of compton, Tyrone be givin' u some crunk prototyping j-shizzle.
35
41
 
36
- 1. [states.js](http://github.com/toolmantim/states.js) &mdash; [t-star](http://toolmantim.com)'s script lets you hide and show bits of your UI so you can simulate state. For example hide and show a logged in user's account controls. Think [Polypage](http://github.com/andykent/polypage) on a diet.
37
- 2. [grid.js](http://gist.github.com/160497) &mdash; A handy tool which overlays vertical and horizontal grids when SHIFT-v or SHIFT-h are pressed. By default it is applied to `body` but you can change this in `application.js`. Big ups [byrne-diddy](http://myles.id.au).
42
+ 1. [states.js](http://github.com/toolmantim/states.js) &mdash; [t-star](http://toolmantim.com)'s script lets you hide and show bits of your UI so you can simulate state. For example toggle a user's account controls. Think [Polypage](http://github.com/andykent/polypage) on a diet.
43
+ 2. [jquery.grid.js](http://github.com/quackingduck/jquery.grid.js) &mdash; A handy tool which overlays vertical and horizontal grids when SHIFT-v or SHIFT-h are pressed. You'll have to initialise it yourself, though. Big ups [byrne-diddy](http://myles.id.au).
38
44
 
39
- Some mockup helpers are:
45
+ What choo get is just a [Sinatra](http://sinatrarb.com) app, so everything you can do in Sinatra you can do in Tyrone. Rather than the views directory, you now have `mockups`.
46
+
47
+ Some helpers are:
40
48
 
41
49
  * `hidden` &mdash; Just returns `{:style => 'display:none'}` so you can quickly hide elements. Useful when doing JS hiding and showing.
42
50
  * `mockup_path(mockup)` &mdash; Returns a URL to another mockup.
43
51
 
44
- The `features` directory is where you start placing your user stories. The prototyping phase is a great time to start writing them.
52
+ To run the local server just type `rake dev`. If you then go to [localhost:4567](http://localhost:4567) you should be redirected to the '/mockups' page. This will show you an index of all the mockups you have. Often you want prototypes to behave like real apps so to set the root page just override it in your `app.rb`:
53
+
54
+ get '/' do
55
+ haml :my_index
56
+ end
57
+
58
+ The `features` directory is where you start placing your user stories. The prototyping phase is a great time to start writing them, but don't feel like you need to implement them.
45
59
 
60
+ All of tyrone's jobs come with [Bundler](http://github.com/carlhuda/bundler) built in and are ready to get up and running on [Heroku](http://heroku.com) with a simple `heroku create`.
46
61
 
47
62
  ## Associates
48
63
 
data/Rakefile CHANGED
@@ -1,11 +1,23 @@
1
- require 'mg'
2
- require 'lib/tyrone'
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = 'tyrone'
5
+ gem.summary = 'care the shit out of your ui'
6
+ gem.homepage = 'http://github.com/chrislloyd/tyrone'
3
7
 
4
- mg = MG.new('tyrone.gemspec')
8
+ gem.author = 'Chris Lloyd'
9
+ gem.email = 'christopher.lloyd@gmail.com'
5
10
 
6
- tyrone_version = Tyrone.version
7
- gemspec_version = mg.spec.version.to_s
11
+ gem.rubyforge_project = gem.name
12
+ gem.executable = gem.name
13
+ gem.has_rdoc = false
8
14
 
9
- unless tyrone_version == gemspec_version
10
- raise "Version mismatch: #{tyrone_version} (Tyrone) - #{gemspec_version} (gemspec)"
15
+ gem.add_dependency 'thor', '>= 0.13.0'
16
+ gem.add_dependency 'sinatra', '>= 1.0'
17
+ gem.add_dependency 'haml', '>= 2.2.0'
18
+ gem.add_dependency 'bundler', '>= 0.9.0'
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
11
23
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9.0
data/bin/tyrone CHANGED
@@ -1,38 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rubygems'
3
2
  require 'tyrone'
4
-
5
- gem 'pixii', '>= 0.1.6'
6
- require 'pixii'
7
-
8
- Pixii.called( :tyrone,
9
- :version => Tyrone.version,
10
- :templates => Tyrone.templates,
11
- :grid => ARGV.include?('--grid'),
12
- :states => ARGV.include?('--states')
13
- )do |make, opts|
14
- make.dir 'features', 'mockups', 'public', 'public/js', 'public/images', 'public/css'
15
-
16
- make.clone 'http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js', 'public/js/jquery.js'
17
-
18
- make.clone 'http://gist.github.com/159037.txt', 'public/css/reset.sass'
19
-
20
- make.template 'sinatra.rb.erb', "#{opts.project}.rb"
21
- make.template 'config.ru.erb', 'config.ru'
22
- make.template 'application.js.erb', 'public/js/application.js'
23
- make.template 'layout.haml.erb', 'mockups/layout.haml'
24
-
25
- make.template 'dot.gems.erb', '.gems'
26
-
27
- if opts.states
28
- make.clone 'http://gist.github.com/160497.txt', 'public/js/grid.js'
29
- end
30
-
31
- if opts.grid
32
- make.clone 'http://github.com/toolmantim/states.js/raw/master/states.js', 'public/js/states.js'
33
- make.clone 'h_grid.gif', 'public/images/h_grid.gif'
34
- make.clone 'v_grid.gif', 'public/images/v_grid.gif'
35
- end
36
-
37
- make.magic!
38
- end
3
+ Tyrone::Cli.start
data/lib/tyrone/app.rb CHANGED
@@ -1,4 +1,9 @@
1
- set :haml => {:format => :html5}
1
+ configure do
2
+ set :app_file => 'app.rb'
3
+ set :views => 'mockups'
4
+ set :haml => {:format => :html5}
5
+ enable :inline_templates
6
+ end
2
7
 
3
8
  helpers do
4
9
  def mockup_path(mockup)
@@ -6,34 +11,38 @@ helpers do
6
11
  end
7
12
  end
8
13
 
14
+ # Please override me
9
15
  get '/' do
10
- use_in_file_templates!
11
- @mockups = Dir.glob(File.join(options.views, '*.haml')).map do |mockup|
12
- File.basename(mockup,'.*').gsub('_',' ')
13
- end.reject {|file| file == 'layout'}
14
- haml :index, :layout => false
16
+ redirect '/mockups'
17
+ end
18
+
19
+ get '/mockups/?' do
20
+ @mockups = Dir.glob(File.join(options.views, '*.haml')).
21
+ reject {|f| f == 'mockups/layout.haml'}.
22
+ sort_by {|f| File.mtime(f)}.reverse.
23
+ map {|f| File.basename(f,'.haml').gsub('_',' ')}
24
+
25
+ haml :tyrone_index, :layout => false
15
26
  end
16
27
 
17
- get '/mockups/:mockup' do |mockup|
28
+ get '/mockups/:mockup/?' do |mockup|
18
29
  haml mockup.to_sym
19
30
  end
20
31
 
21
32
  __END__
22
-
23
- @@index
33
+ @@tyrone_index
24
34
  !!!
25
35
  %html
26
36
  %head
27
37
  %title mockups
28
38
  %style{:type => 'text/css', :media => 'screen'}
29
39
  :sass
30
-
31
40
  *
32
41
  :margin 0
33
42
  :padding 0
34
43
  body
35
44
  :margin 40px
36
- :font-family Helvetica, sans-serif
45
+ :font-family Helvetica, Arial, sans-serif
37
46
  h1
38
47
  :font-size 24px
39
48
  :line-height 40px
@@ -51,6 +60,10 @@ __END__
51
60
  :color #333
52
61
  &:hover
53
62
  :border-bottom 1px solid #333
63
+ small
64
+ color: #CCC
65
+ text-transform: uppercase
66
+ font-size: 10px
54
67
  .footer
55
68
  :font-size 11px
56
69
  :line-height 20px
@@ -62,7 +75,7 @@ __END__
62
75
  %h1 Mockups
63
76
  %ul
64
77
  - if @mockups.empty?
65
- there are no mockups yet. add one to <code>#{File.expand_path(options.views)}</code>.
78
+ There are no mockups yet. Add one to <code>#{File.expand_path(options.views)}</code>.
66
79
  - @mockups.each do |mockup|
67
80
  %li
68
81
  %a{:href => mockup_path(mockup)}= mockup
data/lib/tyrone/cli.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'thor'
2
+
3
+ class Tyrone::Cli < Thor
4
+ include Thor::Actions
5
+
6
+ source_paths << Tyrone.templates
7
+
8
+ desc 'init', 'creates a new tyrone project in the current directory'
9
+ def init
10
+ @project = Pathname.pwd.basename
11
+
12
+ copy_file 'Rakefile', 'Rakefile'
13
+ copy_file 'Gemfile', 'Gemfile'
14
+ copy_file 'config.ru'
15
+ copy_file 'init.rb'
16
+ copy_file 'app.rb', 'app.rb'
17
+
18
+ empty_directory 'mockups'
19
+
20
+ empty_directory 'public'
21
+ template 'layout.haml.erb', 'mockups/layout.haml'
22
+
23
+ empty_directory 'public/css'
24
+ get 'http://html5resetcss.googlecode.com/files/html5reset-1.4.1.css', 'public/css/reset.css'
25
+
26
+ empty_directory 'public/js'
27
+ get 'http://github.com/toolmantim/states.js/raw/master/states.js', 'public/js/jquery.states.js'
28
+ get 'http://github.com/quackingduck/jquery.grid.js/raw/master/jquery.grid.js', 'public/js/jquery.grid.js'
29
+
30
+ empty_directory 'features'
31
+
32
+ system 'bundle install'
33
+ end
34
+
35
+ desc 'mock NAME', 'creates a new mock'
36
+ def mock(name)
37
+ empty_directory 'mockups'
38
+ create_file "mockups/#{name.gsub(' ','-')}.haml"
39
+ end
40
+
41
+ end
data/lib/tyrone.rb CHANGED
@@ -1,11 +1,19 @@
1
+ require 'pathname'
2
+
1
3
  module Tyrone
2
4
  extend self
3
5
 
6
+ def root
7
+ Pathname(__FILE__).dirname.join('..')
8
+ end
9
+
4
10
  def version
5
- '0.4.1'
11
+ root.join('VERSION').read.freeze
6
12
  end
7
13
 
8
14
  def templates
9
- File.join(File.dirname(__FILE__),'..','templates')
15
+ root.join('templates')
10
16
  end
11
17
  end
18
+
19
+ require 'tyrone/cli'
data/logo.png ADDED
Binary file
data/templates/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source :gemcutter
2
+
3
+ gem 'sinatra'
4
+ gem 'haml'
5
+ gem 'tyrone'
6
+
7
+ group :development do
8
+ gem 'shotgun'
9
+ gem 'thin'
10
+ end
@@ -0,0 +1,4 @@
1
+ desc 'Runs the development server'
2
+ task :dev do
3
+ exec 'bundle exec shotgun --require init --server thin --host 127.0.0.1 --port 4567 app.rb'
4
+ end
data/templates/app.rb ADDED
@@ -0,0 +1,7 @@
1
+ # Tyrone cares the shit out of you
2
+
3
+ helpers do
4
+ def hidden
5
+ {:style => 'display:none'}
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ require 'app'
2
+ run Sinatra::Application
data/templates/init.rb ADDED
@@ -0,0 +1,9 @@
1
+ begin
2
+ require File.join(File.dirname(__FILE__), '.bundle', 'environment')
3
+ rescue LoadError
4
+ require 'bundler'
5
+ Bundler.setup
6
+ end
7
+
8
+ Bundler.require
9
+ require 'tyrone/app'
@@ -2,16 +2,11 @@
2
2
  %html
3
3
  %head
4
4
  %meta{:charset => 'utf-8'}
5
- %title <%= project %>
5
+ %title <%= @project %>
6
6
  %link{:rel => 'stylesheet', :type => 'text/css', :href => '/css/reset.css'}
7
-
8
- %script{:src => '/js/jquery.js', :type => 'text/javascript'}
9
- <% if states %> %script{:src => '/js/states.js', :type => 'text/javascript'}<% end %>
10
- %script{:src => '/js/application.js', :type => 'text/javascript'}
11
- <% if grid %> - if options.environment == :development
12
- %script{:src => '/js/grid.js', :type => 'text/javascript'}
13
- :javascript
14
- $(document).ready(function(){ $(document.body).grid(); });
15
- <% end %>
7
+ %script{:src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js', :type => 'text/javascript'}
8
+
9
+ %script{:src => '/js/jquery.states.js', :type => 'text/javascript'}
10
+ %script{:src => '/js/jquery.grid.js', :type => 'text/javascript'}
16
11
  %body
17
12
  = yield
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tyrone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 9
8
+ - 0
9
+ version: 0.9.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Chris Lloyd
@@ -9,86 +14,115 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-08-22 00:00:00 +10:00
13
- default_executable:
17
+ date: 2010-03-27 00:00:00 +11:00
18
+ default_executable: tyrone
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: sinatra
21
+ name: thor
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 13
30
+ - 0
31
+ version: 0.13.0
17
32
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: sinatra
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
20
38
  requirements:
21
39
  - - ">="
22
40
  - !ruby/object:Gem::Version
23
- version: 0.9.4
24
- version:
41
+ segments:
42
+ - 1
43
+ - 0
44
+ version: "1.0"
45
+ type: :runtime
46
+ version_requirements: *id002
25
47
  - !ruby/object:Gem::Dependency
26
48
  name: haml
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
30
51
  requirements:
31
52
  - - ">="
32
53
  - !ruby/object:Gem::Version
33
- version: 2.2.2
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: pixii
54
+ segments:
55
+ - 2
56
+ - 2
57
+ - 0
58
+ version: 2.2.0
37
59
  type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
60
+ version_requirements: *id003
61
+ - !ruby/object:Gem::Dependency
62
+ name: bundler
63
+ prerelease: false
64
+ requirement: &id004 !ruby/object:Gem::Requirement
40
65
  requirements:
41
66
  - - ">="
42
67
  - !ruby/object:Gem::Version
43
- version: 0.1.6
44
- version:
68
+ segments:
69
+ - 0
70
+ - 9
71
+ - 0
72
+ version: 0.9.0
73
+ type: :runtime
74
+ version_requirements: *id004
45
75
  description:
46
76
  email: christopher.lloyd@gmail.com
47
77
  executables:
48
78
  - tyrone
49
79
  extensions: []
50
80
 
51
- extra_rdoc_files: []
52
-
81
+ extra_rdoc_files:
82
+ - README.md
53
83
  files:
54
- - deps.rip
55
- - Rakefile
84
+ - .gitignore
56
85
  - README.md
86
+ - Rakefile
87
+ - VERSION
88
+ - bin/tyrone
57
89
  - lib/tyrone.rb
58
90
  - lib/tyrone/app.rb
59
- - bin/tyrone
60
- - templates/application.js.erb
61
- - templates/config.ru.erb
62
- - templates/dot.gems.erb
63
- - templates/h_grid.gif
91
+ - lib/tyrone/cli.rb
92
+ - logo.png
93
+ - templates/Gemfile
94
+ - templates/Rakefile
95
+ - templates/app.rb
96
+ - templates/config.ru
97
+ - templates/init.rb
64
98
  - templates/layout.haml.erb
65
- - templates/sinatra.rb.erb
66
- - templates/v_grid.gif
67
99
  has_rdoc: true
68
100
  homepage: http://github.com/chrislloyd/tyrone
69
101
  licenses: []
70
102
 
71
103
  post_install_message:
72
- rdoc_options: []
73
-
104
+ rdoc_options:
105
+ - --charset=UTF-8
74
106
  require_paths:
75
107
  - lib
76
108
  required_ruby_version: !ruby/object:Gem::Requirement
77
109
  requirements:
78
110
  - - ">="
79
111
  - !ruby/object:Gem::Version
112
+ segments:
113
+ - 0
80
114
  version: "0"
81
- version:
82
115
  required_rubygems_version: !ruby/object:Gem::Requirement
83
116
  requirements:
84
117
  - - ">="
85
118
  - !ruby/object:Gem::Version
119
+ segments:
120
+ - 0
86
121
  version: "0"
87
- version:
88
122
  requirements: []
89
123
 
90
124
  rubyforge_project: tyrone
91
- rubygems_version: 1.3.4
125
+ rubygems_version: 1.3.6
92
126
  signing_key:
93
127
  specification_version: 3
94
128
  summary: care the shit out of your ui
data/deps.rip DELETED
@@ -1,3 +0,0 @@
1
- git://github.com/sinatra/sinatra.git 0.9.4
2
- git://github.com/nex3/haml.git 2.2.2
3
- git://github.com/chrislloyd/pixii 0.1.6
@@ -1,7 +0,0 @@
1
- (function($){
2
- $(function(){
3
-
4
- // ...
5
-
6
- });
7
- })(jQuery);
@@ -1,22 +0,0 @@
1
- __DIR__ = File.dirname(__FILE__)
2
-
3
- File.file?(gems_file = File.join(__DIR__,'.gems')) && File.read(gems_file).each do |gem_decl|
4
- gem_name, version = gem_decl[/^([^\s]+)/,1], gem_decl[/--version ([^\s]+)/,1]
5
- version ? gem(gem_name, version) : gem(gem_name)
6
- end
7
-
8
- require 'sinatra'
9
- require 'haml'
10
- require 'sass'
11
- require 'tyrone/app'
12
-
13
- set :run => false,
14
- :environment => :development,
15
- :root => __DIR__,
16
- :views => File.join(__DIR__, 'mockups'),
17
- :public => File.join(__DIR__, 'public'),
18
- :app_file => '<%= project %>.rb'
19
-
20
- require '<%= project %>'
21
-
22
- run Sinatra::Application
@@ -1,3 +0,0 @@
1
- haml --version=2.2.2
2
- sinatra --version=0.9.4
3
- tyrone --version=<%= version %>
data/templates/h_grid.gif DELETED
Binary file
@@ -1,14 +0,0 @@
1
- # Tyrone cares the shit out of you
2
-
3
- helpers do
4
- def hidden
5
- {:style => 'display:none'}
6
- end
7
- end
8
-
9
- get /^\/css\/(.+)\.css$/ do |style_file|
10
- sass_file = File.join('public','css',"#{style_file}.sass")
11
- pass unless File.exist?(sass_file)
12
- content_type :css
13
- sass File.read(sass_file)
14
- end
data/templates/v_grid.gif DELETED
Binary file