blossom 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/blossom +75 -0
  2. data/lib/blossom.rb +3 -1
  3. metadata +5 -4
data/bin/blossom ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require "#{File.dirname(__FILE__)}/../lib/blossom"
5
+
6
+ include FileUtils
7
+
8
+ def make_file(name, content)
9
+ File.open(name, "w") { |file| file.write(content) }
10
+ end
11
+
12
+ case ARGV.length
13
+ when 1
14
+ name = ARGV.first
15
+ unless File.exist? name
16
+ mkdir name
17
+ cd name
18
+
19
+ make_file ".gitignore", "tmp\n"
20
+
21
+ make_file "config.ru", <<-"end_file"
22
+ require "rubygems"
23
+ require "bundler/setup"
24
+ require "blossom"
25
+
26
+ run Blossom(__FILE__, :#{name})
27
+ end_file
28
+
29
+ make_file "Gemfile", <<-"end_file"
30
+ source :rubygems
31
+
32
+ gem 'blossom', '~> #{Blossom::VERSION}'
33
+ end_file
34
+
35
+ make_file "#{name}.haml", <<-"end_file"
36
+ !!!
37
+ %meta(charset="utf-8")
38
+ %title #{name.capitalize}
39
+ %meta(name="description" content="Description of #{name.capitalize}.")
40
+ %link(rel="stylesheet" href="#{name}.css")
41
+ .container
42
+ %h1 This is <tt>#{name}.haml</tt>.
43
+ end_file
44
+
45
+ make_file "#{name}.sass", <<-"end_file"
46
+ @import compass/reset
47
+ @import blueprint/grid
48
+
49
+ .container
50
+ +container
51
+
52
+ h1
53
+ margin-top: 80px
54
+ font-size: 40px
55
+ end_file
56
+
57
+ mkdir "static"
58
+
59
+ %x{git init && git add -A && git commit -m 'Create project.'}
60
+
61
+ print "\
62
+ Application created! Now type \`cd #{name}\' and then \`rackup\'.\n\
63
+ This will run your application at <http://localhost:9292/>.\n\
64
+ You can start hacking in \`#{name}.haml\' and \`#{name}.sass\'.\n\
65
+ If you create \`x.haml\', it will show up at <http://localhost:9292/x>.\n\
66
+ Images and other static files go in the \`static/\' directory.\n\
67
+ Good luck, have fun!\n\
68
+ "
69
+ else
70
+ warn "#$0: error: file already exists: #{name}"
71
+ exit -1
72
+ end
73
+ else
74
+ warn "Usage: #$0 PROJECT-NAME"
75
+ end
data/lib/blossom.rb CHANGED
@@ -6,7 +6,9 @@ require "haml" # Load after sinatra.
6
6
  require "rack-strip-www"
7
7
  require "hassle"
8
8
 
9
- module Blossom ; end
9
+ module Blossom
10
+ VERSION = "0.0.3"
11
+ end
10
12
 
11
13
  def Blossom(root_file, index = :index)
12
14
  Rack::Builder.app do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Brockman
@@ -90,14 +90,15 @@ dependencies:
90
90
  description:
91
91
  email:
92
92
  - daniel@brockman.se
93
- executables: []
94
-
93
+ executables:
94
+ - blossom
95
95
  extensions: []
96
96
 
97
97
  extra_rdoc_files: []
98
98
 
99
99
  files:
100
100
  - lib/blossom.rb
101
+ - bin/blossom
101
102
  has_rdoc: true
102
103
  homepage: http://github.com/dbrock/blossom
103
104
  licenses: []