rusic 0.0.4 → 1.0.0.beta1

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 (39) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/README.md +103 -17
  4. data/Rakefile +0 -4
  5. data/bin/rusic +1 -1
  6. data/lib/rusic/cli.rb +28 -10
  7. data/lib/rusic/deployer.rb +15 -0
  8. data/lib/rusic/generators/theme.rb +53 -0
  9. data/lib/rusic/templates/README.md +3 -0
  10. data/lib/rusic/templates/assets/bootstrap.css +5789 -0
  11. data/lib/rusic/templates/assets/bootstrap.js +1951 -0
  12. data/lib/rusic/templates/assets/cover.css +161 -0
  13. data/lib/rusic/templates/assets/glyphicons-halflings-regular.eot +0 -0
  14. data/lib/rusic/templates/assets/glyphicons-halflings-regular.svg +229 -0
  15. data/lib/rusic/templates/assets/glyphicons-halflings-regular.ttf +0 -0
  16. data/lib/rusic/templates/assets/glyphicons-halflings-regular.woff +0 -0
  17. data/lib/rusic/templates/ideas/edit.html.liquid +42 -0
  18. data/lib/rusic/templates/ideas/index.html.liquid +26 -14
  19. data/lib/rusic/templates/ideas/new.html.liquid +52 -0
  20. data/lib/rusic/templates/ideas/show.html.liquid +27 -0
  21. data/lib/rusic/templates/layouts/subdomain.html.liquid +57 -38
  22. data/lib/rusic/templates/pages/about.html.liquid +20 -0
  23. data/lib/rusic/theme_file.rb +43 -0
  24. data/lib/rusic/uploaders/asset.rb +40 -0
  25. data/lib/rusic/uploaders/editable_asset.rb +47 -0
  26. data/lib/rusic/uploaders/template.rb +40 -0
  27. data/lib/rusic/version.rb +1 -1
  28. data/lib/rusic.rb +10 -5
  29. data/rusic.gemspec +23 -23
  30. metadata +75 -86
  31. data/.rvmrc +0 -1
  32. data/TODO.md +0 -33
  33. data/features/rusic.feature +0 -16
  34. data/features/support/env.rb +0 -5
  35. data/lib/rusic/generators.rb +0 -59
  36. data/lib/rusic/idea.rb +0 -8
  37. data/lib/rusic/server.rb +0 -35
  38. data/lib/rusic/templates/rusic.yml +0 -6
  39. data/spec/rusic_spec.rb +0 -21
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04b06628fcb3ea10d731a13297b6fff30a54c8ae
4
+ data.tar.gz: 16224e5b3e04a79d11b2209f7e568d2ea7e137e7
5
+ SHA512:
6
+ metadata.gz: 71de147e0b8749a0a06d645a88ab7f7ae73f91867c9edd6a5481f16f9b93c15d2a2151b20267b45021380850f0fb291be143bcc0f34bb2935632c830485b2163
7
+ data.tar.gz: 7ccf374220d447cb45128547c859746b7db32add10c87abee6c16719cc2d41acb67a17a00a2efdd73c45ca917de0faae1beac0765de430b28c0eba2bce31963b
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.1
data/README.md CHANGED
@@ -1,31 +1,117 @@
1
- rusic
2
- =====
1
+ # Rusic
3
2
 
4
- This gem makes it easy to develop themes for rusic.com. It can generate
5
- themes, as well as serve them from a local server.
3
+ Generate and deploy Rusic themes with ease.
6
4
 
7
- ## Install
5
+ This allows you to:
6
+
7
+ * Create a set of theme templates and assets
8
+ * Deploy those templates and assets to Rusic seamlessly
9
+
10
+ This mean you can develop themes on your local machine (using your editor of
11
+ choice) and see the changes live on Rusic immediately.
8
12
 
9
- You'll need ruby, if you're on OS X you'll already have it. Then you'll
10
- need to install the gem.
13
+ ## Dependencies
11
14
 
12
- gem install rusic
15
+ * Ruby 1.9+
16
+ * Rubygems
17
+
18
+ ## Install
13
19
 
14
- If this gives you a permission error you might need to use `sudo`.
20
+ $ gem install rusic
15
21
 
16
22
  ## Usage
17
23
 
18
- With the gem installed you can now generate a theme using the rusic
19
- command line tool.
24
+ ```
25
+ $ rusic
26
+ Tasks:
27
+ rusic help [TASK] # Describe available tasks or one specific task
28
+ rusic new NAME # Create a new Rusic theme
29
+ rusic deploy # Upload theme to Rusic
30
+ ```
31
+
32
+ ### Generate new theme
33
+
34
+ ```shell
35
+ $ rusic help new
36
+ Usage:
37
+ rusic new NAME
38
+
39
+ Create a new Rusic theme
40
+ ```
41
+
42
+ For example, to create a new theme called "competition-theme"
43
+
44
+ ```shell
45
+ $ rusic new competition-theme
46
+ create competition-theme
47
+ create competition-theme/README.md
48
+ create competition-theme/layouts
49
+ create competition-theme/layouts/subdomain.html.liquid
50
+ create competition-theme/ideas
51
+ create competition-theme/ideas/index.html.liquid
52
+ create competition-theme/ideas/new.html.liquid
53
+ create competition-theme/ideas/show.html.liquid
54
+ create competition-theme/ideas/edit.html.liquid
55
+ create competition-theme/pages
56
+ create competition-theme/pages/about.html.liquid
57
+ create competition-theme/assets
58
+ create competition-theme/assets/bootstrap.css
59
+ create competition-theme/assets/bootstrap.js
60
+ create competition-theme/assets/cover.css
61
+ create competition-theme/assets/glyphicons-halflings-regular.eot
62
+ create competition-theme/assets/glyphicons-halflings-regular.svg
63
+ create competition-theme/assets/glyphicons-halflings-regular.ttf
64
+ create competition-theme/assets/glyphicons-halflings-regular.woff
65
+ ```
66
+
67
+ This will create a simple, bootstrapped theme
68
+
69
+ ### Deploy theme
70
+
71
+ ```shell
72
+ $ rusic help deploy
73
+ Usage:
74
+ rusic deploy
75
+
76
+ Options:
77
+ [--api-key=API_KEY]
78
+ [--api-host=API_HOST] # Default: api.rusic.com
79
+ [--theme=THEME]
80
+ [--watch]
81
+
82
+ Upload theme to Rusic
83
+ ```
84
+
85
+ To deploy the "competition-theme" above, we would do
86
+
87
+ ```shell
88
+ $ cd competition-theme/
89
+ $ rusic deploy --api-key YOUR_API_KEY --theme YOUR_THEME_ID
90
+ Saved layouts/subdomain.html.liquid
91
+ Saved ideas/edit.html.liquid
92
+ Saved ideas/index.html.liquid
93
+ Saved ideas/new.html.liquid
94
+ Saved ideas/show.html.liquid
95
+ Saved pages/about.html.liquid
96
+ Saved assets/bootstrap.css
97
+ Saved assets/bootstrap.js
98
+ Saved assets/cover.css
99
+ Saved assets/glyphicons-halflings-regular.eot
100
+ Saved assets/glyphicons-halflings-regular.svg
101
+ Saved assets/glyphicons-halflings-regular.ttf
102
+ Saved assets/glyphicons-halflings-regular.woff
103
+ ```
20
104
 
21
- cd ~/Desktop # Or somewhere else maybe
22
- rusic new example-theme
105
+ ### Deploy on file changes
23
106
 
24
- cd example-theme
25
- rusic server
107
+ Use the `--watch` flag to watch for changes on files and deploy them automatically
26
108
 
27
- This will start up a server at http://localhost:8080/.
109
+ ```
110
+ $ rusic deploy --api-key YOUR_API_KEY --theme YOUR_THEME_ID --watch
111
+ $ touch layouts/subdomain.html.liquid # in another process
112
+ Saved layouts/subdomain.html.liquid
113
+ ```
28
114
 
29
115
  MIT Licenced
30
116
 
31
- Copyright (c) 2011, Chris Mytton / Simpleweb
117
+ Copyright © 2011–2014, Simpleweb Ltd.
data/Rakefile CHANGED
@@ -1,6 +1,2 @@
1
1
  #!/usr/bin/env rake
2
2
  require 'bundler/gem_tasks'
3
- require 'rspec/core/rake_task'
4
-
5
- RSpec::Core::RakeTask.new(:spec)
6
- task :default => :spec
data/bin/rusic CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require 'rusic'
3
+
4
4
  Rusic::CLI.start
data/lib/rusic/cli.rb CHANGED
@@ -1,19 +1,37 @@
1
- require "thor"
2
- require "thin"
3
- require "rack/handler/thin"
4
-
5
- require "rusic"
1
+ require 'thor'
2
+ require 'pathname'
3
+ require 'filewatcher'
6
4
 
7
5
  module Rusic
8
6
  class CLI < Thor
9
- desc "new NAME", "Create a new rusic theme"
7
+ desc "new NAME", "Create a new Rusic theme"
10
8
  def new(name)
11
- Rusic::Generators::New.start([name])
9
+ Rusic::Generators::Theme.start([name])
12
10
  end
13
11
 
14
- desc "server", "Start up a template server"
15
- def server
16
- Rack::Handler::Thin.run(Rusic::Server)
12
+ desc "deploy", "Upload theme to Rusic"
13
+ method_option :api_key, type: :string
14
+ method_option :api_host, type: :string, default: 'api.rusic.com'
15
+ method_option :theme, type: :string
16
+ method_option :watch, type: :boolean
17
+ def deploy
18
+ path = Pathname.new('.')
19
+ files = []
20
+
21
+ files << Dir.glob(path.join('{layouts,ideas,pages}', '*.liquid'))
22
+ files << Dir.glob(path.join('assets', '*.*'))
23
+
24
+ files.flatten!
25
+
26
+ if options[:watch]
27
+ FileWatcher.new(files).watch(0.5) do |file|
28
+ deployer = Rusic::Deployer.new(file)
29
+ deployer.upload_files(options)
30
+ end
31
+ else
32
+ deployer = Rusic::Deployer.new(files)
33
+ deployer.upload_files(options)
34
+ end
17
35
  end
18
36
  end
19
37
  end
@@ -0,0 +1,15 @@
1
+ module Rusic
2
+ class Deployer
3
+ attr_reader :files
4
+
5
+ def initialize(files)
6
+ @files = Array(files).map { |file| ThemeFile.new(file) }
7
+ end
8
+
9
+ def upload_files(options = {})
10
+ files.each do |file|
11
+ file.uploader.upload_file(options)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,53 @@
1
+ require 'thor'
2
+ require 'thor/group'
3
+
4
+ module Rusic
5
+ module Generators
6
+ class Theme < Thor::Group
7
+ include Thor::Actions
8
+
9
+ argument :name, type: :string
10
+
11
+ def self.source_root
12
+ File.dirname(__FILE__) + '/..'
13
+ end
14
+
15
+ def create_project
16
+ empty_directory(name)
17
+ end
18
+
19
+ def readme
20
+ template('templates/README.md', "#{name}/README.md", name: name)
21
+ end
22
+
23
+ def layout
24
+ empty_directory("#{name}/layouts")
25
+ copy_file('templates/layouts/subdomain.html.liquid', "#{name}/layouts/subdomain.html.liquid")
26
+ end
27
+
28
+ def ideas
29
+ empty_directory("#{name}/ideas")
30
+ copy_file('templates/ideas/index.html.liquid', "#{name}/ideas/index.html.liquid")
31
+ copy_file('templates/ideas/new.html.liquid', "#{name}/ideas/new.html.liquid")
32
+ copy_file('templates/ideas/show.html.liquid', "#{name}/ideas/show.html.liquid")
33
+ copy_file('templates/ideas/edit.html.liquid', "#{name}/ideas/edit.html.liquid")
34
+ end
35
+
36
+ def pages
37
+ empty_directory("#{name}/pages")
38
+ copy_file('templates/pages/about.html.liquid', "#{name}/pages/about.html.liquid")
39
+ end
40
+
41
+ def assets
42
+ empty_directory("#{name}/assets")
43
+ copy_file('templates/assets/bootstrap.css', "#{name}/assets/bootstrap.css")
44
+ copy_file('templates/assets/bootstrap.js', "#{name}/assets/bootstrap.js")
45
+ copy_file('templates/assets/cover.css', "#{name}/assets/cover.css")
46
+ copy_file('templates/assets/glyphicons-halflings-regular.eot', "#{name}/assets/glyphicons-halflings-regular.eot")
47
+ copy_file('templates/assets/glyphicons-halflings-regular.svg', "#{name}/assets/glyphicons-halflings-regular.svg")
48
+ copy_file('templates/assets/glyphicons-halflings-regular.ttf', "#{name}/assets/glyphicons-halflings-regular.ttf")
49
+ copy_file('templates/assets/glyphicons-halflings-regular.woff', "#{name}/assets/glyphicons-halflings-regular.woff")
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ # Rusic theme: <%= @name %>
2
+
3
+ See http://developer.rusic.com/ for full documentation.