orkester 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 400186d1aec2a7f1ce23557111a36baf05f46969
4
- data.tar.gz: b741292e79c3a9db3bc11c5c96266b3359fc8543
3
+ metadata.gz: a64fa407f693b7f201eef19734dd9f744d88e79a
4
+ data.tar.gz: 7d1c909bd3670cdc42dbc1308fe96219269cea35
5
5
  SHA512:
6
- metadata.gz: b4f58eaa34ab3813154ff7b68c250757448ed384676ac7bd3e10cbbd5babb022258dba2722ef696f709257c2a9d7eea045cd198571c17ad34395b6cac19ff111
7
- data.tar.gz: 9b4a8d05407933f71d8eaa899d4dcd5f7ab2419c4bac866d706c23ebd75d8e7faa39e2b7171b0b8020849e7e8ea5bcc1aad98a42d5301b4610cdc00307e06341
6
+ metadata.gz: 1c996c9b789617008d202c15c4f92ac6f951b02b507c1471576c516a663a000308a68ca587678dc05ca5875c1309800f33069c544c065ae098b7691ad77c2cbb
7
+ data.tar.gz: 06e5d20543ea99106015819a9c5cf85d9cbb5ed9a835a184f46342052828cf5d52facfd4650e313ef308f3a96b7125bc4c4e26b9f5e87177a6dad6de47492f43
data/README.md CHANGED
@@ -1,24 +1,76 @@
1
1
  # Orkester
2
2
 
3
- TODO: Write a gem description
3
+ Orkester is a very simple package manager and build system from static assets.
4
+
5
+ ### Features
6
+
7
+ 1. Create self contained packages containing all javascripts and stylesheets
8
+ 2. Use sprockets to handle asset compilation and concatenation
9
+ 2. Manage dependencies transparently
4
10
 
5
11
  ## Installation
6
12
 
7
13
  Add this line to your application's Gemfile:
8
14
 
9
- gem 'orkester'
15
+ gem 'orkester', git: "git@github.com:abhishiv/orkester.git"
10
16
 
11
17
  And then execute:
12
18
 
13
19
  $ bundle
14
20
 
15
- Or install it yourself as:
16
-
17
- $ gem install orkester
18
21
 
19
22
  ## Usage
23
+
24
+ ### Project structure
25
+
26
+ Packages dir in root/packages or app/packages if using with rails.
27
+
28
+ |-- another dependency
29
+ | |-- javascripts
30
+ | | `-- main.js.coffee
31
+ | `-- package.yaml
32
+ |-- main
33
+ | |-- index.html
34
+ | |-- javascripts
35
+ | | |-- main.js.coffee
36
+ | | `-- views
37
+ | | `-- main.js.coffee
38
+ | |-- package.yaml
39
+ | `-- stylesheets
40
+ | `-- main.css.sass
41
+
42
+
43
+ ### Package.yaml
44
+
45
+ name: main
46
+ dependencies:
47
+ -
48
+ name: jquery
49
+ remote_location: http://code.jquery.com/jquery-1.11.0.js
50
+ install_location: vendor/jquery
51
+ type: "javascripts"
52
+ -
53
+ name: dependency2
54
+
55
+ ### Sprocket support
56
+
57
+ root/packages/#{PACKAGE_NAME}/javascripts/main.js
58
+ #= require_tree ./views
59
+ $(document).ready () =>
60
+ console.log 1
61
+ ### Running
62
+
63
+ For a non rails project, navigate to root of your project, and run orkester serve -p 3333
64
+
65
+ Package should be vieweable at /orkester/#{PACKAGE_NAME}/info
66
+
67
+ /orkester/#{PACKAGE_NAME}/javascripts/main.js and /orkester/#{PACKAGE_NAME}/stylesheets/main.css includes all of its js/css, and of its dependencies.
68
+
69
+ From Rails you also have helpers to include a package
70
+
71
+ <%= orkester_include_package "main" %>
72
+
20
73
 
21
- TODO: Write usage instructions here
22
74
 
23
75
  ## Contributing
24
76
 
@@ -2,11 +2,17 @@ module Orkester
2
2
  module AssetHelpers
3
3
  include ActionView::Helpers::AssetTagHelper
4
4
 
5
+ def orkester_include_package(package_name)
6
+ js = orkester_javascript_tag package_name
7
+ css = orkester_stylesheet_tag package_name
8
+ css.concat(js)
9
+ end
10
+
5
11
  def orkester_javascript_tag(package_name)
6
- javascript_include_tag "/orkester/main/javascripts/main"
12
+ javascript_include_tag "/orkester/#{package_name}/javascripts/main"
7
13
  end
8
14
  def orkester_stylesheet_tag(package_name)
9
- stylesheet_link_tag "/orkester/main/stylesheets/main"
15
+ stylesheet_link_tag "/orkester/#{package_name}/stylesheets/main"
10
16
  end
11
17
 
12
18
  end
data/lib/orkester/cli.rb CHANGED
@@ -10,7 +10,8 @@ module Orkester
10
10
 
11
11
  include Thor::Actions
12
12
 
13
- desc 'Serve the project', 'Serve'
13
+ desc 'server', 'Serve the project'
14
+ method_option :port, :aliases => '-p', :desc => 'Port'
14
15
  def server(*assets)
15
16
  Rack::Server.start(
16
17
  :Port => options[:port] || 9292,
@@ -23,6 +23,7 @@ module Orkester
23
23
  arr.push asset.source
24
24
  end
25
25
  end
26
+ @context.included_packages.push @package_defination["name"]
26
27
  end
27
28
 
28
29
  end
@@ -1,13 +1,13 @@
1
1
  module Orkester
2
2
  class Context
3
- attr_accessor :dependencies
3
+ attr_accessor :included_packages
4
4
  attr_accessor :root
5
5
  attr_accessor :javascripts
6
6
  attr_accessor :stylesheets
7
7
 
8
8
  def initialize(args)
9
9
  self.root = args[:root]
10
- self.dependencies = []
10
+ self.included_packages = []
11
11
  self.javascripts = []
12
12
  self.stylesheets = []
13
13
  end
data/lib/orkester/main.rb CHANGED
@@ -19,11 +19,6 @@ module Orkester
19
19
 
20
20
  handler = PackageHandler.new context: self.context, package: package
21
21
 
22
- handler.dependencies.each do |dependency|
23
- dependency_handler = PackageHandler.new context: self.context, package: dependency
24
- dependency_handler.compile
25
- end
26
-
27
22
  handler.compile
28
23
  self.context
29
24
  end
@@ -1,3 +1,5 @@
1
+ require 'net/http'
2
+ require 'uri'
1
3
  require_relative "compiler"
2
4
  module Orkester
3
5
  class PackageHandler
@@ -19,14 +21,24 @@ module Orkester
19
21
  @package_defination = YAML.load package_yaml
20
22
  end
21
23
 
24
+ def dependencies
25
+ @package_defination["dependencies"]
26
+ end
27
+
22
28
  def compile
29
+ self.dependencies.to_a.each do |dependency|
30
+ match = @context.included_packages.find { |x| x == dependency["name"] }
31
+ if match
32
+ else
33
+ dependency_handler = PackageHandler.new context: @context, package: dependency
34
+ dependency_handler.compile
35
+ end
36
+ end
37
+
23
38
  compiler = Compiler.new context: @context, package_defination: @package_defination
24
39
  compiler.compile
25
40
  end
26
41
 
27
- def dependencies
28
- @package_defination["dependencies"]
29
- end
30
42
 
31
43
  def include_from_remote(dependency)
32
44
  p dependency
@@ -1,3 +1,3 @@
1
1
  module Orkester
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/orkester.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'sprockets'
3
3
  require 'pathname'
4
- require_relative "orkester/orkester"
5
4
  require_relative "orkester/version"
6
5
  require_relative "orkester/middleware"
7
6
  require_relative "orkester/cli"
@@ -11,9 +10,10 @@ require_relative "orkester/context"
11
10
  require_relative "orkester/compiler"
12
11
  require_relative "orkester/package_handler"
13
12
 
13
+ require_relative "orkester/asset_helpers" if defined?(Rails) && defined?(Rails::Railtie)
14
+ require_relative "orkester/railtie" if defined?(Rails) && defined?(Rails::Railtie)
15
+
14
16
  module Orkester
15
- require "orkester/asset_helpers" if defined?(Rails) && defined?(Rails::Railtie)
16
- require "orkester/railtie" if defined?(Rails) && defined?(Rails::Railtie)
17
17
 
18
18
  def self.app
19
19
  app = Orkester::Middleware.new
@@ -24,7 +24,6 @@ module Orkester
24
24
  Rails.root.join('app/packages')
25
25
  else
26
26
  root = Pathname('.').expand_path
27
- p root
28
27
  root.join("packages")
29
28
  end
30
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orkester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhishiv Saxena
@@ -143,7 +143,6 @@ files:
143
143
  - lib/orkester/context.rb
144
144
  - lib/orkester/main.rb
145
145
  - lib/orkester/middleware.rb
146
- - lib/orkester/orkester.rb
147
146
  - lib/orkester/package_handler.rb
148
147
  - lib/orkester/railtie.rb
149
148
  - lib/orkester/router.rb
@@ -1,10 +0,0 @@
1
- module Orkester
2
- def self.root
3
- if defined?(Rails) && defined?(Rails.root)
4
- Rails.root.join('app/packages')
5
- else
6
- root = Pathname.new File.expand_path(File.dirname(__FILE__))
7
- root.join("../packages")
8
- end
9
- end
10
- end