Commits

Konstantine Rybnikov committed 9e1e6d2

ok. Now need to do merge

  • Participants
  • Parent commits 9e26f3e

Comments (0)

Files changed (2)

     
     def __init__(self):
         self.base_path = '.'
-        self.merge_groups = []
+        self.merge_groups = {}
     
     def configure_from_dict(self, d):
         if 'base_path' in d:
                 valid_group['name'] = group['name']
                 valid_group['files'] = []
                 for file_ in group['files']:
-                    file_path = os.path.join(self.config['base_path'], file_)
+                    file_path = os.path.join(self.base_path, file_)
                     if not os.path.exists(file_path):
                         log.warning(u'File %s does not exist' % file_path)
                     elif not os.path.isfile(file_path):
                         log.warning(u'File %s is not a file (directory maybe?)' % file_path)
                     else:
                         valid_group['files'].append(file_)
-                self.merge_groups.append(valid_group)
+                self.merge_groups[valid_group['name']] = valid_group['files']
     
     def configure_from_file(self, path):
         import codecs
             self.configure_from_dict(configurer(f))
         
     def get_merge_groups(self):
+        """Returns merge groups names"""
+        return self.merge_groups.keys()
+    
+    def get_merged(self, group_name):
         pass
     

tests/test_main.py

     
     def test_simple_yml_merge_groups(self):
         self.assertEqual(self.merger.merge_groups,
-                         [{'name': 'merged_most_popular.css',
-                            'files':
-                                ['1.css', '2.css',]},
-                           {'name': 'merged_site.css',
-                            'files':
-                                ['3.css',]}])
+                         {'merged_most_popular.css': ['1.css', '2.css',],
+                          'merged_site.css': ['3.css',]})
 
 class TestSimple(unittest.TestCase):
     def setUp(self):
                           'merged_site.css'])
     
     def test_merge(self):
-        self.assertEqual(self.merger.get_merged(),
+        self.assertEqual(self.merger.get_merged('merged_most_popular.css'),
                          self.f.readlines())